mirror of
https://github.com/clangen/musikcube.git
synced 2025-02-06 21:40:20 +00:00
escape percent signs so wprintw won't replace them with random things
This commit is contained in:
parent
6d61ff8333
commit
27cb6cf45d
@ -304,6 +304,14 @@ static size_t writePlayingFormat(
|
||||
}
|
||||
}
|
||||
|
||||
/* any % in the value string might be parsed by wprintw, so replace it */
|
||||
std::size_t percentSignIndex = value.find("%");
|
||||
while (percentSignIndex != std::string::npos) {
|
||||
value.replace(percentSignIndex, 1, "%%");
|
||||
/* we replaced one % with 2 of them, so we need to skip ahead 2 chars */
|
||||
percentSignIndex = value.find("%", percentSignIndex + 2);
|
||||
}
|
||||
|
||||
ON(w, attr);
|
||||
checked_wprintw(w, value.c_str());
|
||||
OFF(w, attr);
|
||||
@ -732,4 +740,4 @@ void TransportWindow::Update(TimeMode timeMode) {
|
||||
OFF(c, repeatAttrs);
|
||||
|
||||
this->Invalidate();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user