handle if the newValue.length is less than the old value by deleting
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
import { IRenderService } from 'browser/services/Services';
|
import { IRenderService } from 'browser/services/Services';
|
||||||
import { IBufferService, ICoreService, IOptionsService } from 'common/services/Services';
|
import { IBufferService, ICoreService, IOptionsService } from 'common/services/Services';
|
||||||
|
import { C0 } from 'common/data/EscapeSequences';
|
||||||
|
|
||||||
interface IPosition {
|
interface IPosition {
|
||||||
start: number;
|
start: number;
|
||||||
@@ -186,11 +187,17 @@ export class CompositionHelper {
|
|||||||
// Ignore if a composition has started since the timeout
|
// Ignore if a composition has started since the timeout
|
||||||
if (!this._isComposing) {
|
if (!this._isComposing) {
|
||||||
const newValue = this._textarea.value;
|
const newValue = this._textarea.value;
|
||||||
|
|
||||||
const diff = newValue.replace(oldValue, '');
|
const diff = newValue.replace(oldValue, '');
|
||||||
if (diff.length > 0) {
|
|
||||||
this._dataAlreadySent = diff;
|
this._dataAlreadySent = diff;
|
||||||
|
|
||||||
|
if (newValue.length > oldValue.length) {
|
||||||
this._coreService.triggerDataEvent(diff, true);
|
this._coreService.triggerDataEvent(diff, true);
|
||||||
|
} else if (newValue.length < oldValue.length) {
|
||||||
|
this._coreService.triggerDataEvent(`${C0.DEL}`, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user