TERMKEY_IN...T_POSITION(3)
β¨ TERMKEY_IN...T_POSITION(3) β¨
okay bestie so this is a page from the Library Functions Manual and it's all about termkey_interpret_position β the girl whose whole job is decoding those lil cursor position report events π
πΈ NAME πΈ
termkey_interpret_position β interpret opaque cursor position event data
like, it takes the mystery box that is a position event and tells you what's inside π
π¦ SYNOPSIS π¦
#include <termkey.h>
TermKeyResult termkey_interpret_position(TermKey *tk, const TermKeyKey *key,
int *line, int *col);
Link with -ltermkey.
ngl if you forget the -ltermkey the linker is gonna be so dramatic about it π don't do that to her
π DESCRIPTION π
So termkey_interpret_position() does the thing where it fills in the variables sitting behind the pointers you passed in, based on the cursor position report event it finds in key. The vibe is: you call this when termkey_getkey(3) or one of her friends handed you back a key event whose type is TERMKEY_TYPE_POSITION. That's your green light, periodt β¨
Any pointer can instead be given as NULL if you don't want that value back. Not interested in the line? Pass NULL, she won't be offended, she's not like that π«Ά
The line and col variables get filled in with the actual cursor position, and it's indexed from 1 (yes bestie, 1, not 0, this is not one of those zero-indexed situations, we're counting like humans here π).
β οΈ and here's the tea: because theTermKeyKeystructure only has a limited number of bytes to work with,lineandcolare capped βlinemaxes out at 2047 andcolmaxes out at 4095. That's just how much room she has, no cap π§
β RETURN VALUE β
If you hand her a key event of type TERMKEY_TYPE_POSITION, she returns TERMKEY_RES_KEY and she will touch the variables whose pointers you passed in, exactly like described above. Iconic behaviour, ate, no notes π
For any other event type she returns TERMKEY_RES_NONE, and what happens to those variables you pointed at is undefined. Not "kinda weird", not "probably fine" β undefined. So don't be out here reading them like they mean something π
π SEE ALSO π
the whole squad, go say hi π
okay that's the whole page!! this one lives in the Library Functions Manual, and she's filed under the very dramatic-looking name TERMKEY_IN...T_POSITION(3) (the ... is just the man page system being extra about the long function name, iykyk). no version or date info came along with her, so that's all we've got β love that for us π
stay hydrated, read your return values, and remember: TERMKEY_RES_NONE means hands off π₯π¦π
π¦ where this page comes from
- alpine 3.24: libtermkey-doc 0.22-r4 Β· MIT
- debian trixie: libtermkey-dev 0.22-2+b1 Β· MIT
- epel 10: libtermkey-devel 0.22-2.el10_0 Β· MIT
- epel 9: libtermkey-devel 0.22-2.el9 Β· MIT
- fedora 43: libtermkey-devel 0.22-11.fc43 Β· MIT
- fedora 43: libtermkey-devel 0.22-11.fc43 Β· MIT
- fedora 44: libtermkey-devel 0.22-12.fc44 Β· MIT
- fedora 44: libtermkey-devel 0.22-12.fc44 Β· MIT
- nixos 26.05: libtermkey 0.22
- nixpkgs unstable: libtermkey 0.22
- opensuse-leap 16.0: libtermkey-devel 0.22-bp160.1.11 Β· MIT
- opensuse-leap 16.0: libtermkey-devel 0.22-bp160.1.11 Β· MIT
- opensuse-leap 16.0: libtermkey-devel 0.22-bp160.1.11 Β· MIT
- opensuse-leap 16.0: libtermkey-devel 0.22-bp160.1.11 Β· MIT
- ubuntu questing: libtermkey-dev 0.22-2
- ubuntu resolute: libtermkey-dev 0.22-2build1 Β· MIT
- ubuntu stonking: libtermkey-dev 0.22-3 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms