Fix an assert in compute modified ranges when merging single char ranges
Due to the way Selection::min/max worked, we were creating backward selections, with cursor < anchor, which was triggering an assert when trying to move cursor back one char when it was already on the first char of the buffer.
This commit is contained in:
parent
26cc8b3ee0
commit
53f5b3d709
|
@ -44,11 +44,12 @@ struct Selection
|
||||||
return m_anchor == other.m_anchor and m_cursor == other.m_cursor;
|
return m_anchor == other.m_anchor and m_cursor == other.m_cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
const BufferCoord& min() const { return m_anchor < m_cursor ? m_anchor : m_cursor; }
|
// When selections are single char, we want the anchor to be considered min, and cursor max
|
||||||
const BufferCoord& max() const { return m_anchor < m_cursor ? m_cursor : m_anchor; }
|
const BufferCoord& min() const { return m_anchor <= m_cursor ? m_anchor : m_cursor; }
|
||||||
|
const BufferCoord& max() const { return m_anchor <= m_cursor ? m_cursor : m_anchor; }
|
||||||
|
|
||||||
BufferCoord& min() { return m_anchor < m_cursor ? m_anchor : m_cursor; }
|
BufferCoord& min() { return m_anchor <= m_cursor ? m_anchor : m_cursor; }
|
||||||
BufferCoord& max() { return m_anchor < m_cursor ? m_cursor : m_anchor; }
|
BufferCoord& max() { return m_anchor <= m_cursor ? m_cursor : m_anchor; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BufferCoord m_anchor;
|
BufferCoord m_anchor;
|
||||||
|
|
1
test/regression/0-compute-modified-range-crash/cmd
Normal file
1
test/regression/0-compute-modified-range-crash/cmd
Normal file
|
@ -0,0 +1 @@
|
||||||
|
es.<ret>!echo<ret>u
|
1
test/regression/0-compute-modified-range-crash/in
Normal file
1
test/regression/0-compute-modified-range-crash/in
Normal file
|
@ -0,0 +1 @@
|
||||||
|
aha
|
1
test/regression/0-compute-modified-range-crash/out
Normal file
1
test/regression/0-compute-modified-range-crash/out
Normal file
|
@ -0,0 +1 @@
|
||||||
|
aha
|
Loading…
Reference in New Issue
Block a user