summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2021-04-17 14:00:11 -0600
committerEduardo Chappa <chappa@washington.edu>2021-04-17 14:00:11 -0600
commite3a9185691280e37a20389c8477b1636e4ac9bf9 (patch)
tree56deb52de4f32f70a0497df897b685c64d1eca24
parent9190d6a72e2464faa39fdb6a792cff01869fd94e (diff)
downloadalpine-e3a9185691280e37a20389c8477b1636e4ac9bf9.tar.xz
* Fix for the status line for terminals that once a smso code has been
printed at the beginning of a line, they will write in inverse all text in that line regardless of where a new character is printed in that line. Joint collaboration with professor Martin Trusler.
-rw-r--r--alpine/status.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/alpine/status.c b/alpine/status.c
index d96dae2..93147d5 100644
--- a/alpine/status.c
+++ b/alpine/status.c
@@ -971,6 +971,8 @@ status_message_write(char *message, int from_alarm_handler)
EndInverse();
}
else{
+ int width = (int) utf8_width(newstatusbuf);
+
if(pico_usingcolor())
lastc = pico_get_cur_color();
@@ -982,6 +984,13 @@ status_message_write(char *message, int from_alarm_handler)
ClearLine(row);
+ if (width > ps_global->ttyo->screen_cols)
+ col = 0;
+ else
+ col = (ps_global->ttyo->screen_cols - width) / 2;
+
+ MoveCursor(row, col); /* so Inverse will be set correctly */
+
if(pico_usingcolor() && VAR_STATUS_FORE_COLOR &&
VAR_STATUS_BACK_COLOR &&
pico_is_good_color(VAR_STATUS_FORE_COLOR) &&
@@ -1000,7 +1009,7 @@ status_message_write(char *message, int from_alarm_handler)
StartInverse();
}
- col = Centerline(row, newstatusbuf);
+ PutLine0(row, col, newstatusbuf);
if(lastc){
(void)pico_set_colorp(lastc, PSC_NONE);