summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2013-02-11 16:47:11 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2013-02-11 16:47:11 +0000
commitfc430dba753ee80762ff3ffdbde8be59a00ba9ab (patch)
treef61e0d79893ff6f69be1d96632812dbac1706890
parente6bf51c3ba29e9fea2a13be4365a4a2d68293ef3 (diff)
downloadnetsurf-fc430dba753ee80762ff3ffdbde8be59a00ba9ab.tar.gz
netsurf-fc430dba753ee80762ff3ffdbde8be59a00ba9ab.tar.bz2
Clip native caret render so it can't overwrite border. Slight simplification.
-rw-r--r--desktop/textarea.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/desktop/textarea.c b/desktop/textarea.c
index 82a026188..eedc09115 100644
--- a/desktop/textarea.c
+++ b/desktop/textarea.c
@@ -1643,22 +1643,23 @@ void textarea_redraw(struct textarea *ta, int x, int y, colour bg, float scale,
c_pos++;
}
- plot->clip(clip);
-
- if ((ta->sel_end == -1 || ta->sel_start == ta->sel_end) &&
+ if (ta->flags & TEXTAREA_INTERNAL_CARET &&
+ (ta->sel_end == -1 || ta->sel_start == ta->sel_end) &&
ta->caret_pos.char_off >= 0) {
- /* There is no selection, and caret visible: show caret */
+ /* No native caret, there is no selection, and caret visible */
int caret_y = y - ta->scroll_y + ta->caret_y;
- if (ta->flags & TEXTAREA_INTERNAL_CARET) {
- /* Render our own caret */
- plot->line(x - ta->scroll_x + ta->caret_x, caret_y,
- x - ta->scroll_x + ta->caret_x,
- caret_y + ta->line_height,
- &pstyle_stroke_caret);
- }
+ plot->clip(&r);
+
+ /* Render our own caret */
+ plot->line(x - ta->scroll_x + ta->caret_x, caret_y,
+ x - ta->scroll_x + ta->caret_x,
+ caret_y + ta->line_height,
+ &pstyle_stroke_caret);
}
+ plot->clip(clip);
+
if (ta->bar_x != NULL)
scrollbar_redraw(ta->bar_x,
x / scale + ta->border_width,