summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2025-12-08 21:00:24 +0800
committer魏曹先生 <1992414357@qq.com>2025-12-08 21:00:24 +0800
commita570d168d145f44ac44b9a2c60b7a089dad65f87 (patch)
tree662193ed15af545287db31fac070c60441f4fb1f /src/bin
parente9bfa7b8cb4a577d1a0864624f866bc98a379ffb (diff)
Add crossterm dependency and implement jvii editor
- Add crossterm crate for terminal UI capabilities - Update jvii editor with proper status bar and keyboard hints - Add i18n support for editor interface - Remove default nano editor configuration from shell scripts
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/jvii.rs19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/bin/jvii.rs b/src/bin/jvii.rs
index 9e1b444..0d6a584 100644
--- a/src/bin/jvii.rs
+++ b/src/bin/jvii.rs
@@ -16,6 +16,13 @@ use crossterm::{
},
};
use just_enough_vcs_cli::utils::display::display_width;
+use just_enough_vcs_cli::utils::display::md;
+use just_enough_vcs_cli::utils::env::current_locales;
+use rust_i18n::set_locale;
+use rust_i18n::t;
+
+// Import i18n files
+rust_i18n::i18n!("locales", fallback = "en");
#[derive(Parser, Debug)]
#[command(
@@ -280,14 +287,15 @@ impl Editor {
stdout.queue(Clear(ClearType::CurrentLine))?;
let status = format!(
- "{} - {} lines{}",
+ "{} - {} lines{} {}",
self.file_path.display(),
self.content.len(),
- if self.modified { " *" } else { "" }
+ if self.modified { " *" } else { "" },
+ md(t!("jvii.hints"))
);
- stdout.queue(SetForegroundColor(Color::White))?;
- stdout.queue(style::SetBackgroundColor(Color::DarkBlue))?;
+ stdout.queue(SetForegroundColor(Color::Black))?;
+ stdout.queue(style::SetBackgroundColor(Color::White))?;
let display_status = if display_width(&status) > width as usize {
// Find the maximum number of characters that fit within width
let mut current_width = 0;
@@ -499,6 +507,9 @@ impl Editor {
#[tokio::main]
async fn main() {
+ // Init i18n
+ set_locale(&current_locales());
+
let args = JustEnoughVcsInputer::parse();
// Check if a file argument was provided