Commit Graph

16 Commits

Author SHA1 Message Date
Tomas Heinrich
0358daf447 read_key: fix buffer length calculation
Signed-off-by: Tomas Heinrich <heinrich.tomas@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-16 16:26:08 -07: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
727e1b536e read_key,lineeedit: parse position answerback faster; sanitize its use
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-26 15:23:32 +01:00
Denys Vlasenko
0f91b3d0dc read_key: ignore unknown keys (do not return them to caller byte-by-byte)
function                                             old     new   delta
read_key                                             568     601     +33

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-26 12:09:06 +01:00
Denys Vlasenko
180f585ac3 read_key: remove handling for ctrl-up/down, we don't use that. -12 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-26 00:59:59 +01:00
Denys Vlasenko
9d71fc6381 read_key: document more weird key sequences
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-26 00:50:52 +01:00
Denys Vlasenko
a17eeb847e lineedit: handle Ctrl-arrows
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-25 23:50:56 +01:00
Denys Vlasenko
a68bd4b2ae comment anc Config.in changes, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-14 11:52:01 +02:00
Denys Vlasenko
4b7db4f2ca read_key: drop optimization where we read 3 bytes at once
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-29 10:39:06 +02:00
Denys Vlasenko
020f40693a line editing: add an option to emit ESC [ 6 n and use results
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-17 16:44:54 +02:00
Denys Vlasenko
c15f40c3e7 lineedit: use read_key to recognize ESC sequence.
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-05-15 03:27:53 +02:00
Denis Vlasenko
7462b21dbe read_key is actually written by Rob, add him to copyright notice 2008-10-26 00:19:33 +00:00
Denis Vlasenko
bdd2d8f178 read_key: add comments how Shift and Meta keys looks like.
no code changes
2008-10-25 23:59:41 +00:00
Denis Vlasenko
5f6aaf39cf less: reuse former vi's key reading code. Improve SIGWINCH handling.
function                                             old     new   delta
less_main                                           2056    2097     +41
getch_nowait                                         248     273     +25
read_key                                             310     321     +11
static.esccmds                                        61      69      +8
count_lines                                           72      74      +2
less_gets                                            166     142     -24
less_getch                                           172      43    -129
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 6/5 up/down: 91/-170)           Total: -79 bytes
   text    data     bss     dec     hex filename
2008-10-25 23:27:29 +00:00
Denis Vlasenko
39b0135c59 libbb: add forgotten file from previous commit :( 2008-10-25 23:23:32 +00:00