@@ -1112,16 +1112,16 @@ int Editor::tabBlockShift()
11121112
11131113 /* block is selected */
11141114 if (cur.hasSelection () && cur.selectedText ().contains (QChar::ParagraphSeparator)) {
1115- /* determine current selection */
1116- int curbeg = cur.selectionStart ();
1117- int curend = cur.selectionEnd ();
1115+ /* determine current selection */
1116+ int curbeg = cur.selectionStart ();
1117+ int curend = cur.selectionEnd ();
11181118
1119- if (curbeg > curend) std::swap (curbeg, curend);
1119+ if (curbeg > curend) std::swap (curbeg, curend);
11201120
1121- /* create workable selection */
1122- cur.setPosition (curbeg, QTextCursor::MoveAnchor);
1123- cur.movePosition (QTextCursor::StartOfLine, QTextCursor::MoveAnchor);
1124- cur.setPosition (curend, QTextCursor::KeepAnchor);
1121+ /* create workable selection */
1122+ cur.setPosition (curbeg, QTextCursor::MoveAnchor);
1123+ cur.movePosition (QTextCursor::StartOfLine, QTextCursor::MoveAnchor);
1124+ cur.setPosition (curend, QTextCursor::KeepAnchor);
11251125
11261126 /* get a list of lines in the selected block. keep empty lines */
11271127 QStringList mylist = cur.selectedText ().split (QChar::ParagraphSeparator);
@@ -1131,33 +1131,33 @@ int Editor::tabBlockShift()
11311131
11321132 /* indent list */
11331133 QString text;
1134-
1134+
11351135 for (int n = 1 ; n <= mylist.length (); n++) {
11361136 QString s = mylist[n-1 ];
1137- int size = s.length ();
1138-
1139- /* ignore empty last line */
1137+ int size = s.length ();
1138+
1139+ /* ignore empty last line */
11401140 if (size == 0 && n == mylist.length ()) break ;
11411141
1142- if (!shiftTab) s.insert (0 , tab); // indent line
1143- else if (s.startsWith (tab)) s.remove (0 , tabSpaces); // decrease line indent
1144- else s.replace (QRegExp (" ^ *" ), " " ); // remove leading spaces
1145-
1146- /* adjust selection */
1147- if (n == 1 ) {
1148- curbeg -= size - s.length (); // only first line
1149- curbeg = std::max (curbeg, cur.selectionStart ()); // avoid underflow
1150- }
1151- curend -= size - s.length (); // all but an empty last line
1152-
1153- /* rebuild block */
1142+ if (!shiftTab) s.insert (0 , tab); // indent line
1143+ else if (s.startsWith (tab)) s.remove (0 , tabSpaces); // decrease line indent
1144+ else s.replace (QRegExp (" ^ *" ), " " ); // remove leading spaces
1145+
1146+ /* adjust selection */
1147+ if (n == 1 ) {
1148+ curbeg -= size - s.length (); // only first line
1149+ curbeg = std::max (curbeg, cur.selectionStart ()); // avoid underflow
1150+ }
1151+ curend -= size - s.length (); // all but an empty last line
1152+
1153+ /* rebuild block */
11541154 text += s;
11551155 if (n < mylist.length ()) text += QChar::ParagraphSeparator;
11561156 }
11571157 /* insert new block */
11581158 cur.insertText (text);
11591159
1160- /* update selection */
1160+ /* update selection */
11611161 cur.setPosition (curbeg, QTextCursor::MoveAnchor);
11621162 cur.setPosition (curend, QTextCursor::KeepAnchor);
11631163
0 commit comments