snprint_key() now takes a bitmask format, not a single boolean
This commit is contained in:
parent
a06d010504
commit
f54687c583
|
@ -856,11 +856,13 @@ termkey_keysym termkey_register_csifunc_full(termkey_t *tk, termkey_type type, t
|
||||||
return sym;
|
return sym;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t termkey_snprint_key(termkey_t *tk, char *buffer, size_t len, termkey_key *key, int longmod)
|
size_t termkey_snprint_key(termkey_t *tk, char *buffer, size_t len, termkey_key *key, termkey_format format)
|
||||||
{
|
{
|
||||||
size_t pos = 0;
|
size_t pos = 0;
|
||||||
size_t l;
|
size_t l;
|
||||||
|
|
||||||
|
int longmod = format & TERMKEY_FORMAT_LONGMOD;
|
||||||
|
|
||||||
if(key->modifiers & TERMKEY_KEYMOD_CTRL) {
|
if(key->modifiers & TERMKEY_KEYMOD_CTRL) {
|
||||||
l = snprintf(buffer + pos, len - pos, longmod ? "Ctrl-" : "C-");
|
l = snprintf(buffer + pos, len - pos, longmod ? "Ctrl-" : "C-");
|
||||||
if(l <= 0) return pos;
|
if(l <= 0) return pos;
|
||||||
|
|
|
@ -132,6 +132,10 @@ termkey_keysym termkey_register_csi_ss3_full(termkey_t *tk, termkey_type type, t
|
||||||
termkey_keysym termkey_register_ss3kpalt_full(termkey_t *tk, termkey_type type, termkey_keysym sym, int modifier_set, int modifier_mask, unsigned char cmd, const char *name, char kpalt);
|
termkey_keysym termkey_register_ss3kpalt_full(termkey_t *tk, termkey_type type, termkey_keysym sym, int modifier_set, int modifier_mask, unsigned char cmd, const char *name, char kpalt);
|
||||||
termkey_keysym termkey_register_csifunc_full(termkey_t *tk, termkey_type type, termkey_keysym sym, int modifier_set, int modifier_mask, int number, const char *name);
|
termkey_keysym termkey_register_csifunc_full(termkey_t *tk, termkey_type type, termkey_keysym sym, int modifier_set, int modifier_mask, int number, const char *name);
|
||||||
|
|
||||||
size_t termkey_snprint_key(termkey_t *tk, char *buffer, size_t len, termkey_key *key, int longmod);
|
typedef enum {
|
||||||
|
TERMKEY_FORMAT_LONGMOD = 1
|
||||||
|
} termkey_format;
|
||||||
|
|
||||||
|
size_t termkey_snprint_key(termkey_t *tk, char *buffer, size_t len, termkey_key *key, termkey_format format);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue