Renamed snprint_key() to strfkey(); provide redirection trampoline

This commit is contained in:
Paul LeoNerd Evans 2011-03-31 11:08:43 +01:00
parent 280047e745
commit 26ef76349e
4 changed files with 11 additions and 2 deletions

View File

@ -6,7 +6,7 @@
static void on_key(TermKey *tk, TermKeyKey *key) static void on_key(TermKey *tk, TermKeyKey *key)
{ {
char buffer[50]; char buffer[50];
termkey_snprint_key(tk, buffer, sizeof buffer, key, TERMKEY_FORMAT_VIM); termkey_strfkey(tk, buffer, sizeof buffer, key, TERMKEY_FORMAT_VIM);
printf("%s\n", buffer); printf("%s\n", buffer);
} }

2
demo.c
View File

@ -44,7 +44,7 @@ int main(int argc, char *argv[])
printf("\e[?%dhMouse mode active\n", mouse); printf("\e[?%dhMouse mode active\n", mouse);
while((ret = termkey_waitkey(tk, &key)) != TERMKEY_RES_EOF) { while((ret = termkey_waitkey(tk, &key)) != TERMKEY_RES_EOF) {
termkey_snprint_key(tk, buffer, sizeof buffer, &key, format); termkey_strfkey(tk, buffer, sizeof buffer, &key, format);
printf("%s\n", buffer); printf("%s\n", buffer);
if(key.type == TERMKEY_TYPE_UNICODE && if(key.type == TERMKEY_TYPE_UNICODE &&

View File

@ -935,7 +935,13 @@ static TermKeySym register_c0_full(TermKey *tk, TermKeySym sym, int modifier_set
return sym; return sym;
} }
/* Previous name for this function */
size_t termkey_snprint_key(TermKey *tk, char *buffer, size_t len, TermKeyKey *key, TermKeyFormat format) size_t termkey_snprint_key(TermKey *tk, char *buffer, size_t len, TermKeyKey *key, TermKeyFormat format)
{
return termkey_strfkey(tk, buffer, len, key, format);
}
size_t termkey_strfkey(TermKey *tk, char *buffer, size_t len, TermKeyKey *key, TermKeyFormat format)
{ {
size_t pos = 0; size_t pos = 0;
size_t l = 0; size_t l = 0;

View File

@ -189,6 +189,9 @@ typedef enum {
#define TERMKEY_FORMAT_VIM (TERMKEY_FORMAT_ALTISMETA|TERMKEY_FORMAT_WRAPBRACKET) #define TERMKEY_FORMAT_VIM (TERMKEY_FORMAT_ALTISMETA|TERMKEY_FORMAT_WRAPBRACKET)
size_t termkey_strfkey(TermKey *tk, char *buffer, size_t len, TermKeyKey *key, TermKeyFormat format);
// Old name for termkey_strfkey()
size_t termkey_snprint_key(TermKey *tk, char *buffer, size_t len, TermKeyKey *key, TermKeyFormat format); size_t termkey_snprint_key(TermKey *tk, char *buffer, size_t len, TermKeyKey *key, TermKeyFormat format);
// Legacy name typedefs // Legacy name typedefs