Skip to content

Commit

Permalink
Merge pull request #3808 from davep/only-suggest-on-focus
Browse files Browse the repository at this point in the history
Only show `Input` suggestions on focus
  • Loading branch information
davep authored Dec 5, 2023
2 parents cb61239 + 10d82d6 commit 3ab7b57
Show file tree
Hide file tree
Showing 5 changed files with 302 additions and 293 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## Unreleased

### Fixed

- Fixed `Input` showing suggestions when not focused https://github.com/Textualize/textual/pull/3808

### Removed

- Removed renderables/align.py which was no longer used
Expand Down
4 changes: 2 additions & 2 deletions src/textual/widgets/_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def __rich_console__(
value = input.value
value_length = len(value)
suggestion = input._suggestion
show_suggestion = len(suggestion) > value_length
show_suggestion = len(suggestion) > value_length and input.has_focus
if show_suggestion:
result += Text(
suggestion[value_length:],
Expand Down Expand Up @@ -145,7 +145,7 @@ class Input(Widget, can_focus=True):
padding: 0 2;
border: tall $background;
width: 100%;
height: 3;
height: 3;
}
Input:focus {
border: tall $accent;
Expand Down
Loading

0 comments on commit 3ab7b57

Please sign in to comment.