[git commit] vi: code shrink

Denys Vlasenko vda.linux at googlemail.com
Sat Feb 7 11:53:27 UTC 2026


commit: https://git.busybox.net/busybox/commit/?id=91075de0a7bd987fa376dbbd624f52a11c6078e3
branch: https://git.busybox.net/busybox/log/?h=master

function                                             old     new   delta
.rodata                                           107007  107019     +12
run_cmds                                              62      50     -12
indicate_error                                        78      55     -23
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 12/-35)            Total: -23 bytes

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 editors/vi.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/editors/vi.c b/editors/vi.c
index 757e8eaa0..ba607bcfd 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -1096,11 +1096,15 @@ static void redraw(int full_screen)
 //----- Flash the screen  --------------------------------------
 static void flash(int h)
 {
-	standout_start();
-	redraw(TRUE);
+	//standout_start();
+	//redraw(TRUE);
+	write1(ESC"[?5h"); // "reverse screen on"
+
 	mysleep(h);
-	standout_end();
-	redraw(TRUE);
+
+	//standout_end();
+	//redraw(TRUE);
+	write1(ESC"[?5l"); // "reverse screen off"
 }
 
 static void indicate_error(void)
@@ -2787,7 +2791,6 @@ static char *regex_search(char *q, regex_t *preg, const char *Rorig,
 # define strchr_backslash(s, c) strchr(s, c)
 #endif /* ENABLE_FEATURE_VI_REGEX_SEARCH */
 
-// buf must be no longer than MAX_INPUT_LEN!
 static void colon(char *buf)
 {
 #if !ENABLE_FEATURE_VI_COLON
@@ -4789,8 +4792,7 @@ static void run_cmds(char *p)
 		if (p)
 			while (*p == '\n')
 				*p++ = '\0';
-		if (strlen(q) < MAX_INPUT_LEN)
-			colon(q);
+		colon(q);
 	}
 }
 #endif


More information about the busybox-cvs mailing list