-
Notifications
You must be signed in to change notification settings - Fork 815
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
Clarify is_end_of_document_line
in docs
#4145
Comments
Sorry I forgot to mention: I think the docstring might need correcting anyway here: textual/src/textual/document/_document_navigator.py Lines 107 to 108 in e1749ac
|
It's not off by one - I should maybe clarify in the docs though. The end of the line is the maximum position in a line the cursor can rest on. Since you need to be able to move the cursor beyond the end of the text (otherwise inserting new text would be impossible), the "end of document line" is |
is_end_of_document_line
is off-by-one?is_end_of_document_line
in docs
Thanks Darren for the explanation, I think clarifying this in the docs is a good idea. |
* Add read_only reactive * Using nested CSS in TextArea and adding COMPONENT_CLASS for read-only cursor * Applying/removing CSS class `.-read-only` in TextArea * Preventing some edits in read-only mode. * Clearer distinction between user/keyboard driven edits and programmatic edits * Ensure we refresh cursor correctly when pressing key in read-only mode * Add test of paste in read-only mode * Fix typo in docstring * Ensure "delete line" keybinding doesnt move cursor in read_only mode in TextArea * Add clarification to docs based on issue #4145 * Add test to ensure read-only cursor colour * Update CHANGELOG * Fix cursor styling in CSS on read-only * Fix a docstring * Improving docstrings * Improving docstrings * Simplify fixtures * Test to ensure API driven editing still works on TextArea.read_only=True
Closed as completed by #4151 (thanks Darren!) |
Don't forget to star the repository! Follow @textualizeio for Textual updates. |
The documentation for the
DocumentNavigator
says that a location "refers to a location, in document-space (in the raw document)".I would expect the "end of line" in the example below to be at index 9. But the
is_end_of_document_line
is actually based on the length of the row, meaning it is off-by-one.Perhaps what is meant by "end of line" just needs clarifying the docs, or this might be an unintended bug?
The text was updated successfully, but these errors were encountered: