home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 6.1.207 < prev    next >
Encoding:
Internet Message Format  |  2002-11-04  |  3.5 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 6.1.207
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=ISO-8859-1
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 6.1.207
  11. Problem:    Indenting a Java file hangs below a line with a comment after a
  12.         command.
  13. Solution:   Break out of a loop. (Andre Pang)
  14.         Also line up } with matching {.
  15. Files:        runtime/indent/java.vim
  16.  
  17.  
  18. *** ../vim61.206/runtime/indent/java.vim    Sun May 12 18:48:10 2002
  19. --- runtime/indent/java.vim    Fri Oct  4 22:36:06 2002
  20. ***************
  21. *** 1,7 ****
  22.   " Vim indent file
  23.   " Language:    Java
  24.   " Maintainer:    Bram Moolenaar <Bram@vim.org>
  25. ! " Last Change:    2002 Apr 21
  26.   
  27.   " Only load this indent file when no other was loaded.
  28.   if exists("b:did_indent")
  29. --- 1,7 ----
  30.   " Vim indent file
  31.   " Language:    Java
  32.   " Maintainer:    Bram Moolenaar <Bram@vim.org>
  33. ! " Last Change:    2002 Oct 04
  34.   
  35.   " Only load this indent file when no other was loaded.
  36.   if exists("b:did_indent")
  37. ***************
  38. *** 30,36 ****
  39.     let theIndent = cindent(v:lnum)
  40.   
  41.     " find start of previous line, in case it was a continuation line
  42. !   let prev = v:lnum - 1
  43.     while prev > 1
  44.       if getline(prev - 1) !~ ',\s*$'
  45.         break
  46. --- 30,36 ----
  47.     let theIndent = cindent(v:lnum)
  48.   
  49.     " find start of previous line, in case it was a continuation line
  50. !   let prev = prevnonblank(v:lnum - 1)
  51.     while prev > 1
  52.       if getline(prev - 1) !~ ',\s*$'
  53.         break
  54. ***************
  55. *** 60,69 ****
  56.       elseif prev == v:lnum - 1
  57.         let theIndent = theIndent + amount
  58.       endif
  59. !   elseif getline(v:lnum - 1) =~ '^\s*throws\>'
  60.       let theIndent = theIndent - &sw
  61.     endif
  62.   
  63.     " Below a line starting with "}" never indent more.  Needed for a method
  64.     " below a method with an indented "throws" clause.
  65.     " First ignore comment lines.
  66. --- 60,87 ----
  67.       elseif prev == v:lnum - 1
  68.         let theIndent = theIndent + amount
  69.       endif
  70. !   elseif getline(prev) =~ '^\s*throws\>'
  71.       let theIndent = theIndent - &sw
  72.     endif
  73.   
  74. +   " When the line starts with a }, try aligning it with the matching {,
  75. +   " skipping over "throws", "extends" and "implements" clauses.
  76. +   if getline(v:lnum) =~ '^\s*}\s*\(//.*\|/\*.*\)\=$'
  77. +     call cursor(v:lnum, 1)
  78. +     silent normal %
  79. +     let lnum = line('.')
  80. +     if lnum < v:lnum
  81. +       while lnum > 1
  82. +     if getline(lnum) !~ '^\s*\(throws\|extends\|implements\)\>'
  83. +           \ && getline(prevnonblank(lnum - 1)) !~ ',\s*$'
  84. +       break
  85. +     endif
  86. +     let lnum = prevnonblank(lnum - 1)
  87. +       endwhile
  88. +       return indent(lnum)
  89. +     endif
  90. +   endif
  91.     " Below a line starting with "}" never indent more.  Needed for a method
  92.     " below a method with an indented "throws" clause.
  93.     " First ignore comment lines.
  94. ***************
  95. *** 76,81 ****
  96. --- 94,101 ----
  97.         endwhile
  98.         if getline(lnum) =~ '^\s*/\*'
  99.       let lnum = lnum - 1
  100. +       else
  101. +     break
  102.         endif
  103.       elseif getline(lnum) =~ '^\s*//'
  104.         let lnum = lnum - 1
  105. *** ../vim61.206/src/version.c    Tue Oct  1 20:20:25 2002
  106. --- src/version.c    Sun Oct  6 18:22:02 2002
  107. ***************
  108. *** 608,609 ****
  109. --- 608,611 ----
  110.   {   /* Add new patch number below this line */
  111. + /**/
  112. +     207,
  113.   /**/
  114.  
  115. -- 
  116. Never eat yellow snow.
  117.  
  118.  ///  Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net  \\\
  119. ///          Creator of Vim - Vi IMproved -- http://www.vim.org          \\\
  120. \\\           Project leader for A-A-P -- http://www.a-a-p.org           ///
  121.  \\\ Lord Of The Rings helps Uganda - http://iccf-holland.org/lotr.html ///
  122.