mirror of
https://github.com/paradoxxxzero/butterfly.git
synced 2026-05-26 07:08:08 +00:00
Clear scrollback on hard reset
This commit is contained in:
4
butterfly/static/ext.min.js
vendored
4
butterfly/static/ext.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -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;
|
||||
|
||||
6
butterfly/static/main.min.js
vendored
6
butterfly/static/main.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user