Clear scrollback on hard reset

This commit is contained in:
Florian Mounier
2015-10-27 16:23:37 +01:00
parent 5714b97c77
commit 28ebf9d8a2
4 changed files with 41 additions and 5 deletions

File diff suppressed because one or more lines are too long

View File

@@ -912,6 +912,7 @@
this.state = State.ignore;
break;
case "c":
this.clearScrollback();
this.reset();
break;
case "E":
@@ -1927,6 +1928,25 @@
return this.refresh(true);
};
Terminal.prototype.clearScrollback = function() {
var group, k, len, len1, line, lines, m, ref, ref1;
lines = document.querySelectorAll('.line');
if (lines.length > this.rows) {
ref = Array.prototype.slice.call(lines, 0, lines.length - this.rows);
for (k = 0, len = ref.length; k < len; k++) {
line = ref[k];
line.remove();
}
ref1 = document.querySelectorAll('.group:empty');
for (m = 0, len1 = ref1.length; m < len1; m++) {
group = ref1[m];
group.remove();
}
lines = document.querySelectorAll('.line');
}
return this.children = Array.prototype.slice.call(lines, -this.rows);
};
Terminal.prototype.tabSet = function() {
this.tabs[this.x] = true;
return this.state = State.normal;

File diff suppressed because one or more lines are too long

View File

@@ -733,6 +733,7 @@ class Terminal
# ESC c Full Reset (RIS).
when "c"
@clearScrollback()
@reset()
# ESC E Next Line ( NEL is 0x85).
@@ -1731,6 +1732,21 @@ class Terminal
@resetVars()
@refresh(true)
clearScrollback: ->
# In case of real hard reset
# Drop DOM history
lines = document.querySelectorAll('.line')
if lines.length > @rows
for line in Array.prototype.slice.call(
lines, 0, lines.length - @rows)
line.remove()
for group in document.querySelectorAll('.group:empty')
group.remove()
lines = document.querySelectorAll('.line')
@children = Array.prototype.slice.call(
lines, -@rows)
# ESC H Tab Set (HTS is 0x88).
tabSet: ->
@tabs[@x] = true