digraph_get('NU') returns 0xA

7 views
Skip to first unread message

John Passaro

unread,
Mar 19, 2023, 4:41:08 PM3/19/23
to vim...@googlegroups.com
:echo char2nr(digraph_get('NU')) prints "10". this would seem to disagree with :h digraphs, which says that NU maps to "0" i.e. the null char. I don't think this is the result of an override as i certainly haven't tried to enact one and it happens even with -u NONE.

is this a bug?

Bram Moolenaar

unread,
Mar 19, 2023, 5:57:43 PM3/19/23
to vim...@googlegroups.com, John Passaro
Since the NUL byte terminates a string in C, it is internally replaced
with NL, 0x0A. When written to a file it is changed back to a NUL.
I most places you don't notice this, but sometimes it does.

> is this a bug?

Nope.

--
DINGO: Wicked wicked Zoot ... she is a bad person and she must pay the
penalty. And here in Castle Anthrax, we have but one punishment
... you must tie her down on a bed ... and spank her. Come!
GIRLS: A spanking! A spanking!
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

John Passaro

unread,
Mar 20, 2023, 9:45:07 AM3/20/23
to Bram Moolenaar, vim...@googlegroups.com
thank you for the explanation! from the perspective of interpreting the output of digraph_get*() functions, would this be the case any time it returns 0x0A, or is this a special case for "NU"?
Reply all
Reply to author
Forward
0 new messages