From c9cab824e9154c9b73309e899d9ff7417aaa4349 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Thu, 20 Aug 2015 01:13:20 -0300 Subject: [PATCH] Extra checks. --- MainPanel.c | 2 +- RichString.c | 2 +- RichString.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/MainPanel.c b/MainPanel.c index be51c101..2e91a3c5 100644 --- a/MainPanel.c +++ b/MainPanel.c @@ -79,7 +79,7 @@ static HandlerResult MainPanel_eventHandler(Panel* super, int ch) { } else { reaction |= Action_setSortKey(settings, field); } - reaction |= HTOP_RECALCULATE | HTOP_REDRAW_BAR; + reaction |= HTOP_RECALCULATE | HTOP_REDRAW_BAR | HTOP_SAVE_SETTINGS; result = HANDLED; } else if (ch != ERR && this->inc->active) { bool filterChanged = IncSet_handleKey(this->inc, ch, super, (IncMode_GetPanelValue) MainPanel_getValue, NULL); diff --git a/RichString.c b/RichString.c index ad90a0ac..ffed3ee0 100644 --- a/RichString.c +++ b/RichString.c @@ -84,7 +84,7 @@ static void RichString_extendLen(RichString* this, int len) { this->chlen = len; } -#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) +#define RichString_setLen(this, len) do{ if(len < RICHSTRING_MAXLEN && this->chlen < RICHSTRING_MAXLEN) { RichString_setChar(this,len,0); this->chlen=len; } else RichString_extendLen(this,len); }while(0) #ifdef HAVE_LIBNCURSESW diff --git a/RichString.h b/RichString.h index 3179bb97..73e59610 100644 --- a/RichString.h +++ b/RichString.h @@ -61,7 +61,7 @@ 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) +#define RichString_setLen(this, len) do{ if(len < RICHSTRING_MAXLEN && this->chlen < RICHSTRING_MAXLEN) { RichString_setChar(this,len,0); this->chlen=len; } else RichString_extendLen(this,len); }while(0) #ifdef HAVE_LIBNCURSESW