let cpropwidth = if let Some(cprop) = &cprop { cprop.width() } else {0};
let extraspace = if !line.is_empty() && cpropwidth > 0 {
FileStatusLine::SPACING
- } else {0};
+ } else if !cprop.is_some() {
+ 1 // trailing '.' if no proportion
+ } else {
+ 0
+ };
let avail = width - min(
width, line.width() + cpropwidth + extraspace + 1);
if let Some(cprop) = cprop {
push(&mut line, cprop.slice());
+ } else {
+ line.push_str(&ColouredString::plain(".").slice());
}
// Done. Now centre it in the available space.
.add(OurKey::Pr('K'), "Keypress", 10)
.finalise();
- assert_eq!(fs.render(21), vec! {
+ assert_eq!(fs.render(22), vec! {
ColouredString::general(
- "weasel [K]:Keypress",
- " k "),
+ "weasel [K]:Keypress.",
+ " k "),
});
- assert_eq!(fs.render(20), vec! {
+ assert_eq!(fs.render(21), vec! {
ColouredString::general(
- " weasel",
- " "),
+ " weasel.",
+ " "),
});
}