summaryrefslogtreecommitdiff
path: root/gtk/window.c
diff options
context:
space:
mode:
authorAchal-Aggarwal <theachalaggarwal@gmail.com>2014-03-21 22:57:41 +0530
committerAchal-Aggarwal <theachalaggarwal@gmail.com>2014-03-21 22:57:41 +0530
commit7bcefbf72dee4cb60fa51ffc9eb4e0ab26ddab75 (patch)
tree129921025938d153bd1b28d637ec386c902f5e6d /gtk/window.c
parenta67c49eacfcdfc65aadd457df9c63232eb806624 (diff)
downloadnetsurf-7bcefbf72dee4cb60fa51ffc9eb4e0ab26ddab75.tar.gz
netsurf-7bcefbf72dee4cb60fa51ffc9eb4e0ab26ddab75.tar.bz2
Fix caret cropping using clip rectangle.
Diffstat (limited to 'gtk/window.c')
-rw-r--r--gtk/window.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/gtk/window.c b/gtk/window.c
index 2da346b33..994c6a2ee 100644
--- a/gtk/window.c
+++ b/gtk/window.c
@@ -1154,9 +1154,21 @@ static void gui_window_place_caret(struct gui_window *g, int x, int y, int heigh
{
nsgtk_redraw_caret(g);
+ height -= 2;
+ y += 1;
+
+ if (y < clip->y0) {
+ height -= clip->y0 - y + 1;
+ y = clip->y0 - 1;
+ }
+
+ if (y + height > clip->y1) {
+ height = clip->y1 - y + 1;
+ }
+
g->caretx = x;
- g->carety = y + 1;
- g->careth = height - 2;
+ g->carety = y;
+ g->careth = height;
nsgtk_redraw_caret(g);