[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kate/part
From:       Johannes Sixt <Johannes.Sixt () telecom ! at>
Date:       2006-03-31 22:27:45
Message-ID: 1143844065.348628.31028.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 525140 by jsixt:

Consolidate Backspace's unindentation.

When the option "Backspace indents" is on, it unindents different from
Ctrl-Shift-I. Example:

f() {
    indentwidth_is_4();
    g(foo,
      bar);
        here();               // (*)
}

Put the cursor in front of here(). Now C-S-I unindents so that the line aligns
with indentwidth_is_4(). But Backspace unindents the line to align with bar,
which does not quite match the expectations. This fixes the problem by
replacing the custom unindentation implementation in KateDocument::backspace()
by a call to indent().

 M  +1 -23     katedocument.cpp  


--- trunk/KDE/kdelibs/kate/part/katedocument.cpp #525139:525140
@@ -2988,29 +2988,7 @@
       if (pos < 0 || pos >= (int)colX)
       {
         // only spaces on left side of cursor
-        // search a line with less spaces
-        int y = line;
-        while (--y >= 0)
-        {
-          // this is save, y <= line, and line was already success
-          textLine = m_buffer->plainLine(y);
-
-          pos = textLine->firstChar();
-
-          if (pos >= 0)
-          {
-            pos = textLine->positionWithTabs(pos, config()->tabWidth());
-            if (pos < (int)colX)
-            {
-              replaceWithOptimizedSpace(line, col, pos, config()->configFlags());
-              break;
-            }
-          }
-        }
-        if (y < 0) {
-          // FIXME: what shoud we do in this case?
-          removeText(KTextEditor::Range(line, 0, line, col+complement));
-        }
+        indent( view, line, -1);
       }
       else
         removeText(KTextEditor::Range(line, col-1, line, col+complement));
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic