RSyntaxTextArea icon indicating copy to clipboard operation
RSyntaxTextArea copied to clipboard

The final quote after a string is doubled in the NetLogo Code Tab

Open brandesNW opened this issue 1 year ago • 1 comments

In NetLogo a string is surrounded by double quotes: "mystring" Typing a string in the NetLogo code tab worked correctly using rsyntaxtextarea 3.3.0. We upgraded to 3.3.4 and then the same typing lead to a second final quote: "mystring"" By trying the intermediate releases I determined that this issue arose in version 3.3.1

The attached screenshots show the difference

Steps to Reproduce Reproducing this would take a lot of effort.

  1. Build NetLogo
  2. Run NetLogo - from the NetLogo directory ./sbt, in the sbt shell netlogo/run
  3. The NetLogo GUI will open, click on the tab labeled Code.
  4. type "mystring" and the correct result "mystring" will appear
  5. exit NetLogo, do not exit sbt
  6. edit the file build.sbt, replacing the line "com.fifesoft" % "rsyntaxtextarea" % "3.3.0" with "com.fifesoft" % "rsyntaxtextarea" % "3.3.1"
  7. in sbt type netlogo/run and repeat steps 3)
  8. type "mystring" and the incorrect result "mystring"" will appear

I tried to see if this happened with one of your demos, but didn't get it to work

TextEditorDemo$ javac -cp  rsyntaxtextarea-3.3.0.jar TextEditorDemo.java 
TextEditorDemo$ ls
TextEditorDemo.class  TextEditorDemo.java  rsyntaxtextarea-3.3.0.jar
TextEditorDemo$ java TextEditorDemo
Error: Unable to initialize main class TextEditorDemo
Caused by: java.lang.NoClassDefFoundError: org/fife/ui/rtextarea/RTextArea

However the relevant file seems to be there

TextEditorDemo$ jar tf rsyntaxtextarea-3.3.0.jar | grep RTextArea.class
org/fife/ui/rtextarea/RTextArea.class

Screenshots Compare the good and bad screenshots

Java version What version of Java are you running? OpenJDK 64-Bit Server VM (build 17.0.8.1+1-LTS, mixed mode, sharing)

bad-3 3 4 good-3 3 0

brandesNW avatar Jan 25 '24 23:01 brandesNW

What language/TokenMaker are you using? Looks like this?

Versaion 3.3.1 introduced features such as auto-closing of double quotes that might be contributing to this. Can you try calling textArea.=setInsertPairedCharacters(false) and see if this addresses things?

If not, do you know if your parser is identifying "mystring" as a single token of type TokenTypes.LITERAL_STRING_DOUBLE_QUOTE?

bobbylight avatar Feb 06 '24 19:02 bobbylight