dupe and comment: make undo handle comment status the same as do

it no longer cares whether the edit is a comment or not.
it now sets the original to whatever the edit was.

better for doing stuff with comments etc
This commit is contained in:
garret 2023-02-16 02:45:32 +00:00
parent e96933c17a
commit 6a8427c7c2
1 changed files with 3 additions and 3 deletions

View File

@ -1,7 +1,7 @@
script_name="Dupe and Comment"
script_description="Copies a line and comments out the original.\nbecause i like seeing the original while editing, and being able to go back to it easily"
script_author = "garret"
script_version = "4.0.0"
script_version = "5.0.0"
script_namespace = "garret.dupe-and-comment"
local haveDepCtrl, DependencyControl, depctrl = pcall(require, "l0.DependencyControl")
@ -64,8 +64,8 @@ local function undo(subs, sel, act)
if not (sel[i] + 1 > #subs) then -- preventing out-of-range errors
local original=subs[sel[i]+1]
if edit.comment == false and original.comment == true then
original.comment = false
if original.comment == true then
original.comment = edit.comment
-- deal with being at the start/end of a fold
local at_fold_end = find_fold_boundary(edit)