update: tuiの文字入力のCtrlブロックを追加
This commit is contained in:
@@ -345,6 +345,10 @@ impl InputBuffer {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn move_start(&mut self) {
|
||||
self.cursor = 0;
|
||||
}
|
||||
|
||||
pub fn move_home(&mut self) {
|
||||
while self.cursor > 0 {
|
||||
if matches!(self.atoms[self.cursor - 1], Atom::Char('\n')) {
|
||||
@@ -921,6 +925,14 @@ mod word_motion_tests {
|
||||
assert_eq!(cursor(&buf), 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn move_start_lands_at_beginning_of_buffer() {
|
||||
let mut buf = buf_from("foo\nbar");
|
||||
assert_eq!(cursor(&buf), 7);
|
||||
buf.move_start();
|
||||
assert_eq!(cursor(&buf), 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn forward_from_start_lands_after_first_word() {
|
||||
let mut buf = buf_from("foo bar baz");
|
||||
|
||||
Reference in New Issue
Block a user