-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Render the help message as the default no-content status message. #222
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportPatch coverage has no change and project coverage change:
Additional details and impacted files@@ Coverage Diff @@
## master #222 +/- ##
==========================================
- Coverage 42.51% 42.46% -0.05%
==========================================
Files 10 10
Lines 915 916 +1
==========================================
Hits 389 389
- Misses 526 527 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
Ah damn, went over the line limit thanks to clippy. I'll look into that tomorrow. |
Edit: fixed! |
Sorry for the delay, I'll review this very soon! @all-contributors please add @ NickGeek for code |
@all-contributors please add @NickGeek for code |
I've put up a pull request to add @NickGeek! 🎉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, this is a great change!
src/editor.rs
Outdated
@@ -291,7 +289,8 @@ impl Editor { | |||
fn update_window_size(&mut self) -> Result<(), Error> { | |||
let wsize = sys::get_window_size().or_else(|_| terminal::get_window_size_using_cursor())?; | |||
// Make room for the status bar and status message | |||
(self.screen_rows, self.window_width) = (wsize.0.saturating_sub(2), wsize.1); | |||
(self.screen_rows, self.window_width) = | |||
(wsize.0.saturating_sub(1 + (self.status_msg().len() + wsize.1) / wsize.1), wsize.1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it be
(wsize.0.saturating_sub(1 + (self.status_msg().len() + wsize.1) / wsize.1), wsize.1); | |
(wsize.0.saturating_sub(1 + (self.status_msg().len() + wsize.1 - 1) / wsize.1), wsize.1); |
instead? Currently, 1 + (self.status_msg().len() + wsize.1) / wsize.1
is equivalent to 2 + self.status_msg().len() / wsize.1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, not quite sure how to fit this one one line with this change + keeping rustfmt happy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need at least one extra line
- (self.screen_rows, self.window_width) =
- (wsize.0.saturating_sub(1 + (self.status_msg().len() + wsize.1 - 1) / wsize.1), wsize.1);
+ self.screen_rows =
+ wsize.0.saturating_sub(1 + (self.status_msg().len() + wsize.1 - 1) / wsize.1);
+ self.window_width = wsize.1;
At least until div_ceil
is stabilized :)
I just merged #229, which cuts down the total line count, so that should be fine now
Fixes #221. Also keeps the help message visible after resizing the window.