Window: move_cursor_to takes a BufferIterator parameter
This commit is contained in:
parent
22bd9f90d5
commit
be043ffe1e
|
@ -323,7 +323,7 @@ void do_go(Window& window, int count)
|
|||
BufferIterator target =
|
||||
window.buffer().iterator_at(BufferCoord(count, 0));
|
||||
|
||||
window.move_cursor_to(window.line_and_column_at(target));
|
||||
window.move_cursor_to(target);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -335,7 +335,7 @@ void do_go(Window& window, int count)
|
|||
{
|
||||
BufferIterator target =
|
||||
window.buffer().iterator_at(BufferCoord(0,0));
|
||||
window.move_cursor_to(window.line_and_column_at(target));
|
||||
window.move_cursor_to(target);
|
||||
break;
|
||||
}
|
||||
case 'l':
|
||||
|
@ -350,7 +350,7 @@ void do_go(Window& window, int count)
|
|||
{
|
||||
BufferIterator target = window.buffer().iterator_at(
|
||||
BufferCoord(window.buffer().line_count() - 1, 0));
|
||||
window.move_cursor_to(window.line_and_column_at(target));
|
||||
window.move_cursor_to(target);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -261,7 +261,7 @@ BufferString Window::selection_content() const
|
|||
void Window::move_cursor(const WindowCoord& offset, bool append)
|
||||
{
|
||||
if (not append)
|
||||
move_cursor_to(cursor_position() + offset);
|
||||
move_cursor_to(iterator_at(cursor_position() + offset));
|
||||
else
|
||||
{
|
||||
for (auto& sel : m_selections)
|
||||
|
@ -273,11 +273,10 @@ void Window::move_cursor(const WindowCoord& offset, bool append)
|
|||
}
|
||||
}
|
||||
|
||||
void Window::move_cursor_to(const WindowCoord& new_pos)
|
||||
void Window::move_cursor_to(const BufferIterator& iterator)
|
||||
{
|
||||
BufferIterator target = iterator_at(new_pos);
|
||||
m_selections.clear();
|
||||
m_selections.push_back(Selection(target, target));
|
||||
m_selections.push_back(Selection(iterator, iterator));
|
||||
|
||||
scroll_to_keep_cursor_visible_ifn();
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ public:
|
|||
WindowCoord line_and_column_at(const BufferIterator& iterator) const;
|
||||
|
||||
void move_cursor(const WindowCoord& offset, bool append = false);
|
||||
void move_cursor_to(const WindowCoord& new_pos);
|
||||
void move_cursor_to(const BufferIterator& iterator);
|
||||
|
||||
void clear_selections();
|
||||
void select(const Selector& selector, bool append = false);
|
||||
|
|
Loading…
Reference in New Issue
Block a user