|
1 | 1 | /**
|
| 2 | + * Copyright (c) 2014 The xterm.js authors. All rights reserved. |
| 3 | + * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License) |
2 | 4 | * @license MIT
|
3 | 5 | */
|
4 | 6 |
|
@@ -36,13 +38,14 @@ export class InputHandler implements IInputHandler {
|
36 | 38 | // dont overflow left
|
37 | 39 | if (this._terminal.buffer.lines.get(row)[this._terminal.buffer.x - 1]) {
|
38 | 40 | if (!this._terminal.buffer.lines.get(row)[this._terminal.buffer.x - 1][CHAR_DATA_WIDTH_INDEX]) {
|
39 |
| - |
40 | 41 | // found empty cell after fullwidth, need to go 2 cells back
|
41 |
| - if (this._terminal.buffer.lines.get(row)[this._terminal.buffer.x - 2]) |
| 42 | + if (this._terminal.buffer.lines.get(row)[this._terminal.buffer.x - 2]) { |
42 | 43 | this._terminal.buffer.lines.get(row)[this._terminal.buffer.x - 2][CHAR_DATA_CHAR_INDEX] += char;
|
43 |
| - |
| 44 | + this._terminal.buffer.lines.get(row)[this._terminal.buffer.x - 2][3] = char.charCodeAt(0); |
| 45 | + } |
44 | 46 | } else {
|
45 | 47 | this._terminal.buffer.lines.get(row)[this._terminal.buffer.x - 1][CHAR_DATA_CHAR_INDEX] += char;
|
| 48 | + this._terminal.buffer.lines.get(row)[this._terminal.buffer.x - 1][3] = char.charCodeAt(0); |
46 | 49 | }
|
47 | 50 | this._terminal.updateRange(this._terminal.buffer.y);
|
48 | 51 | }
|
@@ -81,21 +84,21 @@ export class InputHandler implements IInputHandler {
|
81 | 84 | if (removed[CHAR_DATA_WIDTH_INDEX] === 0
|
82 | 85 | && this._terminal.buffer.lines.get(row)[this._terminal.cols - 2]
|
83 | 86 | && this._terminal.buffer.lines.get(row)[this._terminal.cols - 2][CHAR_DATA_WIDTH_INDEX] === 2) {
|
84 |
| - this._terminal.buffer.lines.get(row)[this._terminal.cols - 2] = [this._terminal.curAttr, ' ', 1]; |
| 87 | + this._terminal.buffer.lines.get(row)[this._terminal.cols - 2] = [this._terminal.curAttr, ' ', 1, ' '.charCodeAt(0)]; |
85 | 88 | }
|
86 | 89 |
|
87 | 90 | // insert empty cell at cursor
|
88 |
| - this._terminal.buffer.lines.get(row).splice(this._terminal.buffer.x, 0, [this._terminal.curAttr, ' ', 1]); |
| 91 | + this._terminal.buffer.lines.get(row).splice(this._terminal.buffer.x, 0, [this._terminal.curAttr, ' ', 1, ' '.charCodeAt(0)]); |
89 | 92 | }
|
90 | 93 | }
|
91 | 94 |
|
92 |
| - this._terminal.buffer.lines.get(row)[this._terminal.buffer.x] = [this._terminal.curAttr, char, ch_width]; |
| 95 | + this._terminal.buffer.lines.get(row)[this._terminal.buffer.x] = [this._terminal.curAttr, char, ch_width, char.charCodeAt(0)]; |
93 | 96 | this._terminal.buffer.x++;
|
94 | 97 | this._terminal.updateRange(this._terminal.buffer.y);
|
95 | 98 |
|
96 | 99 | // fullwidth char - set next cell width to zero and advance cursor
|
97 | 100 | if (ch_width === 2) {
|
98 |
| - this._terminal.buffer.lines.get(row)[this._terminal.buffer.x] = [this._terminal.curAttr, '', 0]; |
| 101 | + this._terminal.buffer.lines.get(row)[this._terminal.buffer.x] = [this._terminal.curAttr, '', 0, undefined]; |
99 | 102 | this._terminal.buffer.x++;
|
100 | 103 | }
|
101 | 104 | }
|
@@ -188,7 +191,7 @@ export class InputHandler implements IInputHandler {
|
188 | 191 |
|
189 | 192 | const row = this._terminal.buffer.y + this._terminal.buffer.ybase;
|
190 | 193 | let j = this._terminal.buffer.x;
|
191 |
| - const ch: CharData = [this._terminal.eraseAttr(), ' ', 1]; // xterm |
| 194 | + const ch: CharData = [this._terminal.eraseAttr(), ' ', 1, 32]; // xterm |
192 | 195 |
|
193 | 196 | while (param-- && j < this._terminal.cols) {
|
194 | 197 | this._terminal.buffer.lines.get(row).splice(j++, 0, ch);
|
@@ -487,7 +490,7 @@ export class InputHandler implements IInputHandler {
|
487 | 490 | }
|
488 | 491 |
|
489 | 492 | const row = this._terminal.buffer.y + this._terminal.buffer.ybase;
|
490 |
| - const ch: CharData = [this._terminal.eraseAttr(), ' ', 1]; // xterm |
| 493 | + const ch: CharData = [this._terminal.eraseAttr(), ' ', 1, 32]; // xterm |
491 | 494 |
|
492 | 495 | while (param--) {
|
493 | 496 | this._terminal.buffer.lines.get(row).splice(this._terminal.buffer.x, 1);
|
@@ -535,7 +538,7 @@ export class InputHandler implements IInputHandler {
|
535 | 538 |
|
536 | 539 | const row = this._terminal.buffer.y + this._terminal.buffer.ybase;
|
537 | 540 | let j = this._terminal.buffer.x;
|
538 |
| - const ch: CharData = [this._terminal.eraseAttr(), ' ', 1]; // xterm |
| 541 | + const ch: CharData = [this._terminal.eraseAttr(), ' ', 1, 32]; // xterm |
539 | 542 |
|
540 | 543 | while (param-- && j < this._terminal.cols) {
|
541 | 544 | this._terminal.buffer.lines.get(row)[j++] = ch;
|
@@ -589,7 +592,7 @@ export class InputHandler implements IInputHandler {
|
589 | 592 | public repeatPrecedingCharacter(params: number[]): void {
|
590 | 593 | let param = params[0] || 1;
|
591 | 594 | const line = this._terminal.buffer.lines.get(this._terminal.buffer.ybase + this._terminal.buffer.y);
|
592 |
| - const ch = line[this._terminal.buffer.x - 1] || [this._terminal.defAttr, ' ', 1]; |
| 595 | + const ch = line[this._terminal.buffer.x - 1] || [this._terminal.defAttr, ' ', 1, 32]; |
593 | 596 |
|
594 | 597 | while (param--) {
|
595 | 598 | line[this._terminal.buffer.x++] = ch;
|
|
0 commit comments