Move cursor motions to new Motion enum, move handling to Buffer

This commit is contained in:
Jeremy Soller 2023-12-15 09:13:14 -07:00
parent 6528e9f804
commit 018a2e9d2a
10 changed files with 567 additions and 505 deletions

View file

@ -2,7 +2,7 @@
use cosmic_text::{
Action, BidiParagraphs, BorrowedWithFontSystem, Buffer, Color, Edit, Editor, FontSystem,
Metrics, SwashCache,
Metrics, Motion, SwashCache,
};
use orbclient::{EventOption, Renderer, Window, WindowFlag};
use std::{env, fs, process, time::Instant};
@ -106,7 +106,7 @@ fn main() {
// Test delete of EGC
{
let cursor = editor.cursor();
editor.action(Action::Previous);
editor.action(Action::Motion(Motion::Previous));
editor.action(Action::Delete);
for c in grapheme.chars() {
editor.action(Action::Insert(c));
@ -130,7 +130,7 @@ fn main() {
{
let cursor = editor.cursor();
editor.action(Action::Enter);
editor.action(Action::Previous);
editor.action(Action::Motion(Motion::Previous));
editor.action(Action::Delete);
assert_eq!(cursor, editor.cursor());
}