Allow \f to mark EvMore pagebreaks for cmds. Resolves #1585.

This commit is contained in:
Griatch 2019-03-31 21:10:37 +02:00
parent f4a1bf9bae
commit 83c6bb69d1
3 changed files with 28 additions and 22 deletions

View file

@ -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.

View file

@ -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

View file

@ -171,6 +171,11 @@ 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 "\f" in text:
self._pages = text.split("\f")
self._npages = len(self._pages)
self._npos = 0
else:
if justify_kwargs is False:
# no justification. Simple division by line
lines = text.split("\n")