diff --git a/Cargo.lock b/Cargo.lock index 68ad1124..b5f934c6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1560,6 +1560,7 @@ dependencies = [ "serde", "serde_json", "slotmap", + "smartstring", "tempfile", "thiserror 2.0.11", "tokio", @@ -2404,6 +2405,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fb72c633efbaa2dd666986505016c32c3044395ceaf881518399d2f4127ee29" dependencies = [ "autocfg", + "serde", "static_assertions", "version_check", ] diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index d8500ed4..4b5fe02e 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -24,7 +24,7 @@ use helix_core::{ }; use helix_view::{ annotations::diagnostics::DiagnosticFilter, - document::{Mode, SCRATCH_BUFFER_NAME}, + document::{Mode, DEFAULT_LANGUAGE_NAME, SCRATCH_BUFFER_NAME}, editor::{CompleteAction, CursorShapeConfig}, graphics::{Color, CursorKind, Modifier, Rect, Style}, input::{KeyEvent, MouseButton, MouseEvent, MouseEventKind}, @@ -646,7 +646,20 @@ impl EditorView { bufferline_inactive }; - let text = format!(" {}{} ", fname, if doc.is_modified() { "[+]" } else { "" }); + let lang = doc.language_name().unwrap_or(DEFAULT_LANGUAGE_NAME); + let config = editor.config(); + let icon = config.icons.mime.get(lang); + + let text = if lang == icon { + format!(" {} {}", fname, if doc.is_modified() { "[+] " } else { "" }) + } else { + format!( + " {icon} {} {}", + fname, + if doc.is_modified() { "[+] " } else { "" } + ) + }; + let used_width = viewport.x.saturating_sub(x); let rem_width = surface.area.width.saturating_sub(used_width); diff --git a/helix-term/src/ui/statusline.rs b/helix-term/src/ui/statusline.rs index 7437cbd0..f02b4b88 100644 --- a/helix-term/src/ui/statusline.rs +++ b/helix-term/src/ui/statusline.rs @@ -243,7 +243,13 @@ where if warnings > 0 { write( context, - "●".to_string(), + context + .editor + .config() + .icons + .diagnostic + .warning() + .to_string(), Some(context.editor.theme.get("warning")), ); write(context, format!(" {} ", warnings), None); @@ -252,7 +258,7 @@ where if errors > 0 { write( context, - "●".to_string(), + context.editor.config().icons.diagnostic.error().to_string(), Some(context.editor.theme.get("error")), ); write(context, format!(" {} ", errors), None); @@ -285,7 +291,13 @@ where if warnings > 0 { write( context, - "●".to_string(), + context + .editor + .config() + .icons + .diagnostic + .warning() + .to_string(), Some(context.editor.theme.get("warning")), ); write(context, format!(" {} ", warnings), None); @@ -294,7 +306,7 @@ where if errors > 0 { write( context, - "●".to_string(), + context.editor.config().icons.diagnostic.error().to_string(), Some(context.editor.theme.get("error")), ); write(context, format!(" {} ", errors), None); @@ -410,9 +422,13 @@ fn render_file_type(context: &mut RenderContext, write: F) where F: Fn(&mut RenderContext, String, Option