summaryrefslogtreecommitdiff
path: root/src/normal.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2014-03-29 09:02:09 +0000
committerMaxime Coste <frrrwww@gmail.com>2014-03-29 09:02:09 +0000
commit0fe9683c0fd880c3def505a5465239cab54559c8 (patch)
treedd1cf3f05d39c6e11b260e48a46aee87c5caf299 /src/normal.cc
parentda9d099f3bdf1806b647fd8deabac60552bb04b2 (diff)
Fix indent/deindent when only empty lines are selected
Diffstat (limited to 'src/normal.cc')
-rw-r--r--src/normal.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/normal.cc b/src/normal.cc
index 75b04e59..73346a75 100644
--- a/src/normal.cc
+++ b/src/normal.cc
@@ -787,8 +787,11 @@ void indent(Context& context, int)
sels.emplace_back(line, line);
}
}
- ScopedEdition edition(context);
- insert<InsertMode::Insert>(buffer, sels, indent);
+ if (not sels.empty())
+ {
+ ScopedEdition edition(context);
+ insert<InsertMode::Insert>(buffer, sels, indent);
+ }
}
template<bool deindent_incomplete = true>
@@ -828,8 +831,11 @@ void deindent(Context& context, int)
}
}
}
- ScopedEdition edition(context);
- erase(context.buffer(), sels);
+ if (not sels.empty())
+ {
+ ScopedEdition edition(context);
+ erase(context.buffer(), sels);
+ }
}
template<ObjectFlags flags, SelectMode mode = SelectMode::Replace>