Refactored key handlers.

Made the logic more modular, hopefully easier to follow,
and removed repeated code.
Plus, some optimization in RichString code.
This commit is contained in:
Hisham Muhammad
2014-11-19 23:17:52 -02:00
parent 300af4b829
commit 9faf4938b8
7 changed files with 462 additions and 371 deletions

View File

@ -9,7 +9,7 @@ Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
#define RICHSTRING_MAXLEN 300
#define RICHSTRING_MAXLEN 350
#include "config.h"
#include <ctype.h>
@ -50,8 +50,8 @@ in the source distribution for its full text.
typedef struct RichString_ {
int chlen;
CharType chstr[RICHSTRING_MAXLEN+1];
CharType* chptr;
CharType chstr[RICHSTRING_MAXLEN+1];
} RichString;
@ -61,6 +61,8 @@ typedef struct RichString_ {
#define charBytes(n) (sizeof(CharType) * (n))
#define RichString_setLen(this, len) do{ if(len < RICHSTRING_MAXLEN) { RichString_setChar(this,len,0); this->chlen=len; } else RichString_extendLen(this,len); }while(0)
#ifdef HAVE_LIBNCURSESW
extern void RichString_setAttrn(RichString* this, int attrs, int start, int finish);