aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorMatouš Dzivjak2021-12-25 15:10:46 +0000
committerGitHub2021-12-25 15:10:46 +0000
commit4b0b1a5657b78693efe609647360de30264fcc92 (patch)
tree2f8481ebc7065d8dcc775f9f32bde0f8a0ed8f3f /helix-term
parentec878e40114d8992c3ed1221f77271a4508d3cde (diff)
feat(ui): file encoding in statusline (#1355)
* feat(ui): file encoding in statusline Display file encoding in statusline if the encoding isn't UTF-8. * Re-export encoding_rs from core From there it can be imported by other mods that rely on it.
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/ui/editor.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs
index 390b3759..dd050398 100644
--- a/helix-term/src/ui/editor.rs
+++ b/helix-term/src/ui/editor.rs
@@ -7,7 +7,7 @@ use crate::{
};
use helix_core::{
- coords_at_pos,
+ coords_at_pos, encoding,
graphemes::{ensure_grapheme_boundary_next, next_grapheme_boundary, prev_grapheme_boundary},
movement::Direction,
syntax::{self, HighlightEvent},
@@ -621,6 +621,13 @@ impl EditorView {
base_style,
));
+ let enc = doc.encoding();
+ if enc != encoding::UTF_8 {
+ right_side_text
+ .0
+ .push(Span::styled(format!(" {} ", enc.name()), base_style));
+ }
+
// Render to the statusline.
surface.set_spans(
viewport.x