diff options
| -rw-r--r-- | src/main.rs | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index 5929295..f21096f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -245,6 +245,48 @@ impl Ivy { }).await?; }, + '0' => { + self.handle_movement(async |ivy: &mut Ivy| { + let window = ivy.window.write().await; + + let mut column = window.cursor_column.write().await; + *column = 0; + + /* For this one, the neutral column changes regardless of + * whether the column does. + */ + *window.cursor_neutral_column.write().await = *column; + + Ok(()) + }).await?; + }, + + '$' => { + self.handle_movement(async |ivy: &mut Ivy| { + let buffer = ivy.buffer.read().await; + let window = ivy.window.write().await; + + let row = *window.cursor_row.read().await; + if let Some(span) = buffer.line_span(row).await { + let width = span.end - span.start; + + let mut column = window.cursor_column.write().await; + if width > 0 { + *column = width - 1; + } else { + *column = 0; + } + + /* For this one, the neutral column changes regardless of + * whether the column does. + */ + *window.cursor_neutral_column.write().await = *column; + } + + Ok(()) + }).await?; + }, + _ => { return Ok(()); }, |