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

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