On Fri, 2006-02-24 at 13:00 +0100, Georg Baum wrote: > Martin Vermeer wrote: > > > On Fri, 2006-02-24 at 11:43 +0100, Georg Baum wrote: > >> Martin Vermeer wrote: > >> > My patch places a > >> > current_cursor stanza into doDispatch/default for this. If you do this, > >> > you can again dump the corresponding stanza in init(). > >> > >> I don't understand the reason for putting it there. Why change the font > >> for every invocation of doDispatch and not once in the constructor? Can > >> it be changed from outside? > > > > What happens is that the current cursor font is set to latex_language. > > You do set the fonts of text_. LCursor::getFont() then somehow has access to > these. > > > When you then type a character, it will go through the dispatch chain to > > the inner LyXText, and will be inserted with this font(*)... unless it > > is surrounded by text having a different language, as you correctly > > observe above(+). But if we have closed all holes, that can never > > happen. > > What I still do not understand is why you set the text_ fonts in doDispatch, > and if it could make a difference if they were set in init().
The difference is that doDispatch is traversed every time you insert a character. init() only upon inset construction. So, if you create an ERT and start typing, OK. But if you then delete all the text in the ERT, and start typing again, init() will not be executed again. Anything that in the meantime changes text_.current_font / text_.real_current_font (these are very ephemeral!) will lead to the new text getting the wrong language. E.g., creating a new paragraph will use the buffer language. > I am currently trying to understand the theory. I will actually try out your > patch later (when I have reinstalled my laptop. The harddisk died, but > fortunately the last backup was not too old (10 days), and the stuff that > was changed after that backup could still be read). Oops. - Martin
signature.asc
Description: This is a digitally signed message part
