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: .play snippet don't handle inserted newlines when using the Enter key. #9011

Open
gopherbot opened this issue Oct 28, 2014 · 1 comment

Comments

Projects
None yet
4 participants
@gopherbot
Copy link

commented Oct 28, 2014

by smyrman:

Before filing a bug, please check whether it has been fixed since the
latest release. Search the issue tracker and check that you're running the
latest version of Go:


Run "go version" and compare against
http://golang.org/doc/devel/release.html  If a newer version of Go exists,
install it and retry what you did to reproduce the problem.

Thanks.

What does 'go version' print?

go version go1.3.3 linux/amd64


What steps reproduce the problem?

Using the following configuration:
- OS: Arch Linux
- Web browser: Chrome Version 38.0.2125.104 (64-bit)
- Keyboard layout: US Internationl AltGr Unicode combining

1. Edit the code in a present ".play" snippet.
2. Add a new code line by using Enter (not shift enter).
3.  Click Run...

If possible, include a link to a program on play.golang.org.

What happened?

The compiler don't detect the newline added by Enter, and the snippet compilation fails.
E.g.:

    prog.go:10: syntax error: unexpected name, expecting semicolon or newline or }
    [process exited with non-zero status]
    Program exited.

What should have happened instead?

The newline should have been detected, and the program should have compiled.

Please provide any additional information below.

I tested to use Chrome Inspect elements, and I can see that using
"shift+Enter" and "Enter", have slightly different effect on the
edited HTML.

Adding a line with Shift + Enter works, and the snippet runs. Adding a file with just
Enter, creates a new "<pre>", element, and the snipet don't run (unless
semicolons are manually adde to the end of the line).

Attachments:

  1. original.png (13618 bytes)
  2. added_line_with_shift_enter.png (14761 bytes)
  3. added_line_with_just_enter.png (21574 bytes)
@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Oct 28, 2014

Comment 1:

Labels changed: added repo-tools, release-none.

@gopherbot gopherbot added new labels Oct 28, 2014

@bradfitz bradfitz removed the new label Dec 18, 2014

@rsc rsc added this to the Unplanned milestone Apr 10, 2015

@rsc rsc removed the release-none label Apr 10, 2015

@rsc rsc changed the title go.tools/present: .play snippet don't handle inserted newlines when using the Enter key. x/tools/present: .play snippet don't handle inserted newlines when using the Enter key. Apr 14, 2015

@rsc rsc modified the milestones: Unreleased, Unplanned Apr 14, 2015

@rsc rsc removed the repo-tools label Apr 14, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.