Skip to content

Commit

Permalink
Add ctrl+backspace and fix ctrl+l (#2851)
Browse files Browse the repository at this point in the history
  • Loading branch information
Smigg-y authored Nov 15, 2023
1 parent 4bdb050 commit a873233
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions lua/wire/client/text_editor/texteditor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1801,11 +1801,13 @@ function EDITOR:_OnKeyCodeTyped(code)
elseif code == KEY_K then
self:CommentSelection(shift)
elseif code == KEY_L then
self.Start = { self.Start[1], 1 }
self.Caret = { self.Start[1] + 1, 1 }
if self.Rows[self.Caret[1]] ~= "" then
self.Start = { self.Start[1], 1 }
self.Caret = { self.Start[1] + 1, 1 }

if not shift then self:Copy() end
self:SetSelection("")
if not shift then self:Copy() end
self:SetSelection("")
end
elseif code == KEY_Q then
self:GetParent():Close()
elseif code == KEY_T then
Expand Down Expand Up @@ -1838,6 +1840,11 @@ function EDITOR:_OnKeyCodeTyped(code)
self:SetCaret({ #self.Rows, 1 })
elseif code == KEY_D then
self:DuplicateLine()
elseif code == KEY_BACKSPACE then
local pos = self:wordLeft(self.Caret)
if self.Rows[self.Caret[1]] ~= "" then
self:SetSelection(self:GetArea({pos, self.Caret}))
end
else
handled = false
end
Expand Down

0 comments on commit a873233

Please sign in to comment.