Skip to content

Commit

Permalink
Merge pull request #7 from bjornbm/wipelast
Browse files Browse the repository at this point in the history
When wiping last line, don't add newline.
  • Loading branch information
philanc authored Apr 27, 2023
2 parents 8c4bc0f + a536e8e commit a169d07
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions ple.lua
Original file line number Diff line number Diff line change
Expand Up @@ -678,12 +678,14 @@ function e.wipe(b, nokeep)
-- (default false)
if not b.si then
msg("No selection.")
if b:atlast() then -- add an empty line at end
e.goeot(b); e.nl(b); e.goup(b)
end
e.gohome(b)
local xi, xj
xi, xj = b.ci+1, 0
if b:atlast() then -- don't remove the newline
xi, xj = b:eol()
xj = xj + 1 -- include last character on line
else
xi, xj = b.ci+1, 0
end
if not nokeep then editor.kll = b:getlines(xi, xj) end
b:bufdel(xi, xj)
return
Expand Down

0 comments on commit a169d07

Please sign in to comment.