From 6f886fe1672cfca93f76516de76fb9cf54db8c62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Breitbart?= Date: Sun, 16 Feb 2020 20:41:55 +0100 Subject: [PATCH] working draft --- src/InputHandler.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/InputHandler.ts b/src/InputHandler.ts index fb37f4ab..863fea1b 100644 --- a/src/InputHandler.ts +++ b/src/InputHandler.ts @@ -717,9 +717,19 @@ export class InputHandler extends Disposable implements IInputHandler { * @vt: #Y C0 BS "Backspace" "\b, \x08" "Move the cursor one position to the left." */ public backspace(): void { - this._restrictCursor(); - if (this._bufferService.buffer.x > 0) { - this._bufferService.buffer.x--; + //this._restrictCursor(); + const buffer = this._bufferService.buffer; + if (buffer.x > 0) { + buffer.x--; + } else { + // reverse wraparound + if (buffer.x === 0 && buffer.y && buffer.lines.get(buffer.y + buffer.ybase).isWrapped) { + buffer.y--; + buffer.x = this._bufferService.cols - 1; + } + } + if (buffer.x >= this._bufferService.cols) { + buffer.x = this._bufferService.cols - 1; } }