aboutsummaryrefslogtreecommitdiff
path: root/editors
AgeCommit message (Collapse)Author
2019-04-28vi: enable 'dG' command. Closes 11801Ron Yorston
The 'G' command was omitted from the list of commands that change or delete whole lines. Add it in the appropriate places so the 'dG', 'cG' and 'yG' commands work, including in cases where an explicit line number has been supplied. function old new delta find_range 534 596 +62 .rodata 175166 175167 +1 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 63/0) Total: 63 bytes Reported-by: David Kelly <david.kelly@liberica.ch> Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-28vi: fix changes to word at end of line. Closes 11796Ron Yorston
As reported in bug 11796 BusyBox vi incorrectly handles changes to a word at the end of a line. If the following line starts with whitespace changing or deleting the last word of a line with the 'cw' or 'dw' commands causes the lines to be joined. This happens because the range for the change returned by find_range() covers all whitespace after the word, including newlines. The problem can be fixed by setting 'ml' to zero to indicate to yank_delete() that processing should stop at the end of the current line. However, this results in a new problem. 'dw' correctly deletes all whitespace following the word but so does 'cw', which should preserve the trailing whitespace. To fix this the code to omit whitespace from the change is modified to include all whitespace not just blanks. function old new delta do_cmd 5034 5069 +35 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 35/0) Total: 35 bytes Reported-by: David Kelly <david.kelly@liberica.ch> Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-03vi: revert change in how "end of file list" is deteced - fixes 'q' in bare "vi"Denys Vlasenko
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>
2019-04-03vi: code shrinkDenys Vlasenko
function old new delta new_screen 84 75 -9 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-03vi: avoid build failure in non-default caseRon Yorston
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>
2019-04-02vi: rename save_argc -> cmdline_filecntDenys Vlasenko
function old new delta vi_main 272 273 +1 colon 2852 2853 +1 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-02vi: restore capability to remember insertion cmds for "."Denys Vlasenko
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>
2019-04-01vi: code shrinkDenys Vlasenko
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>
2019-04-01vi: convert more /**/ comments to //Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-01vi: code shrinkDenys Vlasenko
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>
2019-04-01vi: use vsnprintf to format status lineDenys Vlasenko
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>
2019-04-01vi: rearrange functions, no logic changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-01vi: rearrange functions, no logic changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-01vi: rearrange functions, no logic changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-01vi: rearrange functions, no logic changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-01vi: rearrange functions, no logic changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-01vi: fix ^Z not always working as intendedDenys Vlasenko
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>
2019-04-01vi: install SIGINT handler _after_ restart setjmp is initializedDenys Vlasenko
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>
2019-03-30vi: allow manual screen update if SIGWINCH isn't supportedRon Yorston
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>
2019-03-29vi: code shrink, proper printf formatting for strlen()Denys Vlasenko
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>
2019-02-11vi: further fixes to undo after autoindentRon Yorston
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>
2019-02-08vi: fix replacement of single character with CRRon Yorston
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>
2019-02-08vi: fix faulty undo after autoinsertRon Yorston
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>
2019-01-21sed: code shrinkDenys Vlasenko
function old new delta parse_file_cmd 115 94 -21 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-01-21sed: Fix backslash parsing for 'w' command argBrian Foley
If there's any whitespace between w and the filename, parse_file_cmd writes to the wrong offset when trying to fix up backslashes. This can be seen in the asan build with busybox sed -e 'w 0\\' Signed-off-by: Brian Foley <bpfoley@google.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-01-21awk: Fix overly permissive func arg list parsingBrian Foley
It allows things like 'func f(a b)' and 'func f(a,)' which GNU awk forbids. function old new delta parse_program 327 367 +40 chain_expr 40 67 +27 parse_expr 891 915 +24 EMSG_TOO_FEW_ARGS 30 18 -12 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/1 up/down: 91/-12) Total: 79 bytes Signed-off-by: Brian Foley <bpfoley@google.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-01-21awk: Syntax error if delete isn't given an arg.Brian Foley
Unlike exit and return, delete strictly requires an arg, and derefs a null pointer if executed without one. Signed-off-by: Brian Foley <bpfoley@google.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-01-21awk: Guard pointer chasing when parsing ternary expressions.Brian Foley
Avoids an uninit pointer deref for some malformed ternary exprs. Add a test that would crash in busybox before this fix. Signed-off-by: Brian Foley <bpfoley@google.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-12-28config: update size informationDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-12-03vi: correctly detect when a deletion empties the bufferRon Yorston
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>
2018-11-29vi: code shrinkDenys Vlasenko
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>
2018-11-29vi: fix FEATURE_VI_REGEX_SEARCH to respect LIMITED (one-line) searchDenys Vlasenko
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>
2018-11-28awk: abort if NF set to negative valueDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-10-31vi: remove duplicated codeRon Yorston
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>
2018-09-25sed: fix double-free in FEATURE_CLEAN_UP codeDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-06-27vi: placate "warning: variable orig_buf set but not used"Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-06-27vi: placate "warning: statement with no effect"Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-06-06restore documentation on the build config languageKartik Agaram
Kconfig-language.txt was deleted in commit 4fa499a17b52b back in 2006. Move to docs/ as suggested by Xabier Oneca: http://lists.busybox.net/pipermail/busybox/2014-May/080914.html Also update references to it everywhere. Signed-off-by: Kartik Agaram <akkartik@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-23awk: do not allow $(-1)Denys Vlasenko
function old new delta EMSG_NEGATIVE_FIELD - 25 +25 evaluate 3390 3403 +13 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/0 up/down: 38/0) Total: 38 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-14patch: implement --dry-runDenys Vlasenko
function old new delta static.patch_longopts - 137 +137 patch_main 2053 2135 +82 fail_hunk 132 139 +7 finish_oldfile 119 124 +5 packed_usage 32807 32787 -20 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 3/1 up/down: 231/-20) Total: 211 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-01sed: prevent overflow of length from bb_get_chunk_from_fileQuentin Rameau
This fragment did not work right: temp = bb_get_chunk_from_file(fp, &len); if (temp) { /* len > 0 here, it's ok to do temp[len-1] */ char c = temp[len-1]; With "int len" _sign-extending_, temp[len-1] can refer to a wrong location if len > 0x7fffffff. Signed-off-by: Quentin Rameau <quinq@fifth.space> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-07awk: code shrinkDenys Vlasenko
function old new delta awk_main 955 948 -7 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-07awk: fix 'delete array[var--]' decrementing var twiceDenys Vlasenko
function old new delta evaluate 3395 3390 -5 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-09-29use %m printf specifier where appropriateDenys Vlasenko
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>
2017-09-18regularize format of source file headers, no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-09-13*: use ESC define instead of "\033"; use ESC[m instead of ESC[0mDenys Vlasenko
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>
2017-08-23sed: in '/regexp/cmd1;//cmd2', cmd2 should use the same regexp as cmd1Denys Vlasenko
function old new delta get_address 165 211 +46 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-16awk: stop on first non-option, closes 9861Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-16*: stop using atexit in non-debug build: saves ~260 in bss with muslDenys Vlasenko
"builtin" below is atexit's 32-element global array of functions to call. function old new delta top_main 879 889 +10 launch_helper 185 193 +8 powertop_main 1555 1559 +4 sed_main 651 650 -1 slot 4 - -4 call 4 - -4 atexit 23 - -23 kill_helper 31 - -31 __funcs_on_exit 120 - -120 __cxa_atexit 168 - -168 builtin 260 - -260 ------------------------------------------------------------------------------ (add/remove: 0/8 grow/shrink: 3/1 up/down: 22/-611) Total: -589 bytes text data bss dec hex filename 912364 563 6132 919059 e0613 busybox_old 912035 563 5844 918442 e03aa busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-08getopt32: remove opt_complementaryDenys Vlasenko
function old new delta vgetopt32 1318 1392 +74 runsvdir_main 703 713 +10 bb_make_directory 423 425 +2 collect_cpu 546 545 -1 opt_chars 3 - -3 opt_complementary 4 - -4 tftpd_main 567 562 -5 ntp_init 476 471 -5 zcip_main 1266 1256 -10 xxd_main 428 418 -10 whois_main 140 130 -10 who_main 463 453 -10 which_main 212 202 -10 wget_main 2535 2525 -10 watchdog_main 291 281 -10 watch_main 222 212 -10 vlock_main 399 389 -10 uuencode_main 332 322 -10 uudecode_main 316 306 -10 unlink_main 45 35 -10 udhcpd_main 1482 1472 -10 udhcpc_main 2762 2752 -10 tune2fs_main 290 280 -10 tunctl_main 366 356 -10 truncate_main 218 208 -10 tr_main 518 508 -10 time_main 1134 1124 -10 tftp_main 286 276 -10 telnetd_main 1873 1863 -10 tcpudpsvd_main 1785 1775 -10 taskset_main 521 511 -10 tar_main 1009 999 -10 tail_main 1644 1634 -10 syslogd_main 1967 1957 -10 switch_root_main 368 358 -10 svlogd_main 1454 1444 -10 sv 1296 1286 -10 stat_main 104 94 -10 start_stop_daemon_main 1028 1018 -10 split_main 542 532 -10 sort_main 796 786 -10 slattach_main 624 614 -10 shuf_main 504 494 -10 setsid_main 96 86 -10 setserial_main 1132 1122 -10 setfont_main 388 378 -10 setconsole_main 78 68 -10 sendmail_main 1209 1199 -10 sed_main 677 667 -10 script_main 1077 1067 -10 run_parts_main 325 315 -10 rtcwake_main 454 444 -10 rm_main 175 165 -10 reformime_main 119 109 -10 readlink_main 123 113 -10 rdate_main 246 236 -10 pwdx_main 189 179 -10 pstree_main 317 307 -10 pscan_main 663 653 -10 popmaildir_main 818 808 -10 pmap_main 80 70 -10 nc_main 1042 1032 -10 mv_main 558 548 -10 mountpoint_main 477 467 -10 mount_main 1264 1254 -10 modprobe_main 768 758 -10 modinfo_main 333 323 -10 mktemp_main 200 190 -10 mkswap_main 324 314 -10 mkfs_vfat_main 1489 1479 -10 microcom_main 715 705 -10 md5_sha1_sum_main 521 511 -10 man_main 867 857 -10 makedevs_main 1052 1042 -10 ls_main 563 553 -10 losetup_main 432 422 -10 loadfont_main 89 79 -10 ln_main 524 514 -10 link_main 75 65 -10 ipcalc_main 544 534 -10 iostat_main 2397 2387 -10 install_main 768 758 -10 id_main 480 470 -10 i2cset_main 1239 1229 -10 i2cget_main 380 370 -10 i2cdump_main 1482 1472 -10 i2cdetect_main 682 672 -10 hwclock_main 406 396 -10 httpd_main 741 731 -10 grep_main 837 827 -10 getty_main 1559 1549 -10 fuser_main 297 287 -10 ftpgetput_main 345 335 -10 ftpd_main 2232 2222 -10 fstrim_main 251 241 -10 fsfreeze_main 77 67 -10 fsck_minix_main 2921 2911 -10 flock_main 314 304 -10 flashcp_main 740 730 -10 flash_eraseall_main 833 823 -10 fdformat_main 532 522 -10 expand_main 680 670 -10 eject_main 335 325 -10 dumpleases_main 630 620 -10 du_main 314 304 -10 dos2unix_main 441 431 -10 diff_main 1350 1340 -10 df_main 1064 1054 -10 date_main 1095 1085 -10 cut_main 961 951 -10 cryptpw_main 228 218 -10 crontab_main 575 565 -10 crond_main 1149 1139 -10 cp_main 370 360 -10 common_traceroute_main 3834 3824 -10 common_ping_main 1767 1757 -10 comm_main 239 229 -10 cmp_main 655 645 -10 chrt_main 379 369 -10 chpst_main 704 694 -10 chpasswd_main 308 298 -10 chown_main 171 161 -10 chmod_main 158 148 -10 cat_main 428 418 -10 bzip2_main 120 110 -10 blkdiscard_main 264 254 -10 base64_main 221 211 -10 arping_main 1665 1655 -10 ar_main 556 546 -10 adjtimex_main 406 396 -10 adduser_main 882 872 -10 addgroup_main 411 401 -10 acpid_main 1198 1188 -10 optstring 11 - -11 opt_string 18 - -18 OPT_STR 25 - -25 ubi_tools_main 1288 1258 -30 ls_options 31 - -31 ------------------------------------------------------------------------------ (add/remove: 0/6 grow/shrink: 3/129 up/down: 86/-1383) Total: -1297 bytes text data bss dec hex filename 915428 485 6876 922789 e14a5 busybox_old 914629 485 6872 921986 e1182 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>