Merge branch 'pop-os:master_jammy' into master_jammy

This commit is contained in:
tomlajtos 2023-11-09 17:38:11 +01:00 committed by GitHub
commit 77ffb0224b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 30 deletions

4
Cargo.lock generated
View file

@ -865,7 +865,7 @@ dependencies = [
[[package]]
name = "cosmic-text"
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 = [
"fontdb 0.15.0",
"libm",
@ -2744,7 +2744,7 @@ dependencies = [
[[package]]
name = "modit"
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 = [
"log",
]

View file

@ -15,7 +15,9 @@ use cosmic::{
};
use cosmic_text::{Cursor, Edit, Family, FontSystem, SwashCache, SyntaxSystem, ViMode};
use std::{
env, fs,
env,
fmt::Write,
fs,
path::{Path, PathBuf},
process,
sync::Mutex,
@ -891,36 +893,42 @@ impl cosmic::Application for App {
match self.active_tab() {
Some(tab) => {
tab_column =
tab_column.push(text_box(&tab.editor, self.config.metrics()).padding(8));
let status = match &tab.editor.lock().unwrap().parser().mode {
ViMode::Normal => String::new(),
ViMode::Insert => {
format!("-- INSERT --")
}
ViMode::Extra(extra) => {
format!("{}", extra)
}
ViMode::Replace => {
format!("-- REPLACE --")
}
ViMode::Visual => {
format!("-- VISUAL --")
}
ViMode::VisualLine => {
format!("-- VISUAL LINE --")
}
ViMode::Command { value } => {
format!(":{value}|")
}
ViMode::Search { value, forwards } => {
if *forwards {
format!("/{value}|")
} else {
format!("?{value}|")
let status = {
let editor = tab.editor.lock().unwrap();
let parser = editor.parser();
match &parser.mode {
ViMode::Normal => {
format!("{}", parser.cmd)
}
ViMode::Insert => {
format!("-- INSERT --")
}
ViMode::Extra(extra) => {
format!("{}{}", parser.cmd, extra)
}
ViMode::Replace => {
format!("-- REPLACE --")
}
ViMode::Visual => {
format!("-- VISUAL -- {}", parser.cmd)
}
ViMode::VisualLine => {
format!("-- VISUAL LINE -- {}", parser.cmd)
}
ViMode::Command { value } => {
format!(":{value}|")
}
ViMode::Search { value, forwards } => {
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));
}
None => {