Denys Vlasenko
e45af7ad17
lineedit: remove SAVE_HISTORY bit, ->hist_file can be used as indicator
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-04 16:15:24 +02:00
Denys Vlasenko
bede215cf1
lineedit: add support for history saving on exit
...
Based on the patch by Dennis Groenen <tj.groenen@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-04 16:12:33 +02:00
Denys Vlasenko
4840ae8a06
lineedit: fix atomic replace of history file; hush: fix $HISTFILE handling
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-04 15:28:03 +02:00
Denys Vlasenko
a669eca3a2
libbb/lineedit: implement optional Ctrl-R history search
...
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>
2011-07-11 07:36:59 +02:00
Alexey Fomenko
232ebaa568
lineedit: fix rare SEGV; mark a few FIXMEs
...
Signed-off-by: Alexey Fomenko <ext-alexey.fomenko@nokia.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-20 04:26:29 +02:00
Denys Vlasenko
e3d8d077b7
small fix for HISTFILESIZE
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-31 14:39:38 +02:00
Denys Vlasenko
2c4de5b045
ash,hush: optional support for $HISTFILESIZE.
...
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>
2011-03-31 13:16:52 +02:00
Denys Vlasenko
353680aa46
lineedit: fixes for CONFIG_UNICODE_USING_LOCALE=y
...
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>
2011-03-27 01:18:07 +01:00
Denys Vlasenko
66c5b12dbf
ash: fix TMOUT not restoring tty attributes
...
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>
2011-02-08 05:07:02 +01:00
Mike Shal
f3763033e4
lineedit: fix tab-completion of filenames with spaces
...
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>
2010-11-22 03:49:18 +01:00
Wolfram Sang
2e9aeae4db
lineedit: create history files with mode 0600
...
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-15 02:58:28 +01:00
Marek Polacek
7b18107384
*: use _exit() in sighandlers; showkey: do not use exit-thru-sighandler
...
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>
2010-10-28 21:34:56 +02:00
Denys Vlasenko
d55f599440
lineedit: do not hang on error, but return error indicator.
...
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-07 18:40:53 +02:00
Denys Vlasenko
3926363214
lineedit: on tab completion, show filenames obly in all cases (bash compat)
...
function old new delta
complete_cmd_dir_file 731 730 -1
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-03 14:11:08 +02:00
Denys Vlasenko
76939e7b72
lineedit: allocate matchBuf only temporarily: saves MAX_LINELEN bytes
...
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>
2010-09-03 14:09:24 +02:00
Denys Vlasenko
ba0e103a66
lineedit: de-indent large block in input_tab. No logic changes.
...
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-03 14:08:24 +02:00
Denys Vlasenko
a46e16ef52
lineedit: rename tmp -> chosen_match; small code shrink
...
function old new delta
input_tab 1016 1012 -4
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-03 13:05:51 +02:00
Denys Vlasenko
9b56bf5416
lineedit: stop using permanent int_buf[] (16k!): allocate it
...
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>
2010-09-03 13:02:47 +02:00
Denys Vlasenko
81254ed387
lineedit: remove pos_buf[] array (up to 16k!); fix compat bugs
...
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>
2010-09-03 12:59:15 +02:00
Denys Vlasenko
3c460b005c
lineedit: return prefix len from tab completion helpers
...
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>
2010-09-03 12:56:36 +02:00
Denys Vlasenko
2679e3c8cc
lineedit: clean up tab completion code (variable reuse, comments)
...
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>
2010-09-03 12:53:15 +02:00
Denys Vlasenko
57ea9b488b
preparatory cleanup patch for tab completion fixes
...
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>
2010-09-03 12:51:36 +02:00
Denys Vlasenko
7063e86d0d
lineedit: small readability improvement (same code)
...
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-02 12:44:39 +02:00
Denys Vlasenko
61a36af45d
lineedit: fix completion with Unicode chars
...
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>
2010-09-02 12:03:11 +02:00
Denys Vlasenko
b068bd7a41
lineedit: preparatory cleanup patch for Unicode completion fix
...
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>
2010-09-02 12:01:11 +02:00
Denys Vlasenko
451add4f23
lineedit: mostly revert recent wrong logic in "ask terminal" code
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-25 00:06:41 +02:00
Denys Vlasenko
55241fa2e0
lineedit: limit ASK_TERMINAL to the case when we can't find out the width
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-18 22:53:06 +02:00
Denys Vlasenko
b9e35dc15d
lineedit: cosmetics, no code changes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-18 22:21:24 +02:00
Tomas Heinrich
11bcf4b224
lineedit: fix column display for wide and combining chars in TAB completion
...
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>
2010-06-01 08:33:18 +02:00
Denys Vlasenko
bbf1aa1eaf
typo fix
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-17 12:33:13 +02:00
Denys Vlasenko
1118d9b213
lineedit: fix insertion deep inside line (*several lines* before end)
...
function old new delta
input_backward 212 229 +17
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-17 12:30:44 +02:00
Denys Vlasenko
9963fe36c2
lineedit: trivial simplifications. -7 bytes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-17 04:05:53 +02:00
Denys Vlasenko
248c324f7c
lineedit: fix moving backwards across lines with wide chars
...
function old new delta
input_backward 212 208 -4
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-17 00:45:44 +02:00
Denys Vlasenko
d9a3e89f50
consolidate ESC sequences
...
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>
2010-05-16 23:42:13 +02:00
Denys Vlasenko
26e2c1db0d
stop using LAST_SUPPORTED_WCHAR and CONFIG_LAST_SUPPORTED_WCHAR, it's confusing
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-16 21:15:03 +02:00
Tomas Heinrich
b8909c52fe
lineedit: partially fix wide and combining chars editing
...
Signed-off-by: Tomas Heinrich <heinrich.tomas@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-16 20:46:53 +02:00
Denys Vlasenko
94043e8ad2
lineedit: change how cmdedit_set_out_char works
...
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>
2010-05-11 14:49:13 +02:00
Tomas Heinrich
a659b81dfa
libbb/lineedit: add support for preserving "broken" (non-unicode) chars
...
Signed-off-by: Tomas Heinrich <heinrich.tomas@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-29 13:43:39 +02:00
Denys Vlasenko
19158a837d
unicode: s/FEATURE_ASSUME_UNICODE/UNICODE_SUPPORT, add UNICODE_USING_LOCALE
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-26 14:06:56 +01:00
Tomas Heinrich
aa167556cd
unicode: optional table for better handling of neutral bidi chars
...
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>
2010-03-26 13:13:24 +01:00
Tomas Heinrich
c5c006c10c
lineedit: first shot at optional unicode bidi input support
...
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-18 18:35:37 +01:00
Denys Vlasenko
58f108eb33
lineedit: fix another corner case with bad unicode input
...
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-11 21:17:55 +01:00
Tomas Heinrich
d2b04050c0
lineedit: invalid unicode characters are replaced with CONFIG_SUBST_WCHAR
...
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-03-09 14:09:24 +01:00
Denys Vlasenko
9f93d62192
libbb: better unicode width support. Hopefully fixes bug 839.
...
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-24 07:44:03 +01:00
Denys Vlasenko
28055028a7
fold: unicode support. Based on a patch by Tomas Heinrich <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>
2010-01-04 20:49:58 +01:00
Denys Vlasenko
31e2e7b863
randomconfig fixes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-12-12 02:42:35 +01:00
Denys Vlasenko
13ad90627c
ash: fix bad interaction of "stty -echo" + ASK_TERMINAL
...
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-11 03:19:30 +01:00
Denys Vlasenko
8131eea3dc
*: introduce and use ffulsh_all()
...
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-11-02 14:19:51 +01:00
Denys Vlasenko
1f6d2307ba
lineedit: REALLY fix compile error now
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-29 03:45:26 +01:00
Denys Vlasenko
4dc08262cf
lineedit: compile fix
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-29 03:41:38 +01:00