Skip to content

Commit 8a6cdf6

Browse files
authored
Merge branch 'main' into app-query-change
2 parents 158a015 + f7d2be1 commit 8a6cdf6

File tree

107 files changed

+4821
-3841
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+4821
-3841
lines changed

CHANGELOG.md

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,53 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## Unreleased
99

10+
1011
### Changed
1112

1213
- Breaking change: `App.query` and friends will now always query the default (first) screen, not necessarily the active screen.
1314
- Content now has a default argument of an empty string, so `Content()` is equivalent to `Content("")`
15+
- Assigned names to Textual-specific threads: `textual-input`, `textual-output`. These should become visible in monitoring tools (ps, top, htop) as of Python 3.14. https://github.com/Textualize/textual/pull/5654
16+
- Tabs now accept Content or content markup https://github.com/Textualize/textual/pull/5657
17+
- Buttons will now use Textual markup rather than console markup
18+
- tree-sitter languages are now loaded lazily, improving cold-start time https://github.com/Textualize/textual/pull/563
19+
20+
### Fixed
21+
22+
- Static and Label now accept Content objects, satisfying type checkers https://github.com/Textualize/textual/pull/5618
23+
- Fixed click selection not being disabled when allow_select was set to false https://github.com/Textualize/textual/issues/5627
24+
- Fixed crash on clicking line API border https://github.com/Textualize/textual/pull/5641
25+
- Fixed additional spaces after text-wrapping https://github.com/Textualize/textual/pull/5657
26+
- Added missing `scroll_end` parameter to the `Log.write_line` method https://github.com/Textualize/textual/pull/5672
27+
- Restored support for blink https://github.com/Textualize/textual/pull/5675
28+
29+
### Added
30+
31+
- Added Widget.preflight_checks to perform some debug checks after a widget is instantiated, to catch common errors. https://github.com/Textualize/textual/pull/5588
32+
- Added text-padding style https://github.com/Textualize/textual/pull/5657
33+
- Added `Content.first_line` property https://github.com/Textualize/textual/pull/5657
34+
- Added `Content.from_text` constructor https://github.com/Textualize/textual/pull/5657
35+
- Added `Content.empty` constructor https://github.com/Textualize/textual/pull/5657
36+
- Added `Content.pad` method https://github.com/Textualize/textual/pull/5657
37+
- Added `Style.has_transparent_foreground` property https://github.com/Textualize/textual/pull/5657
38+
39+
40+
## [2.1.2] - 2025-02-26
41+
42+
### Fixed
43+
44+
- Fixed command palette fuzzy search bailing too early https://github.com/Textualize/textual/pull/5579
45+
46+
## [2.1.1] - 2025-02-22
47+
48+
### Fixed
49+
50+
- Fixed `Link` binding to open the link https://github.com/Textualize/textual/issues/5564
51+
- Fixed IndexError in OptionList https://github.com/Textualize/textual/pull/5574
52+
- Fixed issue with clear_panes breaking tabbed content https://github.com/Textualize/textual/pull/5573
53+
54+
## Changed
55+
56+
- The user can now interrupt a scroll to end by grabbing the scrollbar or scrolling in any other way. Press ++end++ or scroll to the end to restore default behavior. This is more intuitive that it may sound.
1457

1558
## [2.1.0] - 2025-02-19
1659

@@ -97,11 +140,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
97140
### Changed
98141

99142
- Breaking change: OptionList no longer supports `Separator`, a separator may be specified with `None`
100-
- Implemented smooth (pixel perfect) scrolling on supported terminals. Set `TEXTUAL_SMOOTH_SCROLL=0` to disable.
143+
- Implemented smooth (pixel perfect) scrolling on supported terminals. Set `TEXTUAL_SMOOTH_SCROLL=0` to disable.
101144

102145
### Removed
103146

104-
- Breaking change: Removed `wrap` argument from OptionList (use CSS `text-wrap: nowrap; text-overflow: ellipses`)
147+
- Breaking change: Removed `wrap` argument from OptionList (use CSS `text-wrap: nowrap; text-overflow: ellipsis`)
105148
- Breaking change: Removed `tooltip` argument from OptionList. Use `tooltip` attribute or `with_tooltip(...)` method.
106149

107150
## [1.0.0] - 2024-12-12
@@ -2768,6 +2811,8 @@ https://textual.textualize.io/blog/2022/11/08/version-040/#version-040
27682811
- New handler system for messages that doesn't require inheritance
27692812
- Improved traceback handling
27702813

2814+
[2.1.2]: https://github.com/Textualize/textual/compare/v2.1.1...v2.1.2
2815+
[2.1.1]: https://github.com/Textualize/textual/compare/v2.1.0...v2.1.1
27712816
[2.1.0]: https://github.com/Textualize/textual/compare/v2.0.4...v2.1.0
27722817
[2.0.4]: https://github.com/Textualize/textual/compare/v2.0.3...v2.0.4
27732818
[2.0.3]: https://github.com/Textualize/textual/compare/v2.0.2...v2.0.3

docs/examples/widgets/radio_button.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from rich.text import Text
2+
13
from textual.app import App, ComposeResult
24
from textual.widgets import RadioButton, RadioSet
35

@@ -15,7 +17,9 @@ def compose(self) -> ComposeResult:
1517
yield RadioButton("Star Wars: A New Hope")
1618
yield RadioButton("The Last Starfighter")
1719
yield RadioButton(
18-
"Total Recall :backhand_index_pointing_right: :red_circle:"
20+
Text.from_markup(
21+
"Total Recall :backhand_index_pointing_right: :red_circle:"
22+
)
1923
)
2024
yield RadioButton("Wing Commander")
2125

docs/examples/widgets/radio_set.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from rich.text import Text
2+
13
from textual.app import App, ComposeResult
24
from textual.containers import Horizontal
35
from textual.widgets import RadioButton, RadioSet
@@ -18,7 +20,9 @@ def compose(self) -> ComposeResult:
1820
yield RadioButton("Star Wars: A New Hope")
1921
yield RadioButton("The Last Starfighter")
2022
yield RadioButton(
21-
"Total Recall :backhand_index_pointing_right: :red_circle:"
23+
Text.from_markup(
24+
"Total Recall :backhand_index_pointing_right: :red_circle:"
25+
)
2226
)
2327
yield RadioButton("Wing Commander")
2428
# A RadioSet built up from a collection of strings.

docs/examples/widgets/radio_set_changed.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from rich.text import Text
2+
13
from textual.app import App, ComposeResult
24
from textual.containers import Horizontal, VerticalScroll
35
from textual.widgets import Label, RadioButton, RadioSet
@@ -18,7 +20,9 @@ def compose(self) -> ComposeResult:
1820
yield RadioButton("Star Wars: A New Hope")
1921
yield RadioButton("The Last Starfighter")
2022
yield RadioButton(
21-
"Total Recall :backhand_index_pointing_right: :red_circle:"
23+
Text.from_markup(
24+
"Total Recall :backhand_index_pointing_right: :red_circle:"
25+
)
2226
)
2327
yield RadioButton("Wing Commander")
2428
with Horizontal():

docs/examples/widgets/text_area_custom_language.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def compose(self) -> ComposeResult:
2222
text_area.cursor_blink = False
2323

2424
# Register the Java language and highlight query
25-
text_area.register_language(java_language, java_highlight_query)
25+
text_area.register_language("java", java_language, java_highlight_query)
2626

2727
# Switch to Java
2828
text_area.language = "java"

docs/getting_started.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
1+
12
All you need to get started building Textual apps.
23

34
## Requirements
45

56
Textual requires Python 3.8 or later (if you have a choice, pick the most recent Python). Textual runs on Linux, macOS, Windows and probably any OS where Python also runs.
67

7-
!!! info inline end "Your platform"
8+
!!! info "Your platform"
89

910
### :fontawesome-brands-linux: Linux (all distros)
1011

1112
All Linux distros come with a terminal emulator that can run Textual apps.
1213

1314
### :material-apple: macOS
1415

15-
The default terminal app is limited to 256 colors. We recommend installing a newer terminal such as [iterm2](https://iterm2.com/), [Kitty](https://sw.kovidgoyal.net/kitty/), or [WezTerm](https://wezfurlong.org/wezterm/).
16+
The default terminal app is limited to 256 colors. We recommend installing a newer terminal such as [iterm2](https://iterm2.com/), [Ghostty](https://ghostty.org/), [Kitty](https://sw.kovidgoyal.net/kitty/), or [WezTerm](https://wezfurlong.org/wezterm/).
1617

1718
### :material-microsoft-windows: Windows
1819

1920
The new [Windows Terminal](https://apps.microsoft.com/store/detail/windows-terminal/9N0DX20HK701?hl=en-gb&gl=GB) runs Textual apps beautifully.
2021

22+
2123
## Installation
2224

2325
Here's how to install Textual.
@@ -36,6 +38,12 @@ If you plan on developing Textual apps, you should also install textual develope
3638
pip install textual-dev
3739
```
3840

41+
If you would like to enable syntax highlighting in the [TextArea](./widgets/text_area.md) widget, you should specify the "syntax" extras when you install Textual:
42+
43+
```
44+
pip install "textual[syntax]"
45+
```
46+
3947
### From conda-forge
4048

4149
Textual is also available on [conda-forge](https://conda-forge.org/). The preferred package manager for conda-forge is currently [micromamba](https://mamba.readthedocs.io/en/latest/installation/micromamba-installation.html):

docs/guide/input.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,15 @@ You can create priority key bindings by setting `priority=True` on the Binding o
185185
The [footer](../widgets/footer.md) widget can inspect bindings to display available keys. If you don't want a binding to display in the footer you can set `show=False`. The default bindings on App do this so that the standard ++ctrl+c++, ++tab++ and ++shift+tab++ bindings don't typically appear in the footer.
186186

187187

188+
### Dynamic bindings?
189+
190+
You may find you have bindings which are not always applicable given the current state of your app.
191+
For instance a "Save file" binding when there are no changes to save.
192+
It wouldn't be a good user experience if the save key did nothing, or raised an error.
193+
194+
Textual doesn't support modifying the bindings at runtime, but you can accomplish this with [dynamic actions](./actions.md#dynamic-actions) which offers greater flexibility.
195+
196+
188197
## Mouse Input
189198

190199
Textual will send events in response to mouse movement and mouse clicks. These events contain the coordinates of the mouse cursor relative to the terminal or widget.

docs/guide/screens.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,8 @@ You can switch between these screens at any time by calling [`App.switch_mode`][
329329
When you switch to a new mode, the topmost screen in the new stack becomes visible.
330330
Any calls to [`App.push_screen`][textual.app.App.push_screen] or [`App.pop_screen`][textual.app.App.pop_screen] will affect only the active mode.
331331

332+
You can set which mode will be active when the app starts by setting the [`DEFAULT_MODE`][textual.app.App.DEFAULT_MODE] class variable.
333+
332334
Let's look at an example with modes:
333335

334336
=== "modes01.py"

docs/widgets/button.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ This widget has no component classes.
5151

5252
## Additional Notes
5353

54-
- The spacing between the text and the edges of a button are _not_ due to padding. The default styling for a `Button` has the `height` set to 3 lines and a `min-width` of 16 columns. To create a button with zero visible padding, you will need to change these values and also remove the border with `border: none;`.
54+
- The spacing between the text and the edges of a button are _not_ due to padding. The default styling for a `Button` includes borders and a `min-width` of 16 columns. To remove the spacing, set `border: none;` in your CSS and adjust the minimum width as needed.
5555

5656
---
5757

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "textual"
3-
version = "2.1.0"
3+
version = "2.1.2"
44
homepage = "https://github.com/Textualize/textual"
55
repository = "https://github.com/Textualize/textual"
66
documentation = "https://textual.textualize.io/"

0 commit comments

Comments
 (0)