JadedTuna
JadedTuna

Reputation: 1823

wxPython StyledTextCtrl, weird 'LF'

I am working on a simple text editor in wxPython, and I noticed a problem:
When I press 'Return' key, editor adds a weird 'LF':

How do i remove them?

How do i prevent my program from printing them?

Upvotes: 0

Views: 199

Answers (2)

JadedTuna
JadedTuna

Reputation: 1823

I found where the problem was:
I had that line in my custom StyledTextCtrl subclass:

self.SetViewEOL(True)

It was causing printing of those 'LF's

Here is the function's description:

SetViewEOL(self, bool visible)

Make the end of line characters visible or invisible.

Upvotes: 0

Steve Barnes
Steve Barnes

Reputation: 28405

If you are on windows then carriage return is actually Carriage Return, Line Feed, (0x0a, 0x0d) - (on old Macs it is the other way round) - you are probably just stripping off the last character line.strip() should get rid of it or you can search for and replace chr(0x0a) and chr(0x0b) with '' in your strings.

Upvotes: 1

Related Questions