GNU nano - Bugs: bug #61316, at a secondary prompt, history can...
You are not allowed to post comments on this tracker with your current authentication level.
bug #61316: at a secondary prompt, history can start in the middle
Submitter: | Benno Schulenberg <bens> | ||
Submitted: | Sat 09 Oct 2021 08:34:48 AM UTC | ||
Severity: | 2 - Minor | Status: | Fixed |
Assigned to: | bens | Open/Closed: | Closed |
Sun 10 Oct 2021 08:08:02 AM UTC, comment #3: |
Benno Schulenberg <bens> |
Sat 09 Oct 2021 03:07:46 PM UTC, comment #2: I've tried it, but clearing the answer (when it was filled in from history) when the user comes back from ^G^W is not nice -- it is too unexpected.
|
Benno Schulenberg <bens> |
Sat 09 Oct 2021 10:54:16 AM UTC, comment #1: Fixed in git, commit 3d6dcb95, by resetting the history pointer both at the start and the end of acquiring an answer from the prompt.
|
Benno Schulenberg <bens> |
Sat 09 Oct 2021 08:34:48 AM UTC, original submission:
To reproduce, run 'src/nano --ignore'.
|
Benno Schulenberg <bens> |
No files currently attached
Depends on the following items: None found
Items that depend on this one: None found
There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.
Follow 2 latest changes.
Date | Changed by | Updated Field | Previous Value | => | Replaced by |
---|---|---|---|---|---|
2021-12-16 | bens | Open/Closed | Open | Closed | |
2021-10-09 | bens | Status | None | Fixed |
Powered by Savane 3.13-758e.
Corresponding source code
The discrepancy can be fixed, in most cases. At the start of acquire_an_answer() the current history pointer is remembered AND the string that it points to too. Then, if at the end of the function the answer is equal to the remembered string, then the user chose that item from history, or retyped it, but in either case this string is now at the bottom of the history list (not the real bottom, which always contains an empty string, but the one right before it), so the history pointer should be reset. If, however, the answer differs from the remembered string, then the history item that the remembered pointer points at still exists, so restore the history pointer to the remembered one. Except when that item was at the top of the list, then it may have fallen off the top of the stack (if the user typed an answer that did not already exist in history). So... remember the history pointer only when its prev is not NULL, AND restore the remembered one only when it isn't NULL.
Pfff... That is some ten, twelve, fourteen lines of code, all for something that will probably never occur and if it were to occur, it would be just an inconvenience, a slight confusion. So, I'm not going to bother.
But one improvement can be made: reset the history pointer only when the user starts to go into history, and at the end reset the history pointer only when magichistory is set, so that the user can do ^W ^C (Search and Cancel) in a help text without disturbing the history pointer in an earlier search prompt.