scroll window on mouse wheel events

This commit is contained in:
josh committed 2017-01-01 23:59:33 -05:00
1 parent 94eb9276d9
commit 842557ee46
2 files changed
+13

No files matched your search

+2
View File
@@ -618,6 +618,7 @@ void BufferPane::scroll_window_up()
move_cursor_screen_row_up(); move_cursor_screen_row_up();
} }
m_cursor_screen_row += lines_to_scroll; m_cursor_screen_row += lines_to_scroll;
m_window->request_redraw();
} }
void BufferPane::scroll_window_down() void BufferPane::scroll_window_down()
@@ -630,6 +631,7 @@ void BufferPane::scroll_window_down()
move_cursor_screen_row_down(); move_cursor_screen_row_down();
} }
m_cursor_screen_row -= lines_to_scroll; m_cursor_screen_row -= lines_to_scroll;
m_window->request_redraw();
} }
void BufferPane::forward_to_column(int column, bool allow_eol) void BufferPane::forward_to_column(int column, bool allow_eol)
+11
View File
@@ -216,6 +216,17 @@ void Window::handle_event(SDL_Event & event)
case SDL_USEREVENT: case SDL_USEREVENT:
handle_keysym((uint32_t)(uintptr_t)event.user.data1); handle_keysym((uint32_t)(uintptr_t)event.user.data1);
break; break;
case SDL_MOUSEWHEEL:
if (event.wheel.y > 0)
{
m_buffer_pane->scroll_window_up();
}
else
{
m_buffer_pane->scroll_window_down();
}
break;
} }
} }