Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/present: editable code is not sync'd between main slide and presenter slide #26177

jtirtawangsa opened this issue Jul 2, 2018 · 0 comments


Copy link

@jtirtawangsa jtirtawangsa commented Jul 2, 2018

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.10.2 linux/amd64

Does this issue reproduce with the latest release?


What operating system and processor architecture are you using (go env)?


What did you do?

Using go "present -notes" to show editing some codes in the editable .code/.play presentation slides with presenter notes window active.

What did you expect to see?

The edited codes are synced between the main window and the presenter window.

What did you see instead?

The edited code is not synced between the two windows. The changes are only shown in the active window, i.e. If editing process in the main window, the codes in the presenter window do not change, and vice versa.


Bug in
Function setupPlayCodeSync adds EventListener in a loop using variable index i (probably expecting the inputHandler function is instantiated for each Listener).
It is not, there is only one instant of inputHandler, and the variable i will contain the last value of i, which is play.length.

One solution to this is as follow (Javascript coders probably could give better solution):

---	2017-09-20 21:24:06.052672029 +0700
+++	2018-07-02 17:41:45.431850356 +0700
@@ -578,9 +578,10 @@
     var play = document.querySelectorAll('div.playground');
     for (var i = 0; i < play.length; i++) {
       play[i].addEventListener('input', inputHandler, false);
+      play[i].setAttribute('play-index', i);
       function inputHandler(e) {
-        localStorage.setItem('play-index', i);
+        localStorage.setItem('play-index','play-index'));
@ALTree ALTree changed the title Go present program: Editable code is not sync'd between main slide and presenter slide x/tools/present: editable code is not sync'd between main slide and presenter slide Jul 2, 2018
@gopherbot gopherbot added this to the Unreleased milestone Jul 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants