Skip to content

Commit

Permalink
'testcurs' had a display oddity if the screen was less than 77 column…
Browse files Browse the repository at this point in the history
…s wide.
  • Loading branch information
Bill-Gray committed Apr 25, 2024
1 parent e29f6ef commit 06dd84b
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions demos/testcurs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1469,6 +1469,8 @@ void extended(int tmarg)
short i, x, y, z, lmarg = (short)(COLS - 77) / 2;

erase();
if( lmarg < 0)
lmarg = 0;

curs_set(0);

Expand All @@ -1479,9 +1481,17 @@ void extended(int tmarg)
mvaddstr(tmarg + 2, lmarg, "6x6x6 Color Cube (16-231):");

mvaddstr(tmarg + 4, lmarg, "Blk Red");
mvaddstr(tmarg + 4, lmarg + 65, "Grn Yel");
mvaddstr(tmarg + 11, lmarg, "Blue Mgta");
mvaddstr(tmarg + 11, lmarg + 65, "Cyan White");
if( COLS >= 77)
{
mvaddstr(tmarg + 4, lmarg + 65, "Grn Yel");
mvaddstr(tmarg + 11, lmarg + 65, "Cyan White");
}
else
{
mvaddstr(tmarg + 11, COLS - 12, "Grn Yel");
mvaddstr(tmarg + 18, COLS - 12, "Cyan White");
}

for (i = 16; i < 256; i++)
init_pair(i, COLOR_BLACK, i);
Expand All @@ -1491,8 +1501,14 @@ void extended(int tmarg)
for (y = 0; y < 6; y++)
{
chtype ch = ' ' | COLOR_PAIR(i++);

mvaddch(tmarg + 5 + y, z * 13 + x * 2 + lmarg, ch);
int line = tmarg + 5 + y, col = z * 13 + x * 2 + lmarg;

if( z == 5 && COLS < 77)
{
line += 7;
col += COLS - 77;
}
mvaddch( line, col, ch);
addch(ch);
}

Expand Down

0 comments on commit 06dd84b

Please sign in to comment.