pub fn getkeystring_with(
s: &str,
how: u32,
misc: Option<&mut i32>,
) -> (String, usize)Expand description
getkeystring with the C how parameter (Src/utils.c:6915).
The plain getkeystring(s) shim above defaults how=0 for
non-EMACS callers (zbeep, dollar-quote — they keep unknown
\<char> as literal \<char>). Pass GETKEYS_PRINT to get
the print/echo behavior (drop backslash on unknown).
getkeystring with the C how parameter AND the
GETKEY_UPDATE_OFFSET cursor-offset out-param (Src/utils.c:6915).
Port of getkeystring(char *s, int *len, int how, int *misc) from
Src/utils.c:6915, specifically its GETKEY_UPDATE_OFFSET path.
When how sets GETKEY_UPDATE_OFFSET and misc is Some, *misc
is the C *misc completion offset — a byte index into s — and is
updated as escapes positioned before the cursor collapse:
-1per collapsed\<char>escape whose backslash precedes the cursor,s - sstart < *misc(c:6987); undone if the backslash is kept literal in the default (non-EMACS) arm (c:7181-7183);- additional
-6for\u,-10(-4+-6) for\U(c:7073-7084), then+Nfor the N output bytes emitted (c:7123-7124). Octal/hex escapes get only the base-1, matching C’s own incomplete/* HERE: GETKEY_UPDATE_OFFSET? */handling (c:7155).
The offset is a byte index. For ASCII $'...' content (one byte per
char) it matches the C metafied-byte semantics exactly; the byte-vs-
char divergence for non-ASCII content is the pre-existing shared-cursor
limitation documented on set_comp_sep (compcore.rs), not new here.
Callers with no offset to track pass misc = None.