aboutsummaryrefslogtreecommitdiff
path: root/libbb/lineedit.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* 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>
* lineedit: preparatory cleanup patch for Unicode completion fixDenys Vlasenko2010-09-021-113/+118
| | | | | | | | | | | | | | | | Some logic changes and function renames. The fix will follow this patch, to mkae it distinct from cleanup. function old new delta build_match_prefix - 892 +892 username_completion - 121 +121 read_line_input 4902 4966 +64 username_tab_completion 235 - -235 find_match 892 - -892 ------------------------------------------------------------------------------ (add/remove: 2/2 grow/shrink: 1/0 up/down: 1077/-1127) Total: -50 bytes Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
* lineedit: mostly revert recent wrong logic in "ask terminal" codeDenys Vlasenko2010-07-251-12/+9
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* lineedit: limit ASK_TERMINAL to the case when we can't find out the widthDenys Vlasenko2010-07-181-9/+14
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* lineedit: cosmetics, no code changesDenys Vlasenko2010-07-181-26/+24
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* lineedit: fix column display for wide and combining chars in TAB completionTomas Heinrich2010-06-011-3/+6
| | | | | | | | | | | | function old new delta unicode_strwidth - 20 +20 read_line_input 4945 4953 +8 unicode_strlen 31 - -31 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 1/0 up/down: 28/-31) Total: -3 bytes Signed-off-by: Tomas Heinrich <heinrich.tomas@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* typo fixDenys Vlasenko2010-05-171-2/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* lineedit: fix insertion deep inside line (*several lines* before end)Denys Vlasenko2010-05-171-8/+15
| | | | | | | function old new delta input_backward 212 229 +17 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* lineedit: trivial simplifications. -7 bytesDenys Vlasenko2010-05-171-14/+6
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* lineedit: fix moving backwards across lines with wide charsDenys Vlasenko2010-05-171-21/+46
| | | | | | | function old new delta input_backward 212 208 -4 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* consolidate ESC sequencesDenys Vlasenko2010-05-161-1/+1
| | | | | | | | | | | | | | function old new delta bell 2 - -2 CMdown 2 - -2 Ceos 4 - -4 Ceol 4 - -4 CMup 4 - -4 SOs 5 - -5 SOn 5 - -5 CMrc 9 - -9 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* stop using LAST_SUPPORTED_WCHAR and CONFIG_LAST_SUPPORTED_WCHAR, it's confusingDenys Vlasenko2010-05-161-3/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* lineedit: partially fix wide and combining chars editingTomas Heinrich2010-05-161-44/+80
| | | | | Signed-off-by: Tomas Heinrich <heinrich.tomas@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* lineedit: change how cmdedit_set_out_char worksDenys Vlasenko2010-05-111-32/+41
| | | | | | | | | | | | | | | | | | | Rename two badly names functions, use "clear to end of screen" to eliminate annoying problems with clearing wide/combining chars, and such. Run tested. function old new delta put_cur_glyph_and_inc_cursor - 124 +124 put_till_end_and_adv_cursor - 24 +24 input_delete 125 130 +5 Ceos 5 4 -1 Ceol 5 4 -1 input_end 24 - -24 cmdedit_set_out_char 122 - -122 ------------------------------------------------------------------------------ (add/remove: 2/2 grow/shrink: 1/2 up/down: 153/-148) Total: 5 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb/lineedit: add support for preserving "broken" (non-unicode) charsTomas Heinrich2010-04-291-11/+51
| | | | | Signed-off-by: Tomas Heinrich <heinrich.tomas@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* unicode: s/FEATURE_ASSUME_UNICODE/UNICODE_SUPPORT, add UNICODE_USING_LOCALEDenys Vlasenko2010-03-261-13/+13
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* unicode: optional table for better handling of neutral bidi charsTomas Heinrich2010-03-261-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | Off: function old new delta unicode_bidi_isrtl - 55 +55 isrtl_str 51 65 +14 unicode_isrtl 55 - -55 read_line_input 5003 4937 -66 ------------------------------------------------------------------------------ (add/remove: 1/4 grow/shrink: 1/1 up/down: 69/-121) Total: -52 bytes On: function old new delta static.neutral_b - 320 +320 static.neutral_p - 142 +142 unicode_bidi_isrtl - 55 +55 unicode_bidi_is_neutral_wchar - 55 +55 isrtl_str 51 59 +8 unicode_isrtl 55 - -55 read_line_input 5003 4937 -66 ------------------------------------------------------------------------------ (add/remove: 4/4 grow/shrink: 1/1 up/down: 580/-121) Total: 459 bytes Signed-off-by: Tomas Heinrich <heinrich.tomas@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* lineedit: first shot at optional unicode bidi input supportTomas Heinrich2010-03-181-12/+32
| | | | | | | | | | | | | | | | | function old new delta read_line_input 4886 5003 +117 in_uint16_table - 97 +97 in_interval_table - 78 +78 static.rtl_b - 68 +68 unicode_isrtl - 55 +55 isrtl_str - 51 +51 static.rtl_p - 42 +42 unicode_conv_to_printable2 633 477 -156 ------------------------------------------------------------------------------ (add/remove: 6/0 grow/shrink: 1/1 up/down: 508/-156) Total: 352 bytes Signed-off-by: Tomas Heinrich <heinrich.tomas@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* lineedit: fix another corner case with bad unicode inputDenys Vlasenko2010-03-111-21/+24
| | | | | | | | | | | | | | | | | function old new delta read_key 607 646 +39 readit 50 55 +5 getch_nowait 290 295 +5 hash_find 233 234 +1 xstrtoul_range_sfx 231 230 -1 passwd_main 1058 1056 -2 builtin_exit 45 43 -2 cmp_main 649 645 -4 lineedit_read_key 257 245 -12 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 4/5 up/down: 50/-21) Total: 29 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* lineedit: invalid unicode characters are replaced with CONFIG_SUBST_WCHARTomas Heinrich2010-03-091-5/+21
| | | | | | | | | function old new delta read_key_ungets - 50 +50 lineedit_read_key 223 252 +29 Signed-off-by: Tomas Heinrich <heinrich.tomas@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb: better unicode width support. Hopefully fixes bug 839.Denys Vlasenko2010-01-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Also opens up a possibility to make other unicode stuff smaller and more correct later. but: function old new delta static.combining - 516 +516 bb_wcwidth - 328 +328 unicode_cut_nchars - 141 +141 mbstowc_internal - 93 +93 in_table - 78 +78 cal_main 899 961 +62 static.combining0x10000 - 40 +40 unicode_strlen - 31 +31 bb_mbstrlen 31 - -31 bb_mbstowcs 173 102 -71 ------------------------------------------------------------------------------ (add/remove: 7/1 grow/shrink: 1/1 up/down: 1289/-102) Total: 1187 bytes Uses code of Markus Kuhn, which is in public domain: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c "Permission to use, copy, modify, and distribute this software for any purpose and without fee is hereby granted. The author disclaims all warranties with regard to this software." Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* fold: unicode support. Based on a patch by Tomas Heinrich ↵Denys Vlasenko2010-01-041-1/+1
| | | | | | | | | | | | | | | | | | | | <heinrich.tomas@gmail.com> General Unicode support is tweaked to expose unicode_status. function old new delta init_unicode - 77 +77 write2stdout - 19 +19 adjust_column 68 71 +3 unicode_status - 1 +1 unicode_is_enabled 1 - -1 grep_main 780 773 -7 fold_main 619 552 -67 check_unicode_in_env 77 - -77 ------------------------------------------------------------------------------ (add/remove: 3/2 grow/shrink: 1/2 up/down: 100/-152) Total: -52 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* randomconfig fixesDenys Vlasenko2009-12-121-0/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* ash: fix bad interaction of "stty -echo" + ASK_TERMINALDenys Vlasenko2009-11-111-47/+52
| | | | | | | | | | function old new delta read_line_input 4820 4886 +66 put_prompt 108 47 -61 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 66/-61) Total: 5 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* *: introduce and use ffulsh_all()Denys Vlasenko2009-11-021-7/+7
| | | | | | | | | | | | | | | | | | | | function old new delta buffer_fill_and_print 179 196 +17 fflush_all - 9 +9 spawn 87 92 +5 rtcwake_main 455 453 -2 ... alarm_intr 93 84 -9 readcmd 1072 1062 -10 bb_ask 345 333 -12 more_main 845 832 -13 flush_stdout_stderr 42 23 -19 xfflush_stdout 27 - -27 flush_stderr 30 - -30 ------------------------------------------------------------------------------ (add/remove: 1/2 grow/shrink: 2/50 up/down: 31/-397) Total: -366 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* lineedit: REALLY fix compile error nowDenys Vlasenko2009-10-291-2/+5
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* lineedit: compile fixDenys Vlasenko2009-10-291-3/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* rename sent_ESC_br_n6 variable to sent_ESC_br6nDenys Vlasenko2009-10-271-5/+5
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb/lineedit: try to make FEATURE_EDITING_ASK_TERMINAL less uglyDenys Vlasenko2009-10-271-10/+35
| | | | | | | | | | | function old new delta read_line_input 4809 4829 +20 lineedit_read_key 207 223 +16 put_prompt 110 117 +7 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/0 up/down: 43/0) Total: 43 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* read_key,lineeedit: parse position answerback faster; sanitize its useDenys Vlasenko2009-10-261-5/+33
| | | | | | | | | | | | | | | | it's still not reliable, and probably cannot be made so... added comment with explanation. function old new delta put_prompt 52 110 +58 read_key 601 607 +6 lineedit_read_key 201 207 +6 win_changed 108 104 -4 read_line_input 4824 4809 -15 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/2 up/down: 70/-19) Total: 51 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* lineedit: handle Ctrl-arrowsDenys Vlasenko2009-10-251-27/+70
| | | | | | | | | | | | | | | | | | | function old new delta read_line_input 4629 4824 +195 BB_isalnum - 39 +39 BB_ispunct - 35 +35 BB_isspace - 31 +31 static.esccmds 69 93 +24 vi_word_motion 165 162 -3 vi_back_motion 204 198 -6 vi_end_motion 172 163 -9 bb_iswspace 28 - -28 bb_iswpunct 32 - -32 bb_iswalnum 37 - -37 ------------------------------------------------------------------------------ (add/remove: 3/3 grow/shrink: 5/8 up/down: 334/-129) Total: 205 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* lineedit: do not hardcode ctrl-C and ctrl-D, use termios fields.Denys Vlasenko2009-10-141-34/+35
| | | | | | | | | Unexpected code shrink is probably a gcc glitch: function old new delta read_line_input 4771 4629 -142 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb/lineedit: restore ^D handling for unicodeDenys Vlasenko2009-09-291-3/+5
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb/lineedit: fix the case when we configured history to have 0 linesDenys Vlasenko2009-09-271-18/+20
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* remove some GNUisms. by Dan Fandrich (dan AT coneharvesters.com)Denys Vlasenko2009-09-061-1/+2
| | | | | | | | | | function old new delta logdirs_reopen 1310 1308 -2 read_line_input 4757 4753 -4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-6) Total: -6 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* another small lineedit fixDenys Vlasenko2009-07-161-1/+3
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* fix a thinko in lineedit completion codeDenys Vlasenko2009-07-161-7/+7
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* lineedit: code shrinkDenys Vlasenko2009-07-161-24/+34
| | | | | | | | | | function old new delta collapse_pos - 77 +77 read_line_input 4755 4757 +2 add_quote_for_spec_chars 75 71 -4 find_match 1283 892 -391 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* remove trailing whitespaceDenys Vlasenko2009-07-151-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* randomconfig fixesDenys Vlasenko2009-07-151-1/+4
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>