Skip to content

Commit

Permalink
Merge pull request #4429 from Textualize/fix-cursor
Browse files Browse the repository at this point in the history
fix cursor
  • Loading branch information
willmcgugan authored Apr 19, 2024
2 parents 217061c + 7e3da30 commit c00502f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

- Fixed `Integer` validator missing failure description when not a number https://github.com/Textualize/textual/issues/4413
- Fixed a crash in `DataTable` if you clicked a link in the border https://github.com/Textualize/textual/issues/4410
- Fixed issue with cursor position https://github.com/Textualize/textual/pull/4429

### Added

Expand Down
22 changes: 13 additions & 9 deletions src/textual/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2840,15 +2840,19 @@ def _display(self, screen: Screen, renderable: RenderableType | None) -> None:
try:
try:
if isinstance(renderable, CompositorUpdate):
cursor_x, cursor_y = self._previous_cursor_position
terminal_sequence = Control.move(
-cursor_x, -cursor_y
).segment.text
cursor_x, cursor_y = self.cursor_position
terminal_sequence += renderable.render_segments(console)
terminal_sequence += Control.move(
cursor_x, cursor_y
).segment.text
if self._driver.is_inline:
terminal_sequence = Control.move(
*(-self._previous_cursor_position)
).segment.text
terminal_sequence += renderable.render_segments(console)
terminal_sequence += Control.move(
*self.cursor_position
).segment.text
else:
terminal_sequence = renderable.render_segments(console)
terminal_sequence += Control.move_to(
*self.cursor_position
).segment.text
self._previous_cursor_position = self.cursor_position
else:
segments = console.render(renderable)
Expand Down

0 comments on commit c00502f

Please sign in to comment.