mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-10 04:27:45 -05:00
url-mode: fix auto-detection of URLs in the top corner of the viewport
The ‘proto_chars’ variable is kind of like a FIFO, where characters from the grid is pushed to the back of it. I.e. the last <n> bytes are at the *end* of the array. This was what the protocol matching logic expected. However, it was only true after reading ‘max_prot_len’ characters from the grid. Before that, the last <n> bytes from the grid was in the *beginning* of ‘proto_chars’. This meant we did not detect URLs starting in the top left corner of the viewport. Test case: foot sh -c "echo http://test.com && sleep 9999"
This commit is contained in:
parent
e8a8d122f0
commit
be980a6282
1 changed files with 4 additions and 4 deletions
|
|
@ -259,11 +259,11 @@ auto_detected(const struct terminal *term, enum url_action action,
|
|||
proto_start[i] = proto_start[i + 1];
|
||||
}
|
||||
|
||||
if (proto_char_count == max_prot_len)
|
||||
proto_char_count--;
|
||||
if (proto_char_count >= max_prot_len)
|
||||
proto_char_count = max_prot_len - 1;
|
||||
|
||||
proto_chars[proto_char_count] = wc;
|
||||
proto_start[proto_char_count] = (struct coord){c, r};
|
||||
proto_chars[max_prot_len - 1] = wc;
|
||||
proto_start[max_prot_len - 1] = (struct coord){c, r};
|
||||
proto_char_count++;
|
||||
|
||||
for (size_t i = 0; i < ALEN(prots); i++) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue