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 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'messageWind.c') 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 ...) -- cgit v1.2.3