summarylogtreecommitdiffstats
path: root/show_history-patch.lineedit.c.patch
blob: 9ff4ded2b9e0410aedaeb1992ec42ab469f13d13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
--- orig.lineedit.c	2021-09-12 10:28:44.712919792 +0300
+++ libbb/lineedit.c	2021-09-12 10:53:48.564855036 +0300
@@ -1404,12 +1404,18 @@
 /* Lists command history. Used by shell 'history' builtins */
 void FAST_FUNC show_history(const line_input_t *st)
 {
-	int i;
+        int i;
 
-	if (!st)
-		return;
-	for (i = 0; i < st->cnt_history; i++)
-		printf("%4d %s\n", i, st->history[i]);
+        if (!st)
+                return;
+        for (i = 0; i < st->cnt_history; i++) {
+        	 if(i % 2 == 0)
+       			 	printf("\033[1m\033[37m%s\n", st->history[i]);
+   			 else
+       				printf("\033[0m%s\n", st->history[i]);
+
+        }
+        printf("\033[0m"); // reset colors
 }
 
 # if ENABLE_FEATURE_EDITING_SAVEHISTORY