Skip to content

Commit ca2c11b

Browse files
authored
docs(text area): fix syntax highlighting in examples (Textualize#4099)
* docs(text area): fix syntax highlighting in examples * revert text_area_extended.py * fix class method * fix extended text area example
1 parent 6459878 commit ca2c11b

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

docs/examples/widgets/text_area_custom_language.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class HelloWorld {
1818

1919
class TextAreaCustomLanguage(App):
2020
def compose(self) -> ComposeResult:
21-
text_area = TextArea(text=java_code)
21+
text_area = TextArea.code_editor(text=java_code)
2222
text_area.cursor_blink = False
2323

2424
# Register the Java language and highlight query

docs/examples/widgets/text_area_example.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def goodbye(name):
1212

1313
class TextAreaExample(App):
1414
def compose(self) -> ComposeResult:
15-
yield TextArea(TEXT, language="python")
15+
yield TextArea.code_editor(TEXT, language="python")
1616

1717

1818
app = TextAreaExample()

docs/examples/widgets/text_area_extended.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def _on_key(self, event: events.Key) -> None:
1515

1616
class TextAreaKeyPressHook(App):
1717
def compose(self) -> ComposeResult:
18-
yield ExtendedTextArea(language="python")
18+
yield ExtendedTextArea.code_editor(language="python")
1919

2020

2121
app = TextAreaKeyPressHook()

docs/examples/widgets/text_area_selection.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def goodbye(name):
1313

1414
class TextAreaSelection(App):
1515
def compose(self) -> ComposeResult:
16-
text_area = TextArea(TEXT, language="python")
16+
text_area = TextArea.code_editor(TEXT, language="python")
1717
text_area.selection = Selection(start=(0, 0), end=(2, 0)) # (1)!
1818
yield text_area
1919

src/textual/widgets/_text_area.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ def code_editor(
457457
classes: One or more Textual CSS compatible class names separated by spaces.
458458
disabled: True if the widget is disabled.
459459
"""
460-
return TextArea(
460+
return cls(
461461
text,
462462
language=language,
463463
theme=theme,

0 commit comments

Comments
 (0)