aboutsummaryrefslogtreecommitdiff
path: root/editors/vi.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* vi: revert change in how "end of file list" is deteced - fixes 'q' in bare "vi"Denys Vlasenko2019-04-031-2/+2
| | | | | | | | | | function old new delta vi_main 273 272 -1 colon 2853 2852 -1 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-2) Total: -2 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vi: code shrinkDenys Vlasenko2019-04-031-7/+12
| | | | | | | function old new delta new_screen 84 75 -9 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vi: avoid build failure in non-default caseRon Yorston2019-04-031-16/+16
| | | | | | | | | If vi is built with FEATURE_VI_USE_SIGNALS disabled and FEATURE_VI_WIN_RESIZE enabled new_screen() is used without a declaration. Move the function to avoid this. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vi: rename save_argc -> cmdline_filecntDenys Vlasenko2019-04-021-17/+16
| | | | | | | | function old new delta vi_main 272 273 +1 colon 2852 2853 +1 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vi: restore capability to remember insertion cmds for "."Denys Vlasenko2019-04-021-5/+6
| | | | | | | | | | | | | function old new delta modifying_cmds 17 22 +5 get_one_char 103 98 -5 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 5/-5) Total: 0 bytes text data bss dec hex filename 982121 485 7296 989902 f1ace busybox_old 982094 485 7296 989875 f1ab3 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vi: code shrinkDenys Vlasenko2019-04-011-7/+14
| | | | | | | | | | | | function old new delta get_input_line 172 175 +3 char_insert 444 447 +3 rawmode 36 24 -12 edit_file 644 626 -18 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/2 up/down: 6/-30) Total: -24 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vi: convert more /**/ comments to //Denys Vlasenko2019-04-011-62/+56
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vi: code shrinkDenys Vlasenko2019-04-011-30/+28
| | | | | | | | | | | function old new delta get_one_char 108 103 -5 edit_file 651 644 -7 do_cmd 4696 4688 -8 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-20) Total: -20 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vi: use vsnprintf to format status lineDenys Vlasenko2019-04-011-27/+22
| | | | | | | | | | | | | This is the last use of "vsprintf" in busybox: function old new delta status_line_bold 72 77 +5 status_line 40 45 +5 vsprintf 23 - -23 ------------------------------------------------------------------------------ (add/remove: 0/2 grow/shrink: 2/0 up/down: 10/-23) Total: -13 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vi: rearrange functions, no logic changesDenys Vlasenko2019-04-011-1508/+1407
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vi: rearrange functions, no logic changesDenys Vlasenko2019-04-011-276/+276
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vi: rearrange functions, no logic changesDenys Vlasenko2019-04-011-42/+42
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vi: rearrange functions, no logic changesDenys Vlasenko2019-04-011-74/+75
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vi: rearrange functions, no logic changesDenys Vlasenko2019-04-011-260/+258
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vi: fix ^Z not always working as intendedDenys Vlasenko2019-04-011-25/+17
| | | | | | | | | | | | | | function old new delta tstp_handler 64 71 +7 text_yank 54 56 +2 vi_main 280 272 -8 do_cmd 4705 4696 -9 colon 2861 2852 -9 cont_handler 66 - -66 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 2/3 up/down: 9/-92) Total: -83 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vi: install SIGINT handler _after_ restart setjmp is initializedDenys Vlasenko2019-04-011-63/+52
| | | | | | | | | | | | | | | | | | | | | While at it, sanitized comment style, deleted wrong ones, renamed signal handlers to <sig>_handler(), slightly optimized "cursor home+clear screen". function old new delta cont_handler - 66 +66 tstp_handler - 64 +64 winch_handler - 60 +60 int_handler - 32 +32 edit_file 648 651 +3 redraw 52 43 -9 catch_sig 32 - -32 winch_sig 60 - -60 suspend_sig 64 - -64 cont_sig 66 - -66 ------------------------------------------------------------------------------ (add/remove: 4/4 grow/shrink: 1/1 up/down: 225/-231) Total: -6 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vi: allow manual screen update if SIGWINCH isn't supportedRon Yorston2019-03-301-0/+8
| | | | | | | | | | | | | | On platforms that don't support SIGWINCH vi can be configured with FEATURE_VI_USE_SIGNALS disabled and FEATURE_VI_WIN_RESIZE enabled. This allows the user to force an update with ^L when the screen is resized. However, because the SIGWINCH handler hasn't run the virtual screen buffer won't have been updated and the display becomes corrupted. Fix this by calling new_screen() if necessary. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vi: code shrink, proper printf formatting for strlen()Denys Vlasenko2019-03-291-5/+6
| | | | | | | | | | | | | | | function old new delta yank_delete 98 99 +1 what_reg 34 33 -1 text_yank 56 54 -2 end_cmd_q 17 14 -3 do_cmd 4718 4705 -13 colon 2875 2861 -14 edit_file 668 648 -20 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/6 up/down: 1/-53) Total: -52 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vi: further fixes to undo after autoindentRon Yorston2019-02-111-13/+15
| | | | | | | | | | | | | | | | | | | | | | | | | Commit bb983f30e (vi: fix faulty undo after autoinsert) has a number of problems: - The commit message refers to 'autoinsert' when it really means 'autoindent'. - The indentation of undo_push_insert() was incorrect. - Most seriously the commit only fixed the problem for cases where the indentation was exactly one character. This is because undo_push() only allows single characters to be queued for UNDO_INS_QUEUED. Lifting this restriction allows the example given in the previous commit message (with a three character indent) to work. function old new delta undo_push 406 435 +29 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 29/0) Total: 29 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vi: fix replacement of single character with CRRon Yorston2019-02-081-8/+3
| | | | | | | | | | | | | | | | | | | Currently if the 'r' command is followed by a carriage return a literal CR replaces the current character. Fix this so that: - a new line is inserted - the autoindent setting is respected - the cursor is placed at the start of the new line function old new delta do_cmd 5052 5060 +8 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 8/0) Total: 8 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vi: fix faulty undo after autoinsertRon Yorston2019-02-081-35/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Enable autoinsert and enter the following with an indent of three spaces: line 1 line 2 Using 'u' to undo the last insert results in: line1e 2 The insertion of the indent hasn't been properly recorded. Since recording insertions is a common operation add a convenience function, undo_push_insert(), to handle this and use it to record the autoindent correctly. function old new delta undo_push_insert - 36 +36 string_insert 133 129 -4 char_insert 518 473 -45 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/2 up/down: 36/-49) Total: -13 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* config: update size informationDenys Vlasenko2018-12-281-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vi: correctly detect when a deletion empties the bufferRon Yorston2018-12-031-1/+1
| | | | | | | | | | | | | | | | | Michał Berger has reported two issues: - Repeatedly deleting and undoing the deletion of the last line results in characters being lost from the end of the line. - Deleting the bottom line twice then attempting to undo each of these deletions results in a segfault. The problem seems to be an incorrect test for whether the text buffer is empty. Reported-by: Michał Berger <michallinuxstuff@gmail.com> Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vi: code shrinkDenys Vlasenko2018-11-291-13/+17
| | | | | | | | | | | | function old new delta char_search 241 247 +6 get_one_address 275 272 -3 colon 2878 2875 -3 do_cmd 4726 4720 -6 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/3 up/down: 6/-12) Total: -6 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vi: fix FEATURE_VI_REGEX_SEARCH to respect LIMITED (one-line) searchDenys Vlasenko2018-11-291-5/+10
| | | | | | | | | | | | | | | | | | | | | | If busybox is compiled with FEATURE_VI_REGEX_SEARCH enabled, command ":s/x/y/" searches not only in the current line, but continues search after it. This makes range searches (":1,3s/x/y/") work incorrect. For example file "./test": 1 2 3 $ vi ./test :1,2s/3/e/ gives us: 1 2 e function old new delta char_search 213 241 +28 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vi: remove duplicated codeRon Yorston2018-10-311-6/+1
| | | | | | | | | | | | | | | At worst show_status_line() might be called needlessly when the user presses ^L/^R, but I don't think we'll get many complaints about that. function old new delta do_cmd 4592 4558 -34 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-34) Total: -34 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vi: placate "warning: variable orig_buf set but not used"Denys Vlasenko2018-06-271-25/+31
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vi: placate "warning: statement with no effect"Denys Vlasenko2018-06-271-1/+4
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* use %m printf specifier where appropriateDenys Vlasenko2017-09-291-3/+3
| | | | | | | | | | | | | | | function old new delta out 85 75 -10 udhcpd_main 1472 1461 -11 open_stdio_to_tty 98 85 -13 init_exec 245 232 -13 udhcpc_main 2763 2749 -14 do_cmd 4771 4755 -16 status_line_bold_errno 32 14 -18 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/7 up/down: 0/-95) Total: -95 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* regularize format of source file headers, no code changesDenys Vlasenko2017-09-181-2/+0
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* *: use ESC define instead of "\033"; use ESC[m instead of ESC[0mDenys Vlasenko2017-09-131-10/+11
| | | | | | | | text data bss dec hex filename 922535 481 6832 929848 e3038 busybox_old 922534 481 6832 929847 e3037 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* config: deindent all help textsDenys Vlasenko2017-07-211-41/+41
| | | | | | Those two spaces after tab have no effect, and always a nuisance when editing. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libarchive: FEATURE_LZMA_FAST should be visible if FEATURE_SEAMLESS_LZMADenys Vlasenko2017-07-201-1/+1
| | | | | | While at it, tweak some config help texts. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Update menuconfig items with approximate applet sizesDenys Vlasenko2017-07-181-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vi: survive if stdin is nonblocking. closes 9851Denys Vlasenko2017-05-021-1/+8
| | | | | | | function old new delta readit 55 69 +14 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vi: avoid touching a new file with ZZ when no editing has been doneYousong Zhou2017-03-241-8/+8
| | | | | | | | | | | | | | This is the behaviour observed with standard vim and busybox vi of at least 1.22.1. It was changed with commit "32afd3a vi: some simplifications" which happened before 1.23.0. Mistyping filename on command line happens fairly often and it's better we restore the old behaviour to avoid a few unnecessary flash writes and sometimes efforts of debugging bugs caused by those unneeded stray files. Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vi: don't touch file with :x when modified_count == 0Denys Vlasenko2017-03-131-17/+26
| | | | | | | | | | | | | | Along with it, there are other changes - Check for uppercase X is removed as the expression will be always false and :X itself is another totally different command in standard vim - The status line will show number of written lines instead of lines requested by the colon command. This is also how the standard vim is doing, though the difference is that '!' has to be explicitly specified in vim to allow partial writes Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vi,fsck: do not use build timestamp unconditionally. Closes 9626Denys Vlasenko2017-01-291-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb: consolidate the code to set termios unbuffered modeDenys Vlasenko2017-01-111-11/+4
| | | | | | | | | | | | | | | | function old new delta set_termios_to_raw - 116 +116 count_lines 72 74 +2 powertop_main 1458 1430 -28 top_main 943 914 -29 more_main 759 714 -45 fsck_minix_main 2969 2921 -48 conspy_main 1197 1135 -62 rawmode 99 36 -63 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/6 up/down: 118/-275) Total: -157 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Big cleanup in config help and descriptionDenys Vlasenko2017-01-101-18/+15
| | | | | | | | | | | | | Redundant help texts (one which only repeats the description) are deleted. Descriptions and help texts are trimmed. Some config options are moved, even across menus. No config option _names_ are changed. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vi: fix '' command (goto to prev context)Denys Vlasenko2016-09-281-5/+5
| | | | | | | | | | | | The '' command in vi doesn't currently work because after the first apostrophe is read, the next character is converted to an integer between 0 and 25 inclusive (for indexing the array of marks). The comparison of the converted character with an apostrophe therefore never succeeds, meaning that '' doesn't do anything. Based on the patch by Francis Rounds <francis.rounds@4bridgeworks.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vi: make "g<key>" error message less likely to show garbageDenys Vlasenko2016-09-151-1/+3
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* *: slap on a few ALIGN1/2s where appropriateDenys Vlasenko2016-04-221-1/+1
| | | | | | | | | | The result of looking at "grep -F -B2 '*fill*' busybox_unstripped.map" text data bss dec hex filename 829901 4086 1904 835891 cc133 busybox_before 829665 4086 1904 835655 cc047 busybox Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* join some common strings, -400 bytesDenys Vlasenko2015-10-081-4/+4
| | | | | | | | | | | | | | | function old new delta print_intel_cstates 499 511 +12 file_insert 355 364 +9 dpkg_main 2944 2940 -4 ifenslave_main 645 640 -5 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/2 up/down: 21/-9) Total: 12 bytes text data bss dec hex filename 937564 932 17676 956172 e970c busybox_old 937164 932 17676 955772 e957c busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Removes stray empty line from codeManinder Singh2015-07-131-1/+0
| | | | | | | | | This patch removes stray empty line from busybox code reported by script find_stray_empty_lines Signed-off-by: Maninder Singh <maninder1.s@samsung.com> Signed-off-by: Akhilesh Kumar <akhilesh.k@samsung.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* typo fixesManinder Singh2015-05-251-7/+7
| | | | | Signed-off-by: Maninder Singh <maninder1.s@samsung.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vi: basic undo feature shouldn't depend on yankmarkAndrew Fuller2015-05-031-5/+5
| | | | | | | | | Currently basic undo functionality with the 'u' key depends on FEATURE_VI_YANKMARK. These two features are separate, so we can remove this dependency. Signed-off-by: Andrew Fuller <abf@google.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vi: make BACKSPACE and DELETE join lines at start/end of lineDenys Vlasenko2015-03-121-4/+4
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* vi: fix reading of file after last lineRon Yorston2015-01-071-1/+5
| | | | | | | | | | | | | | | | | | | | | | 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>
* vi: failure to open file is not an error when initialising bufferRon Yorston2015-01-071-7/+5
| | | | | | | | | | | | | 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>