mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:07:45 +00:00
LibVT: Keep track of the buffer postiion on mousedown events
This commit is contained in:
parent
697e6ccb89
commit
7a673f5aa3
2 changed files with 5 additions and 4 deletions
|
@ -783,8 +783,9 @@ void TerminalWidget::mousedown_event(GUI::MouseEvent& event)
|
|||
{
|
||||
if (event.button() == GUI::MouseButton::Left) {
|
||||
m_left_mousedown_position = event.position();
|
||||
m_left_mousedown_position_buffer = buffer_position_at(m_left_mousedown_position);
|
||||
|
||||
auto attribute = m_terminal.attribute_at(buffer_position_at(event.position()));
|
||||
auto attribute = m_terminal.attribute_at(m_left_mousedown_position_buffer);
|
||||
if (!(event.modifiers() & Mod_Shift) && !attribute.href.is_empty()) {
|
||||
m_active_href = attribute.href;
|
||||
m_active_href_id = attribute.href_id;
|
||||
|
@ -798,10 +799,9 @@ void TerminalWidget::mousedown_event(GUI::MouseEvent& event)
|
|||
int start_column = 0;
|
||||
int end_column = m_terminal.columns() - 1;
|
||||
|
||||
auto position = buffer_position_at(event.position());
|
||||
m_selection.set({ position.row(), start_column }, { position.row(), end_column });
|
||||
m_selection.set({ m_left_mousedown_position_buffer.row(), start_column }, { m_left_mousedown_position_buffer.row(), end_column });
|
||||
} else {
|
||||
m_selection.set(buffer_position_at(event.position()), {});
|
||||
m_selection.set(m_left_mousedown_position_buffer, {});
|
||||
}
|
||||
if (m_alt_key_held)
|
||||
m_rectangle_selection = true;
|
||||
|
|
|
@ -218,6 +218,7 @@ private:
|
|||
Core::ElapsedTimer m_triple_click_timer;
|
||||
|
||||
Gfx::IntPoint m_left_mousedown_position;
|
||||
VT::Position m_left_mousedown_position_buffer;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue