patch - Zoom State Bug


Subject: patch - Zoom State Bug
From: Michael D. Pritchett (mpritchett@attglobal.net)
Date: Fri Oct 12 2001 - 13:56:58 CDT


problem: Open a document and change the zoom. Document is now marked as
dirty???

reason: FV_View constructor calls a setCharFormat to change the language -
which is a zero length span. This attempts to update the undo_position, but
doesn't need to as it append to previous fmt tag. Unfortunately the
save_position does get incremented causing a dirty document.

fix: Either find a better place to do the setCharFormat or handle the case
that if the undo_position doesn't increment neither should the
save_position. The patch below takes the second approach.

I don't think it breaks anything else, but as I don't know this area of code
that well, I am posting to the list instead of comitting. If I hear
nothing, I will commit by default.

Cheers!

Michael D. Pritchett

Here is the patch:

Index: pt_PT_ChangeSpan.cpp
===================================================================
RCS file: /cvsroot/abi/src/text/ptbl/xp/pt_PT_ChangeSpan.cpp,v
retrieving revision 1.32
diff -u -r1.32 pt_PT_ChangeSpan.cpp
--- pt_PT_ChangeSpan.cpp 2001/09/11 04:18:41 1.32
+++ pt_PT_ChangeSpan.cpp 2001/10/12 18:32:06
@@ -355,11 +355,13 @@
  }
  if (dpos1 == dpos2) // if length of change is zero, then we have a
toggle format.
  {
+ UT_uint32 startUndoPos = m_history.getUndoPos();
   bool bRes = _insertFmtMarkFragWithNotify(ptc,dpos1,attributes,lProps);
+ UT_uint32 endUndoPos = m_history.getUndoPos();
   // Won't be a persistant change if it's just a toggle
   PX_ChangeRecord *pcr=0;
   m_history.getUndo(&pcr);
- if (pcr)
+ if (pcr && (startUndoPos != endUndoPos) )
   {
    UT_DEBUGMSG(("Setting persistance of change to false\n"));
    pcr->setPersistance(false);



This archive was generated by hypermail 2b25 : Fri Oct 12 2001 - 14:01:07 CDT