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 147689

Summary: end token for subroutines and programs in Fortran code is not correctly indented (Sun Studio 12)
Product: cnd Reporter: Alexander Simon <alexvsimon>
Component: EditorAssignee: Alexander Simon <alexvsimon>
Status: VERIFIED FIXED    
Severity: blocker CC: sustaining
Priority: P3    
Version: 6.x   
Hardware: Sun   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description Alexander Simon 2008-09-19 09:28:05 UTC
This is from Esc# 1-24701712 on CR# 6749396

In the Sun Studio 12 IDE, when you type in Fortran source code, there seems to be no automatic indenting of the source
code to reflect either subroutine or program structure.

In Sun Studio 12, if I choose

   "File" -> "New..."

and then

   "Choose File Type" -> "Fortran Files" -> "Fortran File (Free Format)"

and then entering the following source code, I get

Note: the vertical bars are there simply to indicate the left edge of the window


   |program test
   |
   |    write (*,*) 'Hello'
   |
   |    contains
   |
   |    subroutine p(c)
   |        integer :: c
   |        c = c+1
   |        end subroutine p
   |
   |        end program test


The above example demonstrates that the "end" token for subroutine and program is not correctly indented.

Note: an "end" token alone is indented to the column 0, and the "end" indentation seems to work for interfaces and functions


The expected result looks as follows. After each carriage return, the newly entered line should be automatically
indented to reflect the subroutine and program block structure.

   |program test
   |
   |    write (*,*) 'Hello'
   |
   |    contains
   |
   |    subroutine p(c)
   |        integer :: c
   |        c = c+1
   |    end subroutine p
   |
   |end program test


Note: the "Source" -> "Reformat Code" function (Ctrl+Shift+F) should do that formatting as well, which is NOT at present
Comment 1 Alexander Simon 2008-09-19 09:38:27 UTC
fixed IZ#147688 & IZ#147689
http://hg.netbeans.org/main/rev/d70f5ec86b7c

unit tests for  IZ#147688 & IZ#147689
http://hg.netbeans.org/main/rev/d013e11f278f
Comment 2 Quality Engineering 2008-09-19 17:31:03 UTC
Integrated into 'main-golden', will be available in build *200809191401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/d70f5ec86b7c
User: Alexander Simon <alexvsimon@netbeans.org>
Log: fixed IZ#147688:infinite loop in indent when "c" is first important line token and IZ#147689:no indent for end program and subroutine
Comment 3 Alexander Pepin 2008-09-24 14:21:37 UTC
verified in NB6.5 build 20080924
Comment 4 Karthikeyan Rajeswaran 2008-10-01 02:25:37 UTC
The fix has been ported to release551_fixes branch.

Checking in src/org/netbeans/modules/cnd/editor/fortran/FFormatSupport.java;
/cvs/cnd/core/src/org/netbeans/modules/cnd/editor/fortran/Attic/FFormatSupport.java,v  <--  FFormatSupport.java
new revision: 1.1.2.3.6.2; previous revision: 1.1.2.3.6.1
done
Checking in src/org/netbeans/modules/cnd/editor/fortran/FFormatter.java;
/cvs/cnd/core/src/org/netbeans/modules/cnd/editor/fortran/Attic/FFormatter.java,v  <--  FFormatter.java
new revision: 1.1.2.3.6.2; previous revision: 1.1.2.3.6.1
done
Checking in src/org/netbeans/modules/cnd/editor/fortran/FSyntax.java;
/cvs/cnd/core/src/org/netbeans/modules/cnd/editor/fortran/Attic/FSyntax.java,v  <--  FSyntax.java
new revision: 1.1.2.2.6.1; previous revision: 1.1.2.2
done

The unit tests were not ported to release551_fixes, since the test infrastructure is more basic and different from trunk
for 65.
Comment 5 Karthikeyan Rajeswaran 2008-10-01 18:53:01 UTC
The fix has been ported into the release61_fixes repository.
http://hg.netbeans.org/release61_fixes/rev/0ce771bf3f24
Comment 6 Alexander Pepin 2008-10-08 14:19:08 UTC
verified in patch4
Comment 7 Karthikeyan Rajeswaran 2008-10-08 18:04:27 UTC
The fix for 147688 , 147689, 136699 and 145858 have been backported to release601_fixes branch.

For details, please refer to:
   ------- Additional comments from krajeswaran Wed Oct 8 17:00:03 +0000 2008 -------
in issue 147688
Comment 8 Alexander Pepin 2008-11-11 14:57:52 UTC
verified in 5.5.1 with manually installed nbms from PromoG1Patch4