aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorZufu Liu <unknown>2025-10-29 17:10:25 +1100
committerZufu Liu <unknown>2025-10-29 17:10:25 +1100
commitbd97e46bc614bb86ff18ab493240dc9be2dabd05 (patch)
treee3eb814bafd47b64468be2d43b3caad93edeec24 /src
parent527af5a4ec23792f40dd26dbbc076b006d75369d (diff)
downloadscintilla-mirror-bd97e46bc614bb86ff18ab493240dc9be2dabd05.tar.gz
Feature [feature-requests:#1567]. Fix bug when indenting rectangular selection.
Diffstat (limited to 'src')
-rw-r--r--src/Editor.cxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 9f3999b08..eb31d40f9 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -4155,6 +4155,12 @@ int Editor::KeyDownWithModifiers(Keys key, KeyMod modifiers, bool *consumed) {
void Editor::Indent(bool forwards, bool lineIndent) {
UndoGroup ug(pdoc);
+ // Avoid problems with recalculating rectangular range multiple times by temporarily
+ // treating rectangular selection as multiple stream selection.
+ const Selection::SelTypes selType = sel.selType;
+ if (sel.IsRectangular()) {
+ sel.selType = Selection::SelTypes::stream;
+ }
for (size_t r=0; r<sel.Count(); r++) {
const Sci::Line lineOfAnchor =
pdoc->SciLineFromPosition(sel.Range(r).anchor.Position());
@@ -4231,6 +4237,8 @@ void Editor::Indent(bool forwards, bool lineIndent) {
}
}
}
+ sel.selType = selType; // Restore rectangular mode
+ ThinRectangularRange();
ContainerNeedsUpdate(Update::Selection);
}