From 6ebbf9c4eecc665ff116ca119ca12f8008976aeb Mon Sep 17 00:00:00 2001 From: DarkSir23 Date: Fri, 10 May 2019 12:19:08 -0400 Subject: [PATCH 1/8] Fix header and footer to use DEFAULT_CLIENT_WIDTH --- evennia/utils/eveditor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/evennia/utils/eveditor.py b/evennia/utils/eveditor.py index 2ec3865eeb..979ac266bb 100644 --- a/evennia/utils/eveditor.py +++ b/evennia/utils/eveditor.py @@ -929,9 +929,9 @@ class EvEditor(object): nchars = len(buf) sep = self._sep - header = "|n" + sep * 10 + "Line Editor [%s]" % self._key + sep * (_DEFAULT_WIDTH - 20 - len(self._key)) + header = "|n" + sep * 10 + "Line Editor [%s]" % self._key + sep * (_DEFAULT_WIDTH - 24 - len(self._key)) footer = "|n" + sep * 10 +\ - "[l:%02i w:%03i c:%04i]" % (nlines, nwords, nchars) + sep * 12 + "(:h for help)" + sep * 28 + "[l:%02i w:%03i c:%04i]" % (nlines, nwords, nchars) + sep * 12 + "(:h for help)" + sep * (_DEFAULT_WIDTH - 54) if linenums: main = "\n".join("|b%02i|||n %s" % (iline + 1 + offset, raw(line)) for iline, line in enumerate(lines)) else: From b74de1c6732cd039da9b3c96524f660306e4e64b Mon Sep 17 00:00:00 2001 From: DarkSir23 Date: Fri, 17 May 2019 19:06:49 -0400 Subject: [PATCH 2/8] Fix for EvMenu width --- evennia/utils/evmenu.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/evennia/utils/evmenu.py b/evennia/utils/evmenu.py index c3a19a6dfa..fbc44322d7 100644 --- a/evennia/utils/evmenu.py +++ b/evennia/utils/evmenu.py @@ -1005,13 +1005,16 @@ class EvMenu(object): else: # add a default white color to key table.append(" |lc%s|lt|w%s|n|le%s" % (raw_key, raw_key, desc_string)) + logger.log_msg('Table Width Max: %s' % table_width_max) + logger.log_msg('Max Width: %d' % _MAX_TEXT_WIDTH) + ncols = (_MAX_TEXT_WIDTH // table_width_max) # number of ncols + logger.log_msg('Max Columns: %d' % ncols) - ncols = (_MAX_TEXT_WIDTH // table_width_max) + 1 # number of ncols - - if ncols <= 0: + if ncols < 0: # no visible option at all return "" + ncols = ncols + 1 if ncols == 0 else ncols # get the amount of rows needed (start with 4 rows) nrows = 4 while nrows * ncols < nlist: From e5eb54b47268d34d51518ebab4fab9b2fb39a772 Mon Sep 17 00:00:00 2001 From: DarkSir23 Date: Fri, 17 May 2019 19:10:37 -0400 Subject: [PATCH 3/8] Testing a width fix. --- evennia/utils/evmenu.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/evennia/utils/evmenu.py b/evennia/utils/evmenu.py index fbc44322d7..cb1e90be6a 100644 --- a/evennia/utils/evmenu.py +++ b/evennia/utils/evmenu.py @@ -1005,10 +1005,7 @@ class EvMenu(object): else: # add a default white color to key table.append(" |lc%s|lt|w%s|n|le%s" % (raw_key, raw_key, desc_string)) - logger.log_msg('Table Width Max: %s' % table_width_max) - logger.log_msg('Max Width: %d' % _MAX_TEXT_WIDTH) ncols = (_MAX_TEXT_WIDTH // table_width_max) # number of ncols - logger.log_msg('Max Columns: %d' % ncols) if ncols < 0: # no visible option at all From 0d5d8ec84789bc50974ef68ea13d62143e482cfe Mon Sep 17 00:00:00 2001 From: DarkSir23 Date: Fri, 17 May 2019 20:52:40 -0400 Subject: [PATCH 4/8] Testing a width fix. --- evennia/utils/evmenu.py | 1 + 1 file changed, 1 insertion(+) diff --git a/evennia/utils/evmenu.py b/evennia/utils/evmenu.py index cb1e90be6a..8429c8fa47 100644 --- a/evennia/utils/evmenu.py +++ b/evennia/utils/evmenu.py @@ -1058,6 +1058,7 @@ class EvMenu(object): nodetext_width_max = max(m_len(line) for line in nodetext.split("\n")) options_width_max = max(m_len(line) for line in optionstext.split("\n")) total_width = min(screen_width, max(options_width_max, nodetext_width_max)) + logger.log_msg("Total Width: %d\nOptions Width Max: %d\nNodeText Width Max: %d" % (total_width, options_with_max, nodetext_width_max)) separator1 = "_" * total_width + "\n\n" if nodetext_width_max else "" separator2 = "\n" + "_" * total_width + "\n\n" if total_width else "" return separator1 + "|n" + nodetext + "|n" + separator2 + "|n" + optionstext From e32a096bf51dac8bc4e4baf83e1ff6c6a97d3aa8 Mon Sep 17 00:00:00 2001 From: DarkSir23 Date: Fri, 17 May 2019 20:56:57 -0400 Subject: [PATCH 5/8] Testing a width fix. --- evennia/utils/evmenu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/evennia/utils/evmenu.py b/evennia/utils/evmenu.py index 8429c8fa47..3d4a944321 100644 --- a/evennia/utils/evmenu.py +++ b/evennia/utils/evmenu.py @@ -1058,7 +1058,7 @@ class EvMenu(object): nodetext_width_max = max(m_len(line) for line in nodetext.split("\n")) options_width_max = max(m_len(line) for line in optionstext.split("\n")) total_width = min(screen_width, max(options_width_max, nodetext_width_max)) - logger.log_msg("Total Width: %d\nOptions Width Max: %d\nNodeText Width Max: %d" % (total_width, options_with_max, nodetext_width_max)) + logger.log_msg("Total Width: %d\nOptions Width Max: %d\nNodeText Width Max: %d" % (total_width, options_width_max, nodetext_width_max)) separator1 = "_" * total_width + "\n\n" if nodetext_width_max else "" separator2 = "\n" + "_" * total_width + "\n\n" if total_width else "" return separator1 + "|n" + nodetext + "|n" + separator2 + "|n" + optionstext From 4094464ec6b10d2239a667d1e62667a0e05202db Mon Sep 17 00:00:00 2001 From: DarkSir23 Date: Fri, 17 May 2019 21:02:22 -0400 Subject: [PATCH 6/8] Testing a width fix. --- evennia/utils/evmenu.py | 1 + 1 file changed, 1 insertion(+) diff --git a/evennia/utils/evmenu.py b/evennia/utils/evmenu.py index 3d4a944321..f0ecf83c19 100644 --- a/evennia/utils/evmenu.py +++ b/evennia/utils/evmenu.py @@ -1052,6 +1052,7 @@ class EvMenu(object): if self._session: screen_width = self._session.protocol_flags.get( "SCREENWIDTH", {0: _MAX_TEXT_WIDTH})[0] + logger.log_msg("Screen Width: %d" % screen_width) else: screen_width = _MAX_TEXT_WIDTH From 39d54d8f569ada6b3328c22bc6331a106e0d70c0 Mon Sep 17 00:00:00 2001 From: DarkSir23 Date: Fri, 17 May 2019 21:16:25 -0400 Subject: [PATCH 7/8] Testing a width fix. --- evennia/utils/evmenu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/evennia/utils/evmenu.py b/evennia/utils/evmenu.py index f0ecf83c19..16a1973fc4 100644 --- a/evennia/utils/evmenu.py +++ b/evennia/utils/evmenu.py @@ -1052,7 +1052,7 @@ class EvMenu(object): if self._session: screen_width = self._session.protocol_flags.get( "SCREENWIDTH", {0: _MAX_TEXT_WIDTH})[0] - logger.log_msg("Screen Width: %d" % screen_width) + logger.log_msg("Flags: %s" % str(self._session.protocol_flags)) else: screen_width = _MAX_TEXT_WIDTH From d152dbc5de2b4a3618821efb7716cd03b48df326 Mon Sep 17 00:00:00 2001 From: DarkSir23 Date: Mon, 20 May 2019 10:50:37 -0400 Subject: [PATCH 8/8] Cleaned up extra debugging lines. --- evennia/utils/evmenu.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/evennia/utils/evmenu.py b/evennia/utils/evmenu.py index 16a1973fc4..cb1e90be6a 100644 --- a/evennia/utils/evmenu.py +++ b/evennia/utils/evmenu.py @@ -1052,14 +1052,12 @@ class EvMenu(object): if self._session: screen_width = self._session.protocol_flags.get( "SCREENWIDTH", {0: _MAX_TEXT_WIDTH})[0] - logger.log_msg("Flags: %s" % str(self._session.protocol_flags)) else: screen_width = _MAX_TEXT_WIDTH nodetext_width_max = max(m_len(line) for line in nodetext.split("\n")) options_width_max = max(m_len(line) for line in optionstext.split("\n")) total_width = min(screen_width, max(options_width_max, nodetext_width_max)) - logger.log_msg("Total Width: %d\nOptions Width Max: %d\nNodeText Width Max: %d" % (total_width, options_width_max, nodetext_width_max)) separator1 = "_" * total_width + "\n\n" if nodetext_width_max else "" separator2 = "\n" + "_" * total_width + "\n\n" if total_width else "" return separator1 + "|n" + nodetext + "|n" + separator2 + "|n" + optionstext