Skip to content

Commit

Permalink
modified indicator added
Browse files Browse the repository at this point in the history
  • Loading branch information
Kacperacy committed May 24, 2024
1 parent 78841a7 commit bc90f2f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub struct App {
pub cursor_offset: Position,
pub opened_filename: String,
pub window_size: Rect,
dirty: bool,
pub dirty: bool,
quit_times: i8,
pub is_prompt: bool,
pub prompt: String,
Expand All @@ -40,7 +40,7 @@ impl Default for App {
content: vec![String::new()],
cursor_position: Position { x: 0, y: 0 },
cursor_offset: Position { x: 0, y: 0 },
opened_filename: String::new(),
opened_filename: "Empty".into(),
window_size: Rect::new(0, 0, 0, 0),
dirty: false,
quit_times: QUIT_TIMES,
Expand Down
8 changes: 7 additions & 1 deletion src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,13 @@ pub fn render(app: &mut App, frame: &mut Frame) {
})
.collect();

let filename_status = Line::from(format!("Filename: {}", app.opened_filename))
let filename_content: String = if app.dirty {
format!("Filename: {} (modified)", app.opened_filename)
} else {
format!("Filename: {} ", app.opened_filename)
};

let filename_status = Line::from(filename_content)
.left_aligned()
.style(Style::default().bg(Color::Rgb(128, 192, 255)).bold());

Expand Down

0 comments on commit bc90f2f

Please sign in to comment.