diff options
| author | Adam <adamdharrison@gmail.com> | 2021-08-31 16:23:17 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-31 16:23:17 -0400 |
| commit | 06b64f29288a82dc0100fc70f5c78e34a231048c (patch) | |
| tree | d66f58ba6c86a74d27ffb922d22efb1a6419171b | |
| parent | 49bee555facebdb8b569bde42d8380202b6c3009 (diff) | |
| parent | e541236c224db4d738f84005e6a9a64a9767b220 (diff) | |
| download | lite-xl-06b64f29288a82dc0100fc70f5c78e34a231048c.tar.gz lite-xl-06b64f29288a82dc0100fc70f5c78e34a231048c.zip | |
Merge pull request #465 from adamharrison/fix-multicursor-commands
Forgot to return an 'n'.
| -rw-r--r-- | data/core/doc/init.lua | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/data/core/doc/init.lua b/data/core/doc/init.lua index 2bb63ac4..8b6ef5e0 100644 --- a/data/core/doc/init.lua +++ b/data/core/doc/init.lua @@ -479,17 +479,18 @@ function Doc:replace_cursor(idx, line1, col1, line2, col2, fn) end function Doc:replace(fn) - local has_selection = false + local has_selection, n = false, 0 for idx, line1, col1, line2, col2 in self:get_selections(true) do if line1 ~= line2 or col1 ~= col2 then - self:replace_cursor(idx, line1, col1, line2, col2, fn) + n = n + self:replace_cursor(idx, line1, col1, line2, col2, fn) has_selection = true end end if not has_selection then self:set_selection(table.unpack(self.selections)) - self:replace_cursor(1, 1, 1, #self.lines, #self.lines[#self.lines], fn) + n = n + self:replace_cursor(1, 1, 1, #self.lines, #self.lines[#self.lines], fn) end + return n end |
