mirror of
https://github.com/youwen5/iamb.git
synced 2025-06-20 05:39:52 -07:00
Update modalkit dependencies (#204)
This commit is contained in:
parent
1cb280df8b
commit
1325295d2b
19 changed files with 199 additions and 235 deletions
77
Cargo.lock
generated
77
Cargo.lock
generated
|
@ -136,9 +136,9 @@ checksum = "d301b3b94cb4b2f23d7917810addbbaff90738e0ca2be692bd027e70d7e0330c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "arboard"
|
name = "arboard"
|
||||||
version = "3.2.1"
|
version = "3.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ac57f2b058a76363e357c056e4f74f1945bf734d37b8b3ef49066c4787dde0fc"
|
checksum = "aafb29b107435aa276664c1db8954ac27a6e105cdad3c88287a199eb0e313c08"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clipboard-win",
|
"clipboard-win",
|
||||||
"core-graphics",
|
"core-graphics",
|
||||||
|
@ -319,9 +319,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bitflags"
|
name = "bitflags"
|
||||||
version = "2.4.0"
|
version = "2.4.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635"
|
checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "blake3"
|
name = "blake3"
|
||||||
|
@ -707,7 +707,7 @@ version = "0.27.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df"
|
checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.4.0",
|
"bitflags 2.4.2",
|
||||||
"crossterm_winapi",
|
"crossterm_winapi",
|
||||||
"libc",
|
"libc",
|
||||||
"mio",
|
"mio",
|
||||||
|
@ -1328,9 +1328,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gethostname"
|
name = "gethostname"
|
||||||
version = "0.2.3"
|
version = "0.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c1ebd34e35c46e00bb73e81363248d627782724609fe1b6396f553f68fe3862e"
|
checksum = "bb65d4ba3173c56a500b555b532f72c42e8d1fe64962b518897f8959fae2c177"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"winapi",
|
"winapi",
|
||||||
|
@ -1595,7 +1595,7 @@ name = "iamb"
|
||||||
version = "0.0.9-alpha.1"
|
version = "0.0.9-alpha.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arboard",
|
"arboard",
|
||||||
"bitflags 2.4.0",
|
"bitflags 2.4.2",
|
||||||
"chrono",
|
"chrono",
|
||||||
"clap",
|
"clap",
|
||||||
"comrak",
|
"comrak",
|
||||||
|
@ -1615,8 +1615,10 @@ dependencies = [
|
||||||
"mime",
|
"mime",
|
||||||
"mime_guess",
|
"mime_guess",
|
||||||
"modalkit",
|
"modalkit",
|
||||||
|
"modalkit-ratatui",
|
||||||
"open",
|
"open",
|
||||||
"pretty_assertions",
|
"pretty_assertions",
|
||||||
|
"ratatui",
|
||||||
"ratatui-image",
|
"ratatui-image",
|
||||||
"regex",
|
"regex",
|
||||||
"rpassword",
|
"rpassword",
|
||||||
|
@ -1857,6 +1859,16 @@ dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "keybindings"
|
||||||
|
version = "0.0.1"
|
||||||
|
source = "git+https://github.com/ulyssa/modalkit?rev=5ebcaf1#5ebcaf18289526216a4e852a6c2c9ee03709e717"
|
||||||
|
dependencies = [
|
||||||
|
"textwrap",
|
||||||
|
"unicode-segmentation",
|
||||||
|
"unicode-width",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lazy_static"
|
name = "lazy_static"
|
||||||
version = "0.1.16"
|
version = "0.1.16"
|
||||||
|
@ -2180,9 +2192,9 @@ checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memoffset"
|
name = "memoffset"
|
||||||
version = "0.6.5"
|
version = "0.7.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce"
|
checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
]
|
]
|
||||||
|
@ -2242,28 +2254,39 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "modalkit"
|
name = "modalkit"
|
||||||
version = "0.0.16"
|
version = "0.0.17"
|
||||||
source = "git+https://github.com/ulyssa/modalkit?rev=f9f0517ed6a6152c1eab36d2e71b11f38831d5e6#f9f0517ed6a6152c1eab36d2e71b11f38831d5e6"
|
source = "git+https://github.com/ulyssa/modalkit?rev=5ebcaf1#5ebcaf18289526216a4e852a6c2c9ee03709e717"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anymap2",
|
"anymap2",
|
||||||
"arboard",
|
"arboard",
|
||||||
"bitflags 1.3.2",
|
"bitflags 2.4.2",
|
||||||
"crossterm 0.27.0",
|
"crossterm 0.27.0",
|
||||||
"derive_more",
|
"derive_more",
|
||||||
"intervaltree",
|
"intervaltree",
|
||||||
"libc",
|
"keybindings",
|
||||||
"nom",
|
"nom",
|
||||||
"radix_trie",
|
"radix_trie",
|
||||||
"ratatui",
|
|
||||||
"regex",
|
"regex",
|
||||||
"ropey",
|
"ropey",
|
||||||
"serde",
|
|
||||||
"textwrap",
|
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"unicode-segmentation",
|
"unicode-segmentation",
|
||||||
"unicode-width",
|
"unicode-width",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "modalkit-ratatui"
|
||||||
|
version = "0.0.17"
|
||||||
|
source = "git+https://github.com/ulyssa/modalkit?rev=5ebcaf1#5ebcaf18289526216a4e852a6c2c9ee03709e717"
|
||||||
|
dependencies = [
|
||||||
|
"crossterm 0.27.0",
|
||||||
|
"intervaltree",
|
||||||
|
"libc",
|
||||||
|
"modalkit",
|
||||||
|
"ratatui",
|
||||||
|
"regex",
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "new_debug_unreachable"
|
name = "new_debug_unreachable"
|
||||||
version = "1.0.4"
|
version = "1.0.4"
|
||||||
|
@ -2281,14 +2304,14 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nix"
|
name = "nix"
|
||||||
version = "0.24.3"
|
version = "0.26.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069"
|
checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 1.3.2",
|
"bitflags 1.3.2",
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"libc",
|
"libc",
|
||||||
"memoffset 0.6.5",
|
"memoffset 0.7.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -2869,7 +2892,7 @@ version = "0.23.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2e2e4cd95294a85c3b4446e63ef054eea43e0205b1fd60120c16b74ff7ff96ad"
|
checksum = "2e2e4cd95294a85c3b4446e63ef054eea43e0205b1fd60120c16b74ff7ff96ad"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.4.0",
|
"bitflags 2.4.2",
|
||||||
"cassowary",
|
"cassowary",
|
||||||
"crossterm 0.27.0",
|
"crossterm 0.27.0",
|
||||||
"indoc",
|
"indoc",
|
||||||
|
@ -3195,7 +3218,7 @@ version = "0.38.17"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f25469e9ae0f3d0047ca8b93fc56843f38e6774f0914a107ff8b41be8be8e0b7"
|
checksum = "f25469e9ae0f3d0047ca8b93fc56843f38e6774f0914a107ff8b41be8be8e0b7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.4.0",
|
"bitflags 2.4.2",
|
||||||
"errno",
|
"errno",
|
||||||
"libc",
|
"libc",
|
||||||
"linux-raw-sys 0.4.8",
|
"linux-raw-sys 0.4.8",
|
||||||
|
@ -4516,11 +4539,11 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "x11rb"
|
name = "x11rb"
|
||||||
version = "0.10.1"
|
version = "0.12.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "592b4883219f345e712b3209c62654ebda0bb50887f330cbd018d0f654bfd507"
|
checksum = "b1641b26d4dec61337c35a1b1aaf9e3cba8f46f0b43636c609ab0291a648040a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"gethostname 0.2.3",
|
"gethostname 0.3.0",
|
||||||
"nix",
|
"nix",
|
||||||
"winapi",
|
"winapi",
|
||||||
"winapi-wsapoll",
|
"winapi-wsapoll",
|
||||||
|
@ -4529,9 +4552,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "x11rb-protocol"
|
name = "x11rb-protocol"
|
||||||
version = "0.10.0"
|
version = "0.12.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "56b245751c0ac9db0e006dc812031482784e434630205a93c73cfefcaabeac67"
|
checksum = "82d6c3f9a0fb6701fab8f6cea9b0c0bd5d6876f1f89f7fada07e558077c344bc"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"nix",
|
"nix",
|
||||||
]
|
]
|
||||||
|
|
12
Cargo.toml
12
Cargo.toml
|
@ -23,7 +23,7 @@ default-features = false
|
||||||
features = ["build", "git", "gitcl",]
|
features = ["build", "git", "gitcl",]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
arboard = "3.2.0"
|
arboard = "3.3.0"
|
||||||
bitflags = "^2.3"
|
bitflags = "^2.3"
|
||||||
chrono = "0.4"
|
chrono = "0.4"
|
||||||
clap = {version = "~4.3", features = ["derive"]}
|
clap = {version = "~4.3", features = ["derive"]}
|
||||||
|
@ -40,6 +40,7 @@ markup5ever_rcdom = "0.2.0"
|
||||||
mime = "^0.3.16"
|
mime = "^0.3.16"
|
||||||
mime_guess = "^2.0.4"
|
mime_guess = "^2.0.4"
|
||||||
open = "3.2.0"
|
open = "3.2.0"
|
||||||
|
ratatui = "0.23"
|
||||||
ratatui-image = { version = "0.4.3", features = ["serde"] }
|
ratatui-image = { version = "0.4.3", features = ["serde"] }
|
||||||
regex = "^1.5"
|
regex = "^1.5"
|
||||||
rpassword = "^7.2"
|
rpassword = "^7.2"
|
||||||
|
@ -55,9 +56,14 @@ url = {version = "^2.2.2", features = ["serde"]}
|
||||||
edit = "0.1.4"
|
edit = "0.1.4"
|
||||||
|
|
||||||
[dependencies.modalkit]
|
[dependencies.modalkit]
|
||||||
# version = "0.0.16"
|
version = "0.0.17"
|
||||||
git = "https://github.com/ulyssa/modalkit"
|
git = "https://github.com/ulyssa/modalkit"
|
||||||
rev = "f9f0517ed6a6152c1eab36d2e71b11f38831d5e6"
|
rev = "5ebcaf1"
|
||||||
|
|
||||||
|
[dependencies.modalkit-ratatui]
|
||||||
|
version = "0.0.17"
|
||||||
|
git = "https://github.com/ulyssa/modalkit"
|
||||||
|
rev = "5ebcaf1"
|
||||||
|
|
||||||
[dependencies.matrix-sdk]
|
[dependencies.matrix-sdk]
|
||||||
version = "^0.6.2"
|
version = "^0.6.2"
|
||||||
|
|
39
src/base.rs
39
src/base.rs
|
@ -12,6 +12,12 @@ use std::sync::Arc;
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
|
|
||||||
use emojis::Emoji;
|
use emojis::Emoji;
|
||||||
|
use ratatui::{
|
||||||
|
buffer::Buffer,
|
||||||
|
layout::{Alignment, Rect},
|
||||||
|
text::{Line, Span},
|
||||||
|
widgets::{Paragraph, Widget},
|
||||||
|
};
|
||||||
use ratatui_image::picker::{Picker, ProtocolType};
|
use ratatui_image::picker::{Picker, ProtocolType};
|
||||||
use serde::{
|
use serde::{
|
||||||
de::Error as SerdeError,
|
de::Error as SerdeError,
|
||||||
|
@ -61,7 +67,6 @@ use modalkit::{
|
||||||
ApplicationStore,
|
ApplicationStore,
|
||||||
ApplicationWindowId,
|
ApplicationWindowId,
|
||||||
},
|
},
|
||||||
base::{CommandType, WordStyle},
|
|
||||||
completion::{complete_path, CompletionMap},
|
completion::{complete_path, CompletionMap},
|
||||||
context::EditContext,
|
context::EditContext,
|
||||||
cursor::Cursor,
|
cursor::Cursor,
|
||||||
|
@ -71,16 +76,10 @@ use modalkit::{
|
||||||
env::vim::{
|
env::vim::{
|
||||||
command::{CommandContext, CommandDescription, VimCommand, VimCommandMachine},
|
command::{CommandContext, CommandDescription, VimCommand, VimCommandMachine},
|
||||||
keybindings::VimMachine,
|
keybindings::VimMachine,
|
||||||
VimContext,
|
|
||||||
},
|
|
||||||
input::bindings::SequenceStatus,
|
|
||||||
input::key::TerminalKey,
|
|
||||||
tui::{
|
|
||||||
buffer::Buffer,
|
|
||||||
layout::{Alignment, Rect},
|
|
||||||
text::{Line, Span},
|
|
||||||
widgets::{Paragraph, Widget},
|
|
||||||
},
|
},
|
||||||
|
key::TerminalKey,
|
||||||
|
keybindings::SequenceStatus,
|
||||||
|
prelude::{CommandType, WordStyle},
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::config::ImagePreviewProtocolValues;
|
use crate::config::ImagePreviewProtocolValues;
|
||||||
|
@ -365,7 +364,7 @@ pub enum RoomAction {
|
||||||
Leave(bool),
|
Leave(bool),
|
||||||
|
|
||||||
/// Open the members window.
|
/// Open the members window.
|
||||||
Members(Box<CommandContext<ProgramContext>>),
|
Members(Box<CommandContext>),
|
||||||
|
|
||||||
/// Set a room property.
|
/// Set a room property.
|
||||||
Set(RoomField, String),
|
Set(RoomField, String),
|
||||||
|
@ -460,7 +459,7 @@ impl From<SendAction> for IambAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ApplicationAction for IambAction {
|
impl ApplicationAction for IambAction {
|
||||||
fn is_edit_sequence<C: EditContext>(&self, _: &C) -> SequenceStatus {
|
fn is_edit_sequence(&self, _: &EditContext) -> SequenceStatus {
|
||||||
match self {
|
match self {
|
||||||
IambAction::Homeserver(..) => SequenceStatus::Break,
|
IambAction::Homeserver(..) => SequenceStatus::Break,
|
||||||
IambAction::Message(..) => SequenceStatus::Break,
|
IambAction::Message(..) => SequenceStatus::Break,
|
||||||
|
@ -473,7 +472,7 @@ impl ApplicationAction for IambAction {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_last_action<C: EditContext>(&self, _: &C) -> SequenceStatus {
|
fn is_last_action(&self, _: &EditContext) -> SequenceStatus {
|
||||||
match self {
|
match self {
|
||||||
IambAction::Homeserver(..) => SequenceStatus::Atom,
|
IambAction::Homeserver(..) => SequenceStatus::Atom,
|
||||||
IambAction::Message(..) => SequenceStatus::Atom,
|
IambAction::Message(..) => SequenceStatus::Atom,
|
||||||
|
@ -486,7 +485,7 @@ impl ApplicationAction for IambAction {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_last_selection<C: EditContext>(&self, _: &C) -> SequenceStatus {
|
fn is_last_selection(&self, _: &EditContext) -> SequenceStatus {
|
||||||
match self {
|
match self {
|
||||||
IambAction::Homeserver(..) => SequenceStatus::Ignore,
|
IambAction::Homeserver(..) => SequenceStatus::Ignore,
|
||||||
IambAction::Message(..) => SequenceStatus::Ignore,
|
IambAction::Message(..) => SequenceStatus::Ignore,
|
||||||
|
@ -499,7 +498,7 @@ impl ApplicationAction for IambAction {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_switchable<C: EditContext>(&self, _: &C) -> bool {
|
fn is_switchable(&self, _: &EditContext) -> bool {
|
||||||
match self {
|
match self {
|
||||||
IambAction::Homeserver(..) => false,
|
IambAction::Homeserver(..) => false,
|
||||||
IambAction::Message(..) => false,
|
IambAction::Message(..) => false,
|
||||||
|
@ -528,13 +527,13 @@ impl From<IambAction> for ProgramAction {
|
||||||
/// Alias for program actions.
|
/// Alias for program actions.
|
||||||
pub type ProgramAction = Action<IambInfo>;
|
pub type ProgramAction = Action<IambInfo>;
|
||||||
/// Alias for program context.
|
/// Alias for program context.
|
||||||
pub type ProgramContext = VimContext<IambInfo>;
|
pub type ProgramContext = EditContext;
|
||||||
/// Alias for program keybindings.
|
/// Alias for program keybindings.
|
||||||
pub type Keybindings = VimMachine<TerminalKey, IambInfo>;
|
pub type Keybindings = VimMachine<TerminalKey, IambInfo>;
|
||||||
/// Alias for a program command.
|
/// Alias for a program command.
|
||||||
pub type ProgramCommand = VimCommand<ProgramContext, IambInfo>;
|
pub type ProgramCommand = VimCommand<IambInfo>;
|
||||||
/// Alias for mapped program commands.
|
/// Alias for mapped program commands.
|
||||||
pub type ProgramCommands = VimCommandMachine<ProgramContext, IambInfo>;
|
pub type ProgramCommands = VimCommandMachine<IambInfo>;
|
||||||
/// Alias for program store.
|
/// Alias for program store.
|
||||||
pub type ProgramStore = Store<IambInfo>;
|
pub type ProgramStore = Store<IambInfo>;
|
||||||
/// Alias for shared program store.
|
/// Alias for shared program store.
|
||||||
|
@ -1612,7 +1611,7 @@ fn complete_cmd(
|
||||||
/// Tab completion for the command bar.
|
/// Tab completion for the command bar.
|
||||||
fn complete_cmdbar(text: &EditRope, cursor: &mut Cursor, store: &ProgramStore) -> Vec<String> {
|
fn complete_cmdbar(text: &EditRope, cursor: &mut Cursor, store: &ProgramStore) -> Vec<String> {
|
||||||
let eo = text.cursor_to_offset(cursor);
|
let eo = text.cursor_to_offset(cursor);
|
||||||
let slice = text.slice(0.into(), eo, false);
|
let slice = text.slice(..eo);
|
||||||
let cow = Cow::from(&slice);
|
let cow = Cow::from(&slice);
|
||||||
|
|
||||||
complete_cmd(cow.as_ref(), text, cursor, store)
|
complete_cmd(cow.as_ref(), text, cursor, store)
|
||||||
|
@ -1623,7 +1622,7 @@ pub mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::config::user_style_from_color;
|
use crate::config::user_style_from_color;
|
||||||
use crate::tests::*;
|
use crate::tests::*;
|
||||||
use modalkit::tui::style::Color;
|
use ratatui::style::Color;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_typing_spans() {
|
fn test_typing_spans() {
|
||||||
|
|
|
@ -7,10 +7,9 @@ use std::convert::TryFrom;
|
||||||
use matrix_sdk::ruma::{events::tag::TagName, OwnedUserId};
|
use matrix_sdk::ruma::{events::tag::TagName, OwnedUserId};
|
||||||
|
|
||||||
use modalkit::{
|
use modalkit::{
|
||||||
editing::base::OpenTarget,
|
commands::{CommandError, CommandResult, CommandStep},
|
||||||
env::vim::command::{CommandContext, CommandDescription, OptionType},
|
env::vim::command::{CommandContext, CommandDescription, OptionType},
|
||||||
input::commands::{CommandError, CommandResult, CommandStep},
|
prelude::OpenTarget,
|
||||||
input::InputContext,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::base::{
|
use crate::base::{
|
||||||
|
@ -23,14 +22,13 @@ use crate::base::{
|
||||||
MessageAction,
|
MessageAction,
|
||||||
ProgramCommand,
|
ProgramCommand,
|
||||||
ProgramCommands,
|
ProgramCommands,
|
||||||
ProgramContext,
|
|
||||||
RoomAction,
|
RoomAction,
|
||||||
RoomField,
|
RoomField,
|
||||||
SendAction,
|
SendAction,
|
||||||
VerifyAction,
|
VerifyAction,
|
||||||
};
|
};
|
||||||
|
|
||||||
type ProgContext = CommandContext<ProgramContext>;
|
type ProgContext = CommandContext;
|
||||||
type ProgResult = CommandResult<ProgramCommand>;
|
type ProgResult = CommandResult<ProgramCommand>;
|
||||||
|
|
||||||
/// Convert strings the user types into a tag name.
|
/// Convert strings the user types into a tag name.
|
||||||
|
@ -99,7 +97,7 @@ fn iamb_invite(desc: CommandDescription, ctx: &mut ProgContext) -> ProgResult {
|
||||||
};
|
};
|
||||||
|
|
||||||
let iact = IambAction::from(ract);
|
let iact = IambAction::from(ract);
|
||||||
let step = CommandStep::Continue(iact.into(), ctx.context.take());
|
let step = CommandStep::Continue(iact.into(), ctx.context.clone());
|
||||||
|
|
||||||
return Ok(step);
|
return Ok(step);
|
||||||
}
|
}
|
||||||
|
@ -110,7 +108,7 @@ fn iamb_verify(desc: CommandDescription, ctx: &mut ProgContext) -> ProgResult {
|
||||||
match args.len() {
|
match args.len() {
|
||||||
0 => {
|
0 => {
|
||||||
let open = ctx.switch(OpenTarget::Application(IambId::VerifyList));
|
let open = ctx.switch(OpenTarget::Application(IambId::VerifyList));
|
||||||
let step = CommandStep::Continue(open, ctx.context.take());
|
let step = CommandStep::Continue(open, ctx.context.clone());
|
||||||
|
|
||||||
return Ok(step);
|
return Ok(step);
|
||||||
},
|
},
|
||||||
|
@ -125,7 +123,7 @@ fn iamb_verify(desc: CommandDescription, ctx: &mut ProgContext) -> ProgResult {
|
||||||
"mismatch" => VerifyAction::Mismatch,
|
"mismatch" => VerifyAction::Mismatch,
|
||||||
"request" => {
|
"request" => {
|
||||||
let iact = IambAction::VerifyRequest(args.remove(1));
|
let iact = IambAction::VerifyRequest(args.remove(1));
|
||||||
let step = CommandStep::Continue(iact.into(), ctx.context.take());
|
let step = CommandStep::Continue(iact.into(), ctx.context.clone());
|
||||||
|
|
||||||
return Ok(step);
|
return Ok(step);
|
||||||
},
|
},
|
||||||
|
@ -133,7 +131,7 @@ fn iamb_verify(desc: CommandDescription, ctx: &mut ProgContext) -> ProgResult {
|
||||||
};
|
};
|
||||||
|
|
||||||
let vact = IambAction::Verify(act, args.remove(1));
|
let vact = IambAction::Verify(act, args.remove(1));
|
||||||
let step = CommandStep::Continue(vact.into(), ctx.context.take());
|
let step = CommandStep::Continue(vact.into(), ctx.context.clone());
|
||||||
|
|
||||||
return Ok(step);
|
return Ok(step);
|
||||||
},
|
},
|
||||||
|
@ -149,7 +147,7 @@ fn iamb_dms(desc: CommandDescription, ctx: &mut ProgContext) -> ProgResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
let open = ctx.switch(OpenTarget::Application(IambId::DirectList));
|
let open = ctx.switch(OpenTarget::Application(IambId::DirectList));
|
||||||
let step = CommandStep::Continue(open, ctx.context.take());
|
let step = CommandStep::Continue(open, ctx.context.clone());
|
||||||
|
|
||||||
return Ok(step);
|
return Ok(step);
|
||||||
}
|
}
|
||||||
|
@ -160,7 +158,7 @@ fn iamb_members(desc: CommandDescription, ctx: &mut ProgContext) -> ProgResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
let open = IambAction::Room(RoomAction::Members(ctx.clone().into()));
|
let open = IambAction::Room(RoomAction::Members(ctx.clone().into()));
|
||||||
let step = CommandStep::Continue(open.into(), ctx.context.take());
|
let step = CommandStep::Continue(open.into(), ctx.context.clone());
|
||||||
|
|
||||||
return Ok(step);
|
return Ok(step);
|
||||||
}
|
}
|
||||||
|
@ -171,7 +169,7 @@ fn iamb_leave(desc: CommandDescription, ctx: &mut ProgContext) -> ProgResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
let leave = IambAction::Room(RoomAction::Leave(desc.bang));
|
let leave = IambAction::Room(RoomAction::Leave(desc.bang));
|
||||||
let step = CommandStep::Continue(leave.into(), ctx.context.take());
|
let step = CommandStep::Continue(leave.into(), ctx.context.clone());
|
||||||
|
|
||||||
return Ok(step);
|
return Ok(step);
|
||||||
}
|
}
|
||||||
|
@ -182,7 +180,7 @@ fn iamb_cancel(desc: CommandDescription, ctx: &mut ProgContext) -> ProgResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
let mact = IambAction::from(MessageAction::Cancel(desc.bang));
|
let mact = IambAction::from(MessageAction::Cancel(desc.bang));
|
||||||
let step = CommandStep::Continue(mact.into(), ctx.context.take());
|
let step = CommandStep::Continue(mact.into(), ctx.context.clone());
|
||||||
|
|
||||||
return Ok(step);
|
return Ok(step);
|
||||||
}
|
}
|
||||||
|
@ -193,7 +191,7 @@ fn iamb_edit(desc: CommandDescription, ctx: &mut ProgContext) -> ProgResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
let mact = IambAction::from(MessageAction::Edit);
|
let mact = IambAction::from(MessageAction::Edit);
|
||||||
let step = CommandStep::Continue(mact.into(), ctx.context.take());
|
let step = CommandStep::Continue(mact.into(), ctx.context.clone());
|
||||||
|
|
||||||
return Ok(step);
|
return Ok(step);
|
||||||
}
|
}
|
||||||
|
@ -209,7 +207,7 @@ fn iamb_react(desc: CommandDescription, ctx: &mut ProgContext) -> ProgResult {
|
||||||
|
|
||||||
if let Some(emoji) = emojis::get(k).or_else(|| emojis::get_by_shortcode(k)) {
|
if let Some(emoji) = emojis::get(k).or_else(|| emojis::get_by_shortcode(k)) {
|
||||||
let mact = IambAction::from(MessageAction::React(emoji.to_string()));
|
let mact = IambAction::from(MessageAction::React(emoji.to_string()));
|
||||||
let step = CommandStep::Continue(mact.into(), ctx.context.take());
|
let step = CommandStep::Continue(mact.into(), ctx.context.clone());
|
||||||
|
|
||||||
return Ok(step);
|
return Ok(step);
|
||||||
} else {
|
} else {
|
||||||
|
@ -240,7 +238,7 @@ fn iamb_unreact(desc: CommandDescription, ctx: &mut ProgContext) -> ProgResult {
|
||||||
IambAction::from(MessageAction::Unreact(None))
|
IambAction::from(MessageAction::Unreact(None))
|
||||||
};
|
};
|
||||||
|
|
||||||
let step = CommandStep::Continue(mact.into(), ctx.context.take());
|
let step = CommandStep::Continue(mact.into(), ctx.context.clone());
|
||||||
|
|
||||||
return Ok(step);
|
return Ok(step);
|
||||||
}
|
}
|
||||||
|
@ -254,7 +252,7 @@ fn iamb_redact(desc: CommandDescription, ctx: &mut ProgContext) -> ProgResult {
|
||||||
|
|
||||||
let reason = args.into_iter().next();
|
let reason = args.into_iter().next();
|
||||||
let ract = IambAction::from(MessageAction::Redact(reason, desc.bang));
|
let ract = IambAction::from(MessageAction::Redact(reason, desc.bang));
|
||||||
let step = CommandStep::Continue(ract.into(), ctx.context.take());
|
let step = CommandStep::Continue(ract.into(), ctx.context.clone());
|
||||||
|
|
||||||
return Ok(step);
|
return Ok(step);
|
||||||
}
|
}
|
||||||
|
@ -265,7 +263,7 @@ fn iamb_reply(desc: CommandDescription, ctx: &mut ProgContext) -> ProgResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
let ract = IambAction::from(MessageAction::Reply);
|
let ract = IambAction::from(MessageAction::Reply);
|
||||||
let step = CommandStep::Continue(ract.into(), ctx.context.take());
|
let step = CommandStep::Continue(ract.into(), ctx.context.clone());
|
||||||
|
|
||||||
return Ok(step);
|
return Ok(step);
|
||||||
}
|
}
|
||||||
|
@ -276,7 +274,7 @@ fn iamb_editor(desc: CommandDescription, ctx: &mut ProgContext) -> ProgResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
let sact = IambAction::from(SendAction::SubmitFromEditor);
|
let sact = IambAction::from(SendAction::SubmitFromEditor);
|
||||||
let step = CommandStep::Continue(sact.into(), ctx.context.take());
|
let step = CommandStep::Continue(sact.into(), ctx.context.clone());
|
||||||
|
|
||||||
return Ok(step);
|
return Ok(step);
|
||||||
}
|
}
|
||||||
|
@ -287,7 +285,7 @@ fn iamb_rooms(desc: CommandDescription, ctx: &mut ProgContext) -> ProgResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
let open = ctx.switch(OpenTarget::Application(IambId::RoomList));
|
let open = ctx.switch(OpenTarget::Application(IambId::RoomList));
|
||||||
let step = CommandStep::Continue(open, ctx.context.take());
|
let step = CommandStep::Continue(open, ctx.context.clone());
|
||||||
|
|
||||||
return Ok(step);
|
return Ok(step);
|
||||||
}
|
}
|
||||||
|
@ -298,7 +296,7 @@ fn iamb_chats(desc: CommandDescription, ctx: &mut ProgContext) -> ProgResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
let open = ctx.switch(OpenTarget::Application(IambId::ChatList));
|
let open = ctx.switch(OpenTarget::Application(IambId::ChatList));
|
||||||
let step = CommandStep::Continue(open, ctx.context.take());
|
let step = CommandStep::Continue(open, ctx.context.clone());
|
||||||
|
|
||||||
return Ok(step);
|
return Ok(step);
|
||||||
}
|
}
|
||||||
|
@ -309,7 +307,7 @@ fn iamb_spaces(desc: CommandDescription, ctx: &mut ProgContext) -> ProgResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
let open = ctx.switch(OpenTarget::Application(IambId::SpaceList));
|
let open = ctx.switch(OpenTarget::Application(IambId::SpaceList));
|
||||||
let step = CommandStep::Continue(open, ctx.context.take());
|
let step = CommandStep::Continue(open, ctx.context.clone());
|
||||||
|
|
||||||
return Ok(step);
|
return Ok(step);
|
||||||
}
|
}
|
||||||
|
@ -320,7 +318,7 @@ fn iamb_welcome(desc: CommandDescription, ctx: &mut ProgContext) -> ProgResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
let open = ctx.switch(OpenTarget::Application(IambId::Welcome));
|
let open = ctx.switch(OpenTarget::Application(IambId::Welcome));
|
||||||
let step = CommandStep::Continue(open, ctx.context.take());
|
let step = CommandStep::Continue(open, ctx.context.clone());
|
||||||
|
|
||||||
return Ok(step);
|
return Ok(step);
|
||||||
}
|
}
|
||||||
|
@ -333,7 +331,7 @@ fn iamb_join(desc: CommandDescription, ctx: &mut ProgContext) -> ProgResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
let open = ctx.switch(args.remove(0));
|
let open = ctx.switch(args.remove(0));
|
||||||
let step = CommandStep::Continue(open, ctx.context.take());
|
let step = CommandStep::Continue(open, ctx.context.clone());
|
||||||
|
|
||||||
return Ok(step);
|
return Ok(step);
|
||||||
}
|
}
|
||||||
|
@ -380,7 +378,7 @@ fn iamb_create(desc: CommandDescription, ctx: &mut ProgContext) -> ProgResult {
|
||||||
|
|
||||||
let hact = HomeserverAction::CreateRoom(alias, ct, flags);
|
let hact = HomeserverAction::CreateRoom(alias, ct, flags);
|
||||||
let iact = IambAction::from(hact);
|
let iact = IambAction::from(hact);
|
||||||
let step = CommandStep::Continue(iact.into(), ctx.context.take());
|
let step = CommandStep::Continue(iact.into(), ctx.context.clone());
|
||||||
|
|
||||||
return Ok(step);
|
return Ok(step);
|
||||||
}
|
}
|
||||||
|
@ -427,7 +425,7 @@ fn iamb_room(desc: CommandDescription, ctx: &mut ProgContext) -> ProgResult {
|
||||||
_ => return Result::Err(CommandError::InvalidArgument),
|
_ => return Result::Err(CommandError::InvalidArgument),
|
||||||
};
|
};
|
||||||
|
|
||||||
let step = CommandStep::Continue(act.into(), ctx.context.take());
|
let step = CommandStep::Continue(act.into(), ctx.context.clone());
|
||||||
|
|
||||||
return Ok(step);
|
return Ok(step);
|
||||||
}
|
}
|
||||||
|
@ -441,7 +439,7 @@ fn iamb_upload(desc: CommandDescription, ctx: &mut ProgContext) -> ProgResult {
|
||||||
|
|
||||||
let sact = SendAction::Upload(args.remove(0));
|
let sact = SendAction::Upload(args.remove(0));
|
||||||
let iact = IambAction::from(sact);
|
let iact = IambAction::from(sact);
|
||||||
let step = CommandStep::Continue(iact.into(), ctx.context.take());
|
let step = CommandStep::Continue(iact.into(), ctx.context.clone());
|
||||||
|
|
||||||
return Ok(step);
|
return Ok(step);
|
||||||
}
|
}
|
||||||
|
@ -459,7 +457,7 @@ fn iamb_download(desc: CommandDescription, ctx: &mut ProgContext) -> ProgResult
|
||||||
};
|
};
|
||||||
let mact = MessageAction::Download(args.pop(), flags);
|
let mact = MessageAction::Download(args.pop(), flags);
|
||||||
let iact = IambAction::from(mact);
|
let iact = IambAction::from(mact);
|
||||||
let step = CommandStep::Continue(iact.into(), ctx.context.take());
|
let step = CommandStep::Continue(iact.into(), ctx.context.clone());
|
||||||
|
|
||||||
return Ok(step);
|
return Ok(step);
|
||||||
}
|
}
|
||||||
|
@ -477,7 +475,7 @@ fn iamb_open(desc: CommandDescription, ctx: &mut ProgContext) -> ProgResult {
|
||||||
};
|
};
|
||||||
let mact = MessageAction::Download(args.pop(), flags);
|
let mact = MessageAction::Download(args.pop(), flags);
|
||||||
let iact = IambAction::from(mact);
|
let iact = IambAction::from(mact);
|
||||||
let step = CommandStep::Continue(iact.into(), ctx.context.take());
|
let step = CommandStep::Continue(iact.into(), ctx.context.clone());
|
||||||
|
|
||||||
return Ok(step);
|
return Ok(step);
|
||||||
}
|
}
|
||||||
|
@ -490,7 +488,7 @@ fn iamb_logout(desc: CommandDescription, ctx: &mut ProgContext) -> ProgResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
let iact = IambAction::from(HomeserverAction::Logout(args[0].clone(), desc.bang));
|
let iact = IambAction::from(HomeserverAction::Logout(args[0].clone(), desc.bang));
|
||||||
let step = CommandStep::Continue(iact.into(), ctx.context.take());
|
let step = CommandStep::Continue(iact.into(), ctx.context.clone());
|
||||||
|
|
||||||
return Ok(step);
|
return Ok(step);
|
||||||
}
|
}
|
||||||
|
@ -607,11 +605,12 @@ mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use matrix_sdk::ruma::user_id;
|
use matrix_sdk::ruma::user_id;
|
||||||
use modalkit::editing::action::WindowAction;
|
use modalkit::editing::action::WindowAction;
|
||||||
|
use modalkit::editing::context::EditContext;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_cmd_verify() {
|
fn test_cmd_verify() {
|
||||||
let mut cmds = setup_commands();
|
let mut cmds = setup_commands();
|
||||||
let ctx = ProgramContext::default();
|
let ctx = EditContext::default();
|
||||||
|
|
||||||
let res = cmds.input_cmd(":verify", ctx.clone()).unwrap();
|
let res = cmds.input_cmd(":verify", ctx.clone()).unwrap();
|
||||||
let act = WindowAction::Switch(OpenTarget::Application(IambId::VerifyList));
|
let act = WindowAction::Switch(OpenTarget::Application(IambId::VerifyList));
|
||||||
|
@ -658,7 +657,7 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_cmd_join() {
|
fn test_cmd_join() {
|
||||||
let mut cmds = setup_commands();
|
let mut cmds = setup_commands();
|
||||||
let ctx = ProgramContext::default();
|
let ctx = EditContext::default();
|
||||||
|
|
||||||
let res = cmds.input_cmd("join #foobar:example.com", ctx.clone()).unwrap();
|
let res = cmds.input_cmd("join #foobar:example.com", ctx.clone()).unwrap();
|
||||||
let act = WindowAction::Switch(OpenTarget::Name("#foobar:example.com".into()));
|
let act = WindowAction::Switch(OpenTarget::Name("#foobar:example.com".into()));
|
||||||
|
@ -678,7 +677,7 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_cmd_room_invalid() {
|
fn test_cmd_room_invalid() {
|
||||||
let mut cmds = setup_commands();
|
let mut cmds = setup_commands();
|
||||||
let ctx = ProgramContext::default();
|
let ctx = EditContext::default();
|
||||||
|
|
||||||
let res = cmds.input_cmd("room", ctx.clone());
|
let res = cmds.input_cmd("room", ctx.clone());
|
||||||
assert_eq!(res, Err(CommandError::InvalidArgument));
|
assert_eq!(res, Err(CommandError::InvalidArgument));
|
||||||
|
@ -693,7 +692,7 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_cmd_room_topic_set() {
|
fn test_cmd_room_topic_set() {
|
||||||
let mut cmds = setup_commands();
|
let mut cmds = setup_commands();
|
||||||
let ctx = ProgramContext::default();
|
let ctx = EditContext::default();
|
||||||
|
|
||||||
let res = cmds
|
let res = cmds
|
||||||
.input_cmd("room topic set \"Lots of fun discussion!\"", ctx.clone())
|
.input_cmd("room topic set \"Lots of fun discussion!\"", ctx.clone())
|
||||||
|
@ -724,7 +723,7 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_cmd_room_name_invalid() {
|
fn test_cmd_room_name_invalid() {
|
||||||
let mut cmds = setup_commands();
|
let mut cmds = setup_commands();
|
||||||
let ctx = ProgramContext::default();
|
let ctx = EditContext::default();
|
||||||
|
|
||||||
let res = cmds.input_cmd("room name", ctx.clone());
|
let res = cmds.input_cmd("room name", ctx.clone());
|
||||||
assert_eq!(res, Err(CommandError::InvalidArgument));
|
assert_eq!(res, Err(CommandError::InvalidArgument));
|
||||||
|
@ -736,7 +735,7 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_cmd_room_name_set() {
|
fn test_cmd_room_name_set() {
|
||||||
let mut cmds = setup_commands();
|
let mut cmds = setup_commands();
|
||||||
let ctx = ProgramContext::default();
|
let ctx = EditContext::default();
|
||||||
|
|
||||||
let res = cmds.input_cmd("room name set Development", ctx.clone()).unwrap();
|
let res = cmds.input_cmd("room name set Development", ctx.clone()).unwrap();
|
||||||
let act = RoomAction::Set(RoomField::Name, "Development".into());
|
let act = RoomAction::Set(RoomField::Name, "Development".into());
|
||||||
|
@ -755,7 +754,7 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_cmd_room_name_unset() {
|
fn test_cmd_room_name_unset() {
|
||||||
let mut cmds = setup_commands();
|
let mut cmds = setup_commands();
|
||||||
let ctx = ProgramContext::default();
|
let ctx = EditContext::default();
|
||||||
|
|
||||||
let res = cmds.input_cmd("room name unset", ctx.clone()).unwrap();
|
let res = cmds.input_cmd("room name unset", ctx.clone()).unwrap();
|
||||||
let act = RoomAction::Unset(RoomField::Name);
|
let act = RoomAction::Unset(RoomField::Name);
|
||||||
|
@ -768,7 +767,7 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_cmd_room_tag_set() {
|
fn test_cmd_room_tag_set() {
|
||||||
let mut cmds = setup_commands();
|
let mut cmds = setup_commands();
|
||||||
let ctx = ProgramContext::default();
|
let ctx = EditContext::default();
|
||||||
|
|
||||||
let res = cmds.input_cmd("room tag set favourite", ctx.clone()).unwrap();
|
let res = cmds.input_cmd("room tag set favourite", ctx.clone()).unwrap();
|
||||||
let act = RoomAction::Set(RoomField::Tag(TagName::Favorite), "".into());
|
let act = RoomAction::Set(RoomField::Tag(TagName::Favorite), "".into());
|
||||||
|
@ -837,7 +836,7 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_cmd_room_tag_unset() {
|
fn test_cmd_room_tag_unset() {
|
||||||
let mut cmds = setup_commands();
|
let mut cmds = setup_commands();
|
||||||
let ctx = ProgramContext::default();
|
let ctx = EditContext::default();
|
||||||
|
|
||||||
let res = cmds.input_cmd("room tag unset favourite", ctx.clone()).unwrap();
|
let res = cmds.input_cmd("room tag unset favourite", ctx.clone()).unwrap();
|
||||||
let act = RoomAction::Unset(RoomField::Tag(TagName::Favorite));
|
let act = RoomAction::Unset(RoomField::Tag(TagName::Favorite));
|
||||||
|
@ -902,7 +901,7 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_cmd_invite() {
|
fn test_cmd_invite() {
|
||||||
let mut cmds = setup_commands();
|
let mut cmds = setup_commands();
|
||||||
let ctx = ProgramContext::default();
|
let ctx = EditContext::default();
|
||||||
|
|
||||||
let res = cmds.input_cmd("invite accept", ctx.clone()).unwrap();
|
let res = cmds.input_cmd("invite accept", ctx.clone()).unwrap();
|
||||||
let act = IambAction::Room(RoomAction::InviteAccept);
|
let act = IambAction::Room(RoomAction::InviteAccept);
|
||||||
|
@ -939,7 +938,7 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_cmd_redact() {
|
fn test_cmd_redact() {
|
||||||
let mut cmds = setup_commands();
|
let mut cmds = setup_commands();
|
||||||
let ctx = ProgramContext::default();
|
let ctx = EditContext::default();
|
||||||
|
|
||||||
let res = cmds.input_cmd("redact", ctx.clone()).unwrap();
|
let res = cmds.input_cmd("redact", ctx.clone()).unwrap();
|
||||||
let act = IambAction::Message(MessageAction::Redact(None, false));
|
let act = IambAction::Message(MessageAction::Redact(None, false));
|
||||||
|
|
|
@ -11,16 +11,13 @@ use std::process;
|
||||||
|
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use matrix_sdk::ruma::{OwnedRoomAliasId, OwnedRoomId, OwnedUserId, UserId};
|
use matrix_sdk::ruma::{OwnedRoomAliasId, OwnedRoomId, OwnedUserId, UserId};
|
||||||
|
use ratatui::style::{Color, Modifier as StyleModifier, Style};
|
||||||
|
use ratatui::text::Span;
|
||||||
use ratatui_image::picker::ProtocolType;
|
use ratatui_image::picker::ProtocolType;
|
||||||
use serde::{de::Error as SerdeError, de::Visitor, Deserialize, Deserializer};
|
use serde::{de::Error as SerdeError, de::Visitor, Deserialize, Deserializer};
|
||||||
use tracing::Level;
|
use tracing::Level;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
use modalkit::tui::{
|
|
||||||
style::{Color, Modifier as StyleModifier, Style},
|
|
||||||
text::Span,
|
|
||||||
};
|
|
||||||
|
|
||||||
use super::base::{IambId, RoomInfo, SortColumn, SortFieldRoom, SortFieldUser, SortOrder};
|
use super::base::{IambId, RoomInfo, SortColumn, SortFieldRoom, SortFieldUser, SortOrder};
|
||||||
|
|
||||||
macro_rules! usage {
|
macro_rules! usage {
|
||||||
|
|
|
@ -6,8 +6,8 @@ use modalkit::{
|
||||||
editing::action::WindowAction,
|
editing::action::WindowAction,
|
||||||
env::vim::keybindings::{InputStep, VimBindings},
|
env::vim::keybindings::{InputStep, VimBindings},
|
||||||
env::vim::VimMode,
|
env::vim::VimMode,
|
||||||
input::bindings::{EdgeEvent, EdgeRepeat, InputBindings},
|
key::TerminalKey,
|
||||||
input::key::TerminalKey,
|
keybindings::{EdgeEvent, EdgeRepeat, InputBindings},
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::base::{IambAction, IambInfo, Keybindings, MATRIX_ID_WORD};
|
use crate::base::{IambAction, IambInfo, Keybindings, MATRIX_ID_WORD};
|
||||||
|
|
28
src/main.rs
28
src/main.rs
|
@ -54,7 +54,7 @@ use modalkit::crossterm::{
|
||||||
terminal::{EnterAlternateScreen, LeaveAlternateScreen, SetTitle},
|
terminal::{EnterAlternateScreen, LeaveAlternateScreen, SetTitle},
|
||||||
};
|
};
|
||||||
|
|
||||||
use modalkit::tui::{
|
use ratatui::{
|
||||||
backend::CrosstermBackend,
|
backend::CrosstermBackend,
|
||||||
layout::Rect,
|
layout::Rect,
|
||||||
style::{Color, Style},
|
style::{Color, Style},
|
||||||
|
@ -116,20 +116,26 @@ use modalkit::{
|
||||||
WindowAction,
|
WindowAction,
|
||||||
WindowContainer,
|
WindowContainer,
|
||||||
},
|
},
|
||||||
base::{CloseFlags, MoveDir1D, OpenTarget, RepeatType, TabTarget},
|
|
||||||
context::Resolve,
|
context::Resolve,
|
||||||
key::KeyManager,
|
key::KeyManager,
|
||||||
store::Store,
|
store::Store,
|
||||||
},
|
},
|
||||||
input::{bindings::BindingMachine, dialog::Pager, dialog::PromptYesNo, key::TerminalKey},
|
key::TerminalKey,
|
||||||
widgets::{
|
keybindings::{
|
||||||
cmdbar::CommandBarState,
|
dialog::{Pager, PromptYesNo},
|
||||||
screen::{FocusList, Screen, ScreenState, TabLayoutDescription},
|
BindingMachine,
|
||||||
windows::WindowLayoutDescription,
|
|
||||||
TerminalCursor,
|
|
||||||
TerminalExtOps,
|
|
||||||
Window,
|
|
||||||
},
|
},
|
||||||
|
prelude::*,
|
||||||
|
ui::FocusList,
|
||||||
|
};
|
||||||
|
|
||||||
|
use modalkit_ratatui::{
|
||||||
|
cmdbar::CommandBarState,
|
||||||
|
screen::{Screen, ScreenState, TabLayoutDescription},
|
||||||
|
windows::WindowLayoutDescription,
|
||||||
|
TerminalCursor,
|
||||||
|
TerminalExtOps,
|
||||||
|
Window,
|
||||||
};
|
};
|
||||||
|
|
||||||
fn config_tab_to_desc(
|
fn config_tab_to_desc(
|
||||||
|
@ -229,7 +235,7 @@ struct Application {
|
||||||
worker: Requester,
|
worker: Requester,
|
||||||
|
|
||||||
/// Mapped keybindings.
|
/// Mapped keybindings.
|
||||||
bindings: KeyManager<TerminalKey, ProgramAction, RepeatType, ProgramContext>,
|
bindings: KeyManager<TerminalKey, ProgramAction, RepeatType>,
|
||||||
|
|
||||||
/// Pending actions to run.
|
/// Pending actions to run.
|
||||||
actstack: VecDeque<(ProgramAction, ProgramContext)>,
|
actstack: VecDeque<(ProgramAction, ProgramContext)>,
|
||||||
|
|
|
@ -26,7 +26,7 @@ use html5ever::{
|
||||||
tendril::{StrTendril, TendrilSink},
|
tendril::{StrTendril, TendrilSink},
|
||||||
};
|
};
|
||||||
|
|
||||||
use modalkit::tui::{
|
use ratatui::{
|
||||||
layout::Alignment,
|
layout::Alignment,
|
||||||
style::{Color, Modifier as StyleModifier, Style},
|
style::{Color, Modifier as StyleModifier, Style},
|
||||||
symbols::line,
|
symbols::line,
|
||||||
|
|
|
@ -44,13 +44,14 @@ use matrix_sdk::ruma::{
|
||||||
UInt,
|
UInt,
|
||||||
};
|
};
|
||||||
|
|
||||||
use modalkit::tui::{
|
use ratatui::{
|
||||||
style::{Modifier as StyleModifier, Style},
|
style::{Modifier as StyleModifier, Style},
|
||||||
symbols::line::THICK_VERTICAL,
|
symbols::line::THICK_VERTICAL,
|
||||||
text::{Line, Span, Text},
|
text::{Line, Span, Text},
|
||||||
};
|
};
|
||||||
|
|
||||||
use modalkit::editing::{base::ViewportContext, cursor::Cursor};
|
use modalkit::editing::cursor::Cursor;
|
||||||
|
use modalkit::prelude::*;
|
||||||
use ratatui_image::protocol::Protocol;
|
use ratatui_image::protocol::Protocol;
|
||||||
|
|
||||||
use crate::config::ImagePreviewSize;
|
use crate::config::ImagePreviewSize;
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
//! contents).
|
//! contents).
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
|
||||||
use modalkit::tui::layout::Alignment;
|
use ratatui::layout::Alignment;
|
||||||
use modalkit::tui::style::Style;
|
use ratatui::style::Style;
|
||||||
use modalkit::tui::text::{Line, Span, Text};
|
use ratatui::text::{Line, Span, Text};
|
||||||
use unicode_segmentation::UnicodeSegmentation;
|
use unicode_segmentation::UnicodeSegmentation;
|
||||||
use unicode_width::UnicodeWidthStr;
|
use unicode_width::UnicodeWidthStr;
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ use matrix_sdk::{
|
||||||
},
|
},
|
||||||
Media,
|
Media,
|
||||||
};
|
};
|
||||||
use modalkit::tui::layout::Rect;
|
use ratatui::layout::Rect;
|
||||||
use ratatui_image::Resize;
|
use ratatui_image::Resize;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
|
|
@ -15,7 +15,7 @@ use matrix_sdk::ruma::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use modalkit::tui::style::{Color, Style};
|
use ratatui::style::{Color, Style};
|
||||||
use tokio::sync::mpsc::unbounded_channel;
|
use tokio::sync::mpsc::unbounded_channel;
|
||||||
use tracing::Level;
|
use tracing::Level;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
|
@ -4,8 +4,8 @@ use std::borrow::Cow;
|
||||||
use unicode_segmentation::UnicodeSegmentation;
|
use unicode_segmentation::UnicodeSegmentation;
|
||||||
use unicode_width::UnicodeWidthStr;
|
use unicode_width::UnicodeWidthStr;
|
||||||
|
|
||||||
use modalkit::tui::style::Style;
|
use ratatui::style::Style;
|
||||||
use modalkit::tui::text::{Line, Span, Text};
|
use ratatui::text::{Line, Span, Text};
|
||||||
|
|
||||||
pub fn split_cow(cow: Cow<'_, str>, idx: usize) -> (Cow<'_, str>, Cow<'_, str>) {
|
pub fn split_cow(cow: Cow<'_, str>, idx: usize) -> (Cow<'_, str>, Cow<'_, str>) {
|
||||||
match cow {
|
match cow {
|
||||||
|
|
|
@ -24,7 +24,7 @@ use matrix_sdk::{
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
use modalkit::tui::{
|
use ratatui::{
|
||||||
buffer::Buffer,
|
buffer::Buffer,
|
||||||
layout::{Alignment, Rect},
|
layout::{Alignment, Rect},
|
||||||
style::{Modifier as StyleModifier, Style},
|
style::{Modifier as StyleModifier, Style},
|
||||||
|
@ -48,25 +48,17 @@ use modalkit::{
|
||||||
UIError,
|
UIError,
|
||||||
WindowAction,
|
WindowAction,
|
||||||
},
|
},
|
||||||
base::{
|
|
||||||
CloseFlags,
|
|
||||||
MoveDir1D,
|
|
||||||
OpenTarget,
|
|
||||||
PositionList,
|
|
||||||
ScrollStyle,
|
|
||||||
ViewportContext,
|
|
||||||
WordStyle,
|
|
||||||
WriteFlags,
|
|
||||||
},
|
|
||||||
completion::CompletionList,
|
completion::CompletionList,
|
||||||
},
|
},
|
||||||
widgets::{
|
prelude::*,
|
||||||
list::{List, ListCursor, ListItem, ListState},
|
};
|
||||||
TermOffset,
|
|
||||||
TerminalCursor,
|
use modalkit_ratatui::{
|
||||||
Window,
|
list::{List, ListCursor, ListItem, ListState},
|
||||||
WindowOps,
|
TermOffset,
|
||||||
},
|
TerminalCursor,
|
||||||
|
Window,
|
||||||
|
WindowOps,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::base::{
|
use crate::base::{
|
||||||
|
@ -281,7 +273,6 @@ fn room_prompt(
|
||||||
|
|
||||||
Err(err)
|
Err(err)
|
||||||
},
|
},
|
||||||
_ => Err(EditError::Unimplemented("unknown prompt action".to_string())),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1332,7 +1323,6 @@ impl Promptable<ProgramContext, ProgramStore, IambInfo> for VerifyItem {
|
||||||
|
|
||||||
Err(err)
|
Err(err)
|
||||||
},
|
},
|
||||||
_ => Err(EditError::Unimplemented("unknown prompt action".to_string())),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1428,7 +1418,6 @@ impl Promptable<ProgramContext, ProgramStore, IambInfo> for MemberItem {
|
||||||
|
|
||||||
Err(err)
|
Err(err)
|
||||||
},
|
},
|
||||||
_ => Err(EditError::Unimplemented("unknown prompt action".to_string())),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,17 +31,20 @@ use matrix_sdk::{
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
use modalkit::{
|
use ratatui::{
|
||||||
input::dialog::{MultiChoice, MultiChoiceItem, PromptYesNo},
|
buffer::Buffer,
|
||||||
tui::{
|
layout::Rect,
|
||||||
buffer::Buffer,
|
text::{Line, Span},
|
||||||
layout::Rect,
|
widgets::{Paragraph, StatefulWidget, Widget},
|
||||||
text::{Line, Span},
|
};
|
||||||
widgets::{Paragraph, StatefulWidget, Widget},
|
|
||||||
},
|
use modalkit::keybindings::dialog::{MultiChoice, MultiChoiceItem, PromptYesNo};
|
||||||
widgets::textbox::{TextBox, TextBoxState},
|
|
||||||
widgets::TerminalCursor,
|
use modalkit_ratatui::{
|
||||||
widgets::{PromptActions, WindowOps},
|
textbox::{TextBox, TextBoxState},
|
||||||
|
PromptActions,
|
||||||
|
TerminalCursor,
|
||||||
|
WindowOps,
|
||||||
};
|
};
|
||||||
|
|
||||||
use modalkit::editing::{
|
use modalkit::editing::{
|
||||||
|
@ -59,12 +62,12 @@ use modalkit::editing::{
|
||||||
Scrollable,
|
Scrollable,
|
||||||
UIError,
|
UIError,
|
||||||
},
|
},
|
||||||
base::{CloseFlags, Count, MoveDir1D, PositionList, ScrollStyle, WordStyle, WriteFlags},
|
|
||||||
completion::CompletionList,
|
completion::CompletionList,
|
||||||
context::Resolve,
|
context::Resolve,
|
||||||
history::{self, HistoryList},
|
history::{self, HistoryList},
|
||||||
rope::EditRope,
|
rope::EditRope,
|
||||||
};
|
};
|
||||||
|
use modalkit::prelude::*;
|
||||||
|
|
||||||
use crate::base::{
|
use crate::base::{
|
||||||
DownloadFlags,
|
DownloadFlags,
|
||||||
|
@ -811,7 +814,6 @@ impl Promptable<ProgramContext, ProgramStore, IambInfo> for ChatState {
|
||||||
PromptAction::Recall(dir, count, prefixed) => {
|
PromptAction::Recall(dir, count, prefixed) => {
|
||||||
self.recall(dir, count, *prefixed, ctx, store)
|
self.recall(dir, count, *prefixed, ctx, store)
|
||||||
},
|
},
|
||||||
_ => Err(EditError::Unimplemented("unknown prompt action".to_string())),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ use matrix_sdk::{
|
||||||
DisplayName,
|
DisplayName,
|
||||||
};
|
};
|
||||||
|
|
||||||
use modalkit::tui::{
|
use ratatui::{
|
||||||
buffer::Buffer,
|
buffer::Buffer,
|
||||||
layout::{Alignment, Rect},
|
layout::{Alignment, Rect},
|
||||||
style::{Modifier as StyleModifier, Style},
|
style::{Modifier as StyleModifier, Style},
|
||||||
|
@ -19,6 +19,7 @@ use modalkit::tui::{
|
||||||
widgets::{Paragraph, StatefulWidget, Widget},
|
widgets::{Paragraph, StatefulWidget, Widget},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use modalkit::prelude::*;
|
||||||
use modalkit::{
|
use modalkit::{
|
||||||
editing::action::{
|
editing::action::{
|
||||||
Action,
|
Action,
|
||||||
|
@ -32,22 +33,10 @@ use modalkit::{
|
||||||
Scrollable,
|
Scrollable,
|
||||||
UIError,
|
UIError,
|
||||||
},
|
},
|
||||||
editing::base::{
|
|
||||||
Axis,
|
|
||||||
CloseFlags,
|
|
||||||
Count,
|
|
||||||
MoveDir1D,
|
|
||||||
OpenTarget,
|
|
||||||
PositionList,
|
|
||||||
ScrollStyle,
|
|
||||||
WordStyle,
|
|
||||||
WriteFlags,
|
|
||||||
},
|
|
||||||
editing::completion::CompletionList,
|
editing::completion::CompletionList,
|
||||||
input::dialog::PromptYesNo,
|
keybindings::dialog::PromptYesNo,
|
||||||
input::InputContext,
|
|
||||||
widgets::{TermOffset, TerminalCursor, WindowOps},
|
|
||||||
};
|
};
|
||||||
|
use modalkit_ratatui::{TermOffset, TerminalCursor, WindowOps};
|
||||||
|
|
||||||
use crate::base::{
|
use crate::base::{
|
||||||
IambAction,
|
IambAction,
|
||||||
|
@ -253,7 +242,7 @@ impl RoomState {
|
||||||
width.into(),
|
width.into(),
|
||||||
);
|
);
|
||||||
|
|
||||||
Ok(vec![(act, cmd.context.take())])
|
Ok(vec![(act, cmd.context.clone())])
|
||||||
},
|
},
|
||||||
RoomAction::Set(field, value) => {
|
RoomAction::Set(field, value) => {
|
||||||
let room = store
|
let room = store
|
||||||
|
|
|
@ -5,14 +5,14 @@ use regex::Regex;
|
||||||
|
|
||||||
use matrix_sdk::ruma::OwnedRoomId;
|
use matrix_sdk::ruma::OwnedRoomId;
|
||||||
|
|
||||||
use modalkit::tui::{
|
use modalkit_ratatui::{ScrollActions, TerminalCursor, WindowOps};
|
||||||
|
use ratatui::{
|
||||||
buffer::Buffer,
|
buffer::Buffer,
|
||||||
layout::{Alignment, Rect},
|
layout::{Alignment, Rect},
|
||||||
style::{Modifier as StyleModifier, Style},
|
style::{Modifier as StyleModifier, Style},
|
||||||
text::{Line, Span},
|
text::{Line, Span},
|
||||||
widgets::{Paragraph, StatefulWidget, Widget},
|
widgets::{Paragraph, StatefulWidget, Widget},
|
||||||
};
|
};
|
||||||
use modalkit::widgets::{ScrollActions, TerminalCursor, WindowOps};
|
|
||||||
|
|
||||||
use modalkit::editing::{
|
use modalkit::editing::{
|
||||||
action::{
|
action::{
|
||||||
|
@ -36,40 +36,14 @@ use modalkit::editing::{
|
||||||
UIError,
|
UIError,
|
||||||
UIResult,
|
UIResult,
|
||||||
},
|
},
|
||||||
base::{
|
|
||||||
Axis,
|
|
||||||
CloseFlags,
|
|
||||||
CompletionDisplay,
|
|
||||||
CompletionSelection,
|
|
||||||
CompletionType,
|
|
||||||
Count,
|
|
||||||
EditRange,
|
|
||||||
EditTarget,
|
|
||||||
Mark,
|
|
||||||
MoveDir1D,
|
|
||||||
MoveDir2D,
|
|
||||||
MoveDirMod,
|
|
||||||
MovePosition,
|
|
||||||
MoveTerminus,
|
|
||||||
MoveType,
|
|
||||||
PositionList,
|
|
||||||
RangeType,
|
|
||||||
Register,
|
|
||||||
ScrollSize,
|
|
||||||
ScrollStyle,
|
|
||||||
SearchType,
|
|
||||||
TargetShape,
|
|
||||||
ViewportContext,
|
|
||||||
WordStyle,
|
|
||||||
WriteFlags,
|
|
||||||
},
|
|
||||||
completion::CompletionList,
|
completion::CompletionList,
|
||||||
context::{EditContext, Resolve},
|
context::Resolve,
|
||||||
cursor::{CursorGroup, CursorState},
|
cursor::{CursorGroup, CursorState},
|
||||||
history::HistoryList,
|
history::HistoryList,
|
||||||
rope::EditRope,
|
rope::EditRope,
|
||||||
store::{RegisterCell, RegisterPutFlags},
|
store::{RegisterCell, RegisterPutFlags},
|
||||||
};
|
};
|
||||||
|
use modalkit::prelude::*;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
base::{
|
base::{
|
||||||
|
@ -620,15 +594,9 @@ impl EditorActions<ProgramContext, ProgramStore, IambInfo> for ScrollbackState {
|
||||||
let dir = ctx.get_search_regex_dir();
|
let dir = ctx.get_search_regex_dir();
|
||||||
let dir = flip.resolve(&dir);
|
let dir = flip.resolve(&dir);
|
||||||
|
|
||||||
let needle = match ctx.get_search_regex() {
|
let lsearch = store.registers.get(&Register::LastSearch)?;
|
||||||
Some(re) => re,
|
let lsearch = lsearch.value.to_string();
|
||||||
None => {
|
let needle = Regex::new(lsearch.as_ref())?;
|
||||||
let lsearch = store.registers.get(&Register::LastSearch)?;
|
|
||||||
let lsearch = lsearch.value.to_string();
|
|
||||||
|
|
||||||
Regex::new(lsearch.as_ref())?
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
let (mc, needs_load) = self.find_message(key, dir, &needle, count, info);
|
let (mc, needs_load) = self.find_message(key, dir, &needle, count, info);
|
||||||
if needs_load {
|
if needs_load {
|
||||||
|
@ -706,15 +674,9 @@ impl EditorActions<ProgramContext, ProgramStore, IambInfo> for ScrollbackState {
|
||||||
let dir = ctx.get_search_regex_dir();
|
let dir = ctx.get_search_regex_dir();
|
||||||
let dir = flip.resolve(&dir);
|
let dir = flip.resolve(&dir);
|
||||||
|
|
||||||
let needle = match ctx.get_search_regex() {
|
let lsearch = store.registers.get(&Register::LastSearch)?;
|
||||||
Some(re) => re,
|
let lsearch = lsearch.value.to_string();
|
||||||
None => {
|
let needle = Regex::new(lsearch.as_ref())?;
|
||||||
let lsearch = store.registers.get(&Register::LastSearch)?;
|
|
||||||
let lsearch = lsearch.value.to_string();
|
|
||||||
|
|
||||||
Regex::new(lsearch.as_ref())?
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
let (mc, needs_load) = self.find_message(key, dir, &needle, count, info);
|
let (mc, needs_load) = self.find_message(key, dir, &needle, count, info);
|
||||||
if needs_load {
|
if needs_load {
|
||||||
|
@ -833,7 +795,6 @@ impl EditorActions<ProgramContext, ProgramStore, IambInfo> for ScrollbackState {
|
||||||
HistoryAction::Checkpoint => Ok(None),
|
HistoryAction::Checkpoint => Ok(None),
|
||||||
HistoryAction::Undo(_) => Err(EditError::Failure("Nothing to undo".into())),
|
HistoryAction::Undo(_) => Err(EditError::Failure("Nothing to undo".into())),
|
||||||
HistoryAction::Redo(_) => Err(EditError::Failure("Nothing to redo".into())),
|
HistoryAction::Redo(_) => Err(EditError::Failure("Nothing to redo".into())),
|
||||||
_ => Err(EditError::Unimplemented(format!("Unknown action: {act:?}"))),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1013,12 +974,6 @@ impl Promptable<ProgramContext, ProgramStore, IambInfo> for ScrollbackState {
|
||||||
let msg = "Cannot recall previous messages.";
|
let msg = "Cannot recall previous messages.";
|
||||||
let err = EditError::Failure(msg.into());
|
let err = EditError::Failure(msg.into());
|
||||||
|
|
||||||
return Err(err);
|
|
||||||
},
|
|
||||||
_ => {
|
|
||||||
let msg = format!("Messages scrollback doesn't support {act:?}");
|
|
||||||
let err = EditError::Unimplemented(msg);
|
|
||||||
|
|
||||||
return Err(err);
|
return Err(err);
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ use matrix_sdk::{
|
||||||
ruma::{OwnedRoomId, RoomId},
|
ruma::{OwnedRoomId, RoomId},
|
||||||
};
|
};
|
||||||
|
|
||||||
use modalkit::tui::{
|
use ratatui::{
|
||||||
buffer::Buffer,
|
buffer::Buffer,
|
||||||
layout::Rect,
|
layout::Rect,
|
||||||
style::{Color, Style},
|
style::{Color, Style},
|
||||||
|
@ -15,9 +15,11 @@ use modalkit::tui::{
|
||||||
widgets::StatefulWidget,
|
widgets::StatefulWidget,
|
||||||
};
|
};
|
||||||
|
|
||||||
use modalkit::{
|
use modalkit_ratatui::{
|
||||||
widgets::list::{List, ListState},
|
list::{List, ListState},
|
||||||
widgets::{TermOffset, TerminalCursor, WindowOps},
|
TermOffset,
|
||||||
|
TerminalCursor,
|
||||||
|
WindowOps,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::base::{IambBufferId, IambInfo, ProgramStore, RoomFocus};
|
use crate::base::{IambBufferId, IambInfo, ProgramStore, RoomFocus};
|
||||||
|
|
|
@ -1,17 +1,13 @@
|
||||||
//! Welcome Window
|
//! Welcome Window
|
||||||
use std::ops::{Deref, DerefMut};
|
use std::ops::{Deref, DerefMut};
|
||||||
|
|
||||||
use modalkit::tui::{buffer::Buffer, layout::Rect};
|
use ratatui::{buffer::Buffer, layout::Rect};
|
||||||
|
|
||||||
use modalkit::{
|
use modalkit_ratatui::{textbox::TextBoxState, TermOffset, TerminalCursor, WindowOps};
|
||||||
widgets::textbox::TextBoxState,
|
|
||||||
widgets::WindowOps,
|
|
||||||
widgets::{TermOffset, TerminalCursor},
|
|
||||||
};
|
|
||||||
|
|
||||||
use modalkit::editing::action::EditInfo;
|
use modalkit::editing::action::EditInfo;
|
||||||
use modalkit::editing::base::{CloseFlags, WordStyle, WriteFlags};
|
|
||||||
use modalkit::editing::completion::CompletionList;
|
use modalkit::editing::completion::CompletionList;
|
||||||
|
use modalkit::prelude::*;
|
||||||
|
|
||||||
use crate::base::{IambBufferId, IambInfo, IambResult, ProgramStore};
|
use crate::base::{IambBufferId, IambInfo, IambResult, ProgramStore};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue