toggle comment for whole line if nothing is selected

This commit is contained in:
takase1121 2021-12-26 15:12:28 +08:00
parent 69a857bbbf
commit 33f7fe4fda
No known key found for this signature in database
GPG Key ID: 60EEFFC68EB3031B
1 changed files with 5 additions and 0 deletions

View File

@ -302,6 +302,11 @@ local commands = {
end end
for idx, line1, col1, line2, col2 in doc_multiline_selections(true) do for idx, line1, col1, line2, col2 in doc_multiline_selections(true) do
-- if nothing is selected, toggle the whole line
if line1 == line2 and col1 == col2 then
col1 = 1
col2 = #doc().lines[line1]
end
local text = doc():get_text(line1, col1, line2, col2) local text = doc():get_text(line1, col1, line2, col2)
-- might need to deal with unicode later... -- might need to deal with unicode later...