* Some work on backspace processign with tabs... WIP.

This commit is contained in:
Bryan Ashby 2015-06-16 23:43:22 -06:00
parent 2c7527bbcd
commit d2244ba028
1 changed files with 24 additions and 13 deletions

View File

@ -290,14 +290,12 @@ function MultiLineEditTextView2(options) {
self.cursorPos.col -= count;
// recalc to next eol
self.updateTextWordWrap(index);
self.redrawRows(self.cursorPos.row, self.dimens.height);
if(self.cursorPos.col < 0) {
if(0 === self.cursorPos.col) {
} else {
var absPos = self.getAbsolutePosition(self.cursorPos.row, self.cursorPos.col);
self.client.term.write(ansi.goto(absPos.row, absPos.col));
@ -710,16 +708,29 @@ function MultiLineEditTextView2(options) {
};
this.keyPressBackspace = function() {
var count;
if('\t' === self.getCharacter(self.cursorPos.col)) {
// :TODO: Need to remove tabs...
}
if(self.cursorPos.col > 1) {
//
// Don't want to delete character at cursor, but rather the character
// to the left of the cursor!
//
self.cursorPos.col -= 1;
self.removeCharactersFromText(
self.getTextLinesIndex(),
self.cursorPos.col,
'left',
1);
var index = self.getTextLinesIndex();
var count;
if('\t' === self.getCharacter(index, self.cursorPos.col)) {
// :TODO: This isn't right... need to find how many up to count to actually remove
count = (self.cursorPos.col - self.getPrevTabStop(self.cursorPos.col));
} else {
count = 1;
}
self.removeCharactersFromText(
index,
self.cursorPos.col,
'left',
count);
}
};
this.keyPressDel = function() {