0

I'm working on an text editing app using wx.stc.StyledTextCtrl in wxPython (2.8). I have a large amount of text on one line. I have created custom lexers to highlight certain parts of the text. This works like a charm as long as I do not turn on word wrap. When I do turn word wrap on I get line breaks after each lexer style. I know this is the default and correct behavior of StyledTextCtrl, but it is detrimental to my app. How do I stop the word wrap from making line breaks after each lexer style?

If I could tell it to make a line break every 100 characters that would be perfect. I tried to do this artificially by adding \n when putting the text into the wx.stc.StyledTextCtrl but that did not work well as the absolute numbering of the characters are important. The \n messed up the numbering.

  • I found this passage in the scintilla documentation: "Set wrapMode to SC_WRAP_WORD (1) to enable wrapping on word or style boundaries, SC_WRAP_CHAR (2) to enable wrapping between any characters, SC_WRAP_WHITESPACE (3) to enable wrapping on whitespace, and SC_WRAP_NONE (0) to disable line wrapping. SC_WRAP_CHAR is preferred for Asian languages where there is no white space between words." It seems like SC_WRAP_CHAR (2) is what I am looking for. How do I access this through wxPython? – user3247720 Jun 16 '14 at 11:50
  • Magic! I just used self.stc.SetWrapMode(wx.stc.STC_WRAP_CHAR) and that took care of it. – user3247720 Jun 16 '14 at 12:07

0 Answers0