New Ticket     Wiki     Browse Source     Timeline     Roadmap     Ticket Reports     Search

Ticket #421: patch-portactivate.tcl.diff

File patch-portactivate.tcl.diff, 1.6 KB (added by perry@…, 3 years ago)
  • portactivate.tcl

     
    4949set_ui_prefix 
    5050 
    5151proc activate_main {args} { 
    52         global portname portversion portrevision portvariants user_options portnotes 
     52        global env portname portversion portrevision portvariants user_options portnotes 
    5353        registry_activate $portname ${portversion}_${portrevision}${portvariants} [array get user_options] 
    5454 
    5555    # Display notes at the end of the activation phase. 
    5656    if {[info exists portnotes] && $portnotes ne {}} { 
    57         ui_msg \n$portnotes\n 
     57        # If env(COLUMNS) exists, limit each line's width to this width. 
     58        if {[info exists env(COLUMNS)]} { 
     59            set maxlen $env(COLUMNS) 
     60 
     61            ui_msg "" 
     62            foreach line [split $portnotes "\n"] { 
     63                set joiner "" 
     64                set lines "" 
     65                set newline "" 
     66 
     67                foreach word [split $line " "] { 
     68                    if {[string length $newline] + [string length $word] >= $maxlen} { 
     69                        lappend lines $newline 
     70                        set newline "" 
     71                        set joiner "" 
     72                    } 
     73                    append newline $joiner $word 
     74                    set joiner " " 
     75                } 
     76                if {$newline ne {}} { 
     77                    lappend lines $newline 
     78                } 
     79                ui_msg [join $lines "\n"] 
     80            } 
     81            ui_msg "" 
     82        } else { 
     83            ui_msg \n$portnotes\n 
     84        } 
    5885    } 
    5986     
    6087    return 0