comparison src/luan_editor/Window.luan @ 68:694359b01e06

fix unindent
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 10 Jun 2025 20:32:40 -0600
parents 2c050fcf2614
children 3867e9e1b94c
comparison
equal deleted inserted replaced
67:2c050fcf2614 68:694359b01e06
197 n_windows = n_windows - 1 197 n_windows = n_windows - 1
198 if n_windows == 0 then 198 if n_windows == 0 then
199 Luan.exit() 199 Luan.exit()
200 end 200 end
201 remove_list_window_item(list_window_item) 201 remove_list_window_item(list_window_item)
202 local document_info = documents[title] or error() 202 local document_info = documents[title] or error(title)
203 document_info.count = document_info.count - 1 203 document_info.count = document_info.count - 1
204 if document_info.count == 0 then 204 if document_info.count == 0 then
205 documents[title] = nil 205 documents[title] = nil
206 end 206 end
207 end) 207 end)
310 function window.unindent() 310 function window.unindent()
311 local r = selection_lines() 311 local r = selection_lines()
312 local text = r.text 312 local text = r.text
313 text = "\n"..text 313 text = "\n"..text
314 local start_seletion = r.start_seletion 314 local start_seletion = r.start_seletion
315 if starts_with(text,"\n\t") then 315 if starts_with(text,"\n\t") and start_seletion > r.start_pos then
316 start_seletion = start_seletion - 1 316 start_seletion = start_seletion - 1
317 end 317 end
318 local len1 = #text 318 local len1 = #text
319 text = replace(text,"\n\t","\n") 319 text = replace(text,"\n\t","\n")
320 local len2 = #text 320 local len2 = #text