---
 desktop/textarea.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/desktop/textarea.c b/desktop/textarea.c
index 584642d..8e4b1dd 100644
--- a/desktop/textarea.c
+++ b/desktop/textarea.c
@@ -755,6 +755,16 @@ static void textarea_scrollbar_callback(void *client_data,
 
                        if ((x >= cr.x0 && x < cr.x1) &&
                                        (y + h >= cr.y0 && y < cr.y1)) {
+                               /* Truncate height of caret on top and bottom 
boundaries */
+                               if (y < cr.y0) {
+                                       h = y + h - cr.y0;
+                                       y = cr.y0;
+                               }
+
+                               if (y + h > cr.y1) {
+                                       h = cr.y1 - y;
+                               }
+
                                /* Caret inside textarea */
                                msg.data.caret.type = TEXTAREA_CARET_SET_POS;
                                msg.data.caret.pos.x = x;
-- 
1.8.3.2


Reply via email to