summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hofmann <scm@uninformativ.de>2023-10-07 07:40:39 +0200
committerRafael Marçalo <raroma09@gmail.com>2023-10-08 23:31:59 +0100
commit088a7d71781fdeba1e8f67d4df76e37bfa6fe6dd (patch)
tree3d737cbe8402000c8bbb0022106ae1601f861b78
parent9f15a1c4913cb42c8ee1ba0d83175ee295f4eae4 (diff)
Fix wide glyphs breaking "nowrap" mode
Consider the following example: printf '\e[?7l';\ for i in $(seq $(($(tput cols) - 1))); do printf a; done;\ printf 'đŸ™ˆ\n';\ printf '\e[?7h' Even though MODE_WRAP has been disabled, the emoji appeared on the next line. This patch keeps wide glyphs on the same line and moves them to the right-most possible position.
-rw-r--r--st.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/st.c b/st.c
index 14c1adb..d1615e2 100644
--- a/st.c
+++ b/st.c
@@ -2565,7 +2565,10 @@ check_control_code:
}
if (term.c.x+width > term.col) {
- tnewline(1);
+ if (IS_SET(MODE_WRAP))
+ tnewline(1);
+ else
+ tmoveto(term.col - width, term.c.y);
gp = &term.line[term.c.y][term.c.x];
}