[67210] trunk/base/src/port1.0/portutil.tcl
raimue at macports.org
raimue at macports.org
Sun May 2 13:45:17 PDT 2010
Revision: 67210
http://trac.macports.org/changeset/67210
Author: raimue at macports.org
Date: 2010-05-02 13:45:12 -0700 (Sun, 02 May 2010)
Log Message:
-----------
Strip only one line break at the beginning and end of notes.
Allows use of empty lines as separators with notes-append.
Modified Paths:
--------------
trunk/base/src/port1.0/portutil.tcl
Modified: trunk/base/src/port1.0/portutil.tcl
===================================================================
--- trunk/base/src/port1.0/portutil.tcl 2010-05-02 20:23:03 UTC (rev 67209)
+++ trunk/base/src/port1.0/portutil.tcl 2010-05-02 20:45:12 UTC (rev 67210)
@@ -460,23 +460,28 @@
# args is a list of strings/list
foreach arg $args {
# Strip trailing empty lines
- set txt [string trim $arg "\n"]
+ if {[string index $arg 0] == "\n"} {
+ set arg [string range $arg 1 end]
+ }
+ if {[string index $arg end] == "\n"} {
+ set arg [string range $arg 0 end-1]
+ }
# Determine indent level
set indent ""
- for {set i 0} {$i < [string length $txt]} {incr i} {
- set c [string index $txt $i]
+ for {set i 0} {$i < [string length $arg]} {incr i} {
+ set c [string index $arg $i]
if {$c != " " && $c != "\t"} {
break
}
append indent $c
}
# Remove indent on first line
- set txt [string replace $txt 0 [expr $i - 1]]
+ set arg [string replace $arg 0 [expr $i - 1]]
# Remove indent on each other line
- set txt [string map "\"\n$indent\" \"\n\"" $txt]
+ set arg [string map "\"\n$indent\" \"\n\"" $arg]
- lappend fulllist $txt
+ lappend fulllist $arg
}
set $option $fulllist
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20100502/d374ef78/attachment.html>
More information about the macports-changes
mailing list