[bug] UNDO

Not spaz like at al.

FTC main widow:
Get an exception in the code below. Just playing with selecting text, deleting text, then doing more undo commands than needed.

Also, select some text and a picture, pressing delete then UNDO restores the info in the wrong place; One char offset.


Sub splitItem(index as integer, offset as integer)

  #if not DebugBuild

    #pragma DisableAutoWaitCursor
    #pragma DisableBoundsChecking
    #pragma NilObjectChecking false
    #pragma StackOverflowChecking false

  #endif

  Dim fto as FTObject
  Dim fto1 as FTObject

  ' Get the target item.
  fto = items(index)   //exception here

  ' Create the second half of the string.
  fto1 = fto.clone
  fto1.deleteLeft(offset)

  ' Is there anything to add?
  if fto1.getLength <> 0 then

    ' Create the first half of the string.
    fto.deleteRight(offset - 1)

    ' Insert the second half of the string.
    items.Insert(index + 1, fto1)

  end if

  ' Update the positions in the paragraph.
  updatePositions

End Sub




Error message =
Error number = 0

Stack:
RaiseOutOfBoundsException
GetIDERegistryKey
FTParagraph.splitItem%%o<FTParagraph>i4i4
FTParagraph.insertObjects%%o<FTParagraph>i4A1o<FTObject>b
FTDocument.insertObject%%o<FTDocument>o<FTObject>
FTCUndoBackspace.undo%%o<FTCUndoBackspace>
UndoManager.undo%%o<UndoManager>
FTCUndoManager.undo%%o<FTCUndoManager>
FormattedText._EditUndo_Action%b%o<FormattedText>
RuntimeMenuItemClick
_Z18BalloonHelpChangedP7SubPane
_Z23DispatchEventToHandlersP14EventTargetRecP14OpaqueEventRefP14HandlerCallRec
_Z30SendEventToEventTargetInternalP14OpaqueEventRefP20OpaqueEventTargetRefP14HandlerCallRec
SendEventToEventTarget
_Z18SendHICommandEventmPK9HICommandmmhP20OpaqueEventTargetRefS3_PP14OpaqueEventRef
ProcessHICommandWithContextAndModifiers
SendMenuItemSelectedEvent
_Z32CompatibilityMenuBarEventHandlerP25OpaqueEventHandlerCallRefP14OpaqueEventRefPv
_Z23DispatchEventToHandlersP14EventTargetRecP14OpaqueEventRefP14HandlerCallRec
_Z30SendEventToEventTargetInternalP14OpaqueEventRefP20OpaqueEventTargetRefP14HandlerCallRec
SendEventToEventTargetWithOptions
_Z29ToolboxEventDispatcherHandlerP25OpaqueEventHandlerCallRefP14OpaqueEventRefPv
_Z23DispatchEventToHandlersP14EventTargetRecP14OpaqueEventRefP14HandlerCallRec
_Z30SendEventToEventTargetInternalP14OpaqueEventRefP20OpaqueEventTargetRefP14HandlerCallRec
SendEventToEventTarget
_Z12SetFocusPaneP7SubPane
_Z9EventPumph
_Z17UpdateMouseCursorv
_Z17IsAppShuttingDownv
_Z33CallFunctionWithExceptionHandlingPFvvE
_Z8mainloopv
RuntimeRun
REALbasic._RuntimeRun
_Main
% main
--

Cheers,

Dr Gerard Hammond
MacSOS Solutions Pty Ltd
macsos@xxxxxxxxxxxxx  http://www.macsos.com.au

Proofread carefully to see if you any words out.

FTC Website: www.truenorthsoftware.com/Realbasic/FormattedText.html
Set List Options (digest and vacation modes): www.freelists.org/list/ftcdev
List Archive: www.freelists.org/archives/ftcdev
Unsubscribe: Send email to ftcdev-request@xxxxxxxxxxxxx with "unsubscribe" in 
the subject field.


Other related posts: