From e1d31cfcc3360bf50f6230d6dd5d1aafc3295c4c Mon Sep 17 00:00:00 2001
From: AidanV <84053180+AidanV@users.noreply.github.com>
Date: Mon, 18 Aug 2025 08:52:25 -0700
Subject: [PATCH] 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
#### New
---
crates/vim/src/state.rs | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/crates/vim/src/state.rs b/crates/vim/src/state.rs
index c4be034871..423859dadc 100644
--- a/crates/vim/src/state.rs
+++ b/crates/vim/src/state.rs
@@ -1028,13 +1028,21 @@ impl Operator {
}
pub fn status(&self) -> String {
+ fn make_visible(c: &str) -> &str {
+ match c {
+ "\n" => "enter",
+ "\t" => "tab",
+ " " => "space",
+ c => c,
+ }
+ }
match self {
Operator::Digraph {
first_char: Some(first_char),
- } => format!("^K{first_char}"),
+ } => format!("^K{}", make_visible(&first_char.to_string())),
Operator::Literal {
prefix: Some(prefix),
- } => format!("^V{prefix}"),
+ } => format!("^V{}", make_visible(&prefix)),
Operator::AutoIndent => "=".to_string(),
Operator::ShellCommand => "=".to_string(),
_ => self.id().to_string(),