fix deleting indentation when there wasn't any

before pressing backspace when there were config.indent_size many spaces
right before the caret would delete them regardless of config.indent_type being
"hard" or not
master
Alessandro Mauri 3 years ago
parent a5e90420e8
commit 241ddd9cea
  1. 4
      TODO
  2. 2
      data/core/commands/doc.lua

@ -15,6 +15,10 @@
[x] add menu to exec arbitrary command -> added console [x] add menu to exec arbitrary command -> added console
[ ] that command can be what is selected [ ] that command can be what is selected
[ ] console: accept input [ ] console: accept input
[ ] console: add option to open terminal
[ ] console: make the itegrated console v100 compatible
[ ] console: automatically switch focus to the previous rootview when hiding it
or selecting something from a treeview
[ ] doc: detect file changes with hash [ ] doc: detect file changes with hash
[x] add horizontal scroll [x] add horizontal scroll
[ ] add a cross to close tab [ ] add a cross to close tab

@ -127,7 +127,7 @@ local commands = {
["doc:backspace"] = function() ["doc:backspace"] = function()
local line, col = doc():get_selection() local line, col = doc():get_selection()
if not doc():has_selection() then if not doc():has_selection() and config.tab_type ~= "hard" then
local text = doc():get_text(line, 1, line, col) local text = doc():get_text(line, 1, line, col)
if #text >= config.indent_size and text:find("^ *$") then if #text >= config.indent_size and text:find("^ *$") then
doc():delete_to(0, -config.indent_size) doc():delete_to(0, -config.indent_size)

Loading…
Cancel
Save