Changeset 7984


Ignore:
Timestamp:
06/12/12 01:27:53 (9 years ago)
Author:
abeham
Message:

#1870:

  • Added a check to remove the last newline only when there's actually a newline at the end
  • Improved speed of StringConvertibleMatrixView with respect to paste operations that would extend the number of rows and columns
Location:
trunk/sources/HeuristicLab.Data.Views/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Data.Views/3.3/StringConvertibleArrayView.cs

    r7318 r7984  
    195195    }
    196196    private string[] SplitClipboardString(string clipboardText) {
    197       clipboardText = clipboardText.Remove(clipboardText.Length - Environment.NewLine.Length);  //remove last newline constant
     197      if (clipboardText.EndsWith(Environment.NewLine))
     198        clipboardText = clipboardText.Remove(clipboardText.Length - Environment.NewLine.Length);  //remove last newline constant
    198199      return clipboardText.Split(new string[] { Environment.NewLine, "\t" }, StringSplitOptions.None);
    199200    }
  • trunk/sources/HeuristicLab.Data.Views/3.3/StringConvertibleMatrixView.cs

    r7259 r7984  
    370370        columnIndex = dataGridView.CurrentCell.ColumnIndex;
    371371      }
     372      if (Content.Rows < values.GetLength(1) + rowIndex) Content.Rows = values.GetLength(1) + rowIndex;
     373      if (Content.Columns < values.GetLength(0) + columnIndex) Content.Columns = values.GetLength(0) + columnIndex;
    372374
    373375      for (int row = 0; row < values.GetLength(1); row++) {
    374         if (row + rowIndex >= Content.Rows)
    375           Content.Rows = Content.Rows + 1;
    376376        for (int col = 0; col < values.GetLength(0); col++) {
    377           if (col + columnIndex >= Content.Columns)
    378             Content.Columns = Content.Columns + 1;
    379377          Content.SetValue(values[col, row], row + rowIndex, col + columnIndex);
    380378        }
Note: See TracChangeset for help on using the changeset viewer.