-
Notifications
You must be signed in to change notification settings - Fork 781
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
docs(text area): fix syntax highlighting in examples #4099
docs(text area): fix syntax highlighting in examples #4099
Conversation
I wonder if this actually shows a slight issue with diff --git a/docs/examples/widgets/text_area_extended.py b/docs/examples/widgets/text_area_extended.py
index 8ac237db..26d29cea 100644
--- a/docs/examples/widgets/text_area_extended.py
+++ b/docs/examples/widgets/text_area_extended.py
@@ -15,7 +15,7 @@ class ExtendedTextArea(TextArea):
class TextAreaKeyPressHook(App):
def compose(self) -> ComposeResult:
- yield ExtendedTextArea(language="python")
+ yield ExtendedTextArea.code_editor(language="python")
app = TextAreaKeyPressHook()
diff --git a/src/textual/widgets/_text_area.py b/src/textual/widgets/_text_area.py
index 48e83502..7acecb8c 100644
--- a/src/textual/widgets/_text_area.py
+++ b/src/textual/widgets/_text_area.py
@@ -90,7 +90,7 @@ TextArea {
height: 1fr;
border: tall $background;
padding: 0 1;
-
+
&:focus {
border: tall $accent;
}
@@ -139,9 +139,9 @@ TextArea:light .text-area--cursor {
}
"""
`TextArea` offers some component classes which can be used to style aspects of the widget.
-
+
Note that any attributes provided in the chosen `TextAreaTheme` will take priority here.
-
+
| Class | Description |
| :- | :- |
| `text-area--cursor` | Target the cursor. |
@@ -457,7 +457,7 @@ TextArea:light .text-area--cursor {
classes: One or more Textual CSS compatible class names separated by spaces.
disabled: True if the widget is disabled.
"""
- return TextArea(
+ return cls(
text,
language=language,
theme=theme, Tagging @darrenburns for input. |
Yeah, you're right @davep. Just a slip up on my part. |
Ah, good catch @davep. I won't be able to update until later this evening as away from my desk, but feel free to take this over if urgent (I have allow edits by maintainers checked). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll let @darrenburns and/or @willmcgugan give the final thumbs up, but this looks good to me.
Fixes #4094.
I do wonder if the docs should start with an example of a plain multi-line input now that is the default
TextArea
experience, but I'll leave that as an open question here (and out of scope for this PR).This does slightly complicate the Extending TextArea example with the long
__init__
method, but I think leaving this as a plain TextArea might cause some confusion.