Lua.OnSave, GetViewForFixingWhenBufferCommand

This commit is contained in:
Krzosa Karol
2025-05-09 20:25:05 +02:00
parent 1590f12b43
commit 8370a2ae67
9 changed files with 174 additions and 85 deletions

View File

@@ -1,3 +1,6 @@
Style.TrimWhitespaceOnSave = true
Style.ClangFormatOnSave = false
INTERNET_BROWSER = 'C:/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe'
SDLK_CTRL = 1073742048
@@ -284,4 +287,17 @@ function OnCommand(e)
end
function OnInit()
end
function OnSave(buffer_id)
local dont_trim_lines_with_caret = false
ConvertLineEndingsToLF(buffer_id, dont_trim_lines_with_caret)
if Style.TrimWhitespaceOnSave then
TrimTrailingWhitespace(buffer_id, dont_trim_lines_with_caret)
end
local name = GetBufferNameByID(buffer_id)
if Style.ClangFormatOnSave and (name:match(".c$") or name:match(".h$") or name:match(".cpp$") or name:match(".hpp$")) then
ApplyClangFormat(buffer_id)
end
end