aboutsummaryrefslogtreecommitdiff
path: root/editors/vi.c
AgeCommit message (Collapse)Author
2015-03-12vi: make BACKSPACE and DELETE join lines at start/end of lineDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-07vi: fix reading of file after last lineRon Yorston
If the :r command is used to read a file after the last line of the buffer the last line of the buffer and the first line of the file are joined. An extra blank line appears at the end of the buffer. file 1 file 1 file 1file 2 file 2 file 2 ~ ~ The insertion point is normally at the start of the line following the specified line. When the specified line is the last one the next_line function baulks at moving to the non-existent following line. Signed-off-by: Ron Yorston <rmy@tigress.co.uk> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-07vi: failure to open file is not an error when initialising bufferRon Yorston
Commit 32afd3a introduced these regressions on the master branch: Starting vi with no filename on the command line gives the status message "'(null)' Bad address" instead of "- No file 1/1 100%". Starting vi with a non-existent file on the command line gives the status message "'new.txt' No such file or directory" instead of "- new.txt 1/1 100%" Signed-off-by: Ron Yorston <rmy@tigress.co.uk> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-15vi: fix incorrect memory access on brace matching. Closes 7256Denys Vlasenko
While at it, fix brace matching to actually show the match (missed fflush was causing cursor positioning to be buffered); shorten brace matching code; remove unused macro indirection in indicate_error(). Custom linker script 'busybox_ldscript' found, using it function old new delta indicate_error - 61 +61 mysleep 43 56 +13 char_insert 483 486 +3 find_pair 167 124 -43 Indicate_Error 61 - -61 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 2/1 up/down: 77/-104) Total: -27 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-05vi: some simplificationsDenys Vlasenko
function old new delta file_insert 301 315 +14 init_text_buffer 179 171 -8 colon 2889 2878 -11 file_size 37 - -37 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 1/2 up/down: 14/-56) Total: -42 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-03vi: clear undo buffer when we change to another fileDenys Vlasenko
function old new delta init_text_buffer 156 190 +34 undo_push 360 382 +22 count_lines 74 72 -2 undo_pop 246 222 -24 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/2 up/down: 56/-26) Total: 30 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-03vi: undo code shrinkDenys Vlasenko
function old new delta undo_push 414 395 -19 do_cmd 4803 4761 -42 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-02vi: undo support for vi with intermediate queuingJody Bruchon
function old new delta undo_push - 411 +411 undo_pop - 288 +288 do_cmd 4160 4426 +266 char_insert 363 483 +120 undo_queue_commit - 61 +61 text_hole_delete 108 163 +55 string_insert 94 127 +33 colon 2864 2882 +18 yank_delete 92 101 +9 vi_main 273 280 +7 dot_scroll 88 93 +5 dot_right 29 34 +5 dot_prev 20 25 +5 dot_next 20 25 +5 dot_left 24 29 +5 dot_end 20 25 +5 dot_begin 20 25 +5 init_text_buffer 154 156 +2 text_hole_make 145 142 -3 file_insert 333 318 -15 ------------------------------------------------------------------------------ (add/remove: 3/0 grow/shrink: 15/2 up/down: 1305/-18) Total: 1287 bytes (without queuing it's ~870 bytes) Signed-off-by: Jody Bruchon <jody@jodybruchon.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-04-21vi: make regexp search case-insensitive if ":set ignorecase" is activeDenys Vlasenko
Reported by Dan Moinescu <dan@moinescu.net>. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-15vi: code shrinkDenys Vlasenko
function old new delta status_line_bold_errno - 32 +32 colon 2891 2873 -18 file_insert 354 313 -41 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/2 up/down: 32/-59) Total: -27 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-15vi: fix adjustment of buffer on partial file readRon Yorston
The second argument to text_hole_delete was incorrect: it should be a pointer to the end of the hole. Signed-off-by: Ron Yorston <rmy@tigress.co.uk> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-22*: reuse more stringsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-15whitespace fixes. no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-14whitespace cleanup. no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-06-11vi: save/restore screen upon invocationDenys Vlasenko
function old new delta vi_main 253 273 +20 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-06-11vi: nuke FEATURE_VI_OPTIMIZE_CURSORDenys Vlasenko
It is not Unicode safe, it is not saving much of I/O, and it's large: function old new delta vi_main 255 253 -2 go_bottom_and_clear_to_eol 28 26 -2 do_cmd 4194 4182 -12 show_status_line 388 374 -14 strncat 39 - -39 __GI_strncat 39 - -39 refresh 774 724 -50 place_cursor 276 83 -193 ------------------------------------------------------------------------------ (add/remove: 0/3 grow/shrink: 0/6 up/down: 0/-351) Total: -351 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-06-11vi: do not set autoindent by defaultDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-01-31vi: add ":prev" command supportDennis Groenen
function old new delta colon 2844 2891 +47 vi_main 243 255 +12 text_yank 54 56 +2 refresh 780 774 -6 Signed-off-by: Dennis Groenen <tj.groenen@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-01-31vi: move mark[i] pointers if text[] moves after reallocDenys Vlasenko
While at it, optimized :s/find/repl/ a bit function old new delta text_hole_make 120 150 +30 colon 2848 2844 -4 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-01-15*: better comments on termios manipulations. No code changes.Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-11-28vi: fix [end] key handlingDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-09vi: prevent unlimited recursion in do_cmd(). Closes 4153Denys Vlasenko
function old new delta do_cmd 4284 4194 -90 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-07-25less: optionally query terminal size via "ESC [ 6 n". Closes bug 2659.Denys Vlasenko
+7 bytes is not selected, +100 if selected. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-07-03vi: tweak regex.h includeDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-27vi: fix regex search, make it selectable in configWalter Harms
function old new delta char_search 134 214 +80 find_pair 187 169 -18 mycmp 37 - -37 Signed-off-by: Walter Harms <wharms@bfs.de> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-05*: remove "Options:" string from help textsDenys Vlasenko
function old new delta packed_usage 28706 28623 -83 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-16vi.c: remove warning: variable 'sp' set but not usedCristian Ionescu-Idbohrn
Signed-off-by: Cristian Ionescu-Idbohrn <cii@axis.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-13fix "variable 'foo' set but not used" warningsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-03move help text from include/usage.src.h to debianutils/*.c e2fsprogs/*.c ↵Pere Orga
editors/*.c loginutils/*.c mailutils/*.c Signed-off-by: Pere Orga <gotrunks@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-16*: make GNU licensing statement forms more regularDenys Vlasenko
This change retains "or later" state! No licensing _changes_ here, only form is adjusted (article, space between "GPL" and "v2" and so on). Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-21vi: fix "ask terminal" codeDenys Vlasenko
function old new delta edit_file 761 793 +32 refresh 773 780 +7 query_screen_dimensions 63 54 -9 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-04remove some dead assignments, add a TODO commentDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-19vi: fix "set ic" command; code shrink while at it. closes bug 1765Denys Vlasenko
function old new delta colon 2970 2848 -122 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-16consolidate ESC sequencesDenys Vlasenko
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-11lineedit: change how cmdedit_set_out_char worksDenys Vlasenko
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-04-18vi: discover window size even on serial consoles. optionalDenys Vlasenko
function old new delta edit_file 671 761 +90 wh_helper - 57 +57 query_screen_dimensions 54 63 +9 ar_main 533 542 +9 refresh 767 773 +6 vi_main 242 243 +1 text_yank 56 54 -2 get_terminal_width_height 180 135 -45 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 5/2 up/down: 172/-47) Total: 125 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-18vi: remove superfluous check on filename == ""Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-16vi: code shrinkDenys Vlasenko
function old new delta vi_main 250 242 -8 colon 2980 2970 -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>
2010-04-16vi: code shrink; save/restore errno in signal handlersDenys Vlasenko
function old new delta query_screen_dimensions - 54 +54 suspend_sig 50 64 +14 cont_sig 65 66 +1 catch_sig 42 32 -10 winch_sig 88 60 -28 edit_file 719 671 -48 refresh 848 767 -81 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 2/4 up/down: 69/-167) Total: -98 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-26vi: fix NUM + "$" handlingDenys Vlasenko
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-01-28*: style fixes. no code changes (verified with objdump)Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-20fix fallout from isprint() changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-18libbb: robustify isXXXX(). +39 bytesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-13*: use "can't" instead of "cannot"Denys Vlasenko
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-22*: remove last function calls to isspaceDenys Vlasenko
function old new delta xstrtoul_range_sfx 232 231 -1 xstrtoull_range_sfx 295 293 -2 trim 82 80 -2 trim_trailing_spaces_and_print 57 52 -5 isspace 18 - -18 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-08*: a few more NOINLINEsDenys Vlasenko
function old new delta print_linkinfo - 815 +815 do_msg - 783 +783 INET_setroute - 757 +757 varvalue - 746 +746 do_sem - 637 +637 inflate_codes - 617 +617 INET6_setroute - 491 +491 edir - 370 +370 sync_cursor - 298 +298 update_utmp - 246 +246 searchLines - 165 +165 setup_alarm - 144 +144 may_wakeup - 101 +101 getNum 566 371 -195 refresh 1166 848 -318 rtcwake_main 809 479 -330 getty_main 2396 1921 -475 chpst_main 1373 746 -627 inflate_unzip_internal 1335 567 -768 evalvar 1384 612 -772 ipaddr_list_or_flush 2160 1246 -914 route_main 1585 245 -1340 ipcs_main 2523 1049 -1474 ------------------------------------------------------------------------------ (add/remove: 13/0 grow/shrink: 0/10 up/down: 6170/-7213) Total: -1043 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-23*: more portability fixes by Dan FandrichDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-04fix dependencies of FEATURE_GETOPT_LONGDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>