Dov Feldstern wrote:
But I also have a bigger question: why should we have a 'current_font' associated with every piece of text at all? I think perhaps there should only be a current_font associated with the cursor: when moving over text, the cursor's current_font would be set to match the font of the text at the current position.

That makes a lot of sense to me. 'current_font' is a view thing not a 'model' thing, and 'Text' is definitely on the model side.

The cursor's current_font is also set when an explicit font/language change occurs. Otherwise, the cursor's current_font wouldn't change. Thus, when moving into a new "piece of text" --- an inset, a new paragraph, etc., if there is already text there, then that text's font will be matched; and if it's empty, then the last font that was in use is retained. Because, for example, I'm not sure that it's even correct that if I created a table while in Hebrew, then all the cells should also be in Hebrew... I think it's more natural for the latest font to be retained, unless there's already text there.

(Implementing this later idea may be more complicated; if we decide it's the right thing to do, I may still provide a quick patch along the lines of the first paragraph, until the second one is implemented.)

Any thoughts on this?

I am not sure that this quick patch will be any shorter than transferring current_font business to Cursor.

Find all "current_font", Match case, Whole word, Subfolders, Find Results 1, "lyx-trunk", "*.c;*.cpp;*.cxx;*.cc;*.tli;*.tlh;*.h;*.hpp;*.hxx;*.hh"
Buffer.cpp(1460):       text().current_font.setLanguage(to);
Text.cpp(688):          if (current_font.number() == Font::ON) {
Text.cpp(696): number(cur); // Set Text.cpp(699): number(cur); // Set current_font.number Text.cpp(708): setCharFont(buffer, pit,
Text.cpp(712):                                  setCharFont(buffer, pit,
Text.cpp(793):  par.insertChar(cur.pos(), c, current_font,
Text.h(375):    Font current_font;
Text2.cpp(78):  : current_font(Font::ALL_INHERIT),
Text2.cpp(470): // Set the current_font
Text2.cpp(485): current_font = real_current_font;
Text2.cpp(486): current_font.reduce(layoutfont);
Text2.cpp(669): cur.paragraph().insertInset(cur.pos(), inset,
Text2.cpp(679):                                  current_font,
Text2.cpp(781): current_font = par.getFontSettings(bufparams,
Text2.cpp(789):         current_font.setLanguage(lang);
Text2.cpp(790):         current_font.setNumber(Font::OFF);
Text2.cpp(917):         // Either we deconst editXY or better we
Text3.cpp(897):         if (current_font.shape() ==
Text3.cpp(899):         else if (current_font.shape() ==
insets\InsetERT.cpp(61):        
insets\InsetERT.cpp(252):               
insets\InsetListings.cpp(50):   
insets\InsetText.cpp(86):       
insets\InsetText.cpp(101):      text_.current_font =
  Matching lines: 25    Matching files: 8    Total files searched: 1777


Abdel.

Reply via email to