Skip to content

Commit

Permalink
Window library v1.2 fix broke AdPlay help output. Reverted the fix. I…
Browse files Browse the repository at this point in the history
…nstead, handle libebreak in AdPlug itself.
  • Loading branch information
simpeter committed Dec 26, 2024
1 parent b1a431d commit febde2b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 19 deletions.
19 changes: 10 additions & 9 deletions adplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,17 +420,18 @@ static void refresh_songinfo(CTxtWnd &w)
{
char tmpstr[80];
unsigned int time = (unsigned int)time_ms;
unsigned char width = w.getsizex() - 1;

w.erase();
sprintf(tmpstr,"Subsong : %d / %d",subsong+1,p->getsubsongs()); w.puts(tmpstr);
sprintf(tmpstr,"Position: %d / %d",p->getorder(),p->getorders()); w.puts(tmpstr);
sprintf(tmpstr,"Pattern : %d / %d",p->getpattern(),p->getpatterns()); w.puts(tmpstr);
sprintf(tmpstr,"Row : %d",p->getrow()); w.puts(tmpstr);
sprintf(tmpstr,"Speed : %d",p->getspeed()); w.puts(tmpstr);
sprintf(tmpstr,"Timer : %.2f Hz",p->getrefresh()); w.puts(tmpstr);
sprintf(tmpstr,"Time : %d:%2d.%2d",time/1000/60,time/1000%60,time/10%100); w.puts(tmpstr);
sprintf(tmpstr,"Total : %lu:%2lu.%2lu",totaltime/1000/60,totaltime/1000%60,
totaltime/10%100); w.puts(tmpstr);
snprintf(tmpstr,width,"Subsong : %d / %d\n",subsong+1,p->getsubsongs()); w.outtext(tmpstr);
snprintf(tmpstr,width,"Position: %d / %d\n",p->getorder(),p->getorders()); w.outtext(tmpstr);
snprintf(tmpstr,width,"Pattern : %d / %d\n",p->getpattern(),p->getpatterns()); w.outtext(tmpstr);
snprintf(tmpstr,width,"Row : %d\n",p->getrow()); w.outtext(tmpstr);
snprintf(tmpstr,width,"Speed : %d\n",p->getspeed()); w.outtext(tmpstr);
snprintf(tmpstr,width,"Timer : %.2f Hz\n",p->getrefresh()); w.outtext(tmpstr);
snprintf(tmpstr,width,"Time : %d:%2d.%2d\n",time/1000/60,time/1000%60,time/10%100); w.outtext(tmpstr);
snprintf(tmpstr,width,"Total : %lu:%2lu.%2lu\n",totaltime/1000/60,totaltime/1000%60,
totaltime/10%100); w.outtext(tmpstr);
w.update();
}

Expand Down
5 changes: 4 additions & 1 deletion window/readme.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Portable Textmode Window Class Library
Copyright (c) 2000 - 2002, 2006 Simon Peter <dn.tlp@gmx.net>
Version 1.2
Version 1.3

Description
-----------
Expand Down Expand Up @@ -67,6 +67,9 @@ freely, subject to the following restrictions:

History
-------
Changes from version 1.2 to version 1.3:
- Reverted bugfix from version 1.2. It should be handled in the application instead.

Changes from version 1.1 to version 1.2:
- Fixed bug which could cause newlines at the end of a row in a window to wrap around and cause an extra newline (https://github.com/adplug/adplay-dos/issues/1)

Expand Down
11 changes: 2 additions & 9 deletions window/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,15 +178,8 @@ void CWindow::outc(char c)
wndbuf[curpos] = c;
if(autocolor) colmap[curpos] = color[In];
curpos++;
}
if(c == '\n') {
// Newline will move the cursor one row down, unless it is the last in the string
// and we just started on a new window row. This would add an extra unneeded line.
if ((wherex() % insizex == 0) && curpos > 0) {
// Do nothing, cursor will move to the next row down when printing out next character anyway
} else {
setcursor(0,wherey()+1);
}
} else {
setcursor(0,wherey()+1);
}
}

Expand Down

0 comments on commit febde2b

Please # to comment.