[SERVER-4043] Tab completion does not work in mid-code Created: 09/Oct/11 Updated: 11/Jul/16 Resolved: 16/Nov/11 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Shell |
| Affects Version/s: | None |
| 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 | ||
| Operating System: | ALL |
| Participants: |
| Description |
|
Tab completion in the shell seems to stop working after other code is already on the input line. It seems like this dates to the introduction of linenoise as a readline replacement. MongoDB shell version: 2.1.0-pre- The behavior is the same in 1.9.1, 2.0.0 and the current code. This works in 1.8.4-rc1-pre- built from source today. Tested in Ubuntu 11.04 with gnome terminal. |
| Comments |
| Comment by Tad Marshall [ 16/Nov/11 ] |
|
Fixed by commit 9bef2fd11e1aa85581c41a7a9ac48ebfb94e7d63 ( |
| Comment by auto [ 16/Nov/11 ] |
|
Author: {u'login': u'', u'name': u'Tad Marshall', u'email': u'tad@10gen.com'}Message: Add code to linenoise to do what readline was doing. When tab is " for now) |
| Comment by Tad Marshall [ 27/Oct/11 ] |
|
Pull request 110 got closed and I forget if Dwight closed it or I did. The problem wasn't with my fix which was and is good but with the incorrect way that I was issuing my pull requests. I was making each pull request against a commit that was based on my previous commits and the way GitHub works this caused each of my pull requests to include every previous change I had made. You can view the specific code changes for this bug at https://github.com/tadmarshall/mongo/commit/8d04e31d9e4d71af2f8630cf3d4cd28daeca5557 . I can resubmit the pull request but because there is a call to refreshLine(), there is an interaction with my larger fix to There is enough information in the earlier (closed) pull request (110) in the commit mentioned above that someone could hand-merge the code if they felt like it, or I can resubmit a pull request dependent on 123 or a variation that assumes that 123 will be rejected. Let me know what you'd like. In any case, this is a significant bug (tab completion is broken at any location other than the start of a line) and the fix is available, so some version of the fix should get into the codebase. |
| Comment by Tad Marshall [ 10/Oct/11 ] |
|
Pull request https://github.com/mongodb/mongo/pull/110 addresses this. |
| Comment by Tad Marshall [ 10/Oct/11 ] |
|
readline was doing some processing that we weren't emulating in linenoise. It looks backwards in the input for a break character and only passes the portion of the buffer between the break character and the current position to the completion routine. So, when I type "g=f.toL<tab>", the 1.8.* readline code would pass "f.toL" to our command completion code, which it handled fine. The newer linenoise code was passing "g=f.toL" which fails. readline also inserts the completion text into the command line at the current position replacing the extracted portion. linenoise was taking the completion text as a full command line replacement. Doing what readline did should make the code work again. |