1234567891011121314151617181920212223242526272829303132333435363738394041 |
- use crate::application::Application;
- use crate::errors::*;
- pub fn move_left(app: &mut Application) -> Result<()> {
- if let Some(ref mut buffer) = app.workspace.current_buffer {
- buffer.cursor.move_left();
- app.monitor.scroll_to_cursor(buffer)?;
- }
- Ok(())
- }
- pub fn move_right(app: &mut Application) -> Result<()> {
- if let Some(ref mut buffer) = app.workspace.current_buffer {
- buffer.cursor.move_right();
- app.monitor.scroll_to_cursor(buffer)?;
- }
- Ok(())
- }
- pub fn move_up(app: &mut Application) -> Result<()> {
- if let Some(ref mut buffer) = app.workspace.current_buffer {
- buffer.cursor.move_up();
- app.monitor.scroll_to_cursor(buffer)?;
- }
- Ok(())
- }
- pub fn move_down(app: &mut Application) -> Result<()> {
- if let Some(ref mut buffer) = app.workspace.current_buffer {
- buffer.cursor.move_down();
- app.monitor.scroll_to_cursor(buffer)?;
- }
- Ok(())
- }
- pub fn move_to_start_of_line(app: &mut Application) -> Result<()> {
- if let Some(ref mut buffer) = app.workspace.current_buffer {
- buffer.cursor.move_to_start_of_line();
- }
- Ok(())
- }
|