From 0b8680daa45d22b3d61b064faaf4114d0cf57d0c Mon Sep 17 00:00:00 2001 From: Paul LeoNerd Evans Date: Mon, 6 Oct 2008 22:33:49 +0100 Subject: Added TERMKEY_FORMAT_WRAPBRACKET --- termkey.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'termkey.c') diff --git a/termkey.c b/termkey.c index 273318c..4175ad0 100644 --- a/termkey.c +++ b/termkey.c @@ -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; } -- cgit v1.2.3-54-g00ecf