Skip to content

Commit

Permalink
Apply NerdFont to editor - tabs & bottom right status message (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
panarch authored Jan 13, 2025
1 parent 9be1294 commit 24adfb6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 25 deletions.
11 changes: 0 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion tui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@ tui-big-text = "0.7.0"
tui-textarea = "0.7.0"
home = "0.5.9"
tokio = { version = "1.41.0", features = ["macros", "rt-multi-thread"] }
throbber-widgets-tui = "0.8.0"
24 changes: 11 additions & 13 deletions tui/src/views/body/notebook/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@ use {
widgets::{Block, Padding},
Frame,
},
throbber_widgets_tui::Throbber,
tui_textarea::TextArea,
};

const NOTE_SYMBOL: &str = "󱇗 ";

pub fn draw(frame: &mut Frame, area: Rect, context: &mut Context) {
context.notebook.editor_height = area.height - 2;

let (title, breadcrumb) = if let Some(tab_index) = context.notebook.tab_index {
let mut title = vec![" ".into()];
let mut title = vec![];
for (i, tab) in context.notebook.tabs.iter().enumerate() {
let name = tab.note.name.clone();
let name = format!(" {NOTE_SYMBOL}{} ", tab.note.name.clone());
let name = if i == tab_index {
if context.notebook.state.is_editor() {
name.white().on_blue()
Expand All @@ -28,9 +29,6 @@ pub fn draw(frame: &mut Frame, area: Rect, context: &mut Context) {
name.dark_gray()
};

if i != 0 {
title.push("|".into());
}
title.push(name);
}

Expand Down Expand Up @@ -59,14 +57,14 @@ pub fn draw(frame: &mut Frame, area: Rect, context: &mut Context) {
context.last_log.as_ref(),
context.notebook.tabs.iter().any(|tab| tab.dirty),
) {
(_, true) => {
let throbber = Throbber::default()
.label("Saving...")
.style(Style::default().yellow());
block.title_bottom(Line::from(throbber).right_aligned())
}
(_, true) => block.title_bottom(
Line::from(" 󰔚 Saving... ")
.black()
.on_yellow()
.right_aligned(),
),
(Some((log, _)), false) => {
block.title_bottom(Line::from(log.clone().green()).right_aligned())
block.title_bottom(Line::from(format!(" {} ", log).black().on_green()).right_aligned())
}
(None, false) => block,
}
Expand Down

0 comments on commit 24adfb6

Please sign in to comment.