Merge remote-tracking branch 'rxi/master' into agg-font-renderer
This commit is contained in:
commit
0645ececf9
|
@ -0,0 +1,3 @@
|
||||||
|
# These are supported funding model platforms
|
||||||
|
|
||||||
|
github: rxi
|
|
@ -4,9 +4,16 @@ local Doc = require "core.doc"
|
||||||
|
|
||||||
|
|
||||||
local function trim_trailing_whitespace(doc)
|
local function trim_trailing_whitespace(doc)
|
||||||
|
local cline, ccol = doc:get_selection()
|
||||||
for i = 1, #doc.lines do
|
for i = 1, #doc.lines do
|
||||||
local old_text = doc:get_text(i, 1, i, math.huge)
|
local old_text = doc:get_text(i, 1, i, math.huge)
|
||||||
local new_text = old_text:gsub("%s*$", "")
|
local new_text = old_text:gsub("%s*$", "")
|
||||||
|
|
||||||
|
-- don't remove whitespace which would cause the caret to reposition
|
||||||
|
if cline == i and ccol > #new_text then
|
||||||
|
new_text = old_text:sub(1, ccol - 1)
|
||||||
|
end
|
||||||
|
|
||||||
if old_text ~= new_text then
|
if old_text ~= new_text then
|
||||||
doc:insert(i, 1, new_text)
|
doc:insert(i, 1, new_text)
|
||||||
doc:remove(i, #new_text + 1, i, math.huge)
|
doc:remove(i, #new_text + 1, i, math.huge)
|
||||||
|
|
Loading…
Reference in New Issue