From a2c6de8ecabbae4960714b7f630691fad3cbd899 Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Wed, 16 Jan 2002 23:06:10 +0000 Subject: [PATCH] (x_erase_phys_cursor): Don't erase cursor if cursor row is invisible. This can happen if cursor is on top line of a window, and we switch to a buffer with a header line. --- src/ChangeLog | 2 ++ src/w32term.c | 6 ++++++ src/xterm.c | 6 ++++++ 3 files changed, 14 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index 24df4986e42..57e508f9f27 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -4,6 +4,8 @@ is invisible. This can happen if cursor is on top line of a window, and we switch to a buffer with a header line. + * w32term.c (x_erase_phys_cursor): ditto. + 2002-01-16 Pavel Jan,Bm(Bk * xterm.c (XTread_socket) [!USE_X_TOOLKIT]: Compute the value of diff --git a/src/w32term.c b/src/w32term.c index 9fe40866edc..af83ae53a2a 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -9462,6 +9462,12 @@ x_erase_phys_cursor (w) if (!cursor_row->enabled_p) goto mark_cursor_off; + /* If row is completely invisible, don't attempt to delete a cursor which + isn't there. This may happen if cursor is at top of window, and + we switch to a buffer with a header line in that window. */ + if (cursor_row->visible_height <= 0) + goto mark_cursor_off; + /* This can happen when the new row is shorter than the old one. In this case, either x_draw_glyphs or clear_end_of_line should have cleared the cursor. Note that we wouldn't be diff --git a/src/xterm.c b/src/xterm.c index 77860842d57..a428b4af8a6 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -11396,6 +11396,12 @@ x_erase_phys_cursor (w) if (!cursor_row->enabled_p) goto mark_cursor_off; + /* If row is completely invisible, don't attempt to delete a cursor which + isn't there. This can happen if cursor is at top of a window, and + we switch to a buffer with a header line in that window. */ + if (cursor_row->visible_height <= 0) + goto mark_cursor_off; + /* This can happen when the new row is shorter than the old one. In this case, either x_draw_glyphs or clear_end_of_line should have cleared the cursor. Note that we wouldn't be -- 2.39.5