Merge branch 'pop-os:master_jammy' into master_jammy
This commit is contained in:
commit
77ffb0224b
2 changed files with 38 additions and 30 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
|
@ -865,7 +865,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cosmic-text"
|
name = "cosmic-text"
|
||||||
version = "0.10.0"
|
version = "0.10.0"
|
||||||
source = "git+https://github.com/pop-os/cosmic-text?branch=vi-editor#c79c1326944c0a688e5c35015b834c18b53aa5c0"
|
source = "git+https://github.com/pop-os/cosmic-text?branch=vi-editor#9efcc41a5aca6df16a66da53aae75b1191ba0576"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"fontdb 0.15.0",
|
"fontdb 0.15.0",
|
||||||
"libm",
|
"libm",
|
||||||
|
|
@ -2744,7 +2744,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "modit"
|
name = "modit"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/pop-os/modit.git#d44cd44692685c2972747ca465a81791887c2cdd"
|
source = "git+https://github.com/pop-os/modit.git#0bfedf9b11412b2f3612bdc5ffebcf882f88eb01"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"log",
|
"log",
|
||||||
]
|
]
|
||||||
|
|
|
||||||
64
src/main.rs
64
src/main.rs
|
|
@ -15,7 +15,9 @@ use cosmic::{
|
||||||
};
|
};
|
||||||
use cosmic_text::{Cursor, Edit, Family, FontSystem, SwashCache, SyntaxSystem, ViMode};
|
use cosmic_text::{Cursor, Edit, Family, FontSystem, SwashCache, SyntaxSystem, ViMode};
|
||||||
use std::{
|
use std::{
|
||||||
env, fs,
|
env,
|
||||||
|
fmt::Write,
|
||||||
|
fs,
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
process,
|
process,
|
||||||
sync::Mutex,
|
sync::Mutex,
|
||||||
|
|
@ -891,36 +893,42 @@ impl cosmic::Application for App {
|
||||||
|
|
||||||
match self.active_tab() {
|
match self.active_tab() {
|
||||||
Some(tab) => {
|
Some(tab) => {
|
||||||
tab_column =
|
let status = {
|
||||||
tab_column.push(text_box(&tab.editor, self.config.metrics()).padding(8));
|
let editor = tab.editor.lock().unwrap();
|
||||||
let status = match &tab.editor.lock().unwrap().parser().mode {
|
let parser = editor.parser();
|
||||||
ViMode::Normal => String::new(),
|
match &parser.mode {
|
||||||
ViMode::Insert => {
|
ViMode::Normal => {
|
||||||
format!("-- INSERT --")
|
format!("{}", parser.cmd)
|
||||||
}
|
}
|
||||||
ViMode::Extra(extra) => {
|
ViMode::Insert => {
|
||||||
format!("{}", extra)
|
format!("-- INSERT --")
|
||||||
}
|
}
|
||||||
ViMode::Replace => {
|
ViMode::Extra(extra) => {
|
||||||
format!("-- REPLACE --")
|
format!("{}{}", parser.cmd, extra)
|
||||||
}
|
}
|
||||||
ViMode::Visual => {
|
ViMode::Replace => {
|
||||||
format!("-- VISUAL --")
|
format!("-- REPLACE --")
|
||||||
}
|
}
|
||||||
ViMode::VisualLine => {
|
ViMode::Visual => {
|
||||||
format!("-- VISUAL LINE --")
|
format!("-- VISUAL -- {}", parser.cmd)
|
||||||
}
|
}
|
||||||
ViMode::Command { value } => {
|
ViMode::VisualLine => {
|
||||||
format!(":{value}|")
|
format!("-- VISUAL LINE -- {}", parser.cmd)
|
||||||
}
|
}
|
||||||
ViMode::Search { value, forwards } => {
|
ViMode::Command { value } => {
|
||||||
if *forwards {
|
format!(":{value}|")
|
||||||
format!("/{value}|")
|
}
|
||||||
} else {
|
ViMode::Search { value, forwards } => {
|
||||||
format!("?{value}|")
|
if *forwards {
|
||||||
|
format!("/{value}|")
|
||||||
|
} else {
|
||||||
|
format!("?{value}|")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
tab_column =
|
||||||
|
tab_column.push(text_box(&tab.editor, self.config.metrics()).padding(8));
|
||||||
tab_column = tab_column.push(text(status).font(cosmic::font::Font::MONOSPACE));
|
tab_column = tab_column.push(text(status).font(cosmic::font::Font::MONOSPACE));
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue