add Window::display_selection_at(LineCount)
This commit is contained in:
parent
301921cd45
commit
fb87c7ac9f
|
@ -38,10 +38,18 @@ Window::~Window()
|
|||
m_options.unregister_watcher(*this);
|
||||
}
|
||||
|
||||
void Window::display_selection_at(LineCount line)
|
||||
{
|
||||
if (line >= 0 or line < m_dimensions.line)
|
||||
{
|
||||
auto cursor_line = main_selection().last().line();
|
||||
m_position.line = std::max(0_line, cursor_line - line);
|
||||
}
|
||||
}
|
||||
|
||||
void Window::center_selection()
|
||||
{
|
||||
BufferIterator cursor = main_selection().last();
|
||||
m_position.line = std::max(0_line, cursor.line() - m_dimensions.line/2_line);
|
||||
display_selection_at(m_dimensions.line/2_line);
|
||||
}
|
||||
|
||||
void Window::update_display_buffer()
|
||||
|
|
|
@ -33,6 +33,7 @@ public:
|
|||
const DisplayBuffer& display_buffer() const { return m_display_buffer; }
|
||||
|
||||
void center_selection();
|
||||
void display_selection_at(LineCount line);
|
||||
void update_display_buffer();
|
||||
|
||||
DisplayCoord display_position(const BufferIterator& it);
|
||||
|
|
Loading…
Reference in New Issue
Block a user