Skip to content

Commit

Permalink
Add missing docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenburns committed Dec 5, 2024
1 parent f9c0aeb commit 2d773ce
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/textual/widgets/_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def cursor(cls, cursor_position: int) -> Selection:

@property
def is_empty(self) -> bool:
"""Return True if the selection is empty."""
return self.start == self.end


Expand Down Expand Up @@ -209,10 +210,12 @@ class Input(ScrollView):

@property
def cursor_position(self) -> int:
"""The current position of the cursor, corresponding to the end of the selection."""
return self.selection.end

@cursor_position.setter
def cursor_position(self, position: int) -> None:
"""Set the current position of the cursor."""
self.selection = Selection.cursor(position)

selection: Reactive[Selection] = reactive(Selection.cursor(0))
Expand Down

0 comments on commit 2d773ce

Please sign in to comment.