fix(tui): show [0/0] instead of [1/0] for empty files
This commit is contained in:
@@ -15,7 +15,12 @@ pub fn render(frame: &mut ratatui::Frame, app: &mut App) {
|
|||||||
// ── Title bar ──────────────────────────────────────────────────
|
// ── Title bar ──────────────────────────────────────────────────
|
||||||
let title_text = if app.is_loaded() {
|
let title_text = if app.is_loaded() {
|
||||||
let name = app.file_name().unwrap_or("unknown");
|
let name = app.file_name().unwrap_or("unknown");
|
||||||
format!(" {} [{}/{}]", name, app.cursor_line + 1, app.total_lines())
|
let cursor_display = if app.total_lines() == 0 {
|
||||||
|
0
|
||||||
|
} else {
|
||||||
|
app.cursor_line + 1
|
||||||
|
};
|
||||||
|
format!(" {} [{}/{}]", name, cursor_display, app.total_lines())
|
||||||
} else {
|
} else {
|
||||||
" Log Viewer".to_string()
|
" Log Viewer".to_string()
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user