Pages: [1]
Author Topic: Adding more keyboard commands/shortcuts for editing text  (Read 4493 times)

Cakes 0
Posts: 8

« on: August 06, 2017, 12:30:29 PM »

Hello everyone! I would like there to be more efficient commands for editing text in the game.

Therefore I think that we add a few commonly used keyboard shortcuts when editing text in fields.

Fields is are the places where the player can enter text, this includes console, messagemode, UI-textboxes and such.

Currently these commands are available:

  left - one character left
  right - one character right
  home, ctrl-a - go to beginning of line
  end, ctrl-e - go to end of line

  insert - overstrike toggle
  delete - forward delete
  backspace, ctrl-h - backward delete
  ctrl-ins, ctrl-v - paste (doesn't appear work on linux though)
  ctrl-c - clear entire line

Console specific:
  tab - autocomplete command
  ctrl-l - clear screen
  up, shift-mwheelup, ctrl-p - previous command in history
  down, shift-mwheeldown, ctrl-n - next command in history
  ctrl-home - scroll to beginning of console
  ctrl-end - scroll to end of console

  enter - send command

Ideas of commands we can add

Currently the keyboard commands available are a mix between what I call "GUI style"-commands (like ctrl-home, ctrl-v, etc) and "UNIX CLI style"-commands (ctrl-a, ctrl-p, ctrl-h, etc).

I propose we add more commands that are expected when working with "GUI Style" and "UNIX CLI Style" keyboard interfaces.

For "GUI style"-commands I think that these should be added:

  ctrl-left - put cursor on previous word
  ctrl-right - put cursor on next word
  ctrl-backspace - delete previous word
  ctrl-delete - delete next word

For "UNIX style"-commands I think that these should be added:

  ctrl-u - delete to beginning of line
  ctrl-k - delete to end of line
  ctrl-d - same as delete
  ctrl-w - delete previous "large word"
  alt-d - delete next word
  ctrl-b - go the previous char
  alt-b - go to to previous word
  ctrl-f - go the next char
  alt-f - go to to next word

I have made some test-changes to the engine code that implements these commands the for console and messagemodes. Implementing the commands for UI-fields (like the place where you pick a player name) should also be added but the code for that is in gamecode and independent of the engine-code.

I made a quick and boring youtube-demo of moving and deleting by words:

What do you think?

Do you agree or disagree?

Do you have any suggestions about the commands?
« Last Edit: August 06, 2017, 12:33:18 PM by commie » Logged

Cakes 0
Posts: 8

« Reply #1 on: August 08, 2017, 04:57:53 AM »

I am also doing experimentation with adding undo for recent changes using ctrl-z.

Currently in my implementation, when inserting text, the undo history will be split at word boundaries.

[ splitting undo history at word bounaries ]

this, is a test text! wef;wef;
^   ^ ^ ^^^^   ^^   ^ ^  ^   ^

This is the behavior that libreoffice uses.

I don't like this because you have to press CTRL-Z so many times. It also fills out the undo history buffer quite quickly.

Other options not splitting the undo history for single character inserts (like firefox), or splitting the inserts each 20th character (like GNU readline).

[ not splitting undo history ]

this, is a test text! wef;wef;

[ splitting at each 20th character ]

this, is a test text! wef;wef;
^                   ^
« Last Edit: August 08, 2017, 06:29:15 AM by commie » Logged
Pages: [1]
Jump to: