mirror of
https://github.com/clangen/musikcube.git
synced 2025-02-22 15:40:02 +00:00
A couple small tweaks to the ellipsizing algorithm in TransportWindow.
This commit is contained in:
parent
1a7ba93e0a
commit
d73113f068
@ -170,11 +170,24 @@ size_t writePlayingFormat(
|
||||
}
|
||||
|
||||
size_t len = u8cols(value);
|
||||
bool ellipsized = false;
|
||||
|
||||
if (len > remaining) {
|
||||
std::string original = value;
|
||||
value = text::Ellipsize(value, remaining);
|
||||
ellipsized = (value != original);
|
||||
len = remaining;
|
||||
}
|
||||
|
||||
/* if we're not at the last token, but there's not enough space
|
||||
to show the next token, ellipsize now and bail out of the loop */
|
||||
if (remaining - len < 3) {
|
||||
if (!ellipsized) {
|
||||
value = text::Ellipsize(value, remaining - 3);
|
||||
len = remaining;
|
||||
}
|
||||
}
|
||||
|
||||
ON(w, attr);
|
||||
wprintw(w, value.c_str());
|
||||
OFF(w, attr);
|
||||
@ -289,10 +302,10 @@ void TransportWindow::Update() {
|
||||
}
|
||||
|
||||
wmove(c, 0, cx - shuffleLabelLen);
|
||||
int64 shuffleAttrs = this->playback.IsShuffled() ? gb : disabled;
|
||||
ON(c, shuffleAttrs);
|
||||
int64 shuffleAttrs = this->playback.IsShuffled() ? gb : disabled;
|
||||
ON(c, shuffleAttrs);
|
||||
wprintw(c, shuffleLabel.c_str());
|
||||
OFF(c, shuffleAttrs);
|
||||
OFF(c, shuffleAttrs);
|
||||
|
||||
wmove(c, 1, 0); /* move cursor to the second line */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user