From cf079109d720b07925f221635ea5c80b0d882ae8 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Mon, 26 Nov 2012 16:37:39 -0800 Subject: [PATCH] Stash --- lib/ace/editor.js | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/lib/ace/editor.js b/lib/ace/editor.js index 4039e0b7..21f33eac 100644 --- a/lib/ace/editor.js +++ b/lib/ace/editor.js @@ -769,6 +769,51 @@ var Editor = function(renderer, session) { } if (shouldOutdent) mode.autoOutdent(lineState, session, cursor.row); + + if (true || this.session.getElasticTabstops()) { + var row = 0, rows = this.session.getLength(), + tabString = "\t"; + + while (row <= rows) { + var cellWidths = this.$findCellWidthsForBlock(row, tabString), + cellWidthsByRow = cellWidths.byRow, rowIndex = cellWidths.rowIndex; + } + } + }; + + + this.$findCellWidthsForBlock = function(row, tabString) { + var cellWidths = []; + + var rowIter = row; + + while (rowIter >= 0) { + var widths = this.$cellWidthsForRow(rowIter, tabString); + } + }; + + this.$cellWidthsForRow = function(row, tabString) { + var selectionColumns = this.$selectionColumnsForRow(row, tabString); + }; + + this.$selectionColumnsForRow = function(row, tabString) { + var selections = []; + + + }; + + this.$tabsForRow = function(row, tabString) { + var rowTabs = []; + + var matches = session.getLine(row).match(new RegExp(tabString, "g")); + + if (matches !== null) { + for (var m = 0, matchLength = matches.length; m < matchLength; m++) { + rowTabs.push(matches[m].length); + } + } + + return rowTabs; }; this.onTextInput = function(text) { @@ -1212,6 +1257,7 @@ var Editor = function(renderer, session) { indentString = lang.stringRepeat(" ", count); } else indentString = "\t"; + return this.insert(indentString); } };