diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b9b27d2d9..9eb72e746d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -115,9 +115,10 @@ Web/Django standard initiative (@strikaco) str to bytes. - `evennia.MONITOR_HANDLER.all` now takes keyword argument `obj` to only retrieve monitors from that specific Object (rather than all monitors in the entire handler). - +- Support adding `\f` in command doc strings to force where EvMore puts page breaks. ### Contribs + - The `extended_room` contrib saw some backwards-incompatible refactoring: + All commands now begin with `CmdExtendedRoom`. So before it was `CmdExtendedLook`, now it's `CmdExtendedRoomLook` etc. diff --git a/evennia/commands/default/building.py b/evennia/commands/default/building.py index 6adc59fce1..e8c91d90fb 100644 --- a/evennia/commands/default/building.py +++ b/evennia/commands/default/building.py @@ -2805,7 +2805,7 @@ class CmdSpawn(COMMAND_DEFAULT_CLASS): @spawn GOBLIN @spawn {"key":"goblin", "typeclass":"monster.Monster", "location":"#2"} @spawn/save {"key": "grunt", prototype: "goblin"};;mobs;edit:all() - + \f Dictionary keys: |wprototype_parent |n - name of parent prototype to use. Required if typeclass is not set. Can be a path or a list for multiple inheritance (inherits diff --git a/evennia/utils/evmore.py b/evennia/utils/evmore.py index 94173b9eca..547c2bcda8 100644 --- a/evennia/utils/evmore.py +++ b/evennia/utils/evmore.py @@ -171,30 +171,35 @@ class EvMore(object): height = max(4, session.protocol_flags.get("SCREENHEIGHT", {0: _SCREEN_HEIGHT})[0] - 4) width = session.protocol_flags.get("SCREENWIDTH", {0: _SCREEN_WIDTH})[0] - if justify_kwargs is False: - # no justification. Simple division by line - lines = text.split("\n") + if "\f" in text: + self._pages = text.split("\f") + self._npages = len(self._pages) + self._npos = 0 else: - # we must break very long lines into multiple ones - justify_kwargs = justify_kwargs or {} - width = justify_kwargs.get("width", width) - justify_kwargs["width"] = width - justify_kwargs["align"] = justify_kwargs.get("align", 'l') - justify_kwargs["indent"] = justify_kwargs.get("indent", 0) + if justify_kwargs is False: + # no justification. Simple division by line + lines = text.split("\n") + else: + # we must break very long lines into multiple ones + justify_kwargs = justify_kwargs or {} + width = justify_kwargs.get("width", width) + justify_kwargs["width"] = width + justify_kwargs["align"] = justify_kwargs.get("align", 'l') + justify_kwargs["indent"] = justify_kwargs.get("indent", 0) - lines = [] - for line in text.split("\n"): - if len(line) > width: - lines.extend(justify(line, **justify_kwargs).split("\n")) - else: - lines.append(line) + lines = [] + for line in text.split("\n"): + if len(line) > width: + lines.extend(justify(line, **justify_kwargs).split("\n")) + else: + lines.append(line) - # always limit number of chars to 10 000 per page - height = min(10000 // max(1, width), height) + # always limit number of chars to 10 000 per page + height = min(10000 // max(1, width), height) - self._pages = ["\n".join(lines[i:i + height]) for i in range(0, len(lines), height)] - self._npages = len(self._pages) - self._npos = 0 + self._pages = ["\n".join(lines[i:i + height]) for i in range(0, len(lines), height)] + self._npages = len(self._pages) + self._npos = 0 if self._npages <= 1 and not always_page: # no need for paging; just pass-through.