Start adding menu OLC mechanic for spawner.

The EvMenu behaves strangely; going from desc->tags by
setting the description means that the back-option no
longer works, giving an error that the desc-node is not
defined ...
This commit is contained in:
Griatch 2018-03-18 21:16:39 +01:00
parent 641ea746a5
commit 2d791252e3
3 changed files with 227 additions and 7 deletions

View file

@ -945,9 +945,11 @@ class EvMenu(object):
node (str): The formatted node to display.
"""
screen_width = self._session.protocol_flags.get("SCREENWIDTH", {0: 78})[0]
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 = max(options_width_max, nodetext_width_max)
total_width = min(screen_width, max(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