[GH-ISSUE #103] Feature Request: Add ability to use the left and right arrow keys in inputFields #79

Closed
opened 2026-03-04 01:01:44 +03:00 by kerem · 3 comments
Owner

Originally created by @joegrasse on GitHub (Apr 17, 2018).
Original GitHub issue: https://github.com/rivo/tview/issues/103

It would be nicer if the user could use the left and right arrow keys within a form inputField to correct mistypes.

Originally created by @joegrasse on GitHub (Apr 17, 2018). Original GitHub issue: https://github.com/rivo/tview/issues/103 It would be nicer if the user could use the left and right arrow keys within a form inputField to correct mistypes.
kerem 2026-03-04 01:01:44 +03:00
Author
Owner

@rivo commented on GitHub (Apr 19, 2018):

I'm giving this the "on roadmap" label. I'm planning to add this.

Can't say exactly when but hopefully soon.

<!-- gh-comment-id:382851040 --> @rivo commented on GitHub (Apr 19, 2018): I'm giving this the "on roadmap" label. I'm planning to add this. Can't say exactly when but hopefully soon.
Author
Owner

@rivo commented on GitHub (Oct 18, 2018):

The latest commit introduces free movement within input fields. This was an effort of many hours, much more than what I had anticipated. The reason is mostly Unicode support, in which one character can consist of multiple runes (with modifiers, zero-width joiners etc.) and one rune can occupy multiple bytes in a string. Additionally, the width of a character can be more than one cell on the screen. All of this needs to be handled properly.

To navigate the input field, I took cues from Bash:

  • Left arrow: Move left by one character.
  • Right arrow: Move right by one character.
  • Home, Ctrl-A, Alt-a: Move to the beginning of the line.
  • End, Ctrl-E, Alt-e: Move to the end of the line.
  • Alt-left, Alt-b: Move left by one word.
  • Alt-right, Alt-f: Move right by one word.
  • Backspace: Delete the character before the cursor.
  • Delete: Delete the character after the cursor.
  • Ctrl-K: Delete from the cursor to the end of the line.
  • Ctrl-W: Delete the last word before the cursor.
  • Ctrl-U: Delete the entire line.

If you find any undesirable behaviour, please open an issue.

<!-- gh-comment-id:430894330 --> @rivo commented on GitHub (Oct 18, 2018): The latest commit introduces free movement within input fields. This was an effort of many hours, much more than what I had anticipated. The reason is mostly Unicode support, in which one character can consist of multiple runes (with modifiers, zero-width joiners etc.) and one rune can occupy multiple bytes in a string. Additionally, the width of a character can be more than one cell on the screen. All of this needs to be handled properly. To navigate the input field, I took cues from Bash: - __Left arrow:__ Move left by one character. - __Right arrow:__ Move right by one character. - __Home, Ctrl-A, Alt-a:__ Move to the beginning of the line. - __End, Ctrl-E, Alt-e:__ Move to the end of the line. - __Alt-left, Alt-b:__ Move left by one word. - __Alt-right, Alt-f:__ Move right by one word. - __Backspace:__ Delete the character before the cursor. - __Delete:__ Delete the character after the cursor. - __Ctrl-K:__ Delete from the cursor to the end of the line. - __Ctrl-W:__ Delete the last word before the cursor. - __Ctrl-U:__ Delete the entire line. If you find any undesirable behaviour, please open an issue.
Author
Owner

@joegrasse commented on GitHub (Oct 22, 2018):

Thank you very much for your work on this!

<!-- gh-comment-id:431846265 --> @joegrasse commented on GitHub (Oct 22, 2018): Thank you very much for your work on this!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tview#79
No description provided.