10-21-2020, 03:58 AM
(10-21-2020, 02:38 AM)tomthetaffer Wrote: Is there any way we can use a linebreak? I tried using /n last night in a simple helloworld app, and the symbol printed as '?'.
Line break handling is integrated into the code to wrap text to fit a specified width. The assumption is that if you need to handle line breaks then you probably don't know how many characters are in the string so therefore you need to split it into lines.
Documentation for the line wrapping code is here (the wrap logic knows the currently selected font so no need to pass this as an argument):
https://wasp-os.readthedocs.io/en/latest...aw565.wrap
You can see the wrap() method being used for real in the pager application but the example in the self test is more compact and easier to read:
https://github.com/daniel-thompson/wasp-...pp.py#L154
Note that the testapp is also "cheating" a little since it knows that the string fits on the screen. Part of the reason the pager is so much more complex is that it allows us to scroll through the whole message regardless of length. Anyhow I'd suggest your first implementation be fairly simple (only show the first two/three lines of the notificaton) to get things working. You can add scrolling later to step through the message on the clock face if you like or alternatively you can just preview the first lines of the first message and keep the existing swipe-down approach to view and dismiss the notification.