From 9fcff77767d324cc86a71d11d3fa71448f6b0f56 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Sun, 6 Apr 2025 13:31:15 +0100 Subject: [PATCH] Set ATTR_RIGHTCURS on pre-edit cursor Currently, we display the cursor at the right-hand end of the pre-edit text. That looks good for block and underline cursors, but it's a bit weird for the vertical line, which naturally appears at the left edge of the rightmost character. Setting ATTR_RIGHTCURS fixes this and means that the vertical-line cursor appears at the right edge of the rightmost character. That also corrects a weirdness where ATTR_RIGHTCURS was leaking through from the underlying pending-wrap state of the terminal, which was definitely wrong. --- terminal/terminal.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/terminal/terminal.c b/terminal/terminal.c index 6198a411..0fad9eb8 100644 --- a/terminal/terminal.c +++ b/terminal/terminal.c @@ -6128,11 +6128,13 @@ static void do_paint(Terminal *term) preedit_end = term->cols; preedit_start = preedit_end - term->preedit_termline->cols; } + /* Show the cursor at the right end of the pre-edit text. */ if (term->preedit_termline->chars[term->preedit_termline->cols - 1] .chr == UCSWIDE) our_curs_x = preedit_end - 2; else our_curs_x = preedit_end - 1; + cursor |= ATTR_RIGHTCURS; } /*