summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xvchat-ui.c64
1 files changed, 32 insertions, 32 deletions
diff --git a/vchat-ui.c b/vchat-ui.c
index 99951a6..4456f37 100755
--- a/vchat-ui.c
+++ b/vchat-ui.c
@@ -174,7 +174,7 @@ linecomplete (char *line)
174 174
175 /* wipe input line and reset cursor */ 175 /* wipe input line and reset cursor */
176 wmove (input, 0, 0); 176 wmove (input, 0, 0);
177 for (i = 0; i < getmaxx(input); i++) 177 for (i = 0; i < getmaxx(input) - 1; i++)
178 waddch (input, ' '); 178 waddch (input, ' ');
179 wmove (input, 0, 0); 179 wmove (input, 0, 0);
180 wrefresh (input); 180 wrefresh (input);
@@ -198,22 +198,22 @@ vciredraw (void)
198 /* calculate horizontal scrolling offset */ 198 /* calculate horizontal scrolling offset */
199 if (rl_point - scroff < 0) 199 if (rl_point - scroff < 0)
200 scroff = rl_point - 4; 200 scroff = rl_point - 4;
201 if (rl_point - scroff > getmaxx(input)) 201 if (rl_point - scroff > getmaxx(input) - 1 )
202 scroff = rl_point - getmaxx(input) + 2; 202 scroff = rl_point - getmaxx(input) + 1;
203 if (rl_point - scroff > getmaxx(input) - (hscroll - 2)) 203 if (rl_point - scroff > getmaxx(input) - 1 - (hscroll - 2))
204 scroff += hscroll; 204 scroff += hscroll;
205 else if (rl_point - scroff < getmaxx(input) - (hscroll + 2)) 205 else if (rl_point - scroff < getmaxx(input) - 1 - (hscroll + 2))
206 scroff -= hscroll; 206 scroff -= hscroll;
207 if (scroff < 0) 207 if (scroff < 0)
208 scroff = 0; 208 scroff = 0;
209 209
210 /* wipe input line */ 210 /* wipe input line */
211 wmove (input, 0, 0); 211 wmove (input, 0, 0);
212 for (i = 0; i < getmaxx(input); i++) 212 for (i = 0; i < getmaxx(input) - 1; i++)
213 waddch (input, ' '); 213 waddch (input, ' ');
214 214
215 /* show current line, move cursor, redraw! */ 215 /* show current line, move cursor, redraw! */
216 mvwaddnstr (input, 0, 0, &rl_line_buffer[scroff], getmaxx(input)); 216 mvwaddnstr (input, 0, 0, &rl_line_buffer[scroff], getmaxx(input) - 1 );
217 wmove (input, 0, rl_point - scroff); 217 wmove (input, 0, rl_point - scroff);
218 wrefresh (input); 218 wrefresh (input);
219} 219}
@@ -495,8 +495,8 @@ writescr ( WINDOW *win, struct sb_entry *entry ) {
495 if( !i || memcmp( attrbuffer+i, attrbuffer+i-1, sizeof(ncurs_attr))) 495 if( !i || memcmp( attrbuffer+i, attrbuffer+i-1, sizeof(ncurs_attr)))
496 WATTR_SET( win, attrbuffer[i]); 496 WATTR_SET( win, attrbuffer[i]);
497 if( textbuffer[ i ] == ' ') { 497 if( textbuffer[ i ] == ' ') {
498 if ((calcdrawcus(textbuffer+i+1) + getcurx(win) > getmaxx(win) - 1)&& 498 if ((calcdrawcus(textbuffer+i+1) + getcurx(win) > getmaxx(win) - 1 - 1)&&
499 (calcdrawcus(textbuffer+i+1) < getmaxx(win))) { 499 (calcdrawcus(textbuffer+i+1) < getmaxx(win) - 1 )) {
500 /* line wrap found */ 500 /* line wrap found */
501 WATTR_SET( win, orgattr); 501 WATTR_SET( win, orgattr);
502 waddstr( win, "\n "); 502 waddstr( win, "\n ");
@@ -532,7 +532,7 @@ doscroll ( int up ) {
532 WINDOW *destwin = (sb_win && private) ? private : channel; 532 WINDOW *destwin = (sb_win && private) ? private : channel;
533 struct sb_data *sb = (sb_win && private) ? sb_priv : sb_pub; 533 struct sb_data *sb = (sb_win && private) ? sb_priv : sb_pub;
534 struct sb_entry *now = sb->entries, *prev = NULL, *tmp; 534 struct sb_entry *now = sb->entries, *prev = NULL, *tmp;
535 int lines = getmaxy(destwin)>>1; 535 int lines = (getmaxy(destwin) - 1 ) >>1;
536 536
537 if( sb->scroll != sb->count ) 537 if( sb->scroll != sb->count )
538 while( now && (now->id != sb->scroll) ) { 538 while( now && (now->id != sb->scroll) ) {
@@ -547,7 +547,7 @@ doscroll ( int up ) {
547 while( now && (lines > 0)) { 547 while( now && (lines > 0)) {
548 if ( (!filtertype) || ( (now->stamp != currentstamp) && ( (now->stamp == (currentstamp | (1<<15))) || testfilter( now ) ) ) ) 548 if ( (!filtertype) || ( (now->stamp != currentstamp) && ( (now->stamp == (currentstamp | (1<<15))) || testfilter( now ) ) ) )
549 { 549 {
550 lines -= getsbeheight( now, getmaxx(destwin), usetime ); 550 lines -= getsbeheight( now, getmaxx(destwin) - 1, usetime );
551 } 551 }
552 tmp = now; now = (struct sb_entry*)((unsigned long)now->link ^ (unsigned long)prev); prev = tmp; 552 tmp = now; now = (struct sb_entry*)((unsigned long)now->link ^ (unsigned long)prev); prev = tmp;
553 } 553 }
@@ -674,7 +674,7 @@ clearpriv ()
674 674
675 /* clear window, move cursor to bottom, redraw */ 675 /* clear window, move cursor to bottom, redraw */
676 wclear (dest); 676 wclear (dest);
677 wmove (dest, getmaxy(dest), getmaxx(dest)); 677 wmove (dest, getmaxy(dest) - 1, getmaxx(dest) - 1);
678 wrefresh (dest); 678 wrefresh (dest);
679 679
680} 680}
@@ -685,7 +685,7 @@ clearchan ()
685{ 685{
686 /* clear window, move cursor to bottom, redraw */ 686 /* clear window, move cursor to bottom, redraw */
687 wclear (channel); 687 wclear (channel);
688 wmove (channel, getmaxy(channel), getmaxx(channel)); 688 wmove (channel, getmaxy(channel) - 1, getmaxx(channel) - 1);
689 wrefresh (channel); 689 wrefresh (channel);
690} 690}
691 691
@@ -972,7 +972,7 @@ drawwin (WINDOW *win, struct sb_data *sb )
972{ 972{
973 if (win) { 973 if (win) {
974 struct sb_entry *now = sb->entries, *prev = NULL, *tmp; 974 struct sb_entry *now = sb->entries, *prev = NULL, *tmp;
975 struct sb_entry *vis[getmaxy(win) + 1]; 975 struct sb_entry *vis[getmaxy(win)];
976 int sumlines = 0, sumbuffers = 0; 976 int sumlines = 0, sumbuffers = 0;
977 977
978 /* public scrollback */ 978 /* public scrollback */
@@ -982,13 +982,13 @@ drawwin (WINDOW *win, struct sb_data *sb )
982 } 982 }
983 983
984 if( (win == output) || (filtertype == 0)) { 984 if( (win == output) || (filtertype == 0)) {
985 while( now && (sumlines <= getmaxy(win) )) { 985 while( now && (sumlines <= getmaxy(win) - 1 )) {
986 sumlines += getsbeheight( now, getmaxx(win), ((win == channel)||(win == private)) && usetime ); 986 sumlines += getsbeheight( now, getmaxx(win) - 1, ((win == channel)||(win == private)) && usetime );
987 vis[ sumbuffers++ ] = now; 987 vis[ sumbuffers++ ] = now;
988 tmp = now; now = (struct sb_entry*)((unsigned long)now->link ^ (unsigned long)prev); prev = tmp; 988 tmp = now; now = (struct sb_entry*)((unsigned long)now->link ^ (unsigned long)prev); prev = tmp;
989 } 989 }
990 } else { 990 } else {
991 while( now && (sumlines <= getmaxy(win) )) { 991 while( now && (sumlines <= getmaxy(win) - 1 )) {
992 992
993 /* If stamp matches exactly, line has been filtered out, since top 993 /* If stamp matches exactly, line has been filtered out, since top
994 bit off means hidden */ 994 bit off means hidden */
@@ -999,7 +999,7 @@ drawwin (WINDOW *win, struct sb_data *sb )
999 tested against filters, which updates stamp. */ 999 tested against filters, which updates stamp. */
1000 if( (now->stamp == (currentstamp | 0x8000) ) || testfilter( now )) 1000 if( (now->stamp == (currentstamp | 0x8000) ) || testfilter( now ))
1001 { 1001 {
1002 sumlines += getsbeheight( now, getmaxx(win), ((win == channel)||(win == private)) && usetime ); 1002 sumlines += getsbeheight( now, getmaxx(win) - 1, ((win == channel)||(win == private)) && usetime );
1003 vis[ sumbuffers++ ] = now; 1003 vis[ sumbuffers++ ] = now;
1004 } 1004 }
1005 1005
@@ -1009,11 +1009,11 @@ drawwin (WINDOW *win, struct sb_data *sb )
1009 } 1009 }
1010 1010
1011 /* If buffer is not completely filled, clear window */ 1011 /* If buffer is not completely filled, clear window */
1012 if( sumlines < getmaxy(win) + 1 ) 1012 if( sumlines < getmaxy(win) )
1013 wclear(win); 1013 wclear(win);
1014 1014
1015 /* Move pointer to bottom to let curses scroll */ 1015 /* Move pointer to bottom to let curses scroll */
1016 wmove(win, getmaxy(win), getmaxx(win)); 1016 wmove(win, getmaxy(win) - 1, getmaxx(win) - 1);
1017 1017
1018 /* Plot visible lines */ 1018 /* Plot visible lines */
1019 while (sumbuffers--) writescr( win, vis[sumbuffers] ); 1019 while (sumbuffers--) writescr( win, vis[sumbuffers] );
@@ -1275,7 +1275,7 @@ consoleline (char *message)
1275 WATTR_GET( console, old_att); 1275 WATTR_GET( console, old_att);
1276 if(sb_pub->scroll!=sb_pub->count) WATTR_SET( console, new_att); 1276 if(sb_pub->scroll!=sb_pub->count) WATTR_SET( console, new_att);
1277 1277
1278 for (i = 0; i < getmaxx(console); i++) 1278 for (i = 0; i < getmaxx(console) - 1; i++)
1279 waddch (console, ' '); 1279 waddch (console, ' ');
1280 1280
1281 if( !message && usetime ) 1281 if( !message && usetime )
@@ -1284,14 +1284,14 @@ consoleline (char *message)
1284 time_t now = time(NULL); 1284 time_t now = time(NULL);
1285 strftime( date, sizeof(date), getformatstr(FS_CONSOLETIME), localtime(&now)); 1285 strftime( date, sizeof(date), getformatstr(FS_CONSOLETIME), localtime(&now));
1286 snprintf( tmpstr, TMPSTRSIZE, "%s%s", date, consolestr); 1286 snprintf( tmpstr, TMPSTRSIZE, "%s%s", date, consolestr);
1287 mvwaddnstr (console, 0, 0, tmpstr, getmaxx(console)); 1287 mvwaddnstr (console, 0, 0, tmpstr, getmaxx(console) - 1);
1288 } else { 1288 } else {
1289 mvwaddnstr (console, 0, 0, message ? message : consolestr, getmaxx(console)); 1289 mvwaddnstr (console, 0, 0, message ? message : consolestr, getmaxx(console) - 1);
1290 } 1290 }
1291 1291
1292 snprintf(tmpstr,TMPSTRSIZE,getformatstr(FS_SBINF),sb_pub->scroll,sb_pub->count); 1292 snprintf(tmpstr,TMPSTRSIZE,getformatstr(FS_SBINF),sb_pub->scroll,sb_pub->count);
1293 mvwaddstr (console, 0, getmaxx(console) - (strlen(tmpstr)-1),tmpstr); 1293 mvwaddstr (console, 0, getmaxx(console) - 1 - (strlen(tmpstr)-1),tmpstr);
1294 if (sb_win == 0) mvwaddch (console, 0, getmaxx(console),'*'); 1294 if (sb_win == 0) mvwaddch (console, 0, getmaxx(console) - 1,'*');
1295 1295
1296 WATTR_SET( console, old_att); 1296 WATTR_SET( console, old_att);
1297 1297
@@ -1328,13 +1328,13 @@ topicline (char *message)
1328 if( private && (sb_priv->scroll!=sb_priv->count)) 1328 if( private && (sb_priv->scroll!=sb_priv->count))
1329 WATTR_SET( topic, new_att); 1329 WATTR_SET( topic, new_att);
1330 1330
1331 for (i = 0; i < getmaxx(topic); i++) 1331 for (i = 0; i < getmaxx(topic) - 1; i++)
1332 waddch (topic, ' '); 1332 waddch (topic, ' ');
1333 mvwaddnstr (topic, 0, 0, message ? message : topicstr, getmaxx(topic)); 1333 mvwaddnstr (topic, 0, 0, message ? message : topicstr, getmaxx(topic) - 1);
1334 if (private) { 1334 if (private) {
1335 snprintf(tmpstr,TMPSTRSIZE,getformatstr(FS_SBINF),sb_priv->scroll,sb_priv->count); 1335 snprintf(tmpstr,TMPSTRSIZE,getformatstr(FS_SBINF),sb_priv->scroll,sb_priv->count);
1336 mvwaddstr (topic, 0, getmaxx(topic) - (strlen(tmpstr)-1),tmpstr); 1336 mvwaddstr (topic, 0, getmaxx(topic) - 1 - (strlen(tmpstr)-1),tmpstr);
1337 if (sb_win == 1) mvwaddch (topic, 0, getmaxx(topic),'*'); 1337 if (sb_win == 1) mvwaddch (topic, 0, getmaxx(topic) - 1,'*');
1338 } 1338 }
1339 WATTR_SET( topic, old_att); 1339 WATTR_SET( topic, old_att);
1340 1340
@@ -1403,13 +1403,13 @@ vcnredraw (void)
1403 1403
1404 /* wipe input line and reset cursor */ 1404 /* wipe input line and reset cursor */
1405 wmove(input, 0, 0); 1405 wmove(input, 0, 0);
1406 for (i = 0; i < getmaxx(input); i++) 1406 for (i = 0; i < getmaxx(input) - 1; i++)
1407 waddch(input, ' '); 1407 waddch(input, ' ');
1408 wmove(input, 0, 0); 1408 wmove(input, 0, 0);
1409 1409
1410 /* draw as many stars as there are characters */ 1410 /* draw as many stars as there are characters */
1411 mvwaddnstr(input, 0, 0, &passbof[rl_point%2], 12); 1411 mvwaddnstr(input, 0, 0, &passbof[rl_point%2], 12);
1412 wmove(input, 0, getmaxx(input)); 1412 wmove(input, 0, getmaxx(input) - 1);
1413 wrefresh(input); 1413 wrefresh(input);
1414} 1414}
1415 1415
@@ -1451,7 +1451,7 @@ passprompt (char *buf, int size, int rwflag, void *userdata)
1451 1451
1452 /* wipe input line and reset cursor */ 1452 /* wipe input line and reset cursor */
1453 wmove (input, 0, 0); 1453 wmove (input, 0, 0);
1454 for (i = 0; i < getmaxx(input); i++) 1454 for (i = 0; i < getmaxx(input) - 1; i++)
1455 waddch (input, ' '); 1455 waddch (input, ' ');
1456 wmove (input, 0, 0); 1456 wmove (input, 0, 0);
1457 wrefresh (input); 1457 wrefresh (input);