Window: add move_cursor_to method
This commit is contained in:
parent
3012f69c4d
commit
5a46ad49ea
|
@ -142,7 +142,12 @@ void Window::select(bool append, const Selector& selector)
|
||||||
|
|
||||||
void Window::move_cursor(const WindowCoord& offset)
|
void Window::move_cursor(const WindowCoord& offset)
|
||||||
{
|
{
|
||||||
BufferCoord target_position = window_to_buffer(m_cursor + offset);
|
move_cursor_to(m_cursor + offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Window::move_cursor_to(const WindowCoord& new_pos)
|
||||||
|
{
|
||||||
|
BufferCoord target_position = window_to_buffer(new_pos);
|
||||||
|
|
||||||
m_cursor = buffer_to_window(m_buffer.clamp(target_position));
|
m_cursor = buffer_to_window(m_buffer.clamp(target_position));
|
||||||
|
|
||||||
|
|
|
@ -68,6 +68,7 @@ public:
|
||||||
WindowCoord line_and_column_at(const BufferIterator& iterator) const;
|
WindowCoord line_and_column_at(const BufferIterator& iterator) const;
|
||||||
|
|
||||||
void move_cursor(const WindowCoord& offset);
|
void move_cursor(const WindowCoord& offset);
|
||||||
|
void move_cursor_to(const WindowCoord& new_pos);
|
||||||
|
|
||||||
void empty_selections();
|
void empty_selections();
|
||||||
void select(bool append, const Selector& selector);
|
void select(bool append, const Selector& selector);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user