Skip to content

Commit

Permalink
Fixed help message not showing when opening multiple files in single …
Browse files Browse the repository at this point in the history
…atom
  • Loading branch information
curlpipe committed Dec 6, 2024
1 parent 7388a89 commit 9ba7451
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/editor/documents.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,16 @@ impl FileLayout {
}
}

/// Work out how many atoms are currently open
pub fn n_atoms(&self) -> usize {
match self {
Self::None | Self::FileTree => 0,
Self::Atom(_, _) => 1,
Self::SideBySide(layouts) => layouts.iter().map(|(layout, _)| layout.n_atoms()).sum(),
Self::TopToBottom(layouts) => layouts.iter().map(|(layout, _)| layout.n_atoms()).sum(),
}
}

/// Find a file container location from it's path
pub fn find(&self, idx: Vec<usize>, path: &str) -> Option<(Vec<usize>, usize)> {
match self {
Expand Down
2 changes: 1 addition & 1 deletion src/editor/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ impl Editor {
// Refuse to render help message on splits - awkward edge case
let help_message_here = config!(self.config, help_message).enabled
&& self.render_cache.help_message_span.contains(&y)
&& self.files.len() == 1;
&& self.files.n_atoms() == 1;
// Render short of the help message
let mut total_width = if help_message_here {
self.render_cache.help_message_width
Expand Down

0 comments on commit 9ba7451

Please sign in to comment.