Changeset 435

Show
Ignore:
Timestamp:
05/24/07 04:33:56 (2 years ago)
Author:
athomas
Message:

cly: Fix a minor glitch in print_table.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • cly/trunk/cly/console.py

    r434 r435  
    436436        raise Exception, 'Table exceeds maximum width' 
    437437 
     438    # Scale columns out to max_width 
    438439    if expand_to_fit is True or max_width < sum(colwidths): 
    439440        scale = float(max_width - 1 - sum(min_widths)) / float(sum(colwidths) - sum(min_widths)) 
    440441        colwidths = [max(int(float(colwidths[x]) * scale), min_widths[x]) for x in range(0, len(colwidths))] 
    441442        mincol = min(colwidths) 
    442         for i, col in enumerate(colwidths): 
    443             if col == mincol: 
    444                 colwidths[0] += max_width - sum(colwidths) 
     443        # Pad smallest column out so total width is size of max_width 
     444        colwidths[colwidths.index(mincol)] += max_width - sum(colwidths) 
    445445 
    446446    auto_format = list(auto_format)