Skip to content

Commit c00502f

Browse files
authored
Merge pull request #4429 from Textualize/fix-cursor
fix cursor
2 parents 217061c + 7e3da30 commit c00502f

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1111

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

1516
### Added
1617

src/textual/app.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2840,15 +2840,19 @@ def _display(self, screen: Screen, renderable: RenderableType | None) -> None:
28402840
try:
28412841
try:
28422842
if isinstance(renderable, CompositorUpdate):
2843-
cursor_x, cursor_y = self._previous_cursor_position
2844-
terminal_sequence = Control.move(
2845-
-cursor_x, -cursor_y
2846-
).segment.text
2847-
cursor_x, cursor_y = self.cursor_position
2848-
terminal_sequence += renderable.render_segments(console)
2849-
terminal_sequence += Control.move(
2850-
cursor_x, cursor_y
2851-
).segment.text
2843+
if self._driver.is_inline:
2844+
terminal_sequence = Control.move(
2845+
*(-self._previous_cursor_position)
2846+
).segment.text
2847+
terminal_sequence += renderable.render_segments(console)
2848+
terminal_sequence += Control.move(
2849+
*self.cursor_position
2850+
).segment.text
2851+
else:
2852+
terminal_sequence = renderable.render_segments(console)
2853+
terminal_sequence += Control.move_to(
2854+
*self.cursor_position
2855+
).segment.text
28522856
self._previous_cursor_position = self.cursor_position
28532857
else:
28542858
segments = console.render(renderable)

0 commit comments

Comments
 (0)