@ -38,6 +38,7 @@ end
local function remove_from_start_of_selected_lines ( text , skip_empty )
local line1 , col1 , line2 , col2 , swap = doc ( ) : get_selection ( true )
local stat_before = doc ( ) : get_change_id ( )
for line = line1 , line2 do
local line_text = doc ( ) . lines [ line ]
if line_text : sub ( 1 , # text ) == text
@ -46,7 +47,9 @@ local function remove_from_start_of_selected_lines(text, skip_empty)
doc ( ) : remove ( line , 1 , line , # text + 1 )
end
end
doc ( ) : set_selection ( line1 , col1 - # text , line2 , col2 - # text , swap )
if doc ( ) : get_change_id ( ) ~= stat_before then
doc ( ) : set_selection ( line1 , col1 - # text , line2 , col2 - # text , swap )
end
end
@ -181,7 +184,7 @@ local commands = {
[ " doc:unindent " ] = function ( )
local text = get_indent_string ( )
remove_from_start_of_selected_lines ( text )
remove_from_start_of_selected_lines ( text , true )
end ,
[ " doc:duplicate-lines " ] = function ( )