aboutsummaryrefslogtreecommitdiff
path: root/libbb/lineedit.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* | Merge branch 'busybox' into mergeRon Yorston2013-03-191-0/+1
|\|
| * lineedit: initialize delptrShawn J. Goff2013-02-271-0/+1
| | | | | | | | | | | | | | | | In vi mode, the 'p' and 'P' commands caused a segfault when nothing had been put in the buffer yet because the delptr was not initialized. Signed-off-by: Shawn J. Goff <shawn7400@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2012-10-101-1/+2
|\|
| * lineedit: in !EDITING config, return -1 on fgets errorDenys Vlasenko2012-09-271-1/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2012-09-071-3/+3
|\| | | | | | | | | | | Conflicts: include/libbb.h shell/ash.c
| * lineedit: fix Alt-D when cursor==0Cliff Frey2012-08-071-3/+3
| | | | | | | | | | Signed-off-by: Cliff Frey <cliff@meraki.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | lineedit: disable hack for wrong width on MinGWRon Yorston2012-05-011-1/+1
| |
* | Merge branch 'busybox' into mergeRon Yorston2012-04-291-4/+2
|\|
| * lineedit: histfile can get emptied when CONFIG_FEATURE_EDITING_SAVE_ON_EXIT=yDennis Groenen2012-04-261-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When CONFIG_FEATURE_EDITING_SAVE_ON_EXIT is set to y, the histfile will get cleared if the total amount of history lines is less than MAX_HISTORY. Only if the histfile is not empty _and_ the amount of lines currently in memory are equal to or greater than MAX_HISTORY, history saving will work as expected with this feature enabled. Output from defconfig + CONFIG_FEATURE_EDITING_SAVE_ON_EXIT=y: $ echo "foo" > ~/.ash_history $ ./busybox ash ~/busybox/a $ echo "bar" > /dev/null ~/busybox/a $ exit $ cat ~/.ash_history $ Output with the patch applied and same config as above: $ echo "foo" > ~/.ash_history $ ./busybox ash ~/busybox/b $ echo "bar" > /dev/null ~/busybox/b $ exit $ cat ~/.ash_history foo echo "bar" > /dev/null exit $ Signed-off-by: Dennis Groenen <tj.groenen at gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | win32: support fancy prompts and (limited) tilde expansionRon Yorston2012-04-231-0/+10
| |
* | Merge commit '1_20_0' into mergeRon Yorston2012-04-231-1/+1
|\|
| * whitespace fixesDenys Vlasenko2012-04-201-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2012-03-231-6/+9
|\| | | | | | | | | Conflicts: Makefile.flags
| * shell_builtin_read: set cc[VMIN] to 1; lineedit: don't clear c_cc[VINTR]Denys Vlasenko2012-01-151-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | First change fixes "read -n NUM". Apparently poll() won't report data availability if cc[VMIN] > 1 until there are at least cc[VMIN] bytes. function old new delta read_line_input 3885 3877 -8 shell_builtin_read 1097 1087 -10 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-18) Total: -18 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge commit 'c0cae52662ccced9df19f19ec94238d1b1e3bd71' into mergeRon Yorston2012-03-231-8/+102
|\| | | | | | | | | | | Conflicts: Makefile.flags scripts/basic/fixdep.c
| * lineedit: fix build failureDenys Vlasenko2011-11-041-1/+3
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * lineedit: add support for M-b, M-f, M-d, M-BackspaceDenys Vlasenko2011-11-031-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | function old new delta ctrl_left - 96 +96 ctrl_right - 76 +76 static.esccmds 81 93 +12 read_line_input 3876 3885 +9 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 2/0 up/down: 193/0) Total: 193 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * lineedit: remove SAVE_HISTORY bit, ->hist_file can be used as indicatorDenys Vlasenko2011-09-041-5/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * lineedit: add support for history saving on exitDenys Vlasenko2011-09-041-6/+62
| | | | | | | | | | | | Based on the patch by Dennis Groenen <tj.groenen@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * lineedit: fix atomic replace of history file; hush: fix $HISTFILE handlingDenys Vlasenko2011-09-041-2/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge commit 'd84b175cb6948eb17f847313bf912174e2f934e1' into mergeRon Yorston2012-03-221-12/+153
|\| | | | | | | | | Conflicts: include/platform.h
| * libbb/lineedit: implement optional Ctrl-R history searchDenys Vlasenko2011-07-111-12/+153
| | | | | | | | | | | | | | | | | | | | | | function old new delta read_line_input 3433 3957 +524 load_string 77 90 +13 input_tab 1086 1069 -17 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/1 up/down: 537/-17) Total: 520 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge commit '56a3b82e9692a25ef9c9269e88feac0d579ce8e8' into mergeRon Yorston2012-03-221-9/+15
|\| | | | | | | | | | | | | Conflicts: coreutils/ls.c include/platform.h libbb/bb_basename.c
| * lineedit: fix rare SEGV; mark a few FIXMEsAlexey Fomenko2011-05-201-9/+15
| | | | | | | | | | Signed-off-by: Alexey Fomenko <ext-alexey.fomenko@nokia.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge commit 'b83c9704128dd106071184e4b00335a3b8486857' into mergeRon Yorston2012-03-221-60/+92
|\|
| * small fix for HISTFILESIZEDenys Vlasenko2011-03-311-0/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash,hush: optional support for $HISTFILESIZE.Denys Vlasenko2011-03-311-15/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | Based on patch from Alexey Fomenko (ext-alexey.fomenko AT nokia.com) function old new delta size_from_HISTFILESIZE - 44 +44 hush_main 998 1025 +27 ash_main 1348 1374 +26 read_line_input 3361 3372 +11 new_line_input_t 17 24 +7 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * lineedit: fixes for CONFIG_UNICODE_USING_LOCALE=yDenys Vlasenko2011-03-271-45/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta load_string 45 91 +46 save_string 40 82 +42 reinit_unicode 34 61 +27 BB_PUTCHAR 97 120 +23 init_unicode 17 37 +20 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 5/0 up/down: 158/0) Total: 158 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge commit 'da4441c44f6efccb6f7b7588404d9c6bfb7b6af8' into mergeRon Yorston2012-03-221-7/+5
|\| | | | | | | | | | | | | Conflicts: libbb/vfork_daemon_rexec.c networking/wget.c procps/ps.c
| * ash: fix TMOUT not restoring tty attributesDenys Vlasenko2011-02-081-7/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta pgetc 420 500 +80 readtoken1 3202 3239 +37 read_line_input 3316 3337 +21 udhcpc_main 2610 2630 +20 file_get 266 272 +6 expandarg 958 963 +5 localcmd 257 259 +2 addLines 85 87 +2 read_line 94 95 +1 ed_main 2540 2541 +1 timed_out 1 - -1 lineedit_read_key 256 255 -1 alrm_sighandler 44 - -44 cmdloop 539 434 -105 ------------------------------------------------------------------------------ (add/remove: 0/2 grow/shrink: 10/2 up/down: 175/-151) Total: 24 bytes text data bss dec hex filename 887379 936 17200 905515 dd12b busybox_old 887411 936 17192 905539 dd143 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge remote-tracking branch 'upstream/master'Nguyễn Thái Ngọc Duy2011-01-041-36/+63
|\|
| * lineedit: fix tab-completion of filenames with spacesMike Shal2010-11-221-22/+45
| | | | | | | | | | | | | | | | | | | | | | | | Using ash in busybox git version dea28e1e, tab completion doesn't seem to work properly for filenames that have special characters (such as spaces) in them. For example, with filenames "foo bar" and "foo zap", typing "ls fo<TAB>" correctly expands to "ls foo\ ", but then continuing to type "b<TAB>" will produce "ls foo\ bbar", which is not correct (the 'b' is duplicated). Signed-off-by: Mike Shal <marfey@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * lineedit: create history files with mode 0600Wolfram Sang2010-11-151-5/+7
| | | | | | | | | | Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * *: use _exit() in sighandlers; showkey: do not use exit-thru-sighandlerMarek Polacek2010-10-281-9/+11
| | | | | | | | | | | | | | | | | | | | | | | | While at it, make ESC sequences more readable; and removed check for isatty(stdin) in reset. Code shrink: text data bss dec hex filename 884771 936 17216 902923 dc70b busybox_old 884723 936 17216 902875 dc6db busybox_unstripped Signed-off-by: Marek Polacek <mmpolacek@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | win32: lineedit: make read_key() pass Ctrl+<letter> to read_line_inputNguyễn Thái Ngọc Duy2010-09-221-0/+2
| | | | | | | | | | | | This makes ^C and ^D work properly regarding ash input handling (i.e. does not crash ash). Pressing ^C in ash does not stop running programs though.
* | win32: lineedit: initialize initial_settingsNguyễn Thái Ngọc Duy2010-09-221-0/+1
| | | | | | | | | | initial_settings.c_cc[] is used to detect Ctrl-C, Ctrl-D. Don't let garbage drive read_line_input()
* | win32: lineedit: fallback to fgets if a tty is not foundNguyễn Thái Ngọc Duy2010-09-211-2/+4
| |
* | Merge remote branch 'origin/master'Nguyễn Thái Ngọc Duy2010-09-141-366/+376
|\|
| * lineedit: do not hang on error, but return error indicator.Denys Vlasenko2010-09-071-6/+6
| | | | | | | | Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
| * lineedit: on tab completion, show filenames obly in all cases (bash compat)Denys Vlasenko2010-09-031-13/+9
| | | | | | | | | | | | | | function old new delta complete_cmd_dir_file 731 730 -1 Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
| * lineedit: allocate matchBuf only temporarily: saves MAX_LINELEN bytesDenys Vlasenko2010-09-031-45/+48
| | | | | | | | | | | | | | | | | | | | function old new delta input_tab 1027 1041 +14 build_match_prefix 590 562 -28 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 14/-28) Total: -14 bytes Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
| * lineedit: de-indent large block in input_tab. No logic changes.Denys Vlasenko2010-09-031-131/+131
| | | | | | | | Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
| * lineedit: rename tmp -> chosen_match; small code shrinkDenys Vlasenko2010-09-031-26/+23
| | | | | | | | | | | | | | function old new delta input_tab 1016 1012 -4 Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
| * lineedit: stop using permanent int_buf[] (16k!): allocate itDenys Vlasenko2010-09-031-14/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | Now it is allocated temporarily only for the duretion of prefix generation, and also we only allocate the needed size, not maximally possible. function old new delta build_match_prefix 579 590 +11 remove_chunk 43 28 -15 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 11/-15) Total: -4 bytes Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
| * lineedit: remove pos_buf[] array (up to 16k!); fix compat bugsDenys Vlasenko2010-09-031-83/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | pos_buf is a strange hack, easy to do without it. This also allows lines >32k long to be handled. Also simplified match prefix generations and made behavior more like bash. function old new delta remove_chunk - 43 +43 collapse_pos 79 - -79 build_match_prefix 804 579 -225 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 0/1 up/down: 43/-304) Total: -261 bytes Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
| * lineedit: return prefix len from tab completion helpersDenys Vlasenko2010-09-031-36/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This kills horrific logic which deletes and re-adds prefix (!) function old new delta complete_cmd_dir_file 705 731 +26 complete_username 121 124 +3 input_tab 1041 1016 -25 build_match_prefix 838 804 -34 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/2 up/down: 29/-59) Total: -30 bytes Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
| * lineedit: clean up tab completion code (variable reuse, comments)Denys Vlasenko2010-09-031-69/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Noted bugs in behavior. Added debugging machinery. Decoupled variables reused for unrelated purposes: apparently, when not forced to use liveness analysis, gcc fares better. function old new delta complete_cmd_dir_file 699 705 +6 collapse_pos 75 79 +4 build_match_prefix 892 838 -54 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/1 up/down: 10/-54) Total: -44 bytes Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
| * preparatory cleanup patch for tab completion fixesDenys Vlasenko2010-09-031-61/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | renames and deinlines a few functions function old new delta input_tab - 1041 +1041 complete_cmd_dir_file - 699 +699 complete_username - 121 +121 username_completion 121 - -121 read_line_input 5002 3313 -1689 ------------------------------------------------------------------------------ (add/remove: 3/1 grow/shrink: 0/1 up/down: 1861/-1810) Total: 51 bytes Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
| * lineedit: small readability improvement (same code)Denys Vlasenko2010-09-021-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
| * lineedit: fix completion with Unicode charsDenys Vlasenko2010-09-021-3/+13
| | | | | | | | | | | | | | | | | | | | function old new delta read_line_input 4966 5002 +36 bb_wcstombs 170 159 -11 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 36/-11) Total: 25 bytes Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>