mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
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 { IBufferService, ICoreService, IOptionsService } from 'common/services/Services';
|
||||
import { C0 } from 'common/data/EscapeSequences';
|
||||
|
||||
interface IPosition {
|
||||
start: number;
|
||||
@@ -186,11 +187,17 @@ export class CompositionHelper {
|
||||
// Ignore if a composition has started since the timeout
|
||||
if (!this._isComposing) {
|
||||
const newValue = this._textarea.value;
|
||||
|
||||
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);
|
||||
} else if (newValue.length < oldValue.length) {
|
||||
this._coreService.triggerDataEvent(`${C0.DEL}`, true);
|
||||
}
|
||||
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user