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 199695 - caret-begin-line jumps to start of document
Summary: caret-begin-line jumps to start of document
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Painting & Printing (show other bugs)
Version: 7.0
Hardware: PC Windows XP
: P3 normal (vote)
Assignee: Miloslav Metelka
URL:
Keywords: REGRESSION
: 193485 196638 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-06-25 16:34 UTC by matthies
Modified: 2012-11-01 09:14 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description matthies 2011-06-25 16:34:24 UTC
When executing the following macro

    select-identifier copy-to-clipboard caret-backward "if (" caret-end-line ") throw new IllegalArgumentException(\"" paste-from-clipboard ": \" + " paste-from-clipboard ");" caret-begin-line caret-next-word caret-next-word caret-next-word

the caret ends up at the start of the document.
This does not happen when the caret-begin-line command is removed from the macro.

This is a regression, it was working correctly up to NB 6.9.

The macro's purpose is to turn an identifier "foo" into

    if (foo) throw new IllegalArgumentException("foo: " + foo);

The "caret-begin-line caret-next-word caret-next-word caret-next-word" should move the caret to after the "foo" within the conditional, so that a condition can be typed for "foo" (e.g. " < 0").
Comment 1 Svata Dedic 2011-09-09 11:48:42 UTC
Hm; it seems that it is caused by Editor thinking that the atomic operation is lengthy (# of modifications within atomic lock exceeded some threshold).

If inside "lengthy" operation, the DocumentOp starts to answer isActive() == false, which IMHO leads to an incorrect behaviour of viewToModelChecked: returns 0 for any coordinates and subsequently any mapping of coordinates > offset fails.

So either viewModelToChecked should report proper char index, or editor Utilities.getRowStart should avoid offset > rectangle > offset re-mapping.

If you have other suggestion, feel free to reassign back - thanks.
Comment 2 Quality Engineering 2011-09-23 13:23:53 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/efa1d8c49b70
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #199695 - caret-begin-line jumps to start of document - partial fix.
Comment 3 Svata Dedic 2011-10-10 12:25:28 UTC
*** Bug 196638 has been marked as a duplicate of this bug. ***
Comment 4 Svata Dedic 2011-10-10 12:45:24 UTC
*** Bug 193485 has been marked as a duplicate of this bug. ***
Comment 5 David Strupl 2012-11-01 09:14:43 UTC
I think this was fixed by Mila as the comment indicate.