This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 197816 - text.Utilities.getPositionBelow fails. (also getPositionAbove)
Summary: text.Utilities.getPositionBelow fails. (also getPositionAbove)
Status: RESOLVED DUPLICATE of bug 199987
Alias: None
Product: editor
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 7.0
Hardware: PC Windows XP
: P4 normal (vote)
Assignee: Milutin Kristofic
Depends on:
Blocks: 179047
  Show dependency tree
Reported: 2011-04-16 18:42 UTC by err
Modified: 2011-10-06 14:43 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description err 2011-04-16 18:42:45 UTC
Following shows up with jVi, I found them using vim's g$,gj,gk commands which are like $,j,k but operate on screen lines, not text lines.

(((While investigating I found possibly related case that fails with the regular NB keybinding; see after my initial description. )))

Given following in editor (java)

or as a string doc.getText(0,20)
If the curor is positioned at the end of the first line, on the 1 (offset == 4),then
        Utilities.getPositionBelow(ep, 4, 0x7fffffff); // MAXINT
returns 4, should return 6. (if 100 is passed instead of MAXINT, it works)
Using MAXINT works ok with regular JEditorPane.

I've worked around this in the jVi code (but, of course, I may not have found all the cases/situations where this is an issue).

=== NetBeans bindings problems ===
They have to do with wrapped lines:
Given these four lines, lines 1, 3 and 4 wrap

line1 One, one, Two, two, Three, (WRAP)

line3 One, one, Two, two, Three, (WRAP)
three. One
line4 One, one, Two, two, Three, (WRAP)
three. One

BUG: put the cursor on line4, press <End>, press <Up>.

Product Version: NetBeans IDE Dev (Build 20110416-36d9fb69458c)
Java: 1.6.0_23; Java HotSpot(TM) Client VM 19.0-b09
System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)
Userdir: C:\a\src\jvi-dev\nbvi\nbvi-suite\build\testuserdir
Comment 1 err 2011-04-16 18:44:38 UTC
Forgot to mention. getPosition(Above|Below) only fails if the target line is empty, that is a single '\n'.
Comment 2 Miloslav Metelka 2011-04-18 07:37:56 UTC
Ernie, I'm not sure how soon I'll get to this anyway if you suggest any patch I'll be happy to review it and integrate it.
Comment 3 err 2011-04-19 05:28:09 UTC
Not sure when I'll get a chance to looks at this (getting major jVi release, then month in the desert). But if ...; I'd be interested in taking a look around the new view hierarchy.

I also wanted to get the <up> button failure in NB bindings "on paper".
Comment 4 Milutin Kristofic 2011-10-06 14:43:45 UTC

*** This bug has been marked as a duplicate of bug 199987 ***