On Mon, Jan 23, 2006 at 11:27:18AM +0100, Helge Hafting wrote: > Martin Vermeer wrote: > > >...and here (drum roll) is the patch... > > > > > I appreciate the effort, for the issue is annoying when writing in a > nondefault language. Something is missing though: > > 1. Create new document. (Default language here is Norwegian) > 2. Set the Document language to Swedish before typing anything at all > 3. Note that the cursor now has the dreaded underline . . . > 4. Type a few words of plain text - note the blue underlining. > > According to lyx, the text typed is in Norwegian language, which > is why it is correctly underlined in this Swedish document. The problem > is that I never actually asked for Norwegian language. :-( > > Looking at the .lyx, I see the text preceeded by unrequested "\lang norsk" > (which selects norwegian language). > > 5. Insert a table > 6. Notice that the entire first row of the table has the blue underline, > but not the rest. > 7. Fill in the table, note that the underlining doesn't change. > > Moving the cursor around the table, none of the cells indicate a > nondefault language. Not the underlined first row, not the non-underlined > other rows. > > Looking at the .lyx, I see a "\lang norsk" in front of the table, but > nothing > inside the table cells. So the table is part of a "norwegian" paragraph, > probably the reason for the strange underline. This is a separate problem, > a table should not be underlined this way . . . > None of the cells have a language specifier inside them. > > > Further testing when you provide your next patch . . . > > Helge Hafting Attached.
- Martin -- Martin Vermeer Puh. 09 451 3910 TKK Maanmittausosasto, Geodesian Laboratorio :wq
Index: buffer.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/buffer.C,v
retrieving revision 1.630
diff -u -p -r1.630 buffer.C
--- buffer.C 29 Nov 2005 15:08:34 -0000 1.630
+++ buffer.C 24 Jan 2006 07:42:51 -0000
@@ -1307,6 +1307,9 @@ void Buffer::changeLanguage(Language con
for_each(par_iterator_begin(),
par_iterator_end(),
bind(&Paragraph::changeLanguage, _1, params(), from, to));
+
+ text().current_font.setLanguage(to);
+ text().real_current_font.setLanguage(to);
}
Index: paragraph.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/paragraph.C,v
retrieving revision 1.418
diff -u -p -r1.418 paragraph.C
--- paragraph.C 30 Dec 2005 19:02:52 -0000 1.418
+++ paragraph.C 24 Jan 2006 07:42:56 -0000
@@ -1513,7 +1513,8 @@ bool Paragraph::isRightToLeftPar(BufferP
void Paragraph::changeLanguage(BufferParams const & bparams,
Language const * from, Language const * to)
{
- for (pos_type i = 0; i < size(); ++i) {
+ // <= to catch the dummy font change at end
+ for (pos_type i = 0; i <= size(); ++i) {
LyXFont font = getFontSettings(bparams, i);
if (font.language() == from) {
font.setLanguage(to);
@@ -1532,7 +1533,8 @@ bool Paragraph::isMultiLingual(BufferPar
for (; cit != end; ++cit)
if (cit->font().language() != ignore_language &&
cit->font().language() != latex_language &&
- cit->font().language() != doc_language)
+ cit->font().language() != doc_language &&
+ cit->font().language() != default_language)
return true;
return false;
}
Index: text2.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text2.C,v
retrieving revision 1.638
diff -u -p -r1.638 text2.C
--- text2.C 23 Jan 2006 10:25:41 -0000 1.638
+++ text2.C 24 Jan 2006 07:42:58 -0000
@@ -222,7 +222,6 @@ void LyXText::applyOuterFont(LyXFont & f
LyXFont lf(font_);
lf.reduce(defaultfont_);
lf.realize(font);
- lf.setLanguage(font.language());
font = lf;
}
Index: text3.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text3.C,v
retrieving revision 1.323
diff -u -p -r1.323 text3.C
--- text3.C 31 Dec 2005 11:40:32 -0000 1.323
+++ text3.C 24 Jan 2006 07:42:59 -0000
@@ -1114,12 +1122,6 @@ void LyXText::dispatch(LCursor & cur, Fu
cur.clearSelection();
LyXFont const old_font = real_current_font;
- // Prevents language turds in new lyxtexts under non-english
- BufferParams const & bufparams = cur.buffer().params();
- Language const * lang =
cur.paragraph().getParLanguage(bufparams);
- current_font.setLanguage(lang);
- real_current_font.setLanguage(lang);
-
string::const_iterator cit = cmd.argument.begin();
string::const_iterator end = cmd.argument.end();
for (; cit != end; ++cit)
Index: text.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v
retrieving revision 1.639
diff -u -p -r1.639 text.C
--- text.C 19 Dec 2005 12:30:33 -0000 1.639
+++ text.C 24 Jan 2006 07:43:00 -0000
@@ -1692,8 +1692,9 @@ bool LyXText::redoParagraph(pit_type con
// redo insets
// FIXME: We should always use getFont(), see documentation of
// noFontChange() in insetbase.h.
- LyXFont const tclassfont =
+ LyXFont tclassfont =
bv()->buffer()->params().getLyXTextClass().defaultfont();
+ tclassfont.setLanguage(bv()->buffer()->params().language);
InsetList::iterator ii = par.insetlist.begin();
InsetList::iterator iend = par.insetlist.end();
for (; ii != iend; ++ii) {
pgpX4PQpqDbP2.pgp
Description: PGP signature
