aboutsummaryrefslogtreecommitdiff
path: root/libbb/lineedit.c
AgeCommit message (Collapse)Author
2010-03-18lineedit: first shot at optional unicode bidi input supportTomas Heinrich
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>
2010-03-11lineedit: fix another corner case with bad unicode inputDenys Vlasenko
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>
2010-03-09lineedit: invalid unicode characters are replaced with CONFIG_SUBST_WCHARTomas Heinrich
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>
2010-01-24libbb: better unicode width support. Hopefully fixes bug 839.Denys Vlasenko
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>
2010-01-04fold: unicode support. Based on a patch by Tomas Heinrich ↵Denys Vlasenko
<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>
2009-12-12randomconfig fixesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-11ash: fix bad interaction of "stty -echo" + ASK_TERMINALDenys Vlasenko
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>
2009-11-02*: introduce and use ffulsh_all()Denys Vlasenko
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>
2009-10-29lineedit: REALLY fix compile error nowDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-29lineedit: compile fixDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-27rename sent_ESC_br_n6 variable to sent_ESC_br6nDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-27libbb/lineedit: try to make FEATURE_EDITING_ASK_TERMINAL less uglyDenys Vlasenko
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>
2009-10-26read_key,lineeedit: parse position answerback faster; sanitize its useDenys Vlasenko
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>
2009-10-25lineedit: handle Ctrl-arrowsDenys Vlasenko
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>
2009-10-14lineedit: do not hardcode ctrl-C and ctrl-D, use termios fields.Denys Vlasenko
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>
2009-09-29libbb/lineedit: restore ^D handling for unicodeDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-27libbb/lineedit: fix the case when we configured history to have 0 linesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-06remove some GNUisms. by Dan Fandrich (dan AT coneharvesters.com)Denys Vlasenko
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>
2009-07-16another small lineedit fixDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-16fix a thinko in lineedit completion codeDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-16lineedit: code shrinkDenys Vlasenko
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>
2009-07-15remove trailing whitespaceDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-15randomconfig fixesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-12lineedit+unicode: make TAB completion work againDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-12vi: small code shrinkDenys Vlasenko
function old new delta vi_word_motion 185 165 -20 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-11added simplified Unicode support for non-locale-enabled buildsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-10lineedit: implement Unicode-aware line editing (optional)Denys Vlasenko
When off: function old new delta input_delete 133 140 +7 vi_word_motion 236 240 +4 vi_Back_motion 89 92 +3 vi_end_motion 223 225 +2 cmdedit_set_out_char 74 76 +2 vi_back_motion 198 199 +1 vi_Word_motion 87 88 +1 vi_End_motion 92 86 -6 read_line_input 6293 6270 -23 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 7/2 up/down: 20/-29) Total: -9 bytes When on: lineedit_read_key 146 272 +126 BB_PUTCHAR - 94 +94 read_line_input 6293 6351 +58 save_string - 43 +43 wcstombs - 38 +38 mbstowcs - 38 +38 save_command_ps_at_cur_history 65 93 +28 input_delete 133 148 +15 vi_Back_motion 89 90 +1 vi_Word_motion 87 86 -1 cmdedit_set_out_char 74 73 -1 vi_End_motion 92 84 -8 vi_back_motion 198 187 -11 vi_word_motion 236 206 -30 vi_end_motion 223 184 -39 ------------------------------------------------------------------------------ (add/remove: 4/0 grow/shrink: 5/6 up/down: 441/-90) Total: 351 bytes There is one TODO and maybe some bugs :) Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-01lineedit: fix warning about unused label when VI editing is disabledMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-05-29read_key: drop optimization where we read 3 bytes at onceDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-17lineedit: small fixesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-17line editing: add an option to emit ESC [ 6 n and use resultsDenys Vlasenko
This makes line editing able to recognize case when cursor was not at the beginning of the line. It may also be adapted later to find out display size (serial line users would love it). Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-15lineedit: use read_key to recognize ESC sequence.Denys Vlasenko
This fixes several vi mode bugs and prepares for further fixes. function old new delta read_line_input 3287 5511 +2224 remember_in_history - 499 +499 lineedit_read_key - 70 +70 read_key 321 332 +11 input_tab 2823 - -2823 ------------------------------------------------------------------------------ (add/remove: 2/1 grow/shrink: 2/0 up/down: 2804/-2823) Total: -19 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-04-21*: mass renaming of USE_XXXX to IF_XXXXDenis Vlasenko
and SKIP_XXXX to IF_NOT_XXXX - the second one was especially badly named. It was not skipping anything!
2009-03-23libbb: revent previous version of "concurrent history updating"Denis Vlasenko
and replace it with one which does not "snoop" history written by others. (1) it is what bug 185 needs, and (2) it is less bloaty: function old new delta load_history - 252 +252 read_line_input 3155 3287 +132 next_token 914 918 +4 qrealloc 36 33 -3 getoptscmd 713 708 -5 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 2/2 up/down: 388/-8) Total: 380 bytes
2009-03-22libbb: make history saving/loading concurrent-safeDenis Vlasenko
* all history writers always append (not overwrite) history files * they reload history if they detect that file length has changed since last write * they trim history file only when it grows 4 times longer than MAXLINES * they do this atomically by creating new file and renaming it to old Unfortunately, this comes at a price: function old new delta load_history - 346 +346 read_line_input 3155 3358 +203 new_line_input_t 17 31 +14 ...irrelevant small jitter... ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 5/5 up/down: 573/-13) Total: 560 bytes
2008-11-05*: code shrink by adding a wrapper around very common tcsetattr(0, TCSANOW, ↵Denis Vlasenko
xx) op function old new delta tcsetattr_stdin_TCSANOW - 14 +14 set_sane_term 116 113 -3 top_main 1277 1273 -4 make_new_session 421 415 -6 rawmode 133 126 -7 reset_term 18 10 -8 die 43 35 -8 cookmode 62 54 -8 vlock_main 425 415 -10 read_line_input 3165 3155 -10 bb_askpass 357 347 -10 fsck_minix_main 3079 3065 -14 getty_main 2375 2332 -43 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/12 up/down: 14/-131) Total: -117 bytes
2008-11-02lineedit: fix bug 5824: Since version 23530 with lineedit.c,Denis Vlasenko
"fdisk" & "ed" can't work any more
2008-09-27lineedit: fix problems with empty commands in historyDenis Vlasenko
2008-08-20linedit: fix use-after-freeDenis Vlasenko
2008-07-22another overlapping_strcpyDenis Vlasenko
2008-07-22fix all cases of strcpy on overlapping strings.Denis Vlasenko
2008-07-21libbb: [x]fopen_for_{read,write} introduced and used.Denis Vlasenko
(by Valdimir) function old new delta config_open2 - 41 +41 config_read 507 542 +35 find_pair 169 187 +18 fopen_for_write - 14 +14 fopen_for_read - 14 +14 find_main 406 418 +12 xfopen_for_write - 10 +10 xfopen_for_read - 10 +10 popstring 134 140 +6 parse_inittab 396 401 +5 next_token 923 928 +5 pack_gzip 1659 1661 +2 bb__parsespent 117 119 +2 fallbackSort 1719 1717 -2 evalvar 1376 1374 -2 qrealloc 36 33 -3 ... ... ... ... singlemount 4579 4569 -10 process_stdin 443 433 -10 patch_main 1111 1101 -10 ifupdown_main 2175 2165 -10 file_action_grep 90 80 -10 uuidcache_init 649 637 -12 hush_main 797 785 -12 read_config 230 217 -13 dpkg_main 3835 3820 -15 read_line_input 3134 3110 -24 sysctl_main 232 203 -29 config_open 40 10 -30 WARN_BAD_LINE 44 - -44 login_main 1714 1575 -139 ------------------------------------------------------------------------------ (add/remove: 5/1 grow/shrink: 8/74 up/down: 174/-737) Total: -563 bytes
2008-07-08libbb: introduce and use xrealloc_vectorDenis Vlasenko
function old new delta xrealloc_vector_helper - 51 +51 create_list 84 99 +15 getopt_main 690 695 +5 passwd_main 1049 1053 +4 get_cached 85 89 +4 msh_main 1377 1380 +3 add_match 42 41 -1 read_lines 720 718 -2 grave 1068 1066 -2 fill_match_lines 143 141 -2 add_to_dirlist 67 65 -2 add_input_file 49 47 -2 act 252 250 -2 fsck_main 2252 2246 -6 man_main 765 757 -8 bb_internal_initgroups 228 220 -8 cut_main 1052 1041 -11 add_edge_to_node 55 43 -12 dpkg_main 3851 3835 -16 ifupdown_main 2202 2178 -24 sort_main 838 812 -26 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 5/15 up/down: 82/-124) Total: -42 bytes
2008-06-28lineedit: document prompt handlingDenis Vlasenko
2008-06-27*: introduce and use FAST_FUNC: regparm on i386, otherwise no-onDenis Vlasenko
text data bss dec hex filename 808035 611 6868 815514 c719a busybox_old 804472 611 6868 811951 c63af busybox_unstripped
2008-05-25lineedit: correctly handle prompt longer than screen width. closes bug 3414Denis Vlasenko
2008-05-18more -Wall warning fixes. -Wall is enabled now.Denis Vlasenko
2008-05-15more of -Wall fixes from Cristian Ionescu-Idbohrn.Denis Vlasenko
Some are fixing real bugs. function old new delta syslogd_main 938 958 +20 get_signum 136 143 +7 obj_load 777 782 +5 recv_from_to 210 214 +4 get_next_block 1795 1799 +4 display_topmem_process_list 1117 1121 +4 logread_main 484 487 +3 buffer_fill_and_print 73 76 +3 kill_main 687 689 +2 ll_remember_index 240 241 +1 do_stats 452 453 +1 if_readconf 166 165 -1 display_process_list 1192 1191 -1 run_applet_and_exit 507 505 -2 print_signames 33 31 -2 parse_one_line 1092 1090 -2 find_out_spec 57 55 -2 add_ksymoops_symbols 421 419 -2 ash_main 1407 1402 -5 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 11/8 up/down: 54/-17) Total: 37 bytes
2008-05-13more -Wall warning fixes from Cristian Ionescu-Idbohrn.Denis Vlasenko
This time it resulted in small code changes: function old new delta nexpr 820 828 +8 tail_main 1200 1202 +2 wrapf 166 167 +1 parse_mount_options 227 209 -18 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/1 up/down: 11/-18) Total: -7 bytes
2008-04-25lineedit: hack for making it sort-of-work even if term width is wrongDenis Vlasenko
function old new delta read_line_input 3158 3153 -5 input_end 29 24 -5 input_delete 115 110 -5 input_forward 27 20 -7 cmdedit_set_out_char 88 80 -8