Caret moving one space over on arrow key navigation

Questions on using RSyntaxTextArea should go here.

Moderator: robert

Caret moving one space over on arrow key navigation

Postby ulmetrs » Fri Mar 28, 2014 6:03 pm

When I am using rsyntaxtextarea and have a couple lines of text if I navigate left and right and then press the down arrow the caret will move 1 position over before sticking to a column.

For example '|' will represent my caret:

0|000 initial (0,1)
0000
0000

00|00 move right > (0,2)
0000
0000

0000 move down v (1,3) <--------WHY does it move to column 3?
000|0
0000

0000 move down v (2,3) <------works how it should after initial move down
0000
000|0

What is going on here? There are other similar strange caret movements as well, is there a way to force the care to maintain its column
number during navigation?
ulmetrs
 
Posts: 7
Joined: Fri Mar 28, 2014 5:50 pm

Re: Caret moving one space over on arrow key navigation

Postby robert » Sun Mar 30, 2014 7:06 pm

Are you using a proportional font or a monospaced one? Did you disable Anti-aliasing (it's enabled by default)? Did you enable fractional font-metrics?

In addition to answering the questions above, if you could prove a text document that reproduces the problem, along with what syntax style to use (Java, C, etc.) and syntax scheme (if you modified it from the default), I can try to figure out where the issue lies.
User avatar
robert
 
Posts: 797
Joined: Sat May 10, 2008 5:16 pm

Re: Caret moving one space over on arrow key navigation

Postby ulmetrs » Mon Mar 31, 2014 5:02 pm

I found my issue:
I was using the setMargin(new Insets(0,6,0,6) as shown in the example: this produces the funky behavior I described above.
ulmetrs
 
Posts: 7
Joined: Fri Mar 28, 2014 5:50 pm

Re: Caret moving one space over on arrow key navigation

Postby robert » Tue Apr 01, 2014 1:50 am

What example are you referring to?

This sounds like a bug in RSTA.
User avatar
robert
 
Posts: 797
Joined: Sat May 10, 2008 5:16 pm

Re: Caret moving one space over on arrow key navigation

Postby ulmetrs » Tue Apr 01, 2014 4:54 pm

When horizontal insets are used it seems rsta has trouble moving the caret to the correct row,column when using the arrow keys to navigate.

The example was :

|ABCD
ABCD
ABCD

With '|' representing our carat. the initial position is at 0,0.
move right to 0,1 then left again to 0,0.
now move down and the caret will not move to 1,0, but rather 1,1

final state:

ABCD
A|BCD
ABCD

The code used:

public class Test {
public static void main (String[] args) {
JFrame frame = new JFrame();
RTextScrollPane scroll = new RTextScrollPane();
RSyntaxTextArea texArea = new RSyntaxTestArea();
textArea.setMargin(new Insets(0,6,0,6));
scroll.setViewportView(textArea);
frame.setSize(800,800);
frame.add(scroll);
frame.setVisible(true);
}
}
ulmetrs
 
Posts: 7
Joined: Fri Mar 28, 2014 5:50 pm


Return to Help

Who is online

Users browsing this forum: No registered users and 2 guests