Issue with Toggle-Comments (Ctrl+/)

Questions on using RSyntaxTextArea should go here.

Moderator: robert

Issue with Toggle-Comments (Ctrl+/)

Postby Guest » Mon Nov 12, 2012 2:14 pm

Hi,

The ToggleComment action seems to not work correctly. I see this in Kojo (which uses RSTA), and also in RText (2.0.4). Here's some sample code to see the problem in RText:

Code: Select all
// test.java
public class X {
    public static void main(String[] main) {
        int x = 20;
        int y = 30;
    }
}


Steps to reproduce problem:
  • Go to the end of the x = 20 line. Hit Ctrl+/. The line gets commented out, but an extra '/' character gets introduced at the caret location.
  • Ctrl+Z to undo the effects of the previous line. Select both the x=20 and y = 30 lines. Hit Ctrl+/. Both lines get deleted, and an extra '/' character shows up. Hit Ctrl+Z to recover the lines in commented form.
Guest
 

Re: Issue with Toggle-Comments (Ctrl+/)

Postby robert » Thu Nov 15, 2012 4:21 am

I can't reproduce either of these two scenarios, either in RText or the latest revision of RSyntaxTextAreaDemo in SVN. Can you also reproduce it in the applet demo here? If so, is this OSX, Linux, or Windows?
User avatar
robert
 
Posts: 796
Joined: Sat May 10, 2008 5:16 pm

Re: Issue with Toggle-Comments (Ctrl+/)

Postby Lalit Pant » Thu Nov 15, 2012 5:26 am

Can you also reproduce it in the applet demo here?


Yes, I can. I'm running Linux (Ubunt 12.04)

The applet ran with JDK 1.6.0_33 (64 bit)
When using RSTA, I see with problem with JDK 1.7.0_09 (32bit)

So this seems to not be tied to any particular JDK version on Linux.

Update:
* I also see the problem on Linux Mint 13 (Maya)
* I don't see the problem on Windows XP

Thanks,
- Lalit
Lalit Pant
 

Re: Issue with Toggle-Comments (Ctrl+/)

Postby robert » Thu Nov 15, 2012 1:59 pm

This is very strange, as the behavior of the editor should not be different from one OS to another. The code is all in RSyntaxTextAreaEditorKit.ToggleCommentAction, and is all straightforward Swing stuff...

Anyway, I've got various flavors of Linux and Unix at work; I'll try them out and see how things look. Typically I don't work on those OS's anymore, so I wouldn't have noticed this.

An OpenJDK issue perhaps?

I also hope to get a new Macbook this weekend, I'll check how it looks there as well.
User avatar
robert
 
Posts: 796
Joined: Sat May 10, 2008 5:16 pm

Re: Issue with Toggle-Comments (Ctrl+/)

Postby Lalit Pant » Thu Nov 15, 2012 2:07 pm

The code is all in RSyntaxTextAreaEditorKit.ToggleCommentAction, and is all straightforward Swing stuff...


I'll check it out to see what's going on. Will report back...

An OpenJDK issue perhaps?


I'm using the Oracle/Sun JDK.

Thanks,
- Lalit
Lalit Pant
 

Re: Issue with Toggle-Comments (Ctrl+/)

Postby Lalit Pant » Thu Nov 15, 2012 5:25 pm

I'll check it out to see what's going on. Will report back...


Looks like this guy is the culprit on Linux:

// RSyntaxTextAreaDefaultInputMap.java, line 44
put(KeyStroke.getKeyStroke('/'), RSyntaxTextAreaEditorKit.rstaCloseMarkupTagAction);

If I comment out this line, comment toggling works fine (that probably breaks something else, though?)

- Lalit
Lalit Pant
 


Return to Help

Who is online

Users browsing this forum: No registered users and 5 guests

cron