diff --git a/butterfly.service b/butterfly.service index 6ae2396..943b5ea 100644 --- a/butterfly.service +++ b/butterfly.service @@ -1,6 +1,6 @@ [Unit] Description=Butterfly Terminal Server -After=syslog.target +After=network.target [Service] ExecStart=/usr/bin/butterfly.server.py diff --git a/butterfly/static/coffees/term.coffee b/butterfly/static/coffees/term.coffee index 56b28f5..e6e9f6a 100644 --- a/butterfly/static/coffees/term.coffee +++ b/butterfly/static/coffees/term.coffee @@ -81,7 +81,7 @@ class Terminal @element.appendChild(div) @children.push(div) - # @scrollback = 100000 + @scrollback = 5000 @missing_lines = 0 @visualBell = 100 @@ -92,9 +92,6 @@ class Terminal @last_cc = 0 @reset_vars() - # Draw screen - # @refresh 0, @rows - 1 - @focus() @startBlink() @@ -378,7 +375,7 @@ class Terminal parent = @element.parentNode parent?.removeChild @element - @missing_lines = Math.min(@missing_lines, @rows - 1) + # @missing_lines = Math.min(@missing_lines, @rows - 1) if @missing_lines for i in [1..@missing_lines] @@ -491,6 +488,8 @@ class Terminal @screen.push @blank_line() @refreshStart = Math.max(@refreshStart - 1, 0) @missing_lines++ + if @missing_lines >= @rows + @refresh 0, @rows - 1 scroll_display: (disp) -> @parent.scrollTop += disp * @char_size.height @@ -499,6 +498,9 @@ class Terminal div = @document.createElement('div') div.className = 'line' @element.appendChild(div) + if @element.childElementCount > @scrollback + @element.children[0].remove() + @children.shift() @children.push(div) @@ -1050,7 +1052,7 @@ class Terminal i++ if ch is "\x1b" @state = State.normal i++ - + @updateRange @y @refresh @refreshStart, @refreshEnd diff --git a/butterfly/static/javascripts/main.js b/butterfly/static/javascripts/main.js index 43b1268..e8bf0ab 100644 --- a/butterfly/static/javascripts/main.js +++ b/butterfly/static/javascripts/main.js @@ -57,6 +57,7 @@ Terminal = (function() { this.element.appendChild(div); this.children.push(div); } + this.scrollback = 5000; this.missing_lines = 0; this.visualBell = 100; this.convertEol = false; @@ -362,7 +363,6 @@ Terminal = (function() { parent.removeChild(this.element); } } - this.missing_lines = Math.min(this.missing_lines, this.rows - 1); if (this.missing_lines) { for (i = _i = 1, _ref = this.missing_lines; 1 <= _ref ? _i <= _ref : _i >= _ref; i = 1 <= _ref ? ++_i : --_i) { this.new_line(); @@ -511,7 +511,10 @@ Terminal = (function() { this.screen.shift(); this.screen.push(this.blank_line()); this.refreshStart = Math.max(this.refreshStart - 1, 0); - return this.missing_lines++; + this.missing_lines++; + if (this.missing_lines >= this.rows) { + return this.refresh(0, this.rows - 1); + } }; Terminal.prototype.scroll_display = function(disp) { @@ -523,6 +526,9 @@ Terminal = (function() { div = this.document.createElement('div'); div.className = 'line'; this.element.appendChild(div); + if (this.element.childElementCount > this.scrollback) { + this.element.children[0].remove(); + } this.children.shift(); return this.children.push(div); };