mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Suggestion autocomplete function now returns full suggestion, Textual calculates suffix
This commit is contained in:
@@ -42,13 +42,14 @@ class FileTable(Widget):
|
||||
grid = Table.grid()
|
||||
grid.add_column()
|
||||
for file in self.filtered_files:
|
||||
file_text = Text(" " + file.name)
|
||||
file_text.highlight_regex(self.filter, "black on yellow")
|
||||
file_text = Text(f" {file.name}")
|
||||
if self.filter:
|
||||
file_text.highlight_regex(self.filter, "black on yellow")
|
||||
grid.add_row(file_text)
|
||||
return grid
|
||||
|
||||
|
||||
class FileSearchApp(App[str]):
|
||||
class FileSearchApp(App):
|
||||
dark = True
|
||||
|
||||
def on_mount(self) -> None:
|
||||
|
||||
@@ -24,7 +24,7 @@ def word_autocompleter(value: str) -> str | None:
|
||||
# word completions
|
||||
for word in words:
|
||||
if word.startswith(value):
|
||||
return word[len(value) :]
|
||||
return word
|
||||
return None
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user