=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/tmux.h,v retrieving revision 1.1106 retrieving revision 1.1107 diff -u -r1.1106 -r1.1107 --- src/usr.bin/tmux/tmux.h 2021/06/10 07:36:47 1.1106 +++ src/usr.bin/tmux/tmux.h 2021/06/10 07:38:28 1.1107 @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.1106 2021/06/10 07:36:47 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.1107 2021/06/10 07:38:28 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -108,12 +108,17 @@ #define VISUAL_ON 1 #define VISUAL_BOTH 2 -/* Special key codes. */ -#define KEYC_NONE 0x00ff000000000ULL -#define KEYC_UNKNOWN 0x00fe000000000ULL -#define KEYC_BASE 0x0001000000000ULL -#define KEYC_USER 0x0002000000000ULL +/* No key or unknown key. */ +#define KEYC_NONE 0x000ff000000000ULL +#define KEYC_UNKNOWN 0x000fe000000000ULL +/* + * Base for special (that is, not Unicode) keys. An enum must be at most a + * signed int, so these are based in the highest Unicode PUA. + */ +#define KEYC_BASE 0x0000000010e000ULL +#define KEYC_USER 0x0000000010f000ULL + /* Key modifier bits. */ #define KEYC_META 0x00100000000000ULL #define KEYC_CTRL 0x00200000000000ULL @@ -135,9 +140,16 @@ #define KEYC_NUSER 1000 /* Is this a mouse key? */ -#define KEYC_IS_MOUSE(key) (((key) & KEYC_MASK_KEY) >= KEYC_MOUSE && \ - ((key) & KEYC_MASK_KEY) < KEYC_BSPACE) +#define KEYC_IS_MOUSE(key) \ + (((key) & KEYC_MASK_KEY) >= KEYC_MOUSE && \ + ((key) & KEYC_MASK_KEY) < KEYC_BSPACE) +/* Is this a Unicode key? */ +#define KEYC_IS_UNICODE(key) \ + (((key) & KEYC_MASK_KEY) > 0x7f && \ + (((key) & KEYC_MASK_KEY) < KEYC_BASE || \ + ((key) & KEYC_MASK_KEY) >= KEYC_BASE_END)) + /* Multiple click timeout. */ #define KEYC_CLICK_TIMEOUT 300 @@ -158,8 +170,8 @@ { #s "Border", KEYC_ ## name ## _BORDER } /* - * A single key. This can be ASCII or Unicode or one of the keys starting at - * KEYC_BASE. + * A single key. This can be ASCII or Unicode or one of the keys between + * KEYC_BASE and KEYC_BASE_END. */ typedef unsigned long long key_code; @@ -252,6 +264,9 @@ KEYC_KP_ENTER, KEYC_KP_ZERO, KEYC_KP_PERIOD, + + /* End of special keys. */ + KEYC_BASE_END }; /* Termcap codes. */