Yesss fix positional bug
This commit is contained in:
parent
6e1398273c
commit
face772865
1 changed files with 11 additions and 6 deletions
|
|
@ -46,6 +46,7 @@ var ElasticTabstops = function(editor, session) {
|
|||
|
||||
if (checkedRows.indexOf(row) > -1)
|
||||
continue;
|
||||
|
||||
var cellWidthObj = this.$findCellWidthsForBlock(row);
|
||||
var cellWidths = this.$setBlockCellWidthsToMax(cellWidthObj.cellWidths);
|
||||
var rowIndex = cellWidthObj.firstRow;
|
||||
|
|
@ -113,9 +114,13 @@ var ElasticTabstops = function(editor, session) {
|
|||
};
|
||||
|
||||
this.$selectionColumnsForRow = function(row) {
|
||||
var selections = [];
|
||||
// todo: support multicursor
|
||||
selections.push(this.$editor.getCursorPosition().column + 1);
|
||||
var selections = [], cursor = this.$editor.getCursorPosition();
|
||||
if (this.$session.getSelection().isEmpty()) {
|
||||
// todo: support multicursor
|
||||
if (row == cursor.row)
|
||||
selections.push(cursor.column);
|
||||
}
|
||||
|
||||
return selections;
|
||||
};
|
||||
|
||||
|
|
@ -192,7 +197,7 @@ var ElasticTabstops = function(editor, session) {
|
|||
|
||||
// this always only contains two elements, so we're safe in the loop below
|
||||
var expandedSet = this.$izip(widths, rowTabs);
|
||||
|
||||
|
||||
for (var i = 0, l = expandedSet.length; i < l; i++) {
|
||||
var w = expandedSet[i][0], it = expandedSet[i][1];
|
||||
location += 1 + w;
|
||||
|
|
@ -202,7 +207,7 @@ var ElasticTabstops = function(editor, session) {
|
|||
if (difference == 0)
|
||||
continue;
|
||||
|
||||
var partialLine = this.$session.getLine(row).substr(0, it);
|
||||
var partialLine = this.$session.getLine(row).substr(0, it );
|
||||
var strippedPartialLine = partialLine.replace(/\s*$/g, "");
|
||||
var ispaces = partialLine.length - strippedPartialLine.length;
|
||||
|
||||
|
|
@ -216,7 +221,7 @@ var ElasticTabstops = function(editor, session) {
|
|||
}
|
||||
|
||||
if (difference < 0 && ispaces >= -difference) {
|
||||
this.$session.getDocument().removeInLine(row, it, it + difference);
|
||||
this.$session.getDocument().removeInLine(row, it + difference, it);
|
||||
bias += difference;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue