scroll window on mouse wheel events

This commit is contained in:
Josh Holtrop 2017-01-01 23:59:33 -05:00
parent 94eb9276d9
commit 842557ee46
2 changed files with 13 additions and 0 deletions

View File

@ -618,6 +618,7 @@ void BufferPane::scroll_window_up()
move_cursor_screen_row_up();
}
m_cursor_screen_row += lines_to_scroll;
m_window->request_redraw();
}
void BufferPane::scroll_window_down()
@ -630,6 +631,7 @@ void BufferPane::scroll_window_down()
move_cursor_screen_row_down();
}
m_cursor_screen_row -= lines_to_scroll;
m_window->request_redraw();
}
void BufferPane::forward_to_column(int column, bool allow_eol)

View File

@ -216,6 +216,17 @@ void Window::handle_event(SDL_Event & event)
case SDL_USEREVENT:
handle_keysym((uint32_t)(uintptr_t)event.user.data1);
break;
case SDL_MOUSEWHEEL:
if (event.wheel.y > 0)
{
m_buffer_pane->scroll_window_up();
}
else
{
m_buffer_pane->scroll_window_down();
}
break;
}
}