#3517 NPE when scrolling to top after multiline delete (soft wrap)

severe bug
closed-fixed
Thomas Meyer
9
2012-10-13
2011-02-26
tvojeho
No

This happens to me often when editing larger texts (such as eBooks). This bug might be related to ID: 1973498 (TextArea: NPE when scrolling to bottom after multiline paste), but perhaps not.

I have tested this on several builds, and the steps described to reproduce the NPE are when using the latest daily build 2011-02-24_12-18-23 (jedit4.5pre1install.jar 2808KB Feb 24 2011) on the attached text pg76.txt (577 kB).

My font settings are Nimbus Roman No9 L 32 Plain, Antialias - standard, soft wrap is on, screen resolution is 1280x800, java 1.6.0_24, both linux (PCLinuxOS 2010) and windows (Windows XP, Windows 7).

Steps to reproduce: Put the cursor at the beginning of line 6 (Title: Adventures of Huckleberry Finn, Complete) and select text pressing Shift+PgDn 3 times (if you select only by pressing twice the PgDn button, the exception does not occur - strange). Then delete the selected text and scroll to the beginning using Up key. The first line is not visible and the NPE pops up.

tvojeho

***

java.lang.NullPointerException
at org.gjt.sp.jedit.textarea.TextArea.scrollTo(TextArea.java:851)
at org.gjt.sp.jedit.textarea.TextArea.scrollToCaret(TextArea.java:708)
at org.gjt.sp.jedit.textarea.TextArea._finishCaretUpdate(TextArea.java:5064)
at org.gjt.sp.jedit.textarea.TextArea.finishCaretUpdate(TextArea.java:5249)
at org.gjt.sp.jedit.textarea.TextArea.moveCaretPosition(TextArea.java:2259)
at org.gjt.sp.jedit.textarea.TextArea.moveCaretPosition(TextArea.java:2226)
at org.gjt.sp.jedit.textarea.TextArea.moveCaretPosition(TextArea.java:2216)
at org.gjt.sp.jedit.textarea.TextArea._changeLine(TextArea.java:5362)
at org.gjt.sp.jedit.textarea.TextArea.goToPrevLine(TextArea.java:2778)
at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
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:225)
at org.gjt.sp.jedit.BeanShell.runCachedBlock(BeanShell.java:423)
at org.gjt.sp.jedit.BeanShellAction.invoke(BeanShellAction.java:73)
at org.gjt.sp.jedit.gui.InputHandler.invokeAction(InputHandler.java:342)
at org.gjt.sp.jedit.gui.InputHandler.invokeAction(InputHandler.java:307)
at org.gjt.sp.jedit.gui.DefaultInputHandler.handleKey(DefaultInputHandler.java:197)
at org.gjt.sp.jedit.input.AbstractInputHandler.processKeyEventKeyStrokeHandling(AbstractInputHandler.java:401)
at org.gjt.sp.jedit.gui.InputHandler.processKeyEvent(InputHandler.java:151)
at org.gjt.sp.jedit.textarea.TextArea.processKeyEvent(TextArea.java:4679)
at java.awt.Component.processEvent(Component.java:6066)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4652)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4482)
at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1850)
at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:712)
at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:990)
at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:855)
at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:676)
at java.awt.Component.dispatchEventImpl(Component.java:4524)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4482)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:644)
at java.awt.EventQueue.access$000(EventQueue.java:85)
at java.awt.EventQueue$1.run(EventQueue.java:603)
at java.awt.EventQueue$1.run(EventQueue.java:601)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
at java.awt.EventQueue$2.run(EventQueue.java:617)
at java.awt.EventQueue$2.run(EventQueue.java:615)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:614)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

Discussion

1 2 > >> (Page 1 of 2)
  • tvojeho
    tvojeho
    2011-02-26

    Test text + screenshot

     
    Attachments
  • Alan Ezust
    Alan Ezust
    2012-09-07

    • milestone: --> severe bug
     
  • Alan Ezust
    Alan Ezust
    2012-09-07

    I just tried to reproduce, and I needed to do shift+pgDN more than 3 times before the delete to get it to happen, but it still happens with 5.1pre1. It causes textarea corruption which can be recovered from by doing a "reset-textarea.bsh".

     
  • Alan Ezust
    Alan Ezust
    2012-09-09

    • priority: 5 --> 9
     
  • Alan Ezust
    Alan Ezust
    2012-09-10

    PS: It appears you need soft word wrap enabled.

     
  • Alan Ezust
    Alan Ezust
    2012-09-10

    • summary: NPE when scrolling to top after multiline delete --> NPE when scrolling to top after multiline delete (soft wrap)
     
  • Alan Ezust
    Alan Ezust
    2012-09-11

    The issue does NOT reproduce if you un-check "electric (auto-scroll) borders" from TextArea options!

    So you need *both* soft wrap and electric (auto scroll) borders checked for this to manifest.

     
    • assigned_to: kpouer --> shlomy
     
  • tvojeho
    tvojeho
    2012-09-11

    Hi Alan,

    I just tried the latest daily version available, and could reproduce the NPE with electric borders off (I attached a snap of my TextArea settings).

    As regards the number of Shift+PgDn jumps, I can still reproduce it with just 3, so I guess this value depends on the screen size.

    Soft wrap is necessary, without it the NPE does not happen. When I delete the text and NPE happens, then press Undo to restore text, and the NPE still happens, until the reset-textarea macro is run or the file is closed and reopened.

    regards, tvojeho

     
  • tvojeho
    tvojeho
    2012-09-11

    TextArea settings

     
    Attachments
1 2 > >> (Page 1 of 2)