Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assorted tweaks to Input #2743

Merged
merged 3 commits into from
Jun 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions src/textual/widgets/_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def validate_view_position(self, view_position: int) -> int:
new_view_position = max(0, min(view_position, self.cursor_width - width))
return new_view_position

def watch_cursor_position(self, cursor_position: int) -> None:
def _watch_cursor_position(self) -> None:
width = self.content_size.width
if width == 0:
# If the input has no width the view position can't be elsewhere.
Expand All @@ -299,7 +299,7 @@ def watch_cursor_position(self, cursor_position: int) -> None:
else:
self.view_position = self.view_position

async def watch_value(self, value: str) -> None:
async def _watch_value(self, value: str) -> None:
self._suggestion = ""
if self.suggester and value:
self.run_worker(self.suggester._get_suggestion(self, value))
Expand Down Expand Up @@ -400,12 +400,7 @@ async def _on_key(self, event: events.Key) -> None:
if self.cursor_blink:
self.blink_timer.reset()

# Do key bindings first
if await self.handle_key(event):
event.prevent_default()
event.stop()
return
elif event.is_printable:
if event.is_printable:
event.stop()
assert event.character is not None
self.insert_text_at_cursor(event.character)
Expand Down