From 4cad82db9f907fb8ffd42303527a976ca226cedd Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Thu, 10 Jan 2013 12:46:33 +0000 Subject: Fix caret placement in multi-line textareas. --- desktop/textarea.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/desktop/textarea.c b/desktop/textarea.c index 31effdc3c..0f42a9f30 100644 --- a/desktop/textarea.c +++ b/desktop/textarea.c @@ -1058,12 +1058,12 @@ void textarea_redraw(struct textarea *ta, int x, int y, /* There is no selection and caret is in horizontal * clip range. */ int caret_height = ta->line_height - 1; - y += ta->caret_y + text_y_offset; - if (y + caret_height >= clip->y0 && y <= clip->y1) + r.y0 = y + ta->caret_y + text_y_offset; + if (r.y0 + caret_height >= clip->y0 && r.y0 <= clip->y1) /* Caret in vertical clip range; plot */ - plot->line(x + ta->caret_x, y + ta->caret_y, + plot->line(x + ta->caret_x, r.y0, x + ta->caret_x, - y + ta->caret_y + caret_height, + r.y0 + caret_height, &pstyle_stroke_caret); } } @@ -1082,7 +1082,6 @@ bool textarea_keypress(struct textarea *ta, uint32_t key) line = ta->caret_pos.line; readonly = (ta->flags & TEXTAREA_READONLY ? true:false); - if (!(key <= 0x001F || (0x007F <= key && key <= 0x009F))) { /* normal character insertion */ length = utf8_from_ucs4(key, utf8); -- cgit v1.2.3