mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
osc-8: fix thinko: can’t use the ID parameters *address* as actual ID
Doing so means the next OSC-8 URL emitted by the client application, with the same ID, will get a *new* id internally. Instead, hash the string and use that as ID.
This commit is contained in:
parent
34b814349b
commit
d44cda11bf
1 changed files with 4 additions and 4 deletions
8
osc.c
8
osc.c
|
|
@ -16,6 +16,7 @@
|
|||
#include "selection.h"
|
||||
#include "terminal.h"
|
||||
#include "uri.h"
|
||||
#include "util.h"
|
||||
#include "vt.h"
|
||||
#include "xmalloc.h"
|
||||
#include "xsnprintf.h"
|
||||
|
|
@ -409,8 +410,6 @@ osc_uri(struct terminal *term, char *string)
|
|||
const char *uri = params_end + 1;
|
||||
uint64_t id = (uint64_t)rand() << 32 | rand();
|
||||
|
||||
LOG_DBG("params=%s, URI=%s", params, uri);
|
||||
|
||||
char *ctx = NULL;
|
||||
for (const char *key_value = strtok_r(params, ":", &ctx);
|
||||
key_value != NULL;
|
||||
|
|
@ -424,12 +423,13 @@ osc_uri(struct terminal *term, char *string)
|
|||
*operator = '\0';
|
||||
|
||||
const char *value = operator + 1;
|
||||
LOG_DBG("param: %s=%s", key, value);
|
||||
|
||||
if (strcmp(key, "id") == 0)
|
||||
id = (uintptr_t)value;
|
||||
id = sdbm_hash(value);
|
||||
}
|
||||
|
||||
LOG_DBG("OSC-8: URL=%s, id=%" PRIu64, uri, id);
|
||||
|
||||
if (uri[0] == '\0')
|
||||
term_osc8_close(term);
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue