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.
Summary: | XML template expansion doesn't preserve cursor position. | ||
---|---|---|---|
Product: | xml | Reporter: | redentis <redentis> |
Component: | Text-Edit | Assignee: | Samaresh Panda <samaresh> |
Status: | VERIFIED FIXED | ||
Severity: | blocker | ||
Priority: | P2 | ||
Version: | 6.x | ||
Hardware: | All | ||
OS: | Windows XP | ||
Issue Type: | DEFECT | Exception Reporter: | |
Bug Depends on: | 137768 | ||
Bug Blocks: |
Description
redentis
2008-05-19 09:40:14 UTC
Visible problem, will try to fix it for M1. Browsing through the xml code-base, it seems like it just relies on the core editor template framework. Kindly take a look. If you think the problem is in my code, please assign it back to me. Cursor is repositioned by the XMLLexerFormatter.reformat(...) method which is called at the end of the template insertion. Reassigning back. Fix in issue 132586 will fix this one as well. *** This issue has been marked as a duplicate of 132586 *** while working on the fix for issue 132586, i realized, this may not actually be a duplicate of that. For the other issue, I position the caret where it was before the formatting, so someone else is repositioning to line1, col1 in replacing code template. dbalek, can you pl. take a look. I'm actually positioning the caret to where it was before. I don't think that it is a good practice to do reformat using doc.replace(0, doc.getLength(), formattedDoc.getText(0, formattedDoc.getLength()), null); If there were any marks in the reformatted document implemented using javax.swing.text.Position objects (like bookmarks, code template parameter regions, etc.), all of these marks would be moved to position 0 after reformat. Better approach would be to compute diffs between doc and foramttedDoc and apply only these diffs. This would preserve all Position markers to stay on proper places. Reassigning back. Fixed changeset bd8460d637b8 in main details: http://hg.netbeans.org/main?cmd=changeset;node=bd8460d637b8 Integrated into 'main-golden', available in build *200807300201* on http://bits.netbeans.org/dev/nightly/ Changeset: http://hg.netbeans.org/main/rev/bd8460d637b8 User: sonali@netbeans.org Log: Fix for issue#135297 XML template expansion doesn't preserve cursor position. Verified Product Version: NetBeans IDE Dev (Build 200808010201) Java: 1.5.0_13; Java HotSpot(TM) Client VM 1.5.0_13-119 System: Mac OS X version 10.5.4 running on i386; MacRoman; en_US (nb) *** Issue 147262 has been marked as a duplicate of this issue. *** |