Fix highlighting right at the edge of a non-scrolled line

This commit is contained in:
Anthony Sottile
2020-03-28 16:56:48 -07:00
parent 3844dcf329
commit 9f36fe2f1b
2 changed files with 10 additions and 1 deletions

View File

@@ -805,7 +805,7 @@ class File:
else:
h_s_x = region.x - l_x
if region.end >= l_x_max:
if region.end >= l_x_max and l_x_max < len(self.buf[l_y]):
if file_hl.include_edge:
h_e_x = curses.COLS
else:

View File

@@ -113,3 +113,12 @@ def test_syntax_highlighting_one_off_left_of_screen(run, tmpdir):
h.press('End')
h.await_text_missing('?')
h.assert_screen_attr_equals(1, [(236, 40, 0)] * 20)
def test_syntax_highlighting_to_edge_of_screen(run, tmpdir):
f = tmpdir.join('f.demo')
f.write(f'# {"x" * 18}')
with run(str(f), term='screen-256color', width=20) as h, and_exit(h):
h.await_text('# xxx')
h.assert_screen_attr_equals(1, [(243, 40, 0)] * 20)