gui-cs / Terminal.Gui

Cross Platform Terminal UI toolkit for .NET
MIT License
9.66k stars 688 forks source link

TextView support for word based operations Ctrl+Del and Ctrl+Backspace #1211

Open tznind opened 3 years ago

tznind commented 3 years ago

I'm loving the improvements to TextView including Ctrl + left/right moving to next/previous word.

But it would be nice if this also extended to del and backspace (if not too hard).

textViewCtrl Deleting to end/begining of word with Ctrl+Del / Ctrl+Backspace in Kate text editor

BDisp commented 3 years ago

Thanks for the suggestion. I've started doing this and I see that the lastWasKill has no utility because I already did the copy feature through the selection. So, my suggestion is ignore the lastWasKill and use the following combinations and actions (I'll maintain the Key.K | Key.CtrlMask for compatibility but without copying to the clipboard):

Key.DeleteChar | Key.CtrlMask | Key.ShiftMask - If the current column is 0 the entire text will be deleted forwards without removing the line. Continuing pressing these keys will then removing the current line and next row will be the current. If the current column is elsewhere in the line, will delete forwards the rest of the line and will maintains all at left and upwards.

Key.Backspace | Key.CtrlMask | Key.ShiftMask - If the current column is 0 the entire text will be moved backwards to the end of the previous line. Continuing pressing these keys, the entire text will be deleted backwards without removing the line. If the current column is elsewhere in the line, will delete backwards the rest of the line and will maintains all at right and below.

Key.DeleteChar | Key.CtrlMask - Same as first but by word forwards.

Key.Backspace | Key.CtrlMask - Same as second but by word backwards.

It' will work exactly like the Windows Notepad.

BDisp commented 3 years ago

I maintained the lastWasKill and added another new feature kill-to-start, which is more or less the kill-to-end but deletes backwards from the end.

Ciantic commented 3 months ago

In V2, the Ctrl+Backspace doesn't work, but CTRL+Delete works

dodexahedron commented 3 months ago

Re-opening based on report by @Ciantic

@BDisp