long #version feedback
Hide a bug in the X11 interface by manually wrapping 'short' version line (the first line of #version output) when runtime ID or git hash and/or branch is present. Otherwise the very wide 'short' line causes a horizontal scrollbar to be present at the bottom of the popup window, but the window size doesn't take that into account so ends up being one line too short. Worse, there's no vertical scrollbar to bring the last line into view. Even if somebody figures out how to fix that properly, the really wide line above a couple of paragraphs which have been carefully wrapped for a much narrower width looked strange. Also, move the 'short' version's period to the end of the text. old: basic version info. (extra info) new: basic version info (extra info).
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 version.c $NHDT-Date: 1546137502 2018/12/30 02:38:22 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.51 $ */
|
||||
/* NetHack 3.6 version.c $NHDT-Date: 1552353060 2019/03/12 01:11:00 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.52 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Michael Allison, 2018. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -17,10 +17,10 @@
|
||||
#endif
|
||||
|
||||
#if defined(NETHACK_GIT_SHA)
|
||||
const char * NetHack_git_sha = NETHACK_GIT_SHA;
|
||||
const char *NetHack_git_sha = NETHACK_GIT_SHA;
|
||||
#endif
|
||||
#if defined(NETHACK_GIT_BRANCH)
|
||||
const char * NetHack_git_branch = NETHACK_GIT_BRANCH;
|
||||
const char *NetHack_git_branch = NETHACK_GIT_BRANCH;
|
||||
#endif
|
||||
|
||||
STATIC_DCL void FDECL(insert_rtoption, (char *));
|
||||
@@ -38,24 +38,21 @@ char *
|
||||
getversionstring(buf)
|
||||
char *buf;
|
||||
{
|
||||
boolean details = FALSE;
|
||||
|
||||
Strcpy(buf, VERSION_ID);
|
||||
#if defined(RUNTIME_PORT_ID) || \
|
||||
defined(NETHACK_GIT_SHA) || defined(NETHACK_GIT_BRANCH)
|
||||
details = TRUE;
|
||||
#endif
|
||||
|
||||
if (details) {
|
||||
#if defined(RUNTIME_PORT_ID) || defined(NETHACK_GIT_SHA) || defined(NETHACK_GIT_BRANCH)
|
||||
#if defined(RUNTIME_PORT_ID) \
|
||||
|| defined(NETHACK_GIT_SHA) || defined(NETHACK_GIT_BRANCH)
|
||||
{
|
||||
int c = 0;
|
||||
#endif
|
||||
#if defined(RUNTIME_PORT_ID)
|
||||
char tmpbuf[BUFSZ];
|
||||
char *tmp = (char *)0;
|
||||
char tmpbuf[BUFSZ], *tmp;
|
||||
#endif
|
||||
char *p = eos(buf);
|
||||
boolean dotoff = (p > buf && p[-1] == '.');
|
||||
|
||||
Sprintf(eos(buf), " (");
|
||||
if (dotoff)
|
||||
--p;
|
||||
Strcpy(p, " (");
|
||||
#if defined(RUNTIME_PORT_ID)
|
||||
tmp = get_port_id(tmpbuf);
|
||||
if (tmp)
|
||||
@@ -72,8 +69,15 @@ char *buf;
|
||||
c++ ? "," : "", NetHack_git_branch);
|
||||
#endif
|
||||
#endif
|
||||
Sprintf(eos(buf), ")");
|
||||
if (c)
|
||||
Strcat(buf, ")");
|
||||
else /* if nothing has been added, strip " (" back off */
|
||||
*p = '\0';
|
||||
if (dotoff)
|
||||
Strcat(buf, ".");
|
||||
}
|
||||
#endif /* RUNTIME_PORT_ID || NETHACK_GIT_SHA || NETHACK_GIT_BRANCH */
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
@@ -92,12 +96,25 @@ int
|
||||
doextversion()
|
||||
{
|
||||
dlb *f;
|
||||
char buf[BUFSZ];
|
||||
char buf[BUFSZ], *p = 0;
|
||||
winid win = create_nhwindow(NHW_TEXT);
|
||||
|
||||
/* instead of using ``display_file(OPTIONS_USED,TRUE)'' we handle
|
||||
the file manually so we can include dynamic version info */
|
||||
putstr(win, 0, getversionstring(buf));
|
||||
|
||||
(void) getversionstring(buf);
|
||||
/* if extra text (git info) is present, put it on separate line */
|
||||
if (strlen(buf) >= COLNO)
|
||||
p = rindex(buf, '(');
|
||||
if (p && p > buf && p[-1] == ' ')
|
||||
p[-1] = '\0';
|
||||
else
|
||||
p = 0;
|
||||
putstr(win, 0, buf);
|
||||
if (p) {
|
||||
*--p = ' ';
|
||||
putstr(win, 0, p);
|
||||
}
|
||||
|
||||
f = dlb_fopen(OPTIONS_USED, "r");
|
||||
if (!f) {
|
||||
|
||||
Reference in New Issue
Block a user