Skip to content

Commit

Permalink
Improve naming
Browse files Browse the repository at this point in the history
  • Loading branch information
theteachr committed Feb 1, 2023
1 parent 78e05f4 commit 7c54b80
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions helix-term/src/ui/statusline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,18 +409,18 @@ where
write(context, format!(" {} ", file_type), None);
}

fn render_path<F>(context: &mut RenderContext, write: F, path: Option<PathBuf>)
fn render_title<F>(context: &mut RenderContext, write: F, path: Option<PathBuf>)
where
F: Fn(&mut RenderContext, String, Option<Style>) + Copy,
{
let path = path
let title = path
.as_ref()
.map(|p| p.to_string_lossy())
.unwrap_or_else(|| SCRATCH_BUFFER_NAME.into());

let title = format!(
" {}{} ",
path,
title,
if context.doc.is_modified() { "[+]" } else { "" },
);

Expand All @@ -431,7 +431,7 @@ fn render_file_name<F>(context: &mut RenderContext, write: F)
where
F: Fn(&mut RenderContext, String, Option<Style>) + Copy,
{
render_path(context, write, context.doc.relative_path())
render_title(context, write, context.doc.relative_path())
}

fn render_file_base_name<F>(context: &mut RenderContext, write: F)
Expand All @@ -443,7 +443,7 @@ where
.relative_path()
.and_then(|p| p.file_name().map(PathBuf::from));

render_path(context, write, path)
render_title(context, write, path)
}

fn render_separator<F>(context: &mut RenderContext, write: F)
Expand Down

0 comments on commit 7c54b80

Please sign in to comment.