Bug 152203 - Undo Redo indentation loss
Summary: Undo Redo indentation loss
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-12 14:30 UTC by James Gauth
Modified: 2010-02-14 20:07 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description James Gauth 2007-11-12 14:30:31 UTC
Version:           2.5.8 (using KDE KDE 3.5.8)
Installed from:    Ubuntu Packages
OS:                Linux

When editing a document, undoing a change then redoing a change loses indentation when applied in the following way:

1) Open a new document
2) Type (where <tab> is an actual tab character):
<tab>Hello
<tab>Goodbye
3) Select from the end of 'Goodbye' to the beginning of 'Hello'
4) Cut the selection such that all remains in the document is:
<tab>
5) Run undo till the beginning of the undo buffer
6) Run redo till the end of the redo buffer
7) Run undo (this step should undo the Cut operation) once more to see the indentation loss

I'm not sure if this problem exists because of my particular indentation settings, these are my configuration values:
Editing options:
	Tabulators:
		Insert spaces instead of tabulators (off)
		Show tabulators (off)
		Tab width (4)
	Remove trailing spaces (on)
	Maximum undo steps (unlimited)

Indentation rules:
	Automatic Indentation:
		Indentation mode (Normal)
		Adjust indentation of code pasted from the clip board (off)
	Indentation with spaces:
		Use spaces instead of tabs to indent (off)
	Keep indent profile (on)
	Keep extra spaces (off)
Comment 1 James Gauth 2007-11-12 16:50:34 UTC
I forgot to include the expected and actual result:

Expected result
---------------
<tab>Hello
<tab>Goodbye

Actual result
-------------
<space>Hello
<tab>Goodbye
Comment 2 Maciej Pilichowski 2007-11-13 19:53:02 UTC
My differences:
Remove trailing spaces (off)
Keep indent profile (off) 
 Keep extra spaces (on)

and I cannot reproduce it (I mean -- it works for me with tabs and with spaces).
Comment 3 James Gauth 2007-11-14 10:34:03 UTC
I've just tested using your settings, changing the 'Remove trailing spaces' setting seems to make this go away. Also, step 3) is important, if you select from the beginning of 'Hello' to the end of 'Goodbye' it doesn't appear.

Could you see if you can reproduce it using 'Remove trailing spaces (on)'?
Comment 4 Maciej Pilichowski 2007-11-14 11:27:03 UTC
Yes, this one makes the difference.
Comment 5 Dominik Haumann 2010-02-14 20:02:05 UTC
Worse, the cursor position at the end may be invalid: The trailing spaces are delted completely, but the cursor column > 0. This leads to a crash when moving the cursor, see backtrace:

Application: KWrite (kwrite), signal: Aborted
[Current thread is 0 (LWP 13943)]

Thread 2 (Thread 0xb41a4b90 (LWP 13944)):
#0  0xb7fdc430 in __kernel_vsyscall ()
#1  0xb69f10e5 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/i686/cmov/libpthread.so.0
#2  0xb43166e1 in QTWTF::TCMalloc_PageHeap::scavengerThread (this=0xb43a5360) at /home/dh/kde/trunk/qt-copy/src/3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.cpp:2304
#3  0xb4316711 in QTWTF::TCMalloc_PageHeap::runScavengerThread (context=0xb43a5360) at /home/dh/kde/trunk/qt-copy/src/3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.cpp:1438
#4  0xb69ed4ff in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#5  0xb684449e in clone () from /lib/tls/i686/cmov/libc.so.6

Thread 1 (Thread 0xb5fe3750 (LWP 13943)):
[KCrash Handler]
#5  0xb7fdc430 in __kernel_vsyscall ()
#6  0xb678b6d0 in raise () from /lib/tls/i686/cmov/libc.so.6
#7  0xb678d098 in abort () from /lib/tls/i686/cmov/libc.so.6
#8  0xb6a807ed in qt_message_output (msgType=QtFatalMsg, buf=0x8a257e8 "ASSERT: \"valid()\" in file /home/dh/kde/trunk/kdelibs/kate/view/kateviewinternal.cpp, line 897")
    at /home/dh/kde/trunk/qt-copy/src/corelib/global/qglobal.cpp:2250
#9  0xb6a808e1 in qt_message (msgType=QtFatalMsg, msg=0x6 <Address 0x6 out of bounds>, ap=0xbfff84e4 "\220i`�Le`�\201\003") at /home/dh/kde/trunk/qt-copy/src/corelib/global/qglobal.cpp:2296
#10 0xb6a80949 in qFatal (msg=0xb6bd83dc "ASSERT: \"%s\" in file %s, line %d") at /home/dh/kde/trunk/qt-copy/src/corelib/global/qglobal.cpp:2479
#11 0xb6a809d5 in qt_assert (assertion=0xb4606990 "valid()", file=0xb460654c "/home/dh/kde/trunk/kdelibs/kate/view/kateviewinternal.cpp", line=897)
    at /home/dh/kde/trunk/qt-copy/src/corelib/global/qglobal.cpp:2013
#12 0xb45598fc in CalculatingCursor (this=0xbfff8564, vi=0x8986c40, c=@0x8986c90) at /home/dh/kde/trunk/kdelibs/kate/view/kateviewinternal.cpp:897
#13 0xb4559935 in BoundedCursor (this=0xbfff8564, vi=0x8986c40, c=@0x8986c90) at /home/dh/kde/trunk/kdelibs/kate/view/kateviewinternal.cpp:961
#14 0xb454f3fa in KateViewInternal::moveEdge (this=0x8986c40, bias=KateViewInternal::right, sel=false) at /home/dh/kde/trunk/kdelibs/kate/view/kateviewinternal.cpp:1210
#15 0xb454f720 in KateViewInternal::end (this=0x8986c40, sel=false) at /home/dh/kde/trunk/kdelibs/kate/view/kateviewinternal.cpp:1282
#16 0xb4531065 in KateView::end (this=0x8983b18) at /home/dh/kde/trunk/kdelibs/kate/view/kateview.cpp:2391
#17 0xb4542d65 in KateView::qt_metacall (this=0x8983b18, _c=QMetaObject::InvokeMetaMethod, _id=67, _a=0xbfff870c) at /home/dh/kde/trunk/build/kdelibs/kate/kateview.moc:390
#18 0xb6b7dbe5 in QMetaObject::metacall (object=0x3677, cl=QMetaObject::InvokeMetaMethod, idx=106, argv=0xbfff870c) at /home/dh/kde/trunk/qt-copy/src/corelib/kernel/qmetaobject.cpp:237
#19 0xb6b8be6f in QMetaObject::activate (sender=0x8813888, m=0xb74cb1f8, local_signal_index=1, argv=0xbfff870c) at /home/dh/kde/trunk/qt-copy/src/corelib/kernel/qobject.cpp:3272
#20 0xb6d8b289 in QAction::triggered (this=0x8813888, _t1=false) at .moc/release-shared/moc_qaction.cpp:263
#21 0xb6d8d20f in QAction::activate (this=0x8813888, event=QAction::Trigger) at /home/dh/kde/trunk/qt-copy/src/gui/kernel/qaction.cpp:1251
#22 0xb6d8e82b in QAction::event (this=0x8813888, e=0xbfff8c94) at /home/dh/kde/trunk/qt-copy/src/gui/kernel/qaction.cpp:1177
#23 0xb78d95d4 in KAction::event (this=0x8813888, event=0xbfff8c94) at /home/dh/kde/trunk/kdelibs/kdeui/actions/kaction.cpp:131
#24 0xb6d90f1c in QApplicationPrivate::notify_helper (this=0x87cbf20, receiver=0x8813888, e=0xbfff8c94) at /home/dh/kde/trunk/qt-copy/src/gui/kernel/qapplication.cpp:4298
#25 0xb6d99ee9 in QApplication::notify (this=0xbfff9bac, receiver=0x8813888, e=0xbfff8c94) at /home/dh/kde/trunk/qt-copy/src/gui/kernel/qapplication.cpp:3702
#26 0xb79c151b in KApplication::notify (this=0xbfff9bac, receiver=0x8813888, event=0xbfff8c94) at /home/dh/kde/trunk/kdelibs/kdeui/kernel/kapplication.cpp:302
#27 0xb6b7913b in QCoreApplication::notifyInternal (this=0xbfff9bac, receiver=0x8813888, event=0xbfff8c94) at /home/dh/kde/trunk/qt-copy/src/corelib/kernel/qcoreapplication.cpp:704
#28 0xb6dce072 in QShortcutMap::dispatchEvent (this=0x87cbfcc, e=0xbfff91ac) at ../../include/QtCore/../../../../qt-copy/src/corelib/kernel/qcoreapplication.h:215
#29 0xb6dcfd7f in QShortcutMap::tryShortcutEvent (this=0x87cbfcc, o=0x8986c40, e=0xbfff91ac) at /home/dh/kde/trunk/qt-copy/src/gui/kernel/qshortcutmap.cpp:364
#30 0xb6d9c0eb in QApplication::notify (this=0xbfff9bac, receiver=0x8986c40, e=0xbfff91ac) at /home/dh/kde/trunk/qt-copy/src/gui/kernel/qapplication.cpp:3744
#31 0xb79c151b in KApplication::notify (this=0xbfff9bac, receiver=0x8986c40, event=0xbfff91ac) at /home/dh/kde/trunk/kdelibs/kdeui/kernel/kapplication.cpp:302
#32 0xb6b7913b in QCoreApplication::notifyInternal (this=0xbfff9bac, receiver=0x8986c40, event=0xbfff91ac) at /home/dh/kde/trunk/qt-copy/src/corelib/kernel/qcoreapplication.cpp:704
#33 0xb6d9235e in qt_sendSpontaneousEvent (receiver=0x8986c40, event=0x6) at ../../include/QtCore/../../../../qt-copy/src/corelib/kernel/qcoreapplication.h:218
#34 0xb6e39310 in QKeyMapper::sendKeyEvent (keyWidget=0x8986c40, grab=false, type=QEvent::KeyPress, code=16777233, modifiers={i = -1073769736}, text=@0xbfff9324, autorepeat=<value optimized out>, 
    count=<value optimized out>, nativeScanCode=115, nativeVirtualKey=65367, nativeModifiers=0) at /home/dh/kde/trunk/qt-copy/src/gui/kernel/qkeymapper_x11.cpp:1861
#35 0xb6e3b2d5 in QKeyMapperPrivate::translateKeyEvent (this=0x87f5c68, keyWidget=0x8986c40, event=0xbfff98bc, grab=false) at /home/dh/kde/trunk/qt-copy/src/gui/kernel/qkeymapper_x11.cpp:1831
#36 0xb6e134d1 in QApplication::x11ProcessEvent (this=0xbfff9bac, event=0xbfff98bc) at /home/dh/kde/trunk/qt-copy/src/gui/kernel/qapplication_x11.cpp:3394
#37 0xb6e3de62 in x11EventSourceDispatch (s=0x87cf100, callback=0, user_data=0x0) at /home/dh/kde/trunk/qt-copy/src/gui/kernel/qguieventdispatcher_glib.cpp:146
#38 0xb6326b88 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#39 0xb632a0eb in ?? () from /usr/lib/libglib-2.0.so.0
#40 0xb632a268 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#41 0xb6ba1141 in QEventDispatcherGlib::processEvents (this=0x87b5fe8, flags={i = -1073767816}) at /home/dh/kde/trunk/qt-copy/src/corelib/kernel/qeventdispatcher_glib.cpp:412
#42 0xb6e3d635 in QGuiEventDispatcherGlib::processEvents (this=0x87b5fe8, flags={i = -1073767768}) at /home/dh/kde/trunk/qt-copy/src/gui/kernel/qguieventdispatcher_glib.cpp:204
#43 0xb6b779aa in QEventLoop::processEvents (this=0xbfff9b10, flags={i = -1073767704}) at /home/dh/kde/trunk/qt-copy/src/corelib/kernel/qeventloop.cpp:149
#44 0xb6b77b72 in QEventLoop::exec (this=0xbfff9b10, flags={i = -1073767656}) at /home/dh/kde/trunk/qt-copy/src/corelib/kernel/qeventloop.cpp:197
#45 0xb6b7a0b1 in QCoreApplication::exec () at /home/dh/kde/trunk/qt-copy/src/corelib/kernel/qcoreapplication.cpp:981
#46 0xb6d90fc7 in QApplication::exec () at /home/dh/kde/trunk/qt-copy/src/gui/kernel/qapplication.cpp:3577
#47 0xb7fd1d39 in kdemain (argc=1, argv=0xbfff9f94) at /home/dh/kde/trunk/kdebase/apps/kwrite/kwritemain.cpp:782
#48 0x080486d6 in main (argc=) at /home/dh/kde/trunk/build/kdebase/apps/kwrite/kwrite_dummy.cpp:3
Comment 6 Dominik Haumann 2010-02-14 20:05:44 UTC
SVN commit 1090151 by dhaumann:

fix crash in removeTrailingSpaces, if undo/redo is active.
BUG: 152203

 M  +7 -0      katedocument.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1090151
Comment 7 Dominik Haumann 2010-02-14 20:07:53 UTC
SVN commit 1090153 by dhaumann:

backport SVN commit 1090151 by dhaumann for KDE 4.4.1:
fix crash in removeTrailingSpaces, if undo/redo is active.
CCBUG: 152203


 M  +7 -0      katedocument.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1090153