TextArea Cursor/Caret Symbol — Change from Block (█
) to Beam (▏
)
#4568
-
Hi, hope everyone is doing alright. My Question — Can you can make the Hacky solutions are okay (e.g. getting the cursor position and manually rendering the desired caret character). I'd also be willing to try a PR as well if someone can point to some ideas. Previous Attempts — I brute force guessed various properties for Searching the source code, the block character likely originates from src/textual/_border.py or src/textual/widgets/_rule.py, but I can't find the code that actually renders it to screen. Minimal Code — If you want to tinker: from textual.app import App, ComposeResult
from textual.widgets import TextArea
class TextAreaExample(App):
# CSS = """\
# .text-area--cursor {
# /* If you want to try CSS */
# }
# """
def compose(self) -> ComposeResult:
default_text = 'This is a basic text editor.'
text_area = TextArea(default_text)
# Note: I don't think the `text_area` object has any attribute to define cursor symbol.
yield text_area
if __name__ == "__main__":
app = TextAreaExample()
app.run() Diagnostics —
For context, I'm working on a FOSS/self-hosted alternative to paid/proprietary apps like Workflowy/Dynalist in the "infinite outliner" niche. Thank you for your time! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The cursor for The cursor isn't a character, it's a changing of the background colour of the cell the cursor is on. If the cursor was a character you wouldn't be able to see the character it was on. |
Beta Was this translation helpful? Give feedback.
The cursor for
TextArea
is handled by the source forTextArea
, not sure how you got to those files from there.The cursor isn't a character, it's a changing of the background colour of the cell the cursor is on. If the cursor was a character you wouldn't be able to see the character it was on.