sugarcube-2 icon indicating copy to clipboard operation
sugarcube-2 copied to clipboard

Engine.backward() disables Config.cleanupWikifierOutput = true

Open david-donachie opened this issue 1 year ago • 6 comments

Describe the bug. Using Engine.backward() in a story with Config.cleanupWikifierOutput = true generates a passage with <br> tags as if Config.cleanupWikifierOutput was not set.

To Reproduce:

  1. Set Config.cleanupWikifierOutput = true in story JS
  2. View a passage
  3. Go to a second passage
  4. Run Engine.backward() to go back to the first pasage

Expected behavior. The first passage should have <p> tags as normal, but just has plain <br> instead

Project details.

  • SugarCube Version: 2.36.1
  • Compiler & Version: Twine 2.6.1

Desktop details.

  • OS & Version: OSX
  • Browser & Version Firefox

david-donachie avatar Jun 10 '23 18:06 david-donachie

Related #189

david-donachie avatar Jun 10 '23 18:06 david-donachie

This is likely related to timing. I.e., Going backwards before the last moment has finished rendering.

tmedwards avatar Jul 06 '23 12:07 tmedwards

This is likely related to timing. I.e., Going backwards before the last moment has finished rendering.

It seemed to happen even if I waited a long while. Could it be that the engine renders the past moment differently and doesn't load the config setting?

hituro avatar Jul 06 '23 12:07 hituro

Config settings, in general, should be set in either the story JavaScript or StoryInit, which is to say not only outside of the story history but before it even begins. In that case, the setting should always be active during normal operation.

All moments are rendered equally, wrt. the setting anyway.

The cleanup setting is only used if no other Wikifier calls are active somewhere. This is the likely culprit of "it no worky at all" the majority of the time.

tmedwards avatar Jul 06 '23 12:07 tmedwards

Yes, I didn't mean that the Config setting was being reset, I was implying that the rendering process involved in Engine.backward() didn't honour it.

So, given that this happens even if there is a long delay before going backwards, it implies that the process nevertheless invokes another Wikifier? Could it be related to StoryInterface rendering passages?

hituro avatar Jul 06 '23 13:07 hituro

I tested the reported behaviour using links like...

<<link 'Backward'>><<run Engine.backward()>><</link>>

...and...

<<link 'Forward'>><<run Engine.forward()>><</link>>

...and the issue also occurs when Engine.forward() is used to wind History forward again.

The Undo and Redo navigation links did not display the reported behaviour when used in the same testing project.

greyelf avatar Jul 07 '23 00:07 greyelf