diff --git a/kitty/marks.py b/kitty/marks.py index 9bac90628..aa6f6d43f 100644 --- a/kitty/marks.py +++ b/kitty/marks.py @@ -15,9 +15,9 @@ def null_marker(*a): def get_output_variables(left_address, right_address, color_address): return ( - cast(c_void_p(left_address, pointer_to_uint)).contents, - cast(c_void_p(right_address, pointer_to_uint)).contents, - cast(c_void_p(color_address, pointer_to_uint)).contents, + cast(c_void_p(left_address), pointer_to_uint).contents, + cast(c_void_p(right_address), pointer_to_uint).contents, + cast(c_void_p(color_address), pointer_to_uint).contents, ) @@ -33,7 +33,7 @@ def marker_from_regex(expression, color): colorv.value = color for match in pat.finditer(text): left.value = match.start() - right.value = match.end() + right.value = match.end() - 1 yield return marker diff --git a/kitty_tests/screen.py b/kitty_tests/screen.py index ec60e5561..34324249d 100644 --- a/kitty_tests/screen.py +++ b/kitty_tests/screen.py @@ -4,6 +4,7 @@ from . import BaseTest from kitty.fast_data_types import DECAWM, IRM, Cursor, DECCOLM, DECOM +from kitty.marks import marker_from_regex class TestScreen(BaseTest): @@ -453,3 +454,9 @@ class TestScreen(BaseTest): self.ae(as_text(), 'ababababab\nc\n\n') self.ae(as_text(True), 'ababababab\nc\n\n') + + def test_user_marking(self): + s = self.create_screen() + s.draw('abaa') + s.add_marker('a', marker_from_regex('a', 3)) + self.ae(s.marked_cells(), [(0, 0, 3), (2, 0, 3), (3, 0, 3)])