From kde-commits Wed Nov 16 19:14:20 2005 From: Holger Danielsson Date: Wed, 16 Nov 2005 19:14:20 +0000 To: kde-commits Subject: extragear/office/kile/kile Message-Id: <1132168460.653856.22337.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=113216846706351 SVN commit 480829 by danielsson: fix: auto complete environment displaces trailing characters M +6 -3 kileedit.cpp --- trunk/extragear/office/kile/kile/kileedit.cpp #480828:480829 @@ -1599,7 +1599,10 @@ bool EditorExtension::eventInsertEnvironment(Kate::View *view) { - QString line = view->getDoc()->textLine(view->cursorLine()).left(view->cursorColumnReal()); + int row = view->cursorLine(); + int col = view->cursorColumnReal(); + QString line = view->getDoc()->textLine(row).left(col); + int pos = m_regexpEnter.search(line); if (pos != -1 ) { @@ -1622,8 +1625,8 @@ if ( shouldCompleteEnv(envname, view) ) { QString item = m_latexCommands->isListEnv(envname) ? "\\item " : QString::null; - view->getDoc()->insertText(view->cursorLine()+1, 0, line+item +'\n'+line+endenv); - view->setCursorPositionReal(view->cursorLine()+1, line.length()+item.length()); + view->getDoc()->insertText(row,col, '\n'+line+item +'\n'+line+endenv); + view->setCursorPositionReal(row+1, line.length()+item.length()); return true; } }