Added TERMKEY_FORMAT_WRAPBRACKET

This commit is contained in:
Paul LeoNerd Evans
2008-10-06 22:33:49 +01:00
parent 5b24e42d90
commit 0b8680daa4
3 changed files with 20 additions and 8 deletions

View File

@@ -863,6 +863,15 @@ size_t termkey_snprint_key(termkey_t *tk, char *buffer, size_t len, termkey_key
int longmod = format & TERMKEY_FORMAT_LONGMOD;
int wrapbracket = (format & TERMKEY_FORMAT_WRAPBRACKET) &&
(key->type != TERMKEY_TYPE_UNICODE || key->modifiers != 0);
if(wrapbracket) {
l = snprintf(buffer + pos, len - pos, "<");
if(l <= 0) return pos;
pos += l;
}
if(format & TERMKEY_FORMAT_CARETCTRL) {
if(key->type == TERMKEY_TYPE_UNICODE &&
key->modifiers == TERMKEY_KEYMOD_CTRL &&
@@ -913,5 +922,11 @@ do_codepoint:
if(l <= 0) return pos;
pos += l;
if(wrapbracket) {
l = snprintf(buffer + pos, len - pos, ">");
if(l <= 0) return pos;
pos += l;
}
return pos;
}