MCPcopy Create free account
hub / github.com/crawl/crawl / _display_diag

Function _display_diag

crawl-ref/source/command.cc:690–795  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

688}
689
690static void _display_diag()
691{
692 string s;
693 const lib_display_info info;
694
695 // on webtiles we suppress some info that will just be confusing / not
696 // useful.
697 const bool webtiles_client
698#ifdef USE_TILE_WEB
699 = tiles.is_controlled_from_web();
700#else
701 = false;
702#endif
703
704 // if true, mostly just display the palettes.
705 const bool suppress_unix_stuff =
706#if defined(USE_TILE_LOCAL) || defined(TARGET_OS_WINDOWS)
707 true;
708#else
709 webtiles_client;
710#endif
711
712 s += make_stringf("Display type: <w>%s</w>\n", info.type.c_str());
713 if (!suppress_unix_stuff)
714 {
715 s += make_stringf("Terminal type (`TERM`): <w>%s</w>\n",
716 info.term.c_str());
717 }
718 s += make_stringf("Terminal colours: %d foreground, %d background\n\n",
719 info.fg_colors, info.bg_colors);
720
721 if (webtiles_client)
722 s+= "The webtiles client will display 16 colors.\n\n";
723
724 // TODO: should any of this be shown ever in webtiles?
725 if (!suppress_unix_stuff && (info.fg_colors < 16
726 || info.bg_colors < 16
727 || info.term == "xterm")) // hack for putty. Maybe should set a compat flag in the lib?
728 {
729 s += "Your terminal is in <red>compatibility mode</red> and may not display full colours.\n";
730 // hint for the putty users:
731 if (info.term == "xterm")
732 s += "For full 16-colour-mode, try setting a better TERM value than `xterm`, e.g. `xterm-256color` (most terminals) or `putty-256color` (for PuTTY).\n";
733
734 // XX is there really value in showing all of these? In 2021 in 99% of
735 // scenarios, I think people shouldn't mess with anything except the
736 // first, and that's only for cosmetic purposes, not compat purposes
737 s += make_stringf(
738 "\nCurrent terminal options (see the Options Guide for details):\n"
739 " `<w>allow_extended_colours</w>`: %d%s\n"
740 " `<w>bold_brightens_foreground</w>`: %d"
741 " `<w>blink_brightens_background</w>`: %d\n"
742 " `<w>best_effort_brighten_foreground</w>`: %d"
743 " `<w>best_effort_brighten_background</w>`: %d\n\n",
744 (int) Options.allow_extended_colours,
745 Options.allow_extended_colours ? " (overridden by TERM)" : "",
746 (int) Options.bold_brightens_foreground.to_bool(true),
747 (int) Options.blink_brightens_background,

Callers 1

_show_help_specialFunction · 0.85

Calls 8

make_stringfFunction · 0.85
_palette_with_bgFunction · 0.85
to_boolMethod · 0.80
add_textMethod · 0.80
default_hover_colourFunction · 0.70
set_moreMethod · 0.45
showMethod · 0.45

Tested by

no test coverage detected