Caret moving one space over on arrow key navigation

Post a reply

Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :arrow: :| :mrgreen: :geek: :ugeek:
BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON
Topic review
   

Expand view Topic review: Caret moving one space over on arrow key navigation

Re: Caret moving one space over on arrow key navigation

Post by 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);
}
}

Re: Caret moving one space over on arrow key navigation

Post by robert » Tue Apr 01, 2014 1:50 am

What example are you referring to?

This sounds like a bug in RSTA.

Re: Caret moving one space over on arrow key navigation

Post by 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.

Re: Caret moving one space over on arrow key navigation

Post by 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.

Caret moving one space over on arrow key navigation

Post by 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?

Top

cron