On Wed, Sep 12, 2007 at 08:58:08PM +0300, Martin Vermeer wrote:
> On Wed, Sep 12, 2007 at 06:10:36PM +0300, Dov Feldstern wrote:
> > Abdelrazak Younes wrote:
> > >Dov Feldstern wrote:
> 
> ...
>  
> > After a clean compile of trunk (r20239), I'm seeing strange stuff:
> > 
> > *) type a few words, switch to \emph (ctrl-e) and continue typing, and 
> > then start an ERT inset (ctrl-l) and continue typing: The ERT text 
> > appears in the GUI as emph. 
> 
> Yes... now I see it too. It's the cursor that carries its own 'current
> font' into the inset.
> 
> ....
>  
> > P.S. I'm not sure if this is the same problem that Neal is reporting --- 
> > I've only been talking about the GUI, I don't know how the latex output 
> > is affected by this... But it sounds to me like the things are probably 
> > connected...
> 
> I'm pretty sure of that.
> 
> - Martin

The attached seems to fix it and has the merit of me sort of
understanding why it works.

- Martin

Index: InsetERT.cpp
===================================================================
--- InsetERT.cpp	(revision 20235)
+++ InsetERT.cpp	(working copy)
@@ -196,6 +196,9 @@
 
 void InsetERT::doDispatch(Cursor & cur, FuncRequest & cmd)
 {
+	BufferParams const & bp = cur.buffer().params();
+	LayoutPtr const layout =
+			bp.getTextClass().defaultLayout();
 	//lyxerr << "\nInsetERT::doDispatch (begin): cmd: " << cmd << endl;
 	switch (cmd.action) {
 
@@ -229,9 +232,6 @@
 		// attributes.
 		// FIXME: Change only the pasted paragraphs
 
-		BufferParams const & bp = cur.buffer().params();
-		LayoutPtr const layout =
-			bp.getTextClass().defaultLayout();
 		Font font = layout->font;
 		// ERT contents has always latex_language
 		font.setLanguage(latex_language);
@@ -259,6 +259,10 @@
 		//text_.current_font.setLanguage(latex_language);
 		//text_.real_current_font.setLanguage(latex_language);
 
+		cur.current_font = layout->font;
+		cur.real_current_font = layout->font;
+		cur.current_font.setLanguage(latex_language);
+		cur.real_current_font.setLanguage(latex_language);
 		InsetCollapsable::doDispatch(cur, cmd);
 		break;
 	}

Reply via email to