textual icon indicating copy to clipboard operation
textual copied to clipboard

Adding additional bindings for widget.Input

Open JoshPaulie opened this issue 3 years ago • 1 comments

Opening up dialog to discuss possible widget.Input bindings. I'd be happy to implement them, and already have a few on my local fork

Proposed action and accompanying shortcut

  • Clear line ✅
    • Shift+Delete (up for debate)
  • Backspace (Word at a time)
    • Ctrl+Backspace
  • Delete forward (Word at a time)
    • Ctrl+Delete
  • Move Cursor (Word at a time) ✅
    • Ctrl+Left
    • Ctrl+Right

Besides the clear line action, "these are universal shortcuts."

There's a discussion to be had here regarding what we consider universal to be. Are we treating widget.Input like we might an html input box? If so, the proposed shortcuts would qualify.

JoshPaulie avatar Oct 24 '22 14:10 JoshPaulie

While trying to implement ctrl+backspace, I noticed an interesting interaction with widget.Input

  • Any unbound bindings (key combinations) have no effect on Input
    • For example, ctrl+left does nothing bc it doesn't have a binding action.
  • This is not the case with backspace though. ctrl+backspace and shift+backspace are functionally the same as backspace

JoshPaulie avatar Oct 28 '22 14:10 JoshPaulie

+1 for adding extra bindings. I think the Emacs-style key bindings are pretty much the standard in macOS and Linux systems. Text input widgets in almost all GUI programs support that. Would be great to support a subset of this cheatsheet: https://readline.kablamo.org/emacs.html

liancheng avatar Jan 24 '23 17:01 liancheng

(Just checking some older issues) Many more actions and bindings were added to Input in 0.11.0.

davep avatar Feb 27 '23 15:02 davep

Don't forget to star the repository!

Follow @textualizeio for Textual updates.

github-actions[bot] avatar Feb 27 '23 15:02 github-actions[bot]