At first suppose the following two examples to reproduce the effects of this bug with enabled Soft-Wrap and jEdit4.3pre13 - jre_1.6.0_04 on windows machine: 1st example) Open jEdit and take a clean buffer. Let the TextArea has 8 visible lines. Write 3 empty lines. Now write one line, that spans at least 3 screenlines. Now write some empty lines below the last line, so that the scrollbar is shown on the right side. Now delete the line above the one, that spans several lines and look at the scrollbar. it's getting smaller each time you delete the line above the long one. 2nd example) This relates to another bug, where an exception occurs sometimes at scrolling down after deleting a softwrapped line. Open jEdit and take a clean buffer. Let the TextArea has 8 visible lines. Be sure, that the last line is not partially visible. Write something into the first line so that it spans two screenlines. Now write 9 further short lines so that you have 10 physical lines in total - 2 more than visible. Now select the whole first line (Selection from the very beginning of the first screenline until the very beginning of the third screenline) and remove it (Ctrl-X). You see that, for no reason, the scrollbar disappears. Now scroll down (with Array-Down-Key) to the very last line of the buffer. You will get the following exception: java.lang.NullPointerException at org.gjt.sp.jedit.textarea.TextArea.scrollTo(TextArea.java:1009) at org.gjt.sp.jedit.textarea.TextArea.scrollToCaret(TextArea.java:873) at org.gjt.sp.jedit.textarea.TextArea._finishCaretUpdate(TextArea.java:5101) at org.gjt.sp.jedit.textarea.TextArea.finishCaretUpdate(TextArea.java:5260) at org.gjt.sp.jedit.textarea.TextArea.moveCaretPosition(TextArea.java:2365) at org.gjt.sp.jedit.textarea.TextArea.moveCaretPosition(TextArea.java:2331) at org.gjt.sp.jedit.textarea.TextArea.moveCaretPosition(TextArea.java:2320) at org.gjt.sp.jedit.textarea.TextArea._changeLine(TextArea.java:5375) at org.gjt.sp.jedit.textarea.TextArea.goToNextLine(TextArea.java:2589) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.gjt.sp.jedit.bsh.Reflect.invokeMethod(Reflect.java:134) at org.gjt.sp.jedit.bsh.Reflect.invokeObjectMethod(Reflect.java:80) at org.gjt.sp.jedit.bsh.Name.invokeMethod(Name.java:855) at org.gjt.sp.jedit.bsh.BSHMethodInvocation.eval(BSHMethodInvocation.java:75) at org.gjt.sp.jedit.bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:102) at org.gjt.sp.jedit.bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:47) at org.gjt.sp.jedit.bsh.BSHBlock.evalBlock(BSHBlock.java:130) at org.gjt.sp.jedit.bsh.BSHBlock.eval(BSHBlock.java:80) at org.gjt.sp.jedit.bsh.BshMethod.invokeImpl(BshMethod.java:362) at org.gjt.sp.jedit.bsh.BshMethod.invoke(BshMethod.java:258) at org.gjt.sp.jedit.bsh.BshMethod.invoke(BshMethod.java:186) at org.gjt.sp.jedit.BeanShellFacade.runCachedBlock(BeanShellFacade.java:224) at org.gjt.sp.jedit.BeanShell.runCachedBlock(BeanShell.java:443) at org.gjt.sp.jedit.BeanShellAction.invoke(BeanShellAction.java:76) at org.gjt.sp.jedit.gui.InputHandler.invokeAction(InputHandler.java:383) at org.gjt.sp.jedit.gui.InputHandler.invokeAction(InputHandler.java:349) at org.gjt.sp.jedit.gui.DefaultInputHandler.handleKey(DefaultInputHandler.java:197) at org.gjt.sp.jedit.input.AbstractInputHandler.processKeyEventKeyStrokeHandling(AbstractInputHandler.java:364) at org.gjt.sp.jedit.gui.InputHandler.processKeyEvent(InputHandler.java:152) at org.gjt.sp.jedit.textarea.TextArea.processKeyEvent(TextArea.java:4731) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source) at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source) at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source) at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source) at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) I figured out, that in org.gjt.sp.jedit.textarea.Anchor.preContentRemoved(int,int,int) the scrollLine count is updated so that it reflects the correct value after the remove operation. But in a next step org.gjt.sp.jedit.textarea.BufferHandler.doDelayedUpdate() is called which calls in turn org.gjt.sp.jedit.textarea.DisplayManager.updateScreenLineCount() for the line, where the removed content started. This method then calls DisplayManager.updateScreenLineCount() for that line. Because the value was invalidated before, it is now recalculated. But in this recalculation (especially in DisplayManger.setScreenLineCount()) also the scrollLineCount.scrollLine is updated by the difference to the previous screenLineCount of that line. I would liketo fix this bug, but I don't know which side-effects it would have not to update the scrollLine in setScreenLineCount. Can anybody give some response? I think, this bug also results in some of the NPE occuring at scrolling sometimes. Thanks, zoniie