* 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

View file

@ -290,13 +290,11 @@ function MultiLineEditTextView2(options) {
self.cursorPos.col -= count; self.cursorPos.col -= count;
// recalc to next eol
self.updateTextWordWrap(index); self.updateTextWordWrap(index);
self.redrawRows(self.cursorPos.row, self.dimens.height); self.redrawRows(self.cursorPos.row, self.dimens.height);
if(self.cursorPos.col < 0) { if(0 === self.cursorPos.col) {
} else { } else {
var absPos = self.getAbsolutePosition(self.cursorPos.row, self.cursorPos.col); var absPos = self.getAbsolutePosition(self.cursorPos.row, self.cursorPos.col);
@ -710,16 +708,29 @@ function MultiLineEditTextView2(options) {
}; };
this.keyPressBackspace = function() { this.keyPressBackspace = function() {
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;
var index = self.getTextLinesIndex();
var count; var count;
if('\t' === self.getCharacter(self.cursorPos.col)) {
// :TODO: Need to remove tabs... 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( self.removeCharactersFromText(
self.getTextLinesIndex(), index,
self.cursorPos.col, self.cursorPos.col,
'left', 'left',
1); count);
}
}; };
this.keyPressDel = function() { this.keyPressDel = function() {