This commit is contained in:
Michael Grant
2026-09-29 08:15:13 +01:00
parent cf7aad1ce8
commit 895c9e4b42

View File

@@ -118,7 +118,6 @@ cmd_send_keys_inject_string(struct cmdq_item *item, struct cmdq_item *after,
key_code key; key_code key;
char *endptr; char *endptr;
long n; long n;
int literal;
if (args_has(args, 'H')) { if (args_has(args, 'H')) {
n = strtol(s, &endptr, 16); n = strtol(s, &endptr, 16);
@@ -128,8 +127,7 @@ cmd_send_keys_inject_string(struct cmdq_item *item, struct cmdq_item *after,
KEYC_LITERAL|n)); KEYC_LITERAL|n));
} }
literal = args_has(args, 'l'); if (!args_has(args, 'l')) {
if (!literal) {
key = key_string_lookup_string(s); key = key_string_lookup_string(s);
if (key != KEYC_NONE && key != KEYC_UNKNOWN) { if (key != KEYC_NONE && key != KEYC_UNKNOWN) {
/* /*
@@ -138,25 +136,24 @@ cmd_send_keys_inject_string(struct cmdq_item *item, struct cmdq_item *after,
*/ */
after = cmd_send_keys_inject_key(item, after, args, after = cmd_send_keys_inject_key(item, after, args,
key); key);
return (after == NULL ? item : after); if (after != NULL)
return (after);
return (item);
} }
literal = 1;
} }
if (literal) {
ud = utf8_fromcstr(s); ud = utf8_fromcstr(s);
for (loop = ud; loop->size != 0; loop++) { for (loop = ud; loop->size != 0; loop++) {
if (loop->size == 1 && loop->data[0] <= 0x7f) if (loop->size == 1 && loop->data[0] <= 0x7f)
key = loop->data[0]; key = loop->data[0];
else { else {
if (utf8_from_data(loop, &uc) != UTF8_DONE) if (utf8_from_data(loop, &uc) != UTF8_DONE)
continue; continue;
key = uc; key = uc;
}
after = cmd_send_keys_inject_key(item, after, args,
key);
} }
free(ud); after = cmd_send_keys_inject_key(item, after, args, key);
} }
free(ud);
return (after); return (after);
} }