From f4848c8b4b8ebcf65c50a371bf8c6a202304b109 Mon Sep 17 00:00:00 2001 From: Marcin Kulik Date: Sun, 12 Feb 2012 22:02:57 +0100 Subject: [PATCH] Update only changed lines instead of whole screen --- app/assets/javascripts/player/vt.js.coffee | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/player/vt.js.coffee b/app/assets/javascripts/player/vt.js.coffee index 7a89d26..b872d0b 100644 --- a/app/assets/javascripts/player/vt.js.coffee +++ b/app/assets/javascripts/player/vt.js.coffee @@ -352,8 +352,14 @@ class AsciiIo.VT updateLine: (n = @cursorY) -> @dirtyLines[n] = @lineData[n] + updateLines: (a, b) -> + n = a + while n <= b + @updateLine n + n++ + updateScreen: -> - @dirtyLines[n] = @lineData[n] for n in [0...@lines] + @updateLine n for n in [0...@lines] carriageReturn: -> @goToFirstColumn() @@ -541,7 +547,7 @@ class AsciiIo.VT @_addEmptyLine l i++ - @updateScreen() + @updateLines(l, @bottomMargin) deleteLine: (n, l = @cursorY) -> return unless @inScrollRegion() @@ -552,7 +558,7 @@ class AsciiIo.VT @_addEmptyLine @bottomMargin i++ - @updateScreen() + @updateLines(l, @bottomMargin) deleteCharacters: (n) -> @getLine().splice(@cursorX, n)