Commit Graph

58 Commits

Author SHA1 Message Date
Tad Marshall
9bef2fd11e SERVER-4043 -- fix tab completion in mid-code
Add code to linenoise to do what readline was doing.  When tab is
hit, we need to search backwards from the insertion point for a
break character (we're using " =+-/\\*?\"'`&<>;|@{([])}" for now)
and only pass the characters between that point and the cursor
position to the completion routine.  When it gives us possible
completions, we need to insert them in place of the string we
extracted, which makes completion work when not at the left margin
and even when inside another expression.  Linenoise was passing
the whole input line and substituting the replacement text for the
entire line.
2011-11-16 15:19:27 -05:00
Tad Marshall
8d8b272225 SERVER-4008 -- don't leak memory in the shell
Track the strdup-ed (i.e. malloc-ed) strings returned by linenoise, and
free the memory when we are done with it. Free command line history
memory explicitly when we save the history to a file and stop using it.
Non-Windows versions were freeing this memory using an atexit handler,
but this handler isn't set up for Windows.
2011-11-16 13:07:37 -05:00
Tad Marshall
1194acb7fb SERVER-3771 -- part 2 -- make mongo shell behave like bash
Remove the all-on-one-line command line editing in the shell and replace it
with something more in the style of other command lines such as bash. Allow
prompts to exceed the width of the terminal screen and allow newlines in
them. Strip all other control characters from the prompt text before
displaying it so that embedded backspaces, tabs and other controls don't
display badly or require extra code to emulate. This prevents users from
using escape sequences in their prompts to perform highlighting, for now
at least. Allow command line text to exceed the available width following
the prompt by wrapping onto other lines the way they bash does it. Make the
newline character display as a newline instead of as a linefeed or DOS OEM
character. Increase the amount of common code between Windows and
non-Windows versions and make them behave the same way. Don't refresh the
Windows command line when the shift key is pressed.
2011-11-15 17:35:40 -05:00
Eliot Horowitz
4c2600d332 scons flag to use each library externally --use-system-(prcre|boost) SERVER-3829
currently supported:

--use-system-all

--use-system-pcre
--use-system-sm
2011-11-14 18:05:46 -05:00
Eliot
749b1b2d8d Merge pull request #121 from tadmarshall/SERVER-3990-reissue-2
SERVER-3990 (reissue 2) -- fix ctrl-D won't delete last character in line
2011-10-31 21:06:15 -07:00
Eliot
2f1cfc6e53 Merge pull request #115 from tadmarshall/SERVER-4012-reissue
SERVER-4012 (reissue) -- make ctrl-T work like bash and emacs
2011-10-31 21:03:22 -07:00
Mathias Stearn
00752854b5 Ignore unhandled control chars rather than printing them to the screen 2011-10-18 15:03:18 -04:00
Mathias Stearn
257dc88e46 Support home and end keys in konsole SERVER-3775 2011-10-18 15:03:18 -04:00
Tad Marshall
8434e67a31 SERVER-3990 (reissue 2) -- fix ctrl-D won't delete last character in line
This is a reissue of my earlier fix. I'm trying to break them down into
bite-sized parts to make them easier to pull.

Merge the code for DEL and ctrl-D, with special handling for ctrl-D on
an empty line.  Let memmove copy the NUL terminator.  Edited for style.
2011-10-13 07:28:22 -04:00
Tad Marshall
7d45ecb7d2 SERVER-4012 (reissue) -- make ctrl-T work like bash and emacs
This is a reissue of my earlier fix. I'm trying to break them down into
bite-sized parts to make them easier to pull.

Small changes to logic to do what bash does when ctrl-T is hit at or
next to the end of a line.
2011-10-12 15:24:24 -04:00
gregs
16a811b037 new benchRun additions for shell 2011-10-11 12:18:59 -04:00
Eliot Horowitz
8ce081f169 use PCRECPP_STATIC SERVER-3992 2011-10-01 11:21:13 -04:00
agirbal
a00f768a98 SERVER-3897: shell prompt does not work well in some debuggers (e.g. eclipse), 'enter' triggers pegged cpu 2011-09-19 14:42:11 -07:00
Mathias Stearn
ff418fdac2 Fix off-by-one in linenoise SERVER-3394 2011-09-09 13:39:07 -04:00
Mathias Stearn
df769f03a4 Make linenoise work correctly with multi-line pastes 2011-09-06 12:11:11 -04:00
Mathias Stearn
55ca0b1658 Correct fix for SERVER-3394 2011-09-06 12:11:11 -04:00
Mathias Stearn
0568f129bd Revert "fix highlighting in shell for lines longer than console width SERVER-3394"
This reverts commit fb88b80ce4.
2011-09-06 12:11:11 -04:00
Eliot Horowitz
0dd179510c fix sm for windows SERVER-3659 2011-08-24 11:13:57 -04:00
Eliot Horowitz
452256db6c NDEBUG might be causing issues 2011-08-23 11:13:20 -04:00
Eliot Horowitz
afa9b2b469 put our sm version at the front 2011-08-22 16:07:35 -04:00
Eliot Horowitz
eb03b83dea put our own versions at the front 2011-08-22 16:07:35 -04:00
Eliot Horowitz
fe08b2ee5a fix depencies for sm SERVER-3659 2011-08-22 15:40:13 -04:00
Eliot Horowitz
ed9f00aa1a fix sm build for solaris SERVER-3659 take3 2011-08-22 02:17:21 -04:00
Eliot Horowitz
cc8730d27f try to fix solaris sm build SERVER-3659 v2 2011-08-22 00:51:34 -04:00
Eliot Horowitz
229e06bae5 try to fix solaris sm build SERVER-3659 2011-08-22 00:43:01 -04:00
Eliot Horowitz
ea8b5df217 fix windows sm build SERVER-3659 2011-08-22 00:40:49 -04:00
Eliot Horowitz
2890a4ed0c sm flags for windows SERVER-3659 2011-08-21 12:20:15 -04:00
Eliot Horowitz
b5343d9319 remove bad files for sm SERVER-3659 2011-08-21 10:40:24 -04:00
Eliot Horowitz
f97d900e5a fix sm build for darwin SERVER-3659 2011-08-21 01:47:27 -04:00
Eliot Horowitz
d40cad9feb combine sm in source 2011-08-21 01:34:54 -04:00
Eliot Horowitz
dfdfac782d don't use pcre heap for solaris 2011-08-19 10:34:08 -04:00
Eliot Horowitz
0e297b70f1 move snappy setup to third_party/snappy.py 2011-08-18 13:24:59 -04:00
Eliot Horowitz
5bd3f44d5c use our own version of pcre SERVER-2085 2011-08-18 10:49:50 -04:00
dwight
13a9e04fd2 make earlier visual studio versions work 2011-08-02 23:23:44 -04:00
dwight
4d3fe8b73a elim a couple warnings on windows 2011-08-02 02:39:06 -04:00
dwight
57b8eaa186 compression lib 2011-08-02 02:38:00 -04:00
Mathias Stearn
aea06e1fd6 Shell ignores tabs at begining of line to play nice with copy-paste SERVER-3508 2011-08-01 19:34:33 -04:00
Mathias Stearn
fb88b80ce4 fix highlighting in shell for lines longer than console width SERVER-3394 2011-07-08 18:15:36 -04:00
Mathias Stearn
1c69e7b64e home and end keys for linux and rxvt 2011-04-20 14:40:07 -04:00
Mathias Stearn
9047007b4c Special debug mode in shell to print raw input bytes 2011-04-20 14:40:07 -04:00
Mathias Stearn
9c98a92af0 Basic highlighting of matched braces
I'm not 100% sure I like this but want to play with it a bit and get feedback.
May revert in a few days.
2011-04-16 04:22:10 -04:00
Mathias Stearn
b81192b775 fix the shell 2011-04-16 02:37:42 -04:00
Mathias Stearn
d3574a11cb don't save or load blank history lines 2011-04-15 19:55:50 -04:00
Mathias Stearn
2892c6daf9 home and end key support on posix 2011-04-15 19:50:50 -04:00
Mathias Stearn
e0d7cc9432 make history_index global and an actual index 2011-04-15 19:32:43 -04:00
Mathias Stearn
c68392bfe8 don't SIGBUS when deleting at end of line 2011-04-12 18:23:47 -04:00
Mathias Stearn
fc0500e539 fix completeLine SERVER-1763 2011-04-11 19:45:25 -04:00
Mathias Stearn
7dee30b39f didn't mean to change this comment 2011-04-11 19:32:30 -04:00
Mathias Stearn
220d413906 CHA is 1-based. Fixes an issue with aterm. 2011-04-11 19:27:19 -04:00
Mathias Stearn
00c383f6c0 first pass at merging posix and win32 linenoise codebases SERVER-1763 2011-04-11 19:00:15 -04:00