[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdelibs/kate/part
From: Dominik Haumann <dhdev () gmx ! de>
Date: 2007-05-20 16:21:31
Message-ID: 1179678091.533043.8102.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 666700 by dhaumann:
forward port SVN commit 481731 by alund:
Make KateDocument handle the cursor position during reload instead of
KateView, so they get remembered for all views. Reviewed by Hamish Rodda.
Unwanted behaviour right now: The cursor position jump to the document end
shortly before it is set correctly again. It works, but would be cool to
have that fixed.
M +11 -0 document/katedocument.cpp
M +1 -8 view/kateview.cpp
--- trunk/KDE/kdelibs/kate/part/document/katedocument.cpp #666699:666700
@@ -5015,10 +5015,21 @@
m_storedVariables.clear();
+ // save cursor positions for all views
+ QVector<KTextEditor::Cursor> cursorPositions;
+ cursorPositions.reserve(m_views.size());
+ foreach (KateView *v, m_views)
+ cursorPositions.append( v->cursorPosition() );
+
m_reloading = true;
KateDocument::openUrl( url() );
m_reloading = false;
+ // restore cursor positions for all views
+ QLinkedList<KateView*>::iterator it = m_views.begin();
+ for(int i = 0; i < m_views.size(); ++i, ++it)
+ (*it)->setCursorPositionInternal( cursorPositions[i], m_config->tabWidth(), false );
+
for (int z=0; z < tmp.size(); z++)
{
if (z < (int)lines())
--- trunk/KDE/kdelibs/kate/part/view/kateview.cpp #666699:666700
@@ -842,15 +842,8 @@
void KateView::reloadFile()
{
- // save cursor position
- KTextEditor::Cursor backupCursor(cursorPositionVirtual());
-
- // save bookmarks
+ // bookmarks and cursor positions are temporarily saved by the document
m_doc->documentReload();
-
- if (m_doc->lines() >= backupCursor.line())
- // Explicitly call internal function because we want this to be registered as a non-external call
- setCursorPositionInternal( backupCursor, m_doc->config()->tabWidth(), false );
}
void KateView::slotUpdate()
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic