aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/commands/typed.rs2
-rw-r--r--helix-term/src/ui/statusline.rs14
2 files changed, 15 insertions, 1 deletions
diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs
index 67640f79..5bb9c6c4 100644
--- a/helix-term/src/commands/typed.rs
+++ b/helix-term/src/commands/typed.rs
@@ -672,7 +672,7 @@ pub fn write_all_impl(
}
if doc.path().is_none() {
if write_scratch {
- errors.push("cannot write a buffer without a filename\n");
+ errors.push("cannot write a buffer without a filename");
}
return None;
}
diff --git a/helix-term/src/ui/statusline.rs b/helix-term/src/ui/statusline.rs
index 61fca609..52dd49f9 100644
--- a/helix-term/src/ui/statusline.rs
+++ b/helix-term/src/ui/statusline.rs
@@ -145,6 +145,7 @@ where
helix_view::editor::StatusLineElement::FileModificationIndicator => {
render_file_modification_indicator
}
+ helix_view::editor::StatusLineElement::ReadOnlyIndicator => render_read_only_indicator,
helix_view::editor::StatusLineElement::FileEncoding => render_file_encoding,
helix_view::editor::StatusLineElement::FileLineEnding => render_file_line_ending,
helix_view::editor::StatusLineElement::FileType => render_file_type,
@@ -442,6 +443,19 @@ where
write(context, title, None);
}
+fn render_read_only_indicator<F>(context: &mut RenderContext, write: F)
+where
+ F: Fn(&mut RenderContext, String, Option<Style>) + Copy,
+{
+ let title = if context.doc.readonly {
+ " [readonly] "
+ } else {
+ ""
+ }
+ .to_string();
+ write(context, title, None);
+}
+
fn render_file_base_name<F>(context: &mut RenderContext, write: F)
where
F: Fn(&mut RenderContext, String, Option<Style>) + Copy,