From f19d27b0ed458a7a08bb31927fcac9a5d328cbc1 Mon Sep 17 00:00:00 2001 From: ache Date: Fri, 26 Jan 2018 20:16:48 +0100 Subject: Fix message showing bug --- messageWind.c | 12 ++++++++---- wind.c | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/messageWind.c b/messageWind.c index 28eaa54..98b2838 100644 --- a/messageWind.c +++ b/messageWind.c @@ -23,16 +23,20 @@ void toTheEnd(void) { if( !currentConv ) return; - int i = currentConv->nbSMS -1, size = h_WMessage ; + int i = currentConv->nbSMS -1, size = h_WMessage + 1; char lin[200] = ""; + char con[200] = ""; - for(; i > 0 && size > 0 ; i--) { - size -= nbLineSMS(¤tConv->listSMS[i]) + 2; + for(; i > 0 && size >= 0 ; i--,size--) { + size -= nbLineSMS(¤tConv->listSMS[i]) + 1; + sprintf(con, "echo %d >> /tmp/a", nbLineSMS(¤tConv->listSMS[i]) + 1); + system(con); + } if( size > 0 ) firstSMSIndex = 0; else - firstSMSIndex = i+1 == currentConv->nbSMS ? i : i+1; + firstSMSIndex = /*(i+1 == currentConv->nbSMS) ? i :*/ i+2; // Seriously ... It can happen only if a SMS is greater than // the windows size ... We simply show the begin of the SMS without // the end. (Yeah, fuck this ...) diff --git a/wind.c b/wind.c index 796476d..6199e3e 100644 --- a/wind.c +++ b/wind.c @@ -24,7 +24,7 @@ void resize() { y_WMessage = 1; w_WMessage = (4*COLS)/5-2; - h_WMessage = LINES-5; + h_WMessage = LINES-2; clear(); showContactListW(); -- cgit v1.2.3