-
Notifications
You must be signed in to change notification settings - Fork 815
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support zero-indexed line numbers in TextArea (#4471)
* widgets: text-area: Make the starting line number a kwarg * Add snapshot test for TextArea.line_number_start and update docs * Update snapshots * Update snapshots using latest Textual version --------- Co-authored-by: Darren Burns <[email protected]>
- Loading branch information
1 parent
fad03c8
commit b61028d
Showing
5 changed files
with
150 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
tests/snapshot_tests/snapshot_apps/text_area_line_number_start.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from textual.app import App, ComposeResult | ||
from textual.widgets import TextArea | ||
|
||
TEXT = """\ | ||
Foo | ||
Bar | ||
Baz | ||
""" | ||
|
||
|
||
class LineNumbersReactive(App[None]): | ||
START_LINE_NUMBER = 9999 | ||
|
||
def compose(self) -> ComposeResult: | ||
yield TextArea( | ||
TEXT, | ||
soft_wrap=True, | ||
show_line_numbers=True, | ||
line_number_start=self.START_LINE_NUMBER, | ||
) | ||
|
||
|
||
app = LineNumbersReactive() | ||
if __name__ == "__main__": | ||
app.run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters