mirror of
https://github.com/swaywm/sway.git
synced 2025-11-11 13:29:51 -05:00
Fix pango escaping and refactor escape_markup_text
Fixes #2674. The cause of the issue was in get_pango_layout. When we call pango_parse_markup, `text` is the escaped string, and the unescaped string is then computed and written to `buf`. We were then passing the unescaped string to pango_layout_set_markup, but this function needs the escaped string. `buf` is not needed and has been removed. The other part of this PR refactors escape_markup_text to remove the dest_length argument and removes the -1 return value on error. It now assumes that you've allocated dest to the correct length.
This commit is contained in:
parent
fe7e66407c
commit
10ef118e09
3 changed files with 24 additions and 56 deletions
|
|
@ -785,14 +785,9 @@ static size_t parse_title_format(struct sway_view *view, char *buffer) {
|
|||
}
|
||||
|
||||
static char *escape_title(char *buffer) {
|
||||
int length = escape_markup_text(buffer, NULL, 0);
|
||||
size_t length = escape_markup_text(buffer, NULL);
|
||||
char *escaped_title = calloc(length + 1, sizeof(char));
|
||||
int result = escape_markup_text(buffer, escaped_title, length);
|
||||
if (result != length) {
|
||||
wlr_log(WLR_ERROR, "Could not escape title: %s", buffer);
|
||||
free(escaped_title);
|
||||
return buffer;
|
||||
}
|
||||
escape_markup_text(buffer, escaped_title);
|
||||
free(buffer);
|
||||
return escaped_title;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue