fix(label): Support variable token order
Bound specifiers required the tokens to be replaced in the same order they were defined. This fixes that by storing and comparing the token string.
This commit is contained in:
parent
09e0ea1932
commit
4ef0c55dda
2 changed files with 13 additions and 12 deletions
include/drawtypes
|
@ -11,8 +11,8 @@ POLYBAR_NS
|
|||
*/
|
||||
|
||||
namespace drawtypes {
|
||||
|
||||
struct bounds {
|
||||
string token;
|
||||
size_t min;
|
||||
size_t max;
|
||||
};
|
||||
|
@ -42,7 +42,7 @@ namespace drawtypes {
|
|||
explicit label(string text, string foreground = "", string background = "",
|
||||
string underline = "", string overline = "", int font = 0, int padding = 0, int margin = 0,
|
||||
size_t maxlen = 0, bool ellipsis = true,
|
||||
const vector<struct bounds>& bound = vector<struct bounds>())
|
||||
const vector<struct bounds>& bound = {})
|
||||
: m_foreground(foreground)
|
||||
, m_background(background)
|
||||
, m_underline(underline)
|
||||
|
@ -68,7 +68,6 @@ namespace drawtypes {
|
|||
private:
|
||||
string m_text, m_tokenized;
|
||||
const vector<struct bounds> m_token_bounds;
|
||||
vector<struct bounds>::const_iterator m_token_iterator;
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue