From 7a7262923b8cf2558a3e4922ff931fced3562fde Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 11 Jun 2018 10:13:21 +0530 Subject: [PATCH] Fix a regression in 0.10 that caused incorrect rendering of the status bar in irssi when used inside screen. Fixes #621. The cursor in margin check was incorrect causing upwards movement of the cursor when below the bottom margin to be incorrect. --- docs/changelog.rst | 3 +++ kitty/screen.c | 2 +- kitty_tests/screen.py | 6 +++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index ad3560552..87f4ab1b8 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -86,6 +86,9 @@ Changelog - Fix `kitty @ set-colors` not working with the window border colors. (:iss:`623`) +- Fix a regression in 0.10 that caused incorrect rendering of the status bar in + irssi when used inside screen. (:iss:`621`) + 0.10.1 [2018-05-24] ------------------------------ diff --git a/kitty/screen.c b/kitty/screen.c index 892f85a33..63d629027 100644 --- a/kitty/screen.c +++ b/kitty/screen.c @@ -464,7 +464,7 @@ write_escape_code_to_child(Screen *self, unsigned char which, const char *data) static inline bool cursor_within_margins(Screen *self) { - return self->margin_top <= self->cursor->y && self->cursor->y >= self->margin_bottom; + return self->margin_top <= self->cursor->y && self->cursor->y <= self->margin_bottom; } void diff --git a/kitty_tests/screen.py b/kitty_tests/screen.py index e70faf14e..d92e42398 100644 --- a/kitty_tests/screen.py +++ b/kitty_tests/screen.py @@ -319,11 +319,15 @@ class TestScreen(BaseTest): s.reset_mode(DECOM) # Test that moving cursor outside the margins works as expected s = self.create_screen(10, 10) - s.set_margins(5, 7) + s.set_margins(4, 6) s.cursor_position(0, 0) self.ae(s.cursor.y, 0) nl() self.ae(s.cursor.y, 1) + s.cursor.y = s.lines - 1 + self.ae(s.cursor.y, 9) + s.reverse_index() + self.ae(s.cursor.y, 8) def test_sgr(self): s = self.create_screen()