mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
selection: fix crash when tripple clicking in a region containing NUL characters
If a cell contains a NUL character, it was incorrectly treated as a quote, later triggering an assertion. Patch by Johannes Altmanninger
This commit is contained in:
parent
3b0c2a3543
commit
67bd5dd460
2 changed files with 5 additions and 4 deletions
|
|
@ -86,6 +86,7 @@
|
||||||
|
|
||||||
* Crash when receiving an OSC-9 or OSC-777 with an empty notification
|
* Crash when receiving an OSC-9 or OSC-777 with an empty notification
|
||||||
body ([#1866][1866]).
|
body ([#1866][1866]).
|
||||||
|
* Crash when tripple-clicking on region containing `NUL` characters.
|
||||||
|
|
||||||
[1866]: https://codeberg.org/dnkl/foot/issues/1866
|
[1866]: https://codeberg.org/dnkl/foot/issues/1866
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -533,8 +533,8 @@ selection_find_quote_left(struct terminal *term, struct coord *pos,
|
||||||
const struct row *row = grid_row_in_view(term->grid, pos->row);
|
const struct row *row = grid_row_in_view(term->grid, pos->row);
|
||||||
char32_t wc = row->cells[pos->col].wc;
|
char32_t wc = row->cells[pos->col].wc;
|
||||||
|
|
||||||
if ((*quote_char == '\0' && (wc == '"' || wc == '\'')) ||
|
if (*quote_char == '\0' ? (wc == '"' || wc == '\'')
|
||||||
wc == *quote_char)
|
: wc == *quote_char)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -555,8 +555,8 @@ selection_find_quote_left(struct terminal *term, struct coord *pos,
|
||||||
|
|
||||||
wc = row->cells[next_col].wc;
|
wc = row->cells[next_col].wc;
|
||||||
|
|
||||||
if ((*quote_char == '\0' && (wc == '"' || wc == '\'')) ||
|
if (*quote_char == '\0' ? (wc == '"' || wc == '\'')
|
||||||
wc == *quote_char)
|
: wc == *quote_char)
|
||||||
{
|
{
|
||||||
pos->row = next_row;
|
pos->row = next_row;
|
||||||
pos->col = next_col + 1;
|
pos->col = next_col + 1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue