[SERVER-4011] Escape only works to end command completion in Windows Created: 04/Oct/11 Updated: 11/Jul/16 Resolved: 08/Dec/11 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Shell |
| Affects Version/s: | 2.0.0 |
| Fix Version/s: | 2.1.0 |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Tad Marshall | Assignee: | Tad Marshall |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Non-Windows |
||
| Operating System: | ALL |
| Participants: |
| Description |
|
There is code in the completeLine() function in third_party/linenoise/linenoise.cpp that lets a user hit the Esc key to break out of the cycle of command completions and return to what they originally had typed when they hit Tab. This feature works fine in the Windows version of the Mongo shell but it doesn't ever get a chance to run in the non-Windows version because ESC characters have all been removed from the input upstream by escape sequence processing. It's not a very exciting feature anyway and could probably be removed from the Windows version with no complaints, or a different character could be picked. It's not a great idea to hack up the escape sequence processing to make this work. If ESC ends the command completion attempt but ESC [ A is the up-arrow key, life is complicated. |
| Comments |
| Comment by auto [ 08/Dec/11 ] |
|
Author: {u'login': u'', u'name': u'Tad Marshall', u'email': u'tad@10gen.com'}Message: The code to accept Esc to revert an in-progress command completion |
| Comment by Tad Marshall [ 08/Dec/11 ] |
|
Adding full and proper handling of Meta key sequences in linenoise requires that we accept two forms of alphabetic Meta commands. To move the cursor to the beginning of the previous word, you use Meta-B, which can be typed as either Alt+b or Esc followed by b. There is no timing constraint, so you are allowed to hit Esc, go to lunch, and hit b when you get back, and this is a legal Meta-b command. So ... I'm going to remove the code that currently lets Windows users revert an in-progress command completion by hitting Esc. When the Ctrl-R (revert-line) feature is added, that will give both Windows and Linux users a way to undo (revert) a command completion they are in the middle of. And, this will change again when command completion changes to bash/readline style. |