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 216456 - Patch for: Show number of collapsed lines when section is collapsed
Summary: Patch for: Show number of collapsed lines when section is collapsed
Status: RESOLVED DUPLICATE of bug 226413
Alias: None
Product: editor
Classification: Unclassified
Component: Code folding (show other bugs)
Version: 7.2
Hardware: PC Windows 7
: P3 normal with 1 vote (vote)
Assignee: Svata Dedic
URL:
Keywords: PATCH_AVAILABLE, PLAN
Depends on: 169660
Blocks:
  Show dependency tree
 
Reported: 2012-08-06 21:25 UTC by markiewb
Modified: 2013-03-17 00:08 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Screenshot showing the proposed feature (19.38 KB, image/png)
2012-08-06 21:25 UTC, markiewb
Details
Proposed patch - only a first draft (1.83 KB, patch)
2012-11-23 18:23 UTC, markiewb
Details | Diff
WIP-Patch in action (85.36 KB, image/png)
2012-11-23 18:25 UTC, markiewb
Details
Mockup - extending the existing NB folds style (44.33 KB, image/png)
2012-12-10 10:38 UTC, Petr Somol
Details
Show the # of lines in the hovering (9.27 KB, image/png)
2012-12-10 19:49 UTC, markiewb
Details
For the record: Shows the current state - introduced by 226413 (4.53 KB, image/png)
2013-03-17 00:08 UTC, markiewb
Details

Note You need to log in before you can comment on or make changes to this bug.
Description markiewb 2012-08-06 21:25:15 UTC
Created attachment 122810 [details]
Screenshot showing the proposed feature

Show the number of collapsed lines when the section is collapsed

See the screenshot
Comment 1 markiewb 2012-11-23 18:23:50 UTC
Created attachment 128326 [details]
Proposed patch - only a first draft

I like to propose a WIP-patch.

CON: 
* does not work properly with javadoc
* ugly code to calculate the surrounded lines
Comment 2 markiewb 2012-11-23 18:25:04 UTC
Created attachment 128327 [details]
WIP-Patch in action
Comment 3 Svata Dedic 2012-12-06 14:14:01 UTC
An indicator what is collapsed (e.g. {...} for a code block, tag name for collapsed XML tag) is a way more informative than how many lines were collapsed when eye-scanning the screen, I think.

If implemented, it should probaly display # of lines *in addition* to the existing marker, not instead of it.
Comment 4 markiewb 2012-12-06 20:26:30 UTC
(In reply to comment #3)
> An indicator what is collapsed (e.g. {...} for a code block, tag name for
> collapsed XML tag) is a way more informative than how many lines were collapsed
> when eye-scanning the screen, I think.
> 
> If implemented, it should probaly display # of lines *in addition* to the
> existing marker, not instead of it.

Yes that makes sense. I invalidate this rfe.
Comment 5 Svata Dedic 2012-12-06 20:46:53 UTC
ok ... but before discarding the idea altogether, I suggest to wait for psomol (UI expert) to decide about the additional option (show line count)
Comment 6 Petr Somol 2012-12-10 10:38:12 UTC
Created attachment 129139 [details]
Mockup - extending the existing NB folds style

First I should confirm that the idea of showing the number of folded lines in some way is agreeable, the added information indeed might help users in orientation across the source.

Currently NB shows a preview of the unfolded area on roll-over, but this serves a different purpose and does not always provided the quick practical info about the length of the fold.

But basically two approaches can be investigated - on roll-over temporary display of some kind or modifying the permanent display which by now is based on displaying "...".

The roll-over based solution can hardly be combined with the existing preview pop-up, but can be considered in the form I illustrate on line 69 in the mockup - a small popup can be displayed when mouse cursor is placed over the plus (or minus) sign. This solution has of course two drawbacks: it does not communicate the number of lines for more than one fold at once and thus does not give a large picture, and second it might look a bit puzzling to have two different types of popups related to one fold, each just showing in a different way the same information.

The other approach would be to change the shortcut message displayed in place of the folded area, as suggested in the original proposal with this issue. 
It is nevertheless better to extend existing NB solution than to change it from scratch - to make things as smooth as possible for existing users. That was the first reason why I was not too happy about the originally proposed change (of showing just a number+"line(s)". Also, the current NB way of showing the type of brackets that encircle the folded area also gives additional visual hint about the fold's context - which would be lost according to the originally proposed change. Attempting to keep the NB way of presenting the brackets, and to keep the three bullet sequence which by many is already visually expected to depict a folded area, I considered just to add the numeric info to it. The problem here is the increased length of the message, which nevertheless still might seem acceptable, being outweighed by the added informational value. To keep it as short as possible it is also advisable not two write "line(s)" but "line" or "lines" depending on the actual number. Removal of the ( ) brackets also reduces the visual clutter that does not carry any useful information.

Thoughts or comments ?
Comment 7 markiewb 2012-12-10 19:49:04 UTC
Created attachment 129177 [details]
Show the # of  lines in the hovering

(In reply to comment #6)
> Created attachment 129139 [details]
> Mockup - extending the existing NB folds style
> 
> ...
> Thoughts or comments ?
Thanks for the detailed inspection. Now i understand. You use the  different foldings to express which kind of comment it is.

What do think about putting the number of lines into the hovering? See attached screenshot.

But IMHO another RFE would be even more useful
http://netbeans.org/bugzilla/show_bug.cgi?id=169660#c3 (show first sentence of javadoc, when collapsed)

FYI Something similar was already done in "java.ext.editor".
http://www.aljoscha-rittner.de/blog/archive/2010/12/21/idedev-bundle-texte-direkt-im-quelltext/
Comment 8 Petr Somol 2013-01-22 09:26:07 UTC
I gave some thought to the idea and I agree that in case of folded comments, showing the initial piece of text indeed may be found more practical by many users. With comments, either in PHP, Java or other language, it is probably well possible to define what to display in one line - probably the first non-empty text line of the comment block. In that case showing the number of lines inside the folded comment would be superfluous. Showing the number of lines above the preview window is IMHO too much - it would not add any value to the contents of the preview window itself. Adding a simple tooltip with just the number of lines to the "plus" fold icon would seem more reasonable, if we want to display the number somewhere, and if the folded comment itself displayed a text excerpt instead.

As for the question whether to display text excerpts in folded comments or not - I guess there might be users who would prefer the cleaner (empty) folds as well. For this purpose I guess we can afford to add a checkbox to Options->Editor->General->Code Folding, named something like "Text Preview in Comment Folds" or so, switched on by default to promote the new functionality, but giving users the option to go back to the behavior they are used to so far.
Comment 9 markiewb 2013-03-17 00:06:57 UTC
http://netbeans.org/bugzilla/show_bug.cgi?id=226413 already implements this. So marking this issue as duplicate. Seen in dev build 201303152300.

Can be enabled via "Options->Folding->Display Options->Show summary"

*** This bug has been marked as a duplicate of bug 226413 ***
Comment 10 markiewb 2013-03-17 00:08:09 UTC
Created attachment 132699 [details]
For the record: Shows the current state - introduced by 226413