Window: add selection_content method
it returns the content of the last selection, or the character under the cursor if there are no selections.
This commit is contained in:
parent
8f70192875
commit
838ceb5958
|
@ -155,6 +155,18 @@ void Window::select(bool append, const Selector& selector)
|
||||||
scroll_to_keep_cursor_visible_ifn();
|
scroll_to_keep_cursor_visible_ifn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BufferString Window::selection_content() const
|
||||||
|
{
|
||||||
|
if (m_selections.empty())
|
||||||
|
{
|
||||||
|
BufferIterator it = iterator_at(m_cursor);
|
||||||
|
return m_buffer.string(it, it+1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return m_buffer.string(m_selections.back().begin(),
|
||||||
|
m_selections.back().end());
|
||||||
|
}
|
||||||
|
|
||||||
void Window::move_cursor(const WindowCoord& offset)
|
void Window::move_cursor(const WindowCoord& offset)
|
||||||
{
|
{
|
||||||
move_cursor_to(m_cursor + offset);
|
move_cursor_to(m_cursor + offset);
|
||||||
|
|
|
@ -65,6 +65,7 @@ public:
|
||||||
|
|
||||||
void empty_selections();
|
void empty_selections();
|
||||||
void select(bool append, const Selector& selector);
|
void select(bool append, const Selector& selector);
|
||||||
|
BufferString selection_content() const;
|
||||||
|
|
||||||
void set_dimensions(const WindowCoord& dimensions);
|
void set_dimensions(const WindowCoord& dimensions);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user