Archipelago icon indicating copy to clipboard operation
Archipelago copied to clipboard

Core: CommonClient: command history and echo

Open MatthewMarinets opened this issue 1 year ago • 2 comments

What is this fixing or adding?

Client command history

  • When executing a command (ie enter a message starting with / or !) in the common client, the command gets saved to a history buffer.
  • Pressing "up" fills in the text input with the previous command, up to a maximum of 50 commands
  • Pressing "down" returns to newer commands
  • Pressing "down" from the last executed command returns to the empty command (ie clears the text prompt)
  • Pressing "down" when on the empty command doesn't clear history (ie this will only clear your text if you've already been scrolling through history)
  • Executing a new command adds to the history and resets the history index to the empty command

Client command echo

  • Executing a command (ie enter a message starting with / or !) in the common client will echo the command back to you
  • The printout is handled by .on_ui_command() on CommonClient, so game-specific clients can override this behaviour
  • I chose to colour these commands for some extra visual clarity, introduced orange to the base colours to represent commands.

Note commands entered in the GUI client don't appear echoed in the command-line client and vice versa.

How was this tested?

I opened the Starcraft 2 client with these changes and tested manually -- entering various commands, going through history, verifying echo manually. GUI tests unfortunately aren't really unit-testable most of the time :/

If this makes graphical changes, please attach screenshots.

image image

ap_client_history_2

MatthewMarinets avatar Apr 30 '24 08:04 MatthewMarinets

I'm not sure about the decision to only keep commands.

I think my intuition would expect everything I type to be in the history.

I would be interested to hear what others think of that.

beauxq avatar May 02 '24 03:05 beauxq

I'm not sure about the decision to only keep commands.

I think my intuition would expect everything I type to be in the history.

I would be interested to hear what others think of that.

My concern would be that recording chat messages would just promote spam. I don't really use the chat messages often in Archipelago, but in general with chat apps I don't see the need to send the same or very similar messages repeatedly in quick succession. In contrast, I've very often found the need to rerun / go back to / adjust a prior command, especially for commands that take arguments that must be spelled correctly.

With respect to echo, I also see no point in echoing that. If we're only echoing commands, we already have a precedent for commands and chat messages being treated differently by the client.

MatthewMarinets avatar May 02 '24 05:05 MatthewMarinets

Rebased onto latest from main, did a quick sanity test. Everything still seems to work. echo_history_demo

MatthewMarinets avatar Jun 09 '24 01:06 MatthewMarinets