@@ -11,7 +11,10 @@ use helix_core::{
11 syntax::{self, HighlightEvent},
11 syntax::{self, HighlightEvent},
12 Position, Range,
12 Position, Range,
15+ document::{IndentStyle, Mode},
14−use helix_view::{document::Mode, Document, Editor, Theme, View};
16+ Document, Editor, Theme, View,
15use std::borrow::Cow;
18use std::borrow::Cow;
17use crossterm::{
20use crossterm::{
@@ -455,6 +458,10 @@ impl EditorView {
455 theme: &Theme,
458 theme: &Theme,
456 is_focused: bool,
459 is_focused: bool,
461+ //-------------------------------
462+ // Left side of the status line.
463+ //-------------------------------
458 let mode = match doc.mode() {
465 let mode = match doc.mode() {
459 Mode::Insert => "INS",
466 Mode::Insert => "INS",
460 Mode::Select => "SEL",
467 Mode::Select => "SEL",
@@ -487,24 +494,41 @@ impl EditorView {
490− surface.set_stringn(
497+ //-------------------------------
491− viewport.x + viewport.width.saturating_sub(15),
498+ // Right side of the status line.
492− viewport.y,
499+ //-------------------------------
493− format!("{}", doc.diagnostics().len()),
500+
494− 4,
501+ // Compute the individual info strings.
495− text_color,
502+ let diag_count = format!("{}", doc.diagnostics().len());
496− );
503+ let indent_info = match doc.indent_style {
497−
504+ IndentStyle::Tabs => "tab",
498− // render line:col
505+ IndentStyle::Spaces(1) => "spaces:1",
506+ IndentStyle::Spaces(2) => "spaces:2",
507+ IndentStyle::Spaces(3) => "spaces:3",
508+ IndentStyle::Spaces(4) => "spaces:4",
509+ IndentStyle::Spaces(5) => "spaces:5",
510+ IndentStyle::Spaces(6) => "spaces:6",
511+ IndentStyle::Spaces(7) => "spaces:7",
512+ IndentStyle::Spaces(8) => "spaces:8",
513+ _ => "indent:ERROR",
515+ let position_info = {
499− let pos = coords_at_pos(doc.text().slice(..), doc.selection(view.id).cursor());
516+ let pos = coords_at_pos(doc.text().slice(..), doc.selection(view.id).cursor());
501− let text = format!("{}:{}", pos.row + 1, pos.col + 1); // convert to 1-indexing
517+ format!("{}:{}", pos.row + 1, pos.col + 1) // convert to 1-indexing
502− let len = text.len();
518+ };
520+ // Render them to the status line together.
521+ let right_side_text = format!(
523+ &diag_count[..diag_count.len().min(4)],
527+ let text_len = right_side_text.len() as u16;
504 surface.set_string(
528 surface.set_string(
505− viewport.x + viewport.width.saturating_sub(len as u16 + 1),
529+ viewport.x + viewport.width.saturating_sub(text_len),
506 viewport.y,
530 viewport.y,
507− text,
531+ right_side_text,
508 text_color,
532 text_color,