From 33f7fe4fdaf1a640dfa33b1805aa948816e0222f Mon Sep 17 00:00:00 2001 From: takase1121 <20792268+takase1121@users.noreply.github.com> Date: Sun, 26 Dec 2021 15:12:28 +0800 Subject: [PATCH] toggle comment for whole line if nothing is selected --- data/core/commands/doc.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/data/core/commands/doc.lua b/data/core/commands/doc.lua index edf36bbd..977f233f 100644 --- a/data/core/commands/doc.lua +++ b/data/core/commands/doc.lua @@ -302,6 +302,11 @@ local commands = { end 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) -- might need to deal with unicode later...