Skip to content

Commit

Permalink
Add watcher for cursor blink to ensure when blink is switched off, th…
Browse files Browse the repository at this point in the history
…e cursor immediately becomes visible. Ensure we turn of cursor blink inside the input suggetions snapshot test.
  • Loading branch information
darrenburns committed Oct 12, 2023
1 parent 65d7853 commit 0b4f3a9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/textual/widgets/_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,10 @@ def _watch_cursor_position(self) -> None:

self.app.cursor_position = self.cursor_screen_offset

def _watch_cursor_blink(self, blink: bool) -> None:
if not blink:
self._cursor_visible = True

@property
def cursor_screen_offset(self) -> Offset:
"""The offset of the cursor of this input in screen-space. (x, y)/(column, row)"""
Expand Down
5 changes: 4 additions & 1 deletion tests/snapshot_tests/test_snapshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ def test_input_validation(snap_compare):


def test_input_suggestions(snap_compare):
assert snap_compare(SNAPSHOT_APPS_DIR / "input_suggestions.py", press=[])
async def run_before(pilot):
pilot.app.query_one(Input).cursor_blink = False

assert snap_compare(SNAPSHOT_APPS_DIR / "input_suggestions.py", press=[], run_before=run_before)


def test_buttons_render(snap_compare):
Expand Down

0 comments on commit 0b4f3a9

Please sign in to comment.