[SERVER-4012] Ctrl-T in Mongo shell behavior isn't quite right Created: 04/Oct/11  Updated: 11/Jul/16  Resolved: 01/Nov/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: Eliot Horowitz (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Any


Operating System: ALL
Participants:

 Description   

Emacs and bash have a cute keystroke for transposing letters. If you type "na" when you meant "an" and you realize instantly that you have done this, you can just press ctrl-t and the two characters to the left of the cursor will trade places, correcting your typo. This is special ctrl-t behavior at the end of a line. If the cursor is at the beginning of the line, so there are no characters to its left, it does nothing. At any other position in the line, it will transpose the character to the cursor's left with the character under the cursor and then advance itself forward by one position. It you press ctrl-t repeatedly from some point in the middle of a line, this has the effect of "dragging" the character that is to the cursor's left along with it towards the end of the line.

The Mongo shell gets most of this right with two exceptions:

1) If the cursor is at the end of the line, the shell does nothing on ctrl-t. It should transpose the two characters to its left.

2) When the cursor is on the last character in the line, the shell correctly transposes the last two characters but it fails to advance the cursor to the end of the line.



 Comments   
Comment by auto [ 01/Nov/11 ]

Author:

{u'login': u'erh', u'name': u'Eliot', u'email': u'eliot@10gen.com'}

Message: Merge pull request #115 from tadmarshall/SERVER-4012-reissue

SERVER-4012 (reissue) – make ctrl-T work like bash and emacs
Branch: master
https://github.com/mongodb/mongo/commit/2f1cfc6e53ab66159ee3f0c056bfaaff9ec0e7be

Comment by auto [ 01/Nov/11 ]

Author:

{u'login': u'erh', u'name': u'Eliot', u'email': u'eliot@10gen.com'}

Message: Merge pull request #115 from tadmarshall/SERVER-4012-reissue

SERVER-4012 (reissue) – make ctrl-T work like bash and emacs
Branch: master
https://github.com/mongodb/mongo/commit/2f1cfc6e53ab66159ee3f0c056bfaaff9ec0e7be

Comment by Tad Marshall [ 13/Oct/11 ]

I closed pull request 100 and opened https://github.com/mongodb/mongo/pull/115 to replace it.
Same code, but without the unrelated commits.

Comment by Tad Marshall [ 06/Oct/11 ]

Pull request https://github.com/mongodb/mongo/pull/100 addresses this.

Generated at Thu Feb 08 03:04:41 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.