-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
Description
In short, when InSelection — it treats the End/Start of the selection, for Right/Left direction respectively, as the current cursor position, and additionally yoinks the adjacent symbols, instead of deleting what's between selection ranges.
-
For better understanding:
wezterm-gui_NgjDZsYS4H.mp4
As you can see, after Undoing, it shows the actual area that was affected. Utterly irritating and highly inconvenient.
In my opinion, selection should always take priority in such cases, as the user has consciously chosen to interact with that specific area and this should be respected. Regardless of the navigation mode.
UPD.1
Alternatively, an additional action called DeleteInSelection is needed, at least. So it could be easily combined as DeleteInSelection|Delete(Sub)?Word(Left/Right) per user preference.
Assuming the current behavior is intentional, of course. With TUI apps, you never know what's a bug and what's a feature really...
UPD.2
My sloppy attempt at solving this locally
-
plug/custom/main.lua
function preventHastyDeletion(bp) local cursors = bp.Buf:GetCursors() local selection for c = #cursors, 1, -1 do c = cursors[c] if c:HasSelection() then c:DeleteSelection() selection = true end end return selection end
-
/bindings.json
{ ... , "Alt-Backspace" : "lua:custom.preventHastyDeletion|DeleteWordLeft" , "OldBackspace" : "lua:custom.preventHastyDeletion|DeleteSubWordLeft" , "Shift-OldBackspace" : "lua:custom.preventHastyDeletion|SelectToStartOfLine&Backspace" , "Alt-Delete" : "lua:custom.preventHastyDeletion|DeleteWordRight" , "Delete" : "lua:custom.preventHastyDeletion|DeleteSubWordRight" , "Shift-Delete" : "lua:custom.preventHastyDeletion|SelectToEndOfLine&Delete" ... }
It does pretty much what I need, although I still think that this should be part of the core logic. Also, not sure if this is the most optimal solution possible.
Environment
- Version: 2.0.16-dev.15 ( 3a7403b )
- OS: -
- Terminal: -