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 183521

Summary: Dimensions relating to TAB character seem incorrect
Product: editor Reporter: err <err>
Component: Painting & PrintingAssignee: Miloslav Metelka <mmetelka>
Status: RESOLVED WORKSFORME    
Severity: normal Keywords: REGRESSION
Priority: P3    
Version: 6.x   
Hardware: PC   
OS: Windows XP   
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 179047    

Description err 2010-04-06 02:16:53 UTC
Tabs don't display in NB's "overwrite" mode as they used to. This also afects how jVi displays over a tab char.

The following shows what NB's ExtCaret.paint() is seeing. The first two lines are over a regular character and the next lines are after moving the caret down one line onto a tab character. It is interesting how the clip region changes after moving to the next line.

      ==ModelToView==                      ==Graphics.getClipBounds==
Rect[x=0,y=153,width=8,height=17]      Rect[x=0,y=153,width=8,height=17]
Rect[x=0,y=153,width=8,height=17]      Rect[x=0,y=153,width=8,height=17]

KeyAction: ViDownKey: e001(1) 0 virt

Rect[x=0,y=170,width=1,height=17]      Rect[x=0,y=153,width=447,height=51]
Rect[x=0,y=170,width=1,height=17]      Rect[x=0,y=153,width=447,height=17]
Rect[x=0,y=170,width=1,height=17]      Rect[x=0,y=170,width=2,height=17]
Rect[x=0,y=170,width=1,height=17]      Rect[x=0,y=170,width=2,height=17]


Somewhat OffTopic, though related. In .../view/NewlineView.java there is the following code which handle a similar issue with newline. I'm confused about a part of it. For axis==View.X_AXIS when not showNonPrint defaultLineHeight is returned. At first glance it seems incorrect to be returning any height for X_AXIS. Before the change this was an "advance", which I still don't entirely understand from the javadoc, but it does seem to be an "X" thing. So the use of line height might be a bug.

    @Override
    public float getPreferredSpan(int axis) {
        // Although the width could be e.g. 1 return a default width of a character
        // since if caret is blinking over the newline character and the caret
        // is in overwrite mode then this will make the caret fully visible.
        DocumentView documentView = getDocumentView();
        if (axis == View.X_AXIS) {
            return (documentView != null)
                    ? (documentView.isShowNonprintingCharacters()
                        ? documentView.getDefaultLineHeight()
                        : documentView.getDefaultCharWidth())
                    : 1; // Only return one if not connected to view hierarchy
        } else {
            return (documentView != null) ? documentView.getDefaultLineHeight() : 1;
        }
    }
Comment 1 David Strupl 2012-11-01 09:01:15 UTC
This report is before the big changes in the views. I am closing as works for me. If still a problem in 7.3 or later please reopen.