I'm still dealing with this problem and i'm still at a loss with it. I don't want to be a pain, i can live with this problem, however i'm posting some more details in case someone wants to look at that.
To summarize the problem, i paste 3 chars (say "ABC") into an empty window, the app styles the 3 chars on SCN_UPDATEUI, then i move the caret to the beginning of line, i type a char or paste a string (say "xyz"), and then the last char of the preexisting ones (the "C") gets its style changed to the default style. I'm using no lexer, and Armel Asselin suggested here that this should be the problem, because Scintilla expects a lexer to restore correct styles after the last updated position. However now i think there must be some more things going on because: 1) The hypothesis of the lexer absence being the cause doesn't square with what Anthony reported, that is that he isn't seeing this problem and he isn't using a lexer either. 2) It's always only the last char which loses its style, regardless of how many chars i paste at the beginning of the line. So all the preexisting chars excepted the last one do keep their style, even though they are after the last updated position. 3) The loss of the style of the last char happens in another circumstance too in my app: - I paste a big text into an empty Scintilla window. - The window automatically scrolls to the end of text, showing the last page. - The app styles only the text in the last page (which is visible), included the last char. - The app starts styling the whole text, from the very first char (which isn't visible because it's in the first page). This styling is done through a timer: at each timer event the app styles a small number of lines. - The first time the timer styles lines at the top of text (not visible), the last char of the document (it's visible) loses its style (it gets the default style). Here too, to the best of my understanding, it's not the app which styles the last char giving it the default style. - (When the timer-based styling reaches the last line of the document, it styles the line, so the last char gets its style back). If after each timer-based styling i restyle the last line of the document, the next timer-based styling trashes the style of the last char of the last line again. I couldn't set a breakpoint in Scintilla as suggested by Armel to see who trashes the style, because i have no C++ compiler. I tried on 2 different systems (Win98 and Win2000) and the behavior is the same. I tested the problem outside my app just to narrow the investigation. I created a bare bones app which logs any Scintilla notification and which sends *any* message to Scintilla through a function which also logs the sent message, so it's impossible that some message is sent to Scintilla without being logged. The test app never uses Scintilla direct function. Here is the log: Start of app execution. SCN: scn_painted (2013) SCN: scn_painted (2013) SCN: scn_painted (2013) SCN: scn_painted (2013) SCN: scn_painted (2013) SCN: SCN_SAVEPOINTLEFT (2003) | Here is when i pasted 3 chars into SCN: SCN_MODIFIED (2008) | the empty window and the app has SCN: SCN_UPDATEUI (2007) | styled them using style #1. Then the --msg: SCI_STARTSTYLING (2032):0 31 | test app has set a flag so that no more --msg: SCI_GETTEXTLENGTH (2183):0 0 | styling commands can be sent at all --msg: SCI_SETSTYLING (2033):3 1 | by the app. SCN: scn_painted (2013) SCN: scn_painted (2013) SCN: (2012) SCN: SCN_UPDATEUI (2007) SCN: scn_painted (2013) SCN: scn_painted (2013) SCN: SCN_MODIFIED (2008) | Here is when i moved the caret at the SCN: SCN_CHARADDED (2001) | beginning of the line and typed one char. SCN: SCN_UPDATEUI (2007) | The last char immediately lost its style. SCN: scn_painted (2013) SCN: scn_painted (2013) SCN: scn_painted (2013) SCN: scn_painted (2013) End of app execution. ------------------------------------------------------------------------------------------------ -- _______________________________________________ Surf the Web in a faster, safer and easier way: Download Opera 8 at http://www.opera.com Powered by Outblaze _______________________________________________ Scintilla-interest mailing list [email protected] http://mailman.lyra.org/mailman/listinfo/scintilla-interest
