Version: 1.9.1 (using KDE KDE 3.5.5) Installed from: Ubuntu Packages When text is selected and double quotes key is pressed, the quote characters (``) appear at the cursor location (selected, if the cursor was anywhere other than the end of the selection block). The expected behavior is that the quotes replace the selected text.
SVN commit 605594 by tbraun: backporting fixes from trunk, but missed to close one bugreport BUG: 137272 M +3 -0 ChangeLog M +22 -15 kile/kileedit.cpp --- branches/kile/1.9/kile/ChangeLog #605593:605594 @@ -10,6 +10,9 @@ - Allow tools with brackets in the configuration string also in sequence tools, fixed also the crash which hid the bug. (#134605) - One fix in latex-document-cwl and color.cwl - Fix crash when adding a file to a project (with no open documents) which contains an undefined reference (#135575) + - Improve the logic for closing environments (#134793) + - Don't treat \\[foo] as a math environment (#137131) + - Remove selected text also if we insert a " (#137272) Feature: - Prepared the latex syntax file for beamer commands --- branches/kile/1.9/kile/kile/kileedit.cpp #605593:605594 @@ -1541,7 +1541,9 @@ uint row,col; view->cursorPositionReal(&row,&col); Kate::Document *doc = view->getDoc(); - + if(doc) + doc->removeSelectedText(); + // simply insert, if we are inside a verb command if ( insideVerb(view) || insideVerbatim(view) ) { @@ -1700,35 +1702,40 @@ bool EditorExtension::shouldCompleteEnv(const QString &env, Kate::View *view) { - kdDebug() << "===EditorExtension::shouldCompleteEnv(...)===" << endl; - QString envname = env; - envname.replace("*","\\*"); + kdDebug() << "===EditorExtension::shouldCompleteEnv( " << env << " )===" << endl; QRegExp reTestBegin,reTestEnd; - if ( envname == "\\[" ) + if ( env == "\\[" ) { - reTestBegin.setPattern("\\\\\\["); - reTestEnd.setPattern("\\\\\\]"); + kdDebug() << "display style" << endl; + reTestBegin.setPattern("(?:[^\\\\]|^)\\\\\\["); + // the first part is a non-capturing bracket (?:...) and we check if we don't have a backslash in front, + // or that we are at the begin of the line + reTestEnd.setPattern("(?:[^\\\\]|^)\\\\\\]"); } else { - reTestBegin.setPattern("\\\\begin\\s*\\{" + envname + "\\}"); - reTestEnd.setPattern("\\\\end\\s*\\{" + envname + "\\}"); + reTestBegin.setPattern("(?:[^\\\\]|^)\\\\begin\\s*\\{" + QRegExp::escape(env) + "\\}"); + reTestEnd.setPattern("(?:[^\\\\]|^)\\\\end\\s*\\{" + QRegExp::escape(env) + "\\}"); } - + int num = view->getDoc()->numLines(); int numBeginsFound = 0; int numEndsFound = 0; uint realLine, realColumn; - view->cursorPositionReal(&realLine, &realColumn); + view->cursorPositionReal(&realLine, &realColumn); for ( int i = realLine; i < num; ++i) { numBeginsFound += view->getDoc()->textLine(i).contains(reTestBegin); numEndsFound += view->getDoc()->textLine(i).contains(reTestEnd); - if ( (numBeginsFound == 1) && (numEndsFound == 1) ) return false; - else if ( (numEndsFound == 0) && (numBeginsFound > 1) ) return true; - else if ( (numBeginsFound > 2) || (numEndsFound > 1) ) return true; //terminate the search + kdDebug() << "line is " << i << " numBeginsFound = " << numBeginsFound << " , " << "numEndsFound = " << numEndsFound << endl; + if ( numEndsFound >= numBeginsFound ) + return false; + else if ( numEndsFound == 0 && numBeginsFound > 1 ) + return true; + else if ( numBeginsFound > 2 || numEndsFound > 1 ) + return true; // terminate the search } - + return true; }