* Cleanup for emiting edit position

This commit is contained in:
Bryan Ashby 2015-07-06 23:26:16 -06:00
parent ab39fcd1ba
commit 06648403cc
2 changed files with 18 additions and 24 deletions

View File

@ -643,15 +643,9 @@ function MultiLineEditTextView(options) {
self.client.term.write(c); self.client.term.write(c);
} else { } else {
self.insertCharactersInText(c, index, self.cursorPos.col); self.insertCharactersInText(c, index, self.cursorPos.col);
/*if(self.cursorPos.col >= self.dimens.width) {
console.log('next line')
self.cursorBeginOfNextLine();
//self.client.term.write(ansi.right(cursorOffset))
}*/
} }
self.emitPosition(); self.emitEditPosition();
}; };
this.keyPressUp = function() { this.keyPressUp = function() {
@ -667,7 +661,7 @@ function MultiLineEditTextView(options) {
self.adjustCursorIfPastEndOfLine(true); self.adjustCursorIfPastEndOfLine(true);
} }
self.emitPosition(); self.emitEditPosition();
}; };
this.keyPressDown = function() { this.keyPressDown = function() {
@ -687,7 +681,7 @@ function MultiLineEditTextView(options) {
self.adjustCursorIfPastEndOfLine(true); self.adjustCursorIfPastEndOfLine(true);
} }
self.emitPosition(); self.emitEditPosition();
}; };
this.keyPressLeft = function() { this.keyPressLeft = function() {
@ -704,7 +698,7 @@ function MultiLineEditTextView(options) {
self.cursorEndOfPreviousLine(); self.cursorEndOfPreviousLine();
} }
self.emitPosition(); self.emitEditPosition();
}; };
this.keyPressRight = function() { this.keyPressRight = function() {
@ -722,7 +716,7 @@ function MultiLineEditTextView(options) {
self.cursorBeginOfNextLine(); self.cursorBeginOfNextLine();
} }
self.emitPosition(); self.emitEditPosition();
}; };
this.keyPressHome = function() { this.keyPressHome = function() {
@ -735,13 +729,13 @@ function MultiLineEditTextView(options) {
console.log('"' + self.getVisibleText() + '"') console.log('"' + self.getVisibleText() + '"')
self.moveClientCusorToCursorPos(); self.moveClientCusorToCursorPos();
self.emitPosition(); self.emitEditPosition();
}; };
this.keyPressEnd = function() { this.keyPressEnd = function() {
self.cursorPos.col = self.getTextEndOfLineColumn(); self.cursorPos.col = self.getTextEndOfLineColumn();
self.moveClientCusorToCursorPos(); self.moveClientCusorToCursorPos();
self.emitPosition(); self.emitEditPosition();
}; };
this.keyPressPageUp = function() { this.keyPressPageUp = function() {
@ -754,7 +748,7 @@ function MultiLineEditTextView(options) {
self.moveClientCusorToCursorPos(); // :TODO: ajust if eol, etc. self.moveClientCusorToCursorPos(); // :TODO: ajust if eol, etc.
} }
self.emitPosition(); self.emitEditPosition();
}; };
this.keyPressPageDown = function() { this.keyPressPageDown = function() {
@ -765,7 +759,7 @@ function MultiLineEditTextView(options) {
self.adjustCursorIfPastEndOfLine(true); self.adjustCursorIfPastEndOfLine(true);
} }
self.emitPosition(); self.emitEditPosition();
}; };
this.keyPressLineFeed = function() { this.keyPressLineFeed = function() {
@ -792,7 +786,7 @@ function MultiLineEditTextView(options) {
self.redrawRows(self.cursorPos.row, self.dimens.height); self.redrawRows(self.cursorPos.row, self.dimens.height);
self.cursorBeginOfNextLine(); self.cursorBeginOfNextLine();
self.emitPosition(); self.emitEditPosition();
}; };
this.keyPressInsert = function() { this.keyPressInsert = function() {
@ -803,7 +797,7 @@ function MultiLineEditTextView(options) {
var index = self.getTextLinesIndex(); var index = self.getTextLinesIndex();
self.insertCharactersInText(self.expandTab(self.cursorPos.col, '\t') + '\t', index, self.cursorPos.col); self.insertCharactersInText(self.expandTab(self.cursorPos.col, '\t') + '\t', index, self.cursorPos.col);
self.emitPosition(); self.emitEditPosition();
}; };
this.keyPressBackspace = function() { this.keyPressBackspace = function() {
@ -848,7 +842,7 @@ function MultiLineEditTextView(options) {
//self.keyPressBackspace(); //self.keyPressBackspace();
} }
self.emitPosition(); self.emitEditPosition();
}; };
this.keyPressDelete = function() { this.keyPressDelete = function() {
@ -858,7 +852,7 @@ function MultiLineEditTextView(options) {
'right', 'right',
1); 1);
self.emitPosition(); self.emitEditPosition();
}; };
//this.keyPressClearLine = function() { //this.keyPressClearLine = function() {
@ -870,7 +864,7 @@ function MultiLineEditTextView(options) {
'delete line'); 'delete line');
} }
self.emitPosition(); self.emitEditPosition();
}; };
this.adjustCursorIfPastEndOfLine = function(forceUpdate) { this.adjustCursorIfPastEndOfLine = function(forceUpdate) {
@ -1020,8 +1014,8 @@ function MultiLineEditTextView(options) {
} }
}; };
this.emitPosition = function() { this.emitEditPosition = function() {
self.emit('cursor position', self.getEditPosition()); self.emit('edit position', self.getEditPosition());
}; };
this.toggleTextEditMode = function() { this.toggleTextEditMode = function() {

View File

@ -176,7 +176,7 @@ function FullScreenEditorModule(options) {
self.viewControllers.header.removeFocus(); self.viewControllers.header.removeFocus();
self.viewControllers.body.switchFocus(1); self.viewControllers.body.switchFocus(1);
self.getBodyView().on('cursor position', function cursorPosUpdate(pos) { self.getBodyView().on('edit position', function cursorPosUpdate(pos) {
self.updateEditModePosition(pos); self.updateEditModePosition(pos);
}); });