Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update modalkit dependencies #204

Merged
merged 1 commit into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
77 changes: 50 additions & 27 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 9 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ default-features = false
features = ["build", "git", "gitcl",]

[dependencies]
arboard = "3.2.0"
arboard = "3.3.0"
bitflags = "^2.3"
chrono = "0.4"
clap = {version = "~4.3", features = ["derive"]}
Expand All @@ -40,6 +40,7 @@ markup5ever_rcdom = "0.2.0"
mime = "^0.3.16"
mime_guess = "^2.0.4"
open = "3.2.0"
ratatui = "0.23"
ratatui-image = { version = "0.4.3", features = ["serde"] }
regex = "^1.5"
rpassword = "^7.2"
Expand All @@ -55,9 +56,14 @@ url = {version = "^2.2.2", features = ["serde"]}
edit = "0.1.4"

[dependencies.modalkit]
# version = "0.0.16"
version = "0.0.17"
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]
version = "^0.6.2"
Expand Down
39 changes: 19 additions & 20 deletions src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ use std::sync::Arc;
use std::time::{Duration, Instant};

use emojis::Emoji;
use ratatui::{
buffer::Buffer,
layout::{Alignment, Rect},
text::{Line, Span},
widgets::{Paragraph, Widget},
};
use ratatui_image::picker::{Picker, ProtocolType};
use serde::{
de::Error as SerdeError,
Expand Down Expand Up @@ -61,7 +67,6 @@ use modalkit::{
ApplicationStore,
ApplicationWindowId,
},
base::{CommandType, WordStyle},
completion::{complete_path, CompletionMap},
context::EditContext,
cursor::Cursor,
Expand All @@ -71,16 +76,10 @@ use modalkit::{
env::vim::{
command::{CommandContext, CommandDescription, VimCommand, VimCommandMachine},
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;
Expand Down Expand Up @@ -365,7 +364,7 @@ pub enum RoomAction {
Leave(bool),

/// Open the members window.
Members(Box<CommandContext<ProgramContext>>),
Members(Box<CommandContext>),

/// Set a room property.
Set(RoomField, String),
Expand Down Expand Up @@ -460,7 +459,7 @@ impl From<SendAction> for IambAction {
}

impl ApplicationAction for IambAction {
fn is_edit_sequence<C: EditContext>(&self, _: &C) -> SequenceStatus {
fn is_edit_sequence(&self, _: &EditContext) -> SequenceStatus {
match self {
IambAction::Homeserver(..) => SequenceStatus::Break,
IambAction::Message(..) => SequenceStatus::Break,
Expand All @@ -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 {
IambAction::Homeserver(..) => SequenceStatus::Atom,
IambAction::Message(..) => SequenceStatus::Atom,
Expand All @@ -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 {
IambAction::Homeserver(..) => SequenceStatus::Ignore,
IambAction::Message(..) => SequenceStatus::Ignore,
Expand All @@ -499,7 +498,7 @@ impl ApplicationAction for IambAction {
}
}

fn is_switchable<C: EditContext>(&self, _: &C) -> bool {
fn is_switchable(&self, _: &EditContext) -> bool {
match self {
IambAction::Homeserver(..) => false,
IambAction::Message(..) => false,
Expand Down Expand Up @@ -528,13 +527,13 @@ impl From<IambAction> for ProgramAction {
/// Alias for program actions.
pub type ProgramAction = Action<IambInfo>;
/// Alias for program context.
pub type ProgramContext = VimContext<IambInfo>;
pub type ProgramContext = EditContext;
/// Alias for program keybindings.
pub type Keybindings = VimMachine<TerminalKey, IambInfo>;
/// Alias for a program command.
pub type ProgramCommand = VimCommand<ProgramContext, IambInfo>;
pub type ProgramCommand = VimCommand<IambInfo>;
/// Alias for mapped program commands.
pub type ProgramCommands = VimCommandMachine<ProgramContext, IambInfo>;
pub type ProgramCommands = VimCommandMachine<IambInfo>;
/// Alias for program store.
pub type ProgramStore = Store<IambInfo>;
/// Alias for shared program store.
Expand Down Expand Up @@ -1612,7 +1611,7 @@ fn complete_cmd(
/// Tab completion for the command bar.
fn complete_cmdbar(text: &EditRope, cursor: &mut Cursor, store: &ProgramStore) -> Vec<String> {
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);

complete_cmd(cow.as_ref(), text, cursor, store)
Expand All @@ -1623,7 +1622,7 @@ pub mod tests {
use super::*;
use crate::config::user_style_from_color;
use crate::tests::*;
use modalkit::tui::style::Color;
use ratatui::style::Color;

#[test]
fn test_typing_spans() {
Expand Down