This commit is contained in:
Garen Torikian 2012-11-30 17:27:27 -08:00 committed by nightwing
commit 9dc94741a6

View file

@ -771,35 +771,74 @@ var Editor = function(renderer, session) {
mode.autoOutdent(lineState, session, cursor.row);
if (true || this.session.getElasticTabstops()) {
var row = 0, rows = this.session.getLength(),
tabString = "\t";
// todo: make this a unique set
var row = cursor.row;
while (row <= rows) {
var cellWidths = this.$findCellWidthsForBlock(row, tabString),
cellWidthsByRow = cellWidths.byRow, rowIndex = cellWidths.rowIndex;
}
this.$processRow([row]);
}
};
this.$processRow = function(rows) {
for (var r = 0, rowCount = rows.length; r < rowCount; r++) {
var cellWidthObj = this.$findCellWidthsForBlock(rows[r]);
}
};
this.$findCellWidthsForBlock = function(row, tabString) {
var cellWidths = [];
var cellWidths = [], widths;
var rowIter = row;
while (rowIter >= 0) {
var widths = this.$cellWidthsForRow(rowIter, tabString);
// starting row and backward
var row_iter = row
while (row_iter >= 0) {
widths = cellWidthsForRow(row_iter);
if (len(widths) == 0)
break;
cellWidths.unshift(widths);
row_iter--;
}
first_row = row_iter++;
// forward (not including starting row)
row_iter = row;
var num_rows = lines_in_buffer(view);
while (row_iter < num_rows - 1) {
row_iter++;
widths = cellWidthsForRow(row_iter);
if (len(widths) == 0)
break;
cellWidths.push(widths);
}
return {cellWidths: cellWidths, firstRow: firstRow};
};
this.$cellWidthsForRow = function(row, tabString) {
var selectionColumns = this.$selectionColumnsForRow(row, tabString);
this.$cellWidthsForRow = function(row) {
var selectionColumns = this.$selectionColumnsForRow(row);
//var tabs = [-1] + this.$tabsForRow(row);
//widths = [0] * (len(tabs) - 1);
//line = view.substr(view.line(view.text_point(row,0)))
//for (var i = 0, len = tabs.length; i < len; i++) {
//left_edge = tabs[i]+1
//right_edge = tabs[i+1]
//rightmost_selection = rightmost_selection_in_cell(selection_columns, right_edge)
//cell = line[left_edge:right_edge]
//widths[i] = max(len(cell.rstrip()), rightmost_selection - left_edge)
//}
return widths;;
};
this.$selectionColumnsForRow = function(row, tabString) {
var selections = [];
selections = []
for s in view.sel():
if s.empty():
r, c =view.rowcol(s.a)
if r == row:
selections.append(c)
return selections
};
this.$tabsForRow = function(row, tabString) {