Bernhard Reutner-Fischer
2014-01-21 17:58:44 UTC
.. to toggle esc negative off.
Simplify escape printing in m_status_print while at it.
function old new delta
m_status_print 200 212 +12
getch_nowait 308 312 +4
buffer_fill_and_print 178 182 +4
read_lines 805 808 +3
re_wrap 454 457 +3
buffer_print 666 665 -1
.rodata 148884 148883 -1
goto_match 125 122 -3
buffer_up 35 32 -3
less_getch 52 46 -6
buffer_down 86 78 -8
less_main 2599 2589 -10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/7 up/down: 26/-32) Total: -6 bytes
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
---
miscutils/less.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/miscutils/less.c b/miscutils/less.c
index 60105f4..506231d 100644
--- a/miscutils/less.c
+++ b/miscutils/less.c
@@ -121,7 +121,7 @@
#define ESC "\033"
/* The escape codes for highlighted and normal text */
#define HIGHLIGHT ESC"[7m"
-#define NORMAL ESC"[0m"
+#define NORMAL ESC"[27m"
/* The escape code to home and clear to the end of screen */
#define CLEAR ESC"[H\033[J"
/* The escape code to clear to the end of line */
@@ -582,9 +582,10 @@ static void m_status_print(void)
cur_fline + 1, cur_fline + max_displayed_line + 1,
max_fline + 1);
if (cur_fline >= (int)(max_fline - max_displayed_line)) {
- printf("(END)"NORMAL);
+ printf("(END)");
if (num_files > 1 && current_file != num_files)
- printf(HIGHLIGHT" - next: %s"NORMAL, files[current_file]);
+ printf(" - next: %s", files[current_file]);
+ printf(NORMAL);
return;
}
percentage = calc_percent();
Simplify escape printing in m_status_print while at it.
function old new delta
m_status_print 200 212 +12
getch_nowait 308 312 +4
buffer_fill_and_print 178 182 +4
read_lines 805 808 +3
re_wrap 454 457 +3
buffer_print 666 665 -1
.rodata 148884 148883 -1
goto_match 125 122 -3
buffer_up 35 32 -3
less_getch 52 46 -6
buffer_down 86 78 -8
less_main 2599 2589 -10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/7 up/down: 26/-32) Total: -6 bytes
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
---
miscutils/less.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/miscutils/less.c b/miscutils/less.c
index 60105f4..506231d 100644
--- a/miscutils/less.c
+++ b/miscutils/less.c
@@ -121,7 +121,7 @@
#define ESC "\033"
/* The escape codes for highlighted and normal text */
#define HIGHLIGHT ESC"[7m"
-#define NORMAL ESC"[0m"
+#define NORMAL ESC"[27m"
/* The escape code to home and clear to the end of screen */
#define CLEAR ESC"[H\033[J"
/* The escape code to clear to the end of line */
@@ -582,9 +582,10 @@ static void m_status_print(void)
cur_fline + 1, cur_fline + max_displayed_line + 1,
max_fline + 1);
if (cur_fline >= (int)(max_fline - max_displayed_line)) {
- printf("(END)"NORMAL);
+ printf("(END)");
if (num_files > 1 && current_file != num_files)
- printf(HIGHLIGHT" - next: %s"NORMAL, files[current_file]);
+ printf(" - next: %s", files[current_file]);
+ printf(NORMAL);
return;
}
percentage = calc_percent();
--
1.8.5.2
1.8.5.2