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 151932 - function code folding moves next function header to the folding line
Summary: function code folding moves next function header to the folding line
Status: NEW
Alias: None
Product: python
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.0.2
Hardware: All All
: P3 blocker with 2 votes (vote)
Assignee: Torbjorn Norbye
URL:
Keywords:
: 153686 167278 170347 177375 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-10-31 02:06 UTC by Peter Lam
Modified: 2017-06-22 22:06 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
code folding example (30.29 KB, image/png)
2008-10-31 02:07 UTC, Peter Lam
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Lam 2008-10-31 02:06:57 UTC
From the following codes, try folding the withdraw() or __init__() function. See attached screenshot for the result.

class Accounts:
    balance = 0

    def __init__(self, amount):
        self.balance = amount
        
    def withdraw(self, amount):
        """
        withraw an amount from the account
        """
        if self.balance < 0:
            print "overdraft from account"
        else:
            self.balance -= amount

    def deposit(self, amount):
        """ deposit an amount to the account """
        self.balance += amount

account = Accounts(100)
print "balance = ", account.balance
account.deposit(20)
print "balance = ", account.balance
account.withdraw(50)
print "balance = ", account.balance
Comment 1 Peter Lam 2008-10-31 02:07:31 UTC
Created attachment 72954 [details]
code folding example
Comment 2 Torbjorn Norbye 2008-10-31 09:35:34 UTC
This is because of offset problems in Jython. The end offsets for functions are not correct.

This is not something we can easily fix for EA -- but I'm not sure this is a P2 or needs to be fixed for EA anyway; I think code folding is one of those 
features people play with when they first see them, but don't end up actually using them in day to day work.
Comment 3 Judy_W 2012-07-25 18:32:39 UTC
I am seeing the same problem. I'm logging this comment to note that the
problem still occurs in newer(?) code.

I'm using Netbeans 7.2 RC1 on Windows 7 Pro. 
I installed the PHP only version, and have installed python plugin also.
Mostly working great. But there's a problem with code folding.

Product Version: NetBeans IDE Dev (Build nbms-and-javadoc-9346-on-20120715)
Java: 1.6.0_30; Java HotSpot(TM) 64-Bit Server VM 20.5-b03
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
User directory: C:\Users\Judy\AppData\Roaming\NetBeans\7.2rc1
Cache directory: C:\Users\Judy\AppData\Local\NetBeans\Cache\7.2rc1

When I collapse a method in a class, they "fold" onto the same single line.
If I collapse many methods in a class, they ALL "fold" onto the same single line.
Not useful.

The python plugin I have installed says 
	Version: 0.107
	Last Check: 7/22/12 10:05 AM URL: http://deadlock.netbeans.org/hudson/job/nbms-and-javadoc/lastStableBuild/artifact/nbbuild/nbms/updates.xml.gz

This behavior also occured on Netbeans 7.2 Development Verison that I used previously: 	
Product Version: NetBeans IDE Dev (Build nbms-and-javadoc-9155-on-20120412)
Comment 4 Lou Dasaro 2015-01-04 07:47:23 UTC
*** Bug 170347 has been marked as a duplicate of this bug. ***
Comment 5 Lou Dasaro 2015-01-04 07:48:17 UTC
*** Bug 177375 has been marked as a duplicate of this bug. ***
Comment 6 Lou Dasaro 2015-09-06 05:31:06 UTC
Changing to P3 in accordance with Priority guidelines (Usability) shown at http://wiki.netbeans.org/BugPriorityGuidelines
Comment 7 Jenselme 2017-06-22 22:05:23 UTC
*** Bug 167278 has been marked as a duplicate of this bug. ***
Comment 8 Jenselme 2017-06-22 22:06:54 UTC
*** Bug 153686 has been marked as a duplicate of this bug. ***