From 98627726cfd29c0b883a61ce857f950d1b26cd12 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 13 Jun 2017 09:00:55 +0100 Subject: [PATCH] Always store InclusiveBufferRange with first < second Closes #1434 --- src/highlighters.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/highlighters.cc b/src/highlighters.cc index 49cd425f..e640e4e2 100644 --- a/src/highlighters.cc +++ b/src/highlighters.cc @@ -1342,7 +1342,7 @@ void option_from_string(StringView str, InclusiveBufferRange& opt) if (first.line < 0 or first.column < 0 or last.line < 0 or last.column < 0) throw runtime_error("coordinates elements should be >= 1"); - opt = { first, last }; + opt = { std::min(first, last), std::max(first, last) }; } BufferCoord& get_first(RangeAndString& r) { return std::get<0>(r).first; }