TextArea: make sure to use \n as line separator #4560
-
Hi, Short version:How to make sure, that Long version:I read in the doc that the I am building a UI for existing data in a database. Other UIs may have used different line separators, and I don't have control over that. I know that I have to solve this at database level. Nevertheless I want to make sure, that Should I scan the text before loading it into And which line separator Any hint is welcome. Regards |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
It sounds like you already have a pretty good understanding of the When content is loaded into the TextArea, the lines of the document are stored separate from the newline character, which is based on the "first occurrence of a line separator". Here's the underlying code (though note only intended for internal use from the leading underscore) : textual/src/textual/document/_document.py Lines 203 to 210 in 4adaf03 You can't change the Since the TextArea doesn't support mixed line endings as all will be converted to this |
Beta Was this translation helpful? Give feedback.
It sounds like you already have a pretty good understanding of the
TextArea
widget from the docs.When content is loaded into the TextArea, the lines of the document are stored separate from the newline character, which is based on the "first occurrence of a line separator". Here's the underlying code (though note only intended for internal use from the leading underscore) :
textual/src/textual/document/_document.py
Lines 203 to 210 in 4adaf03