Improve behavior for indent command with selection over multiple lines

Do not add indentation for the last line is not selected.
This commit is contained in:
Francesco Abbate 2020-11-16 11:52:41 +01:00
parent eb41569e8d
commit 121f0e1aa0
1 changed files with 4 additions and 0 deletions

View File

@ -26,6 +26,10 @@ end
local function insert_at_start_of_selected_lines(text, skip_empty) local function insert_at_start_of_selected_lines(text, skip_empty)
local line1, col1, line2, col2, swap = doc():get_selection(true) local line1, col1, line2, col2, swap = doc():get_selection(true)
if line2 > line1 and col2 == 1 then
line2 = line2 - 1
col2 = #doc().lines[line2]
end
for line = line1, line2 do for line = line1, line2 do
local line_text = doc().lines[line] local line_text = doc().lines[line]
if (not skip_empty or line_text:find("%S")) then if (not skip_empty or line_text:find("%S")) then