Hi,
please find attached an improved version of my patches.
As compared to the yesterday's version ...
1. the patch to "src/insets/insetlatexaccent.C" is not changed
2. the patch to "src/trans_mgr.C" contains a better recognition of LaTeX
   code (yesterday I've forgotten about "{") - now I'm happy with it
3. the patch to "src/text3.C" contains a small "optimization" - in most
   cases the number of calls to "...backspace()" will be reduced by one
Hope it helps,
Best regards,
Jacek.
===================================================================
--- ./src/insets/insetlatexaccent.C.000 2005-11-25 15:40:34.000000000 +0100
+++ ./src/insets/insetlatexaccent.C     2007-01-10 14:06:34.000000000 +0100
@@ -460,14 +460,16 @@
                                    LColor::foreground);
                        break;
 
-               case CARON: {
-                       int xp[3], yp[3];
-                       xp[0] = int(x2 - hg35);    yp[0] = int(y + hg35);
-                       xp[1] = int(x2);           yp[1] = int(y + hg);
-                       xp[2] = int(x2 + hg35);    yp[2] = int(y + hg35);
-                       pi.pain.lines(xp, yp, 3, LColor::foreground);
-                       break;
-               }
+               case CARON:
+                       if (!contains("dlLt", ic)) {
+                               int xp[3], yp[3];
+                               xp[0] = int(x2 - hg35);    yp[0] = int(y + 
hg35);
+                               xp[1] = int(x2);           yp[1] = int(y + hg);
+                               xp[2] = int(x2 + hg35);    yp[2] = int(y + 
hg35);
+                               pi.pain.lines(xp, yp, 3, LColor::foreground);
+                               break;
+                       }
+                       // fall through for Czech and Slovak characters "dlLt" 
...
 
                case SPECIAL_CARON: {
                        switch (ic) {

===================================================================
--- ./src/trans_mgr.C.000       2005-07-14 15:05:03.000000000 +0200
+++ ./src/trans_mgr.C   2007-01-11 09:09:50.000000000 +0100
@@ -13,6 +13,8 @@
 
 #include "trans_mgr.h"
 
+#include "buffer.h"
+#include "language.h"
 #include "BufferView.h"
 #include "CutAndPaste.h"
 #include "cursor.h"
@@ -22,6 +24,7 @@
 #include "trans.h"
 
 #include "insets/insetlatexaccent.h"
+#include "insets/insetert.h"
 
 #include "support/lstrings.h"
 
@@ -289,6 +292,15 @@
                        lyx::cap::replaceSelection(cur);
                        cur.insert(new InsetLatexAccent(ins));
                        cur.posRight();
+               } else if ((str.size() > 1) && ((str[0] == '\\') || (str[0] == 
'{')) && (str[1] != ' ')) {
+                       // str looks like a LaTeX code ... make an ERT out of 
it ...
+                       InsetERT * ert = new 
InsetERT(text->bv()->buffer()->params(), InsetBase::Open);
+                       LyXFont font(LyXFont::ALL_INHERIT, latex_language);
+                       ert->setText(str, font);
+                       LCursor & cur = text->bv()->cursor();
+                       cur.insert(ert);
+                       ert->setStatus(cur, InsetBase::Collapsed);
+                       cur.posRight();
                } else {
                        insertVerbatim(str, text);
                }

===================================================================
--- ./src/text3.C.000   2006-09-14 15:50:37.000000000 +0200
+++ ./src/text3.C       2007-01-11 09:36:53.000000000 +0100
@@ -325,6 +325,17 @@
        // Remember the old paragraph metric (_outer_ paragraph!)
        Dimension olddim = cur.bottom().paragraph().dim();
 
+       // if <enter> pressed after an <accent> ... kill the <accent> ...
+       switch (cmd.action) {
+       case LFUN_BREAKLINE:
+       case LFUN_BREAKPARAGRAPH:
+       case LFUN_BREAKPARAGRAPHKEEPLAYOUT:
+       case LFUN_BREAKPARAGRAPH_SKIP:
+       case LFUN_END_OF_SENTENCE:
+               // combined_state_ -> deadkey_state_ -> init_state_
+               while (!(bv->owner()->getIntl().getTransManager().backspace())) 
;
+       }
+
        switch (cmd.action) {
 
        case LFUN_APPENDIX: {

Reply via email to