diff options
| author | Maxime Coste <mawww@kakoune.org> | 2019-02-17 10:19:54 +1100 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2019-02-17 11:21:26 +1100 |
| commit | 1ad3b8730283ade32d64c43b45de5aca59930de0 (patch) | |
| tree | 61168234753a9d7eefd9e78ed23304a41985c0e3 /src/context.cc | |
| parent | 924f30840bdde1b18602b3db8b63e2efb3517c21 (diff) | |
Collapse jumps based on current index change
The previous method, while likely more correct, could restore jump
lists containing references to already removed buffers.
Diffstat (limited to 'src/context.cc')
| -rw-r--r-- | src/context.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/context.cc b/src/context.cc index b3b82938..d97073d0 100644 --- a/src/context.cc +++ b/src/context.cc @@ -76,8 +76,14 @@ void Context::print_status(DisplayLine status) const client().print_status(std::move(status)); } -void JumpList::push(SelectionList jump) +void JumpList::push(SelectionList jump, Optional<size_t> index) { + if (index) + { + m_current = *index; + kak_assert(m_current <= m_jumps.size()); + } + if (m_current != m_jumps.size()) m_jumps.erase(m_jumps.begin()+m_current+1, m_jumps.end()); m_jumps.erase(std::remove(begin(m_jumps), end(m_jumps), jump), |
