Skip to content

Add show cursor boolean#5934

Merged
willmcgugan merged 4 commits into
mainfrom
show-cursor
Jul 7, 2025
Merged

Add show cursor boolean#5934
willmcgugan merged 4 commits into
mainfrom
show-cursor

Conversation

@willmcgugan

@willmcgugan willmcgugan commented Jul 7, 2025

Copy link
Copy Markdown
Member

Fixes #5928

A recent change to hide the cursor in read-only mode, revealed plenty of edge cases.

  • Restores cursor to read_only mode.
  • Added a show_cursor which applies when read_only==True. Note that show_cursor is ignored when not in read only mode, as being able to make edits without a cursor just seems like sadism.
  • When in read only mode the cursor doesn't blink, to give a subtle indication that you can't insert anything.
  • When in read only mode with show_cursor==False then the cursor keys will scroll the window (i.e. the default behavior for scrollable containers).

@TomJGooding TomJGooding left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for revisiting this. I haven't had chance to test the code yet, but from a quick scan spotted a possible mistake in the docstring.

Comment thread src/textual/widgets/_text_area.py
@willmcgugan willmcgugan merged commit d5ab640 into main Jul 7, 2025
23 checks passed
@willmcgugan willmcgugan deleted the show-cursor branch July 7, 2025 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cursor removed in read-only TextArea

2 participants