diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2021-02-14 12:28:42 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2021-02-21 19:15:31 +0000 |
| commit | d44cda11bf435b7687fada29946d4a1cecbc728c (patch) | |
| tree | 20e47c6c7aa483a1ae99c177205815f0bbcda4f5 /osc.c | |
| parent | util: add a sdbm hash implementation (diff) | |
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.
Diffstat (limited to 'osc.c')
| -rw-r--r-- | osc.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -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 |
