Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-line command history inconsistent behavior #116

Open
leventp opened this issue Nov 12, 2023 · 4 comments
Open

Multi-line command history inconsistent behavior #116

leventp opened this issue Nov 12, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@leventp
Copy link

leventp commented Nov 12, 2023

When pressing up-arrow a previous command is displayed as expected, again pressing up-arrow the cursor moves to the beginning of the command line. It should display the next command in history. Third up-arrow displays the next command in history. This behavior repeats for each command in history. Down-arrow seems to work fine.

@breakintoprogram breakintoprogram added the bug Something isn't working label Nov 15, 2023
@stevesims
Copy link
Contributor

whilst this might not be what you are expecting, this is working as intended/designed.

pressing "up" when you are not at the beginning of an input line is intended to take you either up a line (when the input line wraps over multiple lines) or to the beginning of the top line.
pressing "up" at the beginning of an input line will attempt to fetch the previous history entry. if this is successful your input cursor will be placed at the end of the line

the "down" arrow works "fine" because you're left at the end of the input line. if your cursor however has been moved somewhere other than the end of the input line, then your first "down" press will bring you to the end of the line

I do understand that the up key handing isn't what you expected, but I couldn't work out a sensible way to get it to work in the kind of manner you were suggesting and still have sensible multi-line editing working. leaving the cursor at the beginning of the line when stepping thru history would "solve" this issue, but also feel weird in use when you want to edit a previously used command. other possibilities involve complex algorithms that change the line editing behaviour depending on whether the user has tried to edit the line or not, and can also end up feeling "unnatural".

at some point I plan to add support for page up/down keys to move thru command history, which would not care about cursor position on the line

@tonedef71
Copy link

leaving the cursor at the beginning of the line when stepping thru history would "solve" this issue, but also feel weird in use when you want to edit a previously used command

Being able to continuously scroll up and down with the up & down keys through the command history unimpeded is preferable. If the "home" & "end" keys are working properly, perhaps they could be used to opt-in and/or opt-out of "command history mode" based on the current context (the cursor's current position, whether it be at the beginning, end, or middle of a line; the current keyboard mode, whether it be "command history mode" or "editing mode"; etc.).

As you mentioned, though, I'm not sure how complex the algorithms would be to implement, or whether or not folks would find using the "home" and "end" keys to influence the keyboard mode behavior to feel too unnatural. I can understand why you want to transfer the command history control keys from the up & down keys to the page up & page down keys.

@leventp
Copy link
Author

leventp commented Nov 16, 2023

Hi Steve, thanks for explaining the logic behind the design. All is well. Looking forward to '*KEY' implementation;)

@stevesims
Copy link
Contributor

@tonedef71 the recent Console8 2.2.x release contains support for moving thru command history using the page up and page down keys. the up and down arrows, when at the beginning or end of the command line respectively, maintain their behaviour of also stepping thru the history.

@leventp that release also includes the *hotkey command

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: No status
Development

No branches or pull requests

4 participants