vim: Display invisibles in mode indicator (#35760)
Release Notes: - Fixes bug where `ctrl-k enter` while in `INSERT` mode would put a newline in the Vim mode indicator #### Old <img width="729" height="486" alt="OldVimModeIndicator" src="https://github.com/user-attachments/assets/58742745-5a58-4e7b-a1ef-29aa3ff1c4f7" /> #### New <img width="729" height="486" alt="NewVimModeIndicator" src="https://github.com/user-attachments/assets/e636359a-06b6-4cdd-9e62-5dc52c6f068f" />
This commit is contained in:
parent
48fed866e6
commit
e1d31cfcc3
1 changed files with 10 additions and 2 deletions
|
@ -1028,13 +1028,21 @@ impl Operator {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn status(&self) -> String {
|
pub fn status(&self) -> String {
|
||||||
|
fn make_visible(c: &str) -> &str {
|
||||||
|
match c {
|
||||||
|
"\n" => "enter",
|
||||||
|
"\t" => "tab",
|
||||||
|
" " => "space",
|
||||||
|
c => c,
|
||||||
|
}
|
||||||
|
}
|
||||||
match self {
|
match self {
|
||||||
Operator::Digraph {
|
Operator::Digraph {
|
||||||
first_char: Some(first_char),
|
first_char: Some(first_char),
|
||||||
} => format!("^K{first_char}"),
|
} => format!("^K{}", make_visible(&first_char.to_string())),
|
||||||
Operator::Literal {
|
Operator::Literal {
|
||||||
prefix: Some(prefix),
|
prefix: Some(prefix),
|
||||||
} => format!("^V{prefix}"),
|
} => format!("^V{}", make_visible(&prefix)),
|
||||||
Operator::AutoIndent => "=".to_string(),
|
Operator::AutoIndent => "=".to_string(),
|
||||||
Operator::ShellCommand => "=".to_string(),
|
Operator::ShellCommand => "=".to_string(),
|
||||||
_ => self.id().to_string(),
|
_ => self.id().to_string(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue