[145037] trunk/base/src/port1.0/portutil.tcl

raimue at macports.org raimue at macports.org
Sat Jan 23 18:04:39 PST 2016


Revision: 145037
          https://trac.macports.org/changeset/145037
Author:   raimue at macports.org
Date:     2016-01-23 18:04:38 -0800 (Sat, 23 Jan 2016)
Log Message:
-----------
base: port1.0:
Make handle_option_string remove multiple empty lines to correctly detect
indentation for notes, remove all trailing whitespace.

Modified Paths:
--------------
    trunk/base/src/port1.0/portutil.tcl

Modified: trunk/base/src/port1.0/portutil.tcl
===================================================================
--- trunk/base/src/port1.0/portutil.tcl	2016-01-24 01:56:47 UTC (rev 145036)
+++ trunk/base/src/port1.0/portutil.tcl	2016-01-24 02:04:38 UTC (rev 145037)
@@ -523,13 +523,10 @@
             set fulllist {}
             # args is a list of strings/list
             foreach arg $args {
-                # Strip trailing empty lines
-                if {[string index $arg 0] eq "\n"} {
-                    set arg [string range $arg 1 end]
-                }
-                if {[string index $arg end] eq "\n"} {
-                    set arg [string range $arg 0 end-1]
-                }
+                # Strip empty lines at beginning
+                set arg [string trimleft $arg "\n"]
+                # Strip all trailing whitespace
+                set arg [string trimright $arg]
 
                 # Determine indent level
                 set indent ""
@@ -540,6 +537,7 @@
                     }
                     append indent $c
                 }
+
                 # Remove indent on first line
                 set arg [string replace $arg 0 [expr {$i - 1}]]
                 # Remove indent on each other line
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20160123/368a9eee/attachment-0001.html>


More information about the macports-changes mailing list