diff options
Diffstat (limited to 'scripting/java/com/sun/star/script/framework/provider/beanshell/PlainSourceView.java')
-rw-r--r-- | scripting/java/com/sun/star/script/framework/provider/beanshell/PlainSourceView.java | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/scripting/java/com/sun/star/script/framework/provider/beanshell/PlainSourceView.java b/scripting/java/com/sun/star/script/framework/provider/beanshell/PlainSourceView.java index bd8f01c9193a..f1f8e09561cb 100644 --- a/scripting/java/com/sun/star/script/framework/provider/beanshell/PlainSourceView.java +++ b/scripting/java/com/sun/star/script/framework/provider/beanshell/PlainSourceView.java @@ -55,14 +55,13 @@ public class PlainSourceView extends JScrollPane so we don't get a storm of DocumentEvents during loading */ ta.getDocument().removeDocumentListener(this); - if (!isModified) - { + if (!isModified) { int pos = ta.getCaretPosition(); ta.setText(model.getText()); + try { ta.setCaretPosition(pos); - } - catch (IllegalArgumentException iae) { + } catch (IllegalArgumentException iae) { // do nothing and allow JTextArea to set it's own position } } @@ -72,8 +71,7 @@ public class PlainSourceView extends JScrollPane int line = ta.getLineStartOffset(model.getCurrentPosition()); Rectangle rect = ta.modelToView(line); ta.scrollRectToVisible(rect); - } - catch (Exception e) { + } catch (Exception e) { // couldn't scroll to line, do nothing } @@ -164,6 +162,7 @@ class GlyphGutter extends JComponent { int lineCount = textArea.getLineCount() + 1; String dummy = Integer.toString(lineCount); + if (dummy.length() < 2) { dummy = DUMMY_STRING; } @@ -195,6 +194,7 @@ class GlyphGutter extends JComponent { int startLine = clip.y / h; int endLine = (clip.y + clip.height) / h + 1; int width = getWidth(); + if (endLine > lineCount) { endLine = lineCount; } @@ -221,12 +221,15 @@ class GlyphGutter extends JComponent { int dy = y; arrow.addPoint(dx, dy + 3); arrow.addPoint(dx + 5, dy + 3); + for (x = dx + 5; x <= dx + 10; x++, y++) { arrow.addPoint(x, y); } + for (x = dx + 9; x >= dx + 5; x--, y++) { arrow.addPoint(x, y); } + arrow.addPoint(dx + 5, dy + 7); arrow.addPoint(dx, dy + 7); |