Stash
This commit is contained in:
parent
cf079109d7
commit
9dc94741a6
1 changed files with 54 additions and 15 deletions
|
|
@ -771,35 +771,74 @@ var Editor = function(renderer, session) {
|
||||||
mode.autoOutdent(lineState, session, cursor.row);
|
mode.autoOutdent(lineState, session, cursor.row);
|
||||||
|
|
||||||
if (true || this.session.getElasticTabstops()) {
|
if (true || this.session.getElasticTabstops()) {
|
||||||
var row = 0, rows = this.session.getLength(),
|
// todo: make this a unique set
|
||||||
tabString = "\t";
|
var row = cursor.row;
|
||||||
|
|
||||||
while (row <= rows) {
|
this.$processRow([row]);
|
||||||
var cellWidths = this.$findCellWidthsForBlock(row, tabString),
|
|
||||||
cellWidthsByRow = cellWidths.byRow, rowIndex = cellWidths.rowIndex;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
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) {
|
this.$findCellWidthsForBlock = function(row, tabString) {
|
||||||
var cellWidths = [];
|
var cellWidths = [], widths;
|
||||||
|
|
||||||
var rowIter = row;
|
// starting row and backward
|
||||||
|
var row_iter = row
|
||||||
while (rowIter >= 0) {
|
while (row_iter >= 0) {
|
||||||
var widths = this.$cellWidthsForRow(rowIter, tabString);
|
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) {
|
this.$cellWidthsForRow = function(row) {
|
||||||
var selectionColumns = this.$selectionColumnsForRow(row, tabString);
|
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) {
|
this.$selectionColumnsForRow = function(row, tabString) {
|
||||||
var selections = [];
|
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) {
|
this.$tabsForRow = function(row, tabString) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue