]> granicus.if.org Git - nethack/commitdiff
Qt text windows
authorPatR <rankin@nethack.org>
Thu, 8 Apr 2021 18:42:55 +0000 (11:42 -0700)
committerPatR <rankin@nethack.org>
Thu, 8 Apr 2021 18:42:55 +0000 (11:42 -0700)
For Qt, always render text windows with fixed width font instead
of switching from proportional to fixed when the text contains
any line(s) with four consecutive spaces.  That was really meant
for menu lines without selector letters which want to be lined
up under or over ones with such, and wasn't a very good heuristic
for text windows.

Most of the text files for the '?' command happen to have such
lines so are already being shown with fixed-width font.  data.base
entries were hit or miss; most have attribution lines indented by
four or more spaces but some don't, so display was inconsistent:
some were shown with fixed-width font and some with proportional.

doc/fixes37.0
win/Qt/qt_menu.cpp

index 8618ab6dc1b7dd099eb94cf9f07d64634307fe17..22bcbecfe2d98d67fb7f246d48f35e5fd73ebe68 100644 (file)
@@ -709,7 +709,14 @@ Qt: when a new message is issued, pan the message window to its left edge if
 Qt: there was no way to enter extended command "#version" by typing; command
        name matching was waiting to disambiguate it from "#versionshort"
        and the only way to that was to type #version<return> but <return>
-       explicitly triggered rejection, cancelling '#' processing
+       explicitly triggered rejection, cancelling '#' processing; #drop vs
+       "droptype, "known vs "knownclass, and #takeoff vs #takeoffall are in
+       similar ambiguous situation but usually invoked via keystroke
+Qt: render all text windows in fixed-width font instead of just ones which
+       have one or more lines with four consecutive spaces; some data.base
+       entries do have those (usually final attribution) and some don't,
+       so display from one entry to another was inconsistent if default
+       proportional font was ever used
 Qt: while a text window was shown (such as the "things that are here" popup
        when stepping on items), typing commands had the input passed on to
        the map and then executed; sometimes that caused the not-yet-dismissed
index dd22e402d4a283f9ff0bd40cb92f191b2324eb52..b33058ae55979da2d51d9f8f10e4055ccb1c51c3 100644 (file)
@@ -1147,9 +1147,24 @@ void NetHackQtTextWindow::Display(bool block UNUSED)
     textsearching = false;
 }
 
+// handle a line of text for a text window
 void NetHackQtTextWindow::PutStr(int attr UNUSED, const QString& text)
 {
-    str_fixed=str_fixed || text.contains("    ");
+#if 1
+    // 3.7:  Always render text windows with fixed-width font.  The majority
+    // of text files we'll ever display including ('license' and 'history')
+    // happen to have some lines with four spaces anyway and/or they have
+    // been pre-formatted to fit within less than 80 columns.  For data.base
+    // entries, some do have four spaces (usually the final attribution)
+    // and some don't, resulting in inconsistent display from one entry to
+    // another if the default proportional font is ever used.
+    str_fixed = true;
+#else
+    // if any line contains four consecutive spaces, render this text window
+    // using fixed-width font; skip substring lookup if flag is already set
+    str_fixed = str_fixed || text.contains("    ");
+#endif
+    // instead of outputting the line directly, save it for future rendering
     lines->addItem(text);
 }