Use cosmic_undo_2 instead of undo_2 for improved compiler support
This commit is contained in:
parent
56f71ef973
commit
38bed64ef1
2 changed files with 8 additions and 9 deletions
|
|
@ -10,6 +10,7 @@ repository = "https://github.com/pop-os/cosmic-text"
|
||||||
rust-version = "1.65"
|
rust-version = "1.65"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
cosmic_undo_2 = { version = "0.2.0", optional = true }
|
||||||
fontdb = { version = "0.15.0", default-features = false }
|
fontdb = { version = "0.15.0", default-features = false }
|
||||||
hashbrown = { version = "0.14.1", optional = true, default-features = false }
|
hashbrown = { version = "0.14.1", optional = true, default-features = false }
|
||||||
libm = "0.2.8"
|
libm = "0.2.8"
|
||||||
|
|
@ -21,7 +22,6 @@ self_cell = "1.0.1"
|
||||||
swash = { version = "0.1.8", optional = true }
|
swash = { version = "0.1.8", optional = true }
|
||||||
syntect = { version = "5.1.0", optional = true }
|
syntect = { version = "5.1.0", optional = true }
|
||||||
sys-locale = { version = "0.3.1", optional = true }
|
sys-locale = { version = "0.3.1", optional = true }
|
||||||
undo_2 = { version = "0.2.0", optional = true }
|
|
||||||
unicode-linebreak = "0.1.5"
|
unicode-linebreak = "0.1.5"
|
||||||
unicode-script = "0.5.5"
|
unicode-script = "0.5.5"
|
||||||
unicode-segmentation = "1.10.1"
|
unicode-segmentation = "1.10.1"
|
||||||
|
|
@ -47,7 +47,7 @@ std = [
|
||||||
"sys-locale",
|
"sys-locale",
|
||||||
"unicode-bidi/std",
|
"unicode-bidi/std",
|
||||||
]
|
]
|
||||||
vi = ["modit", "syntect", "undo_2"]
|
vi = ["modit", "syntect", "cosmic_undo_2"]
|
||||||
wasm-web = ["sys-locale?/js"]
|
wasm-web = ["sys-locale?/js"]
|
||||||
warn_on_missing_glyphs = []
|
warn_on_missing_glyphs = []
|
||||||
fontconfig = ["fontdb/fontconfig", "std"]
|
fontconfig = ["fontdb/fontconfig", "std"]
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
use alloc::string::String;
|
use alloc::string::String;
|
||||||
use core::cmp;
|
use core::cmp;
|
||||||
use modit::{Event, Key, Motion, Parser, TextObject, WordIter};
|
use modit::{Event, Key, Motion, Parser, TextObject, WordIter};
|
||||||
use undo_2::Commands;
|
|
||||||
use unicode_segmentation::UnicodeSegmentation;
|
use unicode_segmentation::UnicodeSegmentation;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
|
@ -11,12 +10,12 @@ use crate::{
|
||||||
|
|
||||||
pub use modit::{ViMode, ViParser};
|
pub use modit::{ViMode, ViParser};
|
||||||
|
|
||||||
fn undo_2_action<E: Edit>(editor: &mut E, action: undo_2::Action<&Change>) {
|
fn undo_2_action<E: Edit>(editor: &mut E, action: cosmic_undo_2::Action<&Change>) {
|
||||||
match action {
|
match action {
|
||||||
undo_2::Action::Do(change) => {
|
cosmic_undo_2::Action::Do(change) => {
|
||||||
editor.apply_change(change);
|
editor.apply_change(change);
|
||||||
}
|
}
|
||||||
undo_2::Action::Undo(change) => {
|
cosmic_undo_2::Action::Undo(change) => {
|
||||||
//TODO: make this more efficient
|
//TODO: make this more efficient
|
||||||
let mut reversed = change.clone();
|
let mut reversed = change.clone();
|
||||||
reversed.reverse();
|
reversed.reverse();
|
||||||
|
|
@ -27,7 +26,7 @@ fn undo_2_action<E: Edit>(editor: &mut E, action: undo_2::Action<&Change>) {
|
||||||
|
|
||||||
fn finish_change<E: Edit>(
|
fn finish_change<E: Edit>(
|
||||||
editor: &mut E,
|
editor: &mut E,
|
||||||
commands: &mut undo_2::Commands<Change>,
|
commands: &mut cosmic_undo_2::Commands<Change>,
|
||||||
changed: &mut bool,
|
changed: &mut bool,
|
||||||
) {
|
) {
|
||||||
//TODO: join changes together
|
//TODO: join changes together
|
||||||
|
|
@ -157,7 +156,7 @@ pub struct ViEditor<'a> {
|
||||||
parser: ViParser,
|
parser: ViParser,
|
||||||
passthrough: bool,
|
passthrough: bool,
|
||||||
search_opt: Option<(String, bool)>,
|
search_opt: Option<(String, bool)>,
|
||||||
commands: Commands<Change>,
|
commands: cosmic_undo_2::Commands<Change>,
|
||||||
changed: bool,
|
changed: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -168,7 +167,7 @@ impl<'a> ViEditor<'a> {
|
||||||
parser: ViParser::new(),
|
parser: ViParser::new(),
|
||||||
passthrough: false,
|
passthrough: false,
|
||||||
search_opt: None,
|
search_opt: None,
|
||||||
commands: Commands::new(),
|
commands: cosmic_undo_2::Commands::new(),
|
||||||
changed: false,
|
changed: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue