/// <summary> /// initialize column widths /// </summary> internal override void Initialize() { // set the hard wider default, to be used if no other info is available int itemsPerRow = 2; // get the header info and the view hint WideFormattingHint hint = this.InnerCommand.RetrieveFormattingHint() as WideFormattingHint; int columnsOnTheScreen = GetConsoleWindowWidth(this.InnerCommand._lo.ColumnNumber); // give a preference to the hint, if there if (hint != null && hint.maxWidth > 0) { itemsPerRow = TableWriter.ComputeWideViewBestItemsPerRowFit(hint.maxWidth, columnsOnTheScreen); } else if (this.CurrentWideHeaderInfo.columns > 0) { itemsPerRow = this.CurrentWideHeaderInfo.columns; } // create a buffer object to hold partial rows _buffer = new StringValuesBuffer(itemsPerRow); // initialize the writer Span <int> columnWidths = stackalloc int[itemsPerRow]; Span <int> alignment = stackalloc int[itemsPerRow]; for (int k = 0; k < itemsPerRow; k++) { columnWidths[k] = 0; // autosize alignment[k] = TextAlignment.Left; } this.Writer.Initialize(0, columnsOnTheScreen, columnWidths, alignment, false); }
internal override void Initialize() { int size = 2; OutCommandInner.WideFormattingHint hint = base.InnerCommand.RetrieveFormattingHint() as OutCommandInner.WideFormattingHint; if ((hint != null) && (hint.maxWidth > 0)) { size = TableWriter.ComputeWideViewBestItemsPerRowFit(hint.maxWidth, base.InnerCommand.lo.ColumnNumber); } else if (this.CurrentWideHeaderInfo.columns > 0) { size = this.CurrentWideHeaderInfo.columns; } this.buffer = new StringValuesBuffer(size); int[] columnWidths = new int[size]; int[] alignment = new int[size]; for (int i = 0; i < size; i++) { columnWidths[i] = 0; alignment[i] = 1; } base.Writer.Initialize(0, base.InnerCommand.lo.ColumnNumber, columnWidths, alignment, false); }
/// <summary> /// initialize column widths /// </summary> internal override void Initialize() { // set the hard wider default, to be used if no other info is available int itemsPerRow = 2; // get the header info and the view hint WideFormattingHint hint = this.InnerCommand.RetrieveFormattingHint() as WideFormattingHint; // give a preference to the hint, if there if (hint != null && hint.maxWidth > 0) { itemsPerRow = TableWriter.ComputeWideViewBestItemsPerRowFit(hint.maxWidth, this.InnerCommand._lo.ColumnNumber); } else if (this.CurrentWideHeaderInfo.columns > 0) { itemsPerRow = this.CurrentWideHeaderInfo.columns; } // create a buffer object to hold partial rows _buffer = new StringValuesBuffer(itemsPerRow); // initialize the writer int[] columnWidths = new int[itemsPerRow]; int[] alignment = new int[itemsPerRow]; for (int k = 0; k < itemsPerRow; k++) { columnWidths[k] = 0; // autosize alignment[k] = TextAlignment.Left; } this.Writer.Initialize(0, this.InnerCommand._lo.ColumnNumber, columnWidths, alignment, false); }