Hi all,
        here is patch to fix bug 776, which is that "backward delete
removes a character ahead of the cursor after a font change".

It preserves the font chosen before the delete too.

Apply the patch to the "abi" directory. It makes a small change to
fv_View.cpp

Cheers

Martin

diff -Naur --exclude=CVS abi/src/text/fmt/xp/fv_View.cpp 
abi-new/src/text/fmt/xp/fv_View.cpp
--- abi/src/text/fmt/xp/fv_View.cpp     Wed Mar  8 12:18:25 2000
+++ abi-new/src/text/fmt/xp/fv_View.cpp Mon Mar 13 08:46:25 2000
@@ -1863,6 +1863,10 @@
 
 void FV_View::cmdCharDelete(UT_Bool bForward, UT_uint32 count)
 {
+  const XML_Char * properties[] = { "font-family", NULL, 0};
+  const XML_Char ** props_in = NULL;
+  const XML_Char * currentfont;
+  
        if (!isSelectionEmpty())
        {
                _deleteSelection();
@@ -1877,10 +1881,23 @@
        }
        else
        {
-               _eraseInsertionPoint();
+         /*
+           Code to deal with font boundary problem. 
+TODO: This should really be fixed by someone who understands how this code
+ works! In the meantime save current font to be restored after character is
+deleted.
+Blame Martin Sevior ([EMAIL PROTECTED]) if this screws up
+something
+         */
+               getCharFormat(&props_in);
+               currentfont = UT_getAttribute("font-family",props_in);
+               properties[1] = currentfont;
 
+               _eraseInsertionPoint();
                UT_uint32 amt = count;
                UT_uint32 posCur = getPoint();
+               UT_uint32 nposCur = getPoint();
+               UT_Bool fontFlag = UT_FALSE;
 
                if (!bForward)
                {
@@ -1892,6 +1909,14 @@
                        }
 
                        posCur = getPoint();
+  /* 
+     Code to deal with change of font boundaries: 
+  */
+                       if((posCur == nposCur) && (posCur > 0)) 
+                         {
+                           fontFlag = UT_TRUE;
+                           posCur--;
+                         }
                }
                else
                {
@@ -1911,9 +1936,14 @@
                if (amt > 0)
                {
                        m_pDoc->deleteSpan(posCur, posCur+amt);
-               }
+                       if(fontFlag)
+                         {
+                           setCharFormat(properties);
+                         }
+       }
 
                _generalUpdate();
+               free(props_in);
 
                if (!_ensureThatInsertionPointIsOnScreen())
                {

Reply via email to