AnthonyVillacorta / arduino

Automatically exported from code.google.com/p/arduino
0 stars 0 forks source link

Decrease-Indent command raises exception on empty sketch #77

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a new sketch
2. Without typing anything into the text-editor run command
"Decrease-Indent" from the edit-menu

What is the expected output? 
Nothing, since the sketch is empty 

What do you see instead?
A Runtime exception is thrown 
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException:
Bounds out of range: 0,2
    at processing.app.syntax.JEditTextArea.select(JEditTextArea.java:1128)
    at processing.app.Editor.handleIndentOutdent(Editor.java:1692)
    at processing.app.Editor$39.actionPerformed(Editor.java:1156)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
    at
javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)

What version of the Arduino software are you using? 
0017
On what operating system? 
Windows and Linux

Original issue reported on code.google.com by e.fa...@wayoda.org on 12 Aug 2009 at 8:15

GoogleCodeExporter commented 9 years ago
The outdent case is using the tabSize when calculating "end" position when 
passing the start, end pair to the selection code. We should probably 
short-circuit this when location is 0, as this is a nonsense outdent case 
anyway.

The attached diff handles this particular call into the selection code.

Original comment by john.ve...@gmail.com on 8 May 2012 at 4:10

Attachments: