-
Notifications
You must be signed in to change notification settings - Fork 70
Aligned UI #301
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
Aligned UI #301
Conversation
Added ellipse char for long nick cutoff. Alignment of activity line.
osa1
left a comment
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.
Thanks @trevarj , and sorry for the delay.
This looks good. Left some inline comments. We should merge this and start using.
| #[serde(rename_all = "snake_case")] | ||
| pub(crate) enum UiStyle { | ||
| Compact, | ||
| Aligned { max_nick_length: usize }, |
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.
tiny is supposed to easy to configure and provide good UX out of the box, so I think making max_nick_length optional would be good. I think I should be able to change
ui_style: compact
to
ui_style: aligned
and it should work.
Perhaps moving max_nick_length to another top-level field might make sense. Something like:
ui_style: aligned
max_nick_length: 12
|
|
||
| #[derive(Deserialize)] | ||
| #[serde(rename_all = "snake_case")] | ||
| pub(crate) enum UiStyle { |
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 we rename this to Layout maybe? (both the type name and the config field name)
| /// Inserts a blank space that is the size of a timestamp | ||
| fn blank(msg_area: &mut MsgArea) { | ||
| msg_area.add_text( | ||
| &format!("{:^width$}", "", width = Timestamp::WIDTH), |
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.
This allocates a String, but it's actually a static string. I think we can't create &'static str using WIDTH, but having a const/static string next to WIDTH, with documentation that the length of the string should be WIDTH should be fine.
Added Aligned UI, which can be turned on or off, and configured (currently only minimally).
Implementation details:
Layout--Compact(original) andAligned.Linegetting constructed will have a type -- regular and aligned (MsgandAligned, withinLineDataCache). Not all message lines are aligned in the aligned ui (ex. topics)Small refactors are included.
Closes #169 and #299