Applies consistant padding to each of the columns in a row and serves as
    the source of the overall screen width.
175984
def format_row(pid="", port="", name="", mem="", workers="", prefix_char="  "):
    
    row = "%s%-5s %-6s %-25s %8s %7s " \
          % (prefix_char, pid, port, name, mem, workers)

    global screen_width
    if screen_width is None:
        screen_width = len(row)
    return row
1341506
def fmt_row(self, columns, dimensions, row, **settings):
        
        cells = []
        i = 0
        for column in columns:
            cells.append(self.fmt_cell(
                    row[i],
                    dimensions[i],
                    column,
                    **settings[self.SETTING_TEXT_FORMATING]
                )
            )
            i += 1
        return self.bchar('v', 'm', settings[self.SETTING_BORDER_STYLE], **settings[self.SETTING_BORDER_FORMATING]) + \
               self.bchar('v', 'm', settings[self.SETTING_BORDER_STYLE], **settings[self.SETTING_BORDER_FORMATING]).join(cells) + \
               self.bchar('v', 'm', settings[self.SETTING_BORDER_STYLE], **settings[self.SETTING_BORDER_FORMATING])
236276
function() {
    // Calculate new column count after resize.
    columnCount = getColumnCount();
    if(columnHeights.length != columnCount) {
      // Reset array of column heights and container width.
      resetHeights(columnCount);
      adjustCells(cellsContainer.children, true);
    } else {
      manageCells();
    }
  }
687425
def _build_row(padded_cells, colwidths, colaligns, rowfmt):
    ""
    if not rowfmt:
        return None
    if hasattr(rowfmt, "__call__"):
        return rowfmt(padded_cells, colwidths, colaligns)
    else:
        return _build_simple_row(padded_cells, rowfmt)
702397
function pad(text, width) {
  var space = (width - text.length) + 5;
  return text + Array(space).join(" ");
}
899338
private void addAppLevelCSSExample() {
		String htmlClass = "my_local_class";
		add(new WHeading(HeadingLevel.H2, "App defined widths"));
		add(new ExplanatoryText("This example shows the use of a htmlClass and app-specific CSS (in this case inline)"
				+ " to style the columns including responsive widths"
				+ " which kick in at 1000px and 900px"));

		WRow row = new WRow();
		row.setHtmlClass(htmlClass);
		add(row);

		WColumn col1 = new WColumn();
		String col1HtmlClass = "my_col1";
		col1.setHtmlClass(col1HtmlClass);
		col1.add(new ExplanatoryText("This is some text content in the first column."));
		row.add(col1);

		WColumn col2 = new WColumn();
		String col2HtmlClass = "my_col2";
		col2.setHtmlClass(col2HtmlClass);
		col2.add(new ExplanatoryText("Some content in column 2."));
		row.add(col2);

		WColumn col3 = new WColumn();
		col3.add(new ExplanatoryText("Some content in column 3."));
		row.add(col3);

		String columnClass = ".wc-column";
		String rowSelector = "." + htmlClass;
		String columnSelector =  rowSelector + " > " + columnClass; // .column is the local name of WColumn's XML element and is part of the client side API.
		String css = columnSelector + " {width: 20%; background-color: #f0f0f0; padding: 0.5em;}"
				+ columnSelector + " + " + columnClass + " {margin-left: 0.5em}"
 				+ columnSelector + "." + col2.getHtmlClass() + " {width: 60%;}"
				+ "@media only screen and (max-width: 1000px) {"  //when the screen goes below 1000px wide
				+ rowSelector + " {display: block;}"
				+ columnSelector + " {display: inline-block; box-sizing: border-box;}"
				+ columnSelector + " + " + columnClass + " {margin-left: 0}"
				+ columnSelector + "." + col1.getHtmlClass() + " {display: block; width: 100%; margin-bottom: 0.5em;} "
				+ columnSelector + " ~ " + columnClass + " {width: calc(50% - 0.25em); background-color: #f0f000}"
				+ "." + col2.getHtmlClass() + " {margin-right: 0.25em}"
				+ "." + col2.getHtmlClass() + " + " + columnClass + " {margin-left: 0.25em;}"
				+ "}\n@media only screen and (max-width: 900px) {"  //when the screen goes below 900px wide;
				+ columnSelector + " {width: 100% !important; margin-left: 0 !important; margin-right: 0 !important; background-color: #ff0 !important;}" //the importants are becauseI am lazy
				+ "." + col2.getHtmlClass() + " {margin-bottom: 0.5em;}\n}";

		WText cssText = new WText("<style type='text/css'>" + css + "</style>");
		cssText.setEncodeText(false);
		add(cssText);
	}
1218784
private function buildRow(): void
    {
        if ($this->model->noGutters) {
            $this->grid->addClass('no-gutters');
        }

        if ($this->model->rowClass) {
            $this->grid->addClass($this->model->rowClass);
        }

        if ($this->model->align) {
            $this->grid->align($this->model->align);
        }

        if ($this->model->justify) {
            $this->grid->justify($this->model->justify);
        }
    }
704313
function() {

		// If there is no min width set, or not content items, do nothing.
		if( !this._useResponsiveLayout() || this._updatingColumnsResponsive || !this.config.dimensions || !this.config.dimensions.minItemWidth || this.root.contentItems.length === 0 || !this.root.contentItems[ 0 ].isRow ) {
			this._firstLoad = false;
			return;
		}

		this._firstLoad = false;

		// If there is only one column, do nothing.
		var columnCount = this.root.contentItems[ 0 ].contentItems.length;
		if( columnCount <= 1 ) {
			return;
		}

		// If they all still fit, do nothing.
		var minItemWidth = this.config.dimensions.minItemWidth;
		var totalMinWidth = columnCount * minItemWidth;
		if( totalMinWidth <= this.width ) {
			return;
		}

		// Prevent updates while it is already happening.
		this._updatingColumnsResponsive = true;

		// Figure out how many columns to stack, and put them all in the first stack container.
		var finalColumnCount = Math.max( Math.floor( this.width / minItemWidth ), 1 );
		var stackColumnCount = columnCount - finalColumnCount;

		var rootContentItem = this.root.contentItems[ 0 ];
		var firstStackContainer = this._findAllStackContainers()[ 0 ];
		for( var i = 0; i < stackColumnCount; i++ ) {
			// Stack from right.
			var column = rootContentItem.contentItems[ rootContentItem.contentItems.length - 1 ];
			this._addChildContentItemsToContainer( firstStackContainer, column );
		}

		this._updatingColumnsResponsive = false;
	}
1276306
def set_cols_width(self, array):
        

        self._check_row_size(array)
        try:
            array = map(int, array)
            if reduce(min, array) <= 0:
                raise ValueError
        except ValueError:
            sys.stderr.write("Wrong argument in column width specification\n")
            raise
        self._width = array
436083
def wrap_row(self, widths, row, width_default=None):
        """"""
        lines = []
        longest = 0 # longest wrapped column in row

        if not width_default:
            width_default = self.width_default

        # Wrap column contents
        for i in range(0, len(row)):
            w=width_default # column width

            # Only set column width dynamicaly for non-rogue rows
            if i < len(widths):
              w = widths[i]

            tw = textwrap.TextWrapper(width=w, break_on_hyphens=False)
            # Wrap and left-justify
            row[i] = tw.wrap(textwrap.dedent(row[i]))
            # Pad with spaces up to to fixed column width
            for l in range(0, len(row[i])):
                    row[i][l] += (w - len(row[i][l])) * ' '
            if len(row[i]) > longest:
                longest = len(row[i])

        # Pad all columns to have the same number of lines
        for i in range(0, len(row)):
            w=width_default # column width

            # Only set column width dynamicaly for non-rogue rows
            if i < len(widths):
                w = widths[i]

            if len(row[i]) < longest:
                for j in range(len(row[i]), longest):
                    row[i].append(w * ' ')

        for l in range(0,longest):
            line = []
            for c in range(len(row)):
                line.append(row[c][l])
            line = '| ' + ' | '.join(line) + ' |'
            lines.append(line)

        return lines
1364312
def scroll_screen_rows (self, rs, re): # <ESC>[{start};{end}r
        ''''''

        self.scroll_row_start = rs
        self.scroll_row_end = re
        self.scroll_constrain()
1033497
def write_padding(self, s):
        

        lines = s.splitlines(True)
        for line in lines:
            self.stream.write(line)
            if line[-1] in '\r\n':
                self._newline()
            else:
                # this is the last line
                self.generated_col += len(line)
1263993
function row(metric, dimensions, isTarget) {
  let left = '';
  let right = '';

  if (isTarget) {
    left = HIGHLIGHT;
    right = RESET;
  }

  return BORDER_VERT
    + left + padEnd(' ' + metric.label, dimensions.name) + right
    + BORDER_VERT
    + left + padEnd(' ' + metric.avg + UNIT, dimensions.avg) + right
    + BORDER_VERT
    + left + padEnd(' ' + metric.min + UNIT, dimensions.min) + right
    + BORDER_VERT
    + left + padEnd(' ' + metric.max + UNIT, dimensions.max) + right
    + BORDER_VERT
    + '\n';
}
1149622
def columnize(rows):
    ''

    ## find all character columns that are not spaces
    allNonspaces = set()
    allNonspaces.add(max(len(r) for r in rows)+1)
    for r in rows:
        for i, ch in enumerate(r):
            if not ch.isspace():
                allNonspaces.add(i)

    colstart = 0
    prev = 0

    # collapse fields
    for i in allNonspaces:
        if i > prev+1:
            yield colstart, prev+1
            colstart = i
        prev = i
380893
function() {
        var gutter = this.options.gutter,
            items = this.matrix,
            item,
            span,
            dir = this.options.rtl ? 'right' : 'left',
            y = [], // The top position values indexed by column
            c = 0, // Current column in the loop
            h = 0, // Smallest height column
            i, // Items loop counter
            l, // Items length
            s, // Current span column in the loop
            top,
            pos = { margin: 0, position: 'absolute' };

        for (i = 0; i < this.colCount; i++) {
            y.push(0);
        }

        for (i = 0, l = items.length; i < l; i++) {
            item = items[i];
            span = item.span;

            // Place the item in the smallest column
            h = -1;

            for (s = 0; s < this.colCount; s++) {
                if (h === -1 || y[s] < h) {
                    h = y[s];
                    c = s;
                }
            }

            // If the item extends too far out, move it to the next column
            // Or if the last column has been reached
            if ((c >= this.colCount) || ((span + c) > this.colCount)) {
                c = 0;
            }

            // Item spans a column or multiple columns
            if (span) {
                top = 0;

                // If the item spans multiple columns
                // Get the largest height from the previous row
                for (s = 0; s < span; s++) {
                    if (y[c + s] > top) {
                        top = y[c + s];
                    }
                }

                // Position the item
                pos.top = top;
                pos[dir] = (this.colWidth + gutter) * c;
                pos.width = ((this.colWidth + gutter) * span) - gutter;

                item.item.css(pos).reveal();

                // Loop again to add the value to each columns Y top value
                // This must be done after positioning so we can calculate a new size
                for (s = 0; s < span; s++) {
                    y[c + s] = item.item.outerHeight() + gutter + top;
                }
            }

            this.colHeights[c] = y[c];

            c++;
        }

        // Set height of wrapper
        this.element.css('height', Math.max.apply(Math, y));
    }
90695
function onResize() {
	if ( this.stdout.columns && this.stdout.rows ) {
		this.width = this.stdout.columns ;
		this.height = this.stdout.rows ;
	}

	this.emit( 'resize' , this.width , this.height ) ;
}
1016067
def auto_style(self):
        
        if self._row_size is None:
            return
        elif self._row_size == 3:
            self.set_cols_align(['l', 'l', 'l'])
            self.set_cols_valign(['t', 't', 't'])
            self.set_cols_width([12, 54, 12])
        elif self._row_size == 4:
            self.set_cols_align(['l', 'l', 'l', 'l'])
            self.set_cols_valign(['t', 't', 't', 't'])
            self.set_cols_width([10, 40, 10, 10])