Skip to content

Commit f3913c0

Browse files
committed
feat(input): make cursor_at_end property public
1 parent 1d893a9 commit f3913c0

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/textual/widgets/_input.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -464,12 +464,12 @@ def _position_to_cell(self, position: int) -> int:
464464
def _cursor_offset(self) -> int:
465465
"""The cell offset of the cursor."""
466466
offset = self._position_to_cell(self.cursor_position)
467-
if self._cursor_at_end:
467+
if self.cursor_at_end:
468468
offset += 1
469469
return offset
470470

471471
@property
472-
def _cursor_at_end(self) -> bool:
472+
def cursor_at_end(self) -> bool:
473473
"""Flag to indicate if the cursor is at the end"""
474474
return self.cursor_position == len(self.value)
475475

@@ -640,7 +640,7 @@ def render_line(self, y: int) -> Strip:
640640
if self._cursor_visible:
641641
cursor_style = self.get_component_rich_style("input--cursor")
642642
cursor = self.cursor_position
643-
if not show_suggestion and self._cursor_at_end:
643+
if not show_suggestion and self.cursor_at_end:
644644
result.pad_right(1)
645645
result.stylize(cursor_style, cursor, cursor + 1)
646646

@@ -848,7 +848,7 @@ def action_cursor_right(self, select: bool = False) -> None:
848848
if select:
849849
self.selection = Selection(start, end + 1)
850850
else:
851-
if self._cursor_at_end and self._suggestion:
851+
if self.cursor_at_end and self._suggestion:
852852
self.value = self._suggestion
853853
self.cursor_position = len(self.value)
854854
else:

src/textual/widgets/_masked_input.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ def render_line(self, y: int) -> Strip:
570570
result.stylize(style, index, index + 1)
571571

572572
if self._cursor_visible and self.has_focus:
573-
if self._cursor_at_end:
573+
if self.cursor_at_end:
574574
result.pad_right(1)
575575
cursor_style = self.get_component_rich_style("input--cursor")
576576
cursor = self.cursor_position

0 commit comments

Comments
 (0)