From 9faf4938b8195a0fb5d62cf1702f9f5c07523031 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Wed, 19 Nov 2014 23:17:52 -0200 Subject: Refactored key handlers. Made the logic more modular, hopefully easier to follow, and removed repeated code. Plus, some optimization in RichString code. --- RichString.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'RichString.h') diff --git a/RichString.h b/RichString.h index a9cb3f6e..971e3acb 100644 --- a/RichString.h +++ b/RichString.h @@ -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 @@ -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); -- cgit v1.2.3