mirror of
https://github.com/paradoxxxzero/butterfly.git
synced 2026-05-26 07:08:08 +00:00
Merge branch 'domscroll_try2' into piped
This commit is contained in:
@@ -19,17 +19,21 @@ html, body
|
||||
margin: 0
|
||||
padding: 0
|
||||
line-height: 1.2
|
||||
|
||||
body
|
||||
white-space: nowrap
|
||||
overflow-x: hidden
|
||||
overflow-y: scroll
|
||||
white-space: nowrap
|
||||
|
||||
::-webkit-scrollbar
|
||||
background: $bg
|
||||
width: .75em
|
||||
height: .75em
|
||||
|
||||
::-webkit-scrollbar-thumb
|
||||
background: rgba($fg, .1)
|
||||
|
||||
::-webkit-scrollbar-thumb:hover
|
||||
background: rgba($fg, .15)
|
||||
|
||||
.terminal
|
||||
outline: none
|
||||
|
||||
2
butterfly/static/ext.min.js
vendored
2
butterfly/static/ext.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -3020,19 +3020,23 @@ html, body {
|
||||
html, body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
line-height: 1.2;
|
||||
line-height: 1.2; }
|
||||
|
||||
body {
|
||||
white-space: nowrap;
|
||||
overflow-x: hidden;
|
||||
overflow-y: scroll;
|
||||
white-space: nowrap; }
|
||||
overflow-y: scroll; }
|
||||
|
||||
::-webkit-scrollbar {
|
||||
background: #110f13;
|
||||
width: .75em;
|
||||
height: .75em; }
|
||||
width: .75em; }
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
background: rgba(244, 234, 213, 0.1); }
|
||||
|
||||
::-webkit-scrollbar-thumb:hover {
|
||||
background: rgba(244, 234, 213, 0.15); }
|
||||
|
||||
.terminal {
|
||||
outline: none; }
|
||||
|
||||
|
||||
@@ -176,6 +176,7 @@
|
||||
while (i--) {
|
||||
div = this.document.createElement('div');
|
||||
div.className = 'line';
|
||||
div.textContent = ' ';
|
||||
this.element.appendChild(div);
|
||||
this.children.push(div);
|
||||
}
|
||||
@@ -285,7 +286,7 @@
|
||||
|
||||
Terminal.prototype.focus = function() {
|
||||
if (this.sendFocus) {
|
||||
this.handler('\x1b[I');
|
||||
this.send('\x1b[I');
|
||||
}
|
||||
this.showCursor();
|
||||
this.element.classList.add('focus');
|
||||
@@ -296,7 +297,7 @@
|
||||
this.cursorState = 1;
|
||||
this.refresh(this.y, this.y);
|
||||
if (this.sendFocus) {
|
||||
this.handler('\x1b[O');
|
||||
this.send('\x1b[O');
|
||||
}
|
||||
this.element.classList.add('blur');
|
||||
return this.element.classList.remove('focus');
|
||||
@@ -364,20 +365,20 @@
|
||||
pos.y -= 32;
|
||||
pos.x++;
|
||||
pos.y++;
|
||||
_this.handler("\x1b[" + button + ";" + pos.x + ";" + pos.y + "M");
|
||||
_this.send("\x1b[" + button + ";" + pos.x + ";" + pos.y + "M");
|
||||
return;
|
||||
}
|
||||
if (_this.sgrMouse) {
|
||||
pos.x -= 32;
|
||||
pos.y -= 32;
|
||||
_this.handler("\x1b[<" + ((button & 3) === 3 ? button & ~3 : button) + ";" + pos.x + ";" + pos.y + ((button & 3) === 3 ? "m" : "M"));
|
||||
_this.send("\x1b[<" + ((button & 3) === 3 ? button & ~3 : button) + ";" + pos.x + ";" + pos.y + ((button & 3) === 3 ? "m" : "M"));
|
||||
return;
|
||||
}
|
||||
data = [];
|
||||
encode(data, button);
|
||||
encode(data, pos.x);
|
||||
encode(data, pos.y);
|
||||
return _this.handler("\x1b[M" + String.fromCharCode.apply(String, data));
|
||||
return _this.send("\x1b[M" + String.fromCharCode.apply(String, data));
|
||||
};
|
||||
})(this);
|
||||
getButton = (function(_this) {
|
||||
@@ -1135,7 +1136,7 @@
|
||||
this.updateRange(this.y);
|
||||
break;
|
||||
case "PROMPT":
|
||||
this.handler(content);
|
||||
this.send(content);
|
||||
break;
|
||||
case "TEXT":
|
||||
l += content.length;
|
||||
@@ -1165,12 +1166,12 @@
|
||||
console.error("Unknown DCS Pt: %s.", pt);
|
||||
pt = "";
|
||||
}
|
||||
this.handler("\x1bP" + +valid + "$r" + pt + "\x1b\\");
|
||||
this.send("\x1bP" + +valid + "$r" + pt + "\x1b\\");
|
||||
break;
|
||||
case "+q":
|
||||
pt = this.currentParam;
|
||||
valid = false;
|
||||
this.handler("\x1bP" + +valid + "+r" + pt + "\x1b\\");
|
||||
this.send("\x1bP" + +valid + "+r" + pt + "\x1b\\");
|
||||
break;
|
||||
default:
|
||||
console.error("Unknown DCS prefix: %s.", this.prefix);
|
||||
@@ -1419,7 +1420,7 @@
|
||||
return true;
|
||||
}
|
||||
this.showCursor();
|
||||
this.handler(key);
|
||||
this.send(key);
|
||||
return cancel(ev);
|
||||
};
|
||||
|
||||
@@ -1465,7 +1466,7 @@
|
||||
}
|
||||
key = String.fromCharCode(key);
|
||||
this.showCursor();
|
||||
this.handler(key);
|
||||
this.send(key);
|
||||
return false;
|
||||
};
|
||||
|
||||
@@ -1668,7 +1669,7 @@
|
||||
return ("" + this.termName).indexOf(term) === 0;
|
||||
};
|
||||
|
||||
Terminal.prototype.handler = function(data) {
|
||||
Terminal.prototype.send = function(data) {
|
||||
return this.out(data);
|
||||
};
|
||||
|
||||
@@ -1912,13 +1913,13 @@
|
||||
if (!this.prefix) {
|
||||
switch (params[0]) {
|
||||
case 5:
|
||||
return this.handler("\x1b[0n");
|
||||
return this.send("\x1b[0n");
|
||||
case 6:
|
||||
return this.handler("\x1b[" + (this.y + 1) + ";" + (this.x + 1) + "R");
|
||||
return this.send("\x1b[" + (this.y + 1) + ";" + (this.x + 1) + "R");
|
||||
}
|
||||
} else if (this.prefix === "?") {
|
||||
if (params[0] === 6) {
|
||||
return this.handler("\x1b[?" + (this.y + 1) + ";" + (this.x + 1) + "R");
|
||||
return this.send("\x1b[?" + (this.y + 1) + ";" + (this.x + 1) + "R");
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -2061,22 +2062,22 @@
|
||||
}
|
||||
if (!this.prefix) {
|
||||
if (this.isterm("xterm") || this.isterm("rxvt-unicode") || this.isterm("screen")) {
|
||||
return this.handler("\x1b[?1;2c");
|
||||
return this.send("\x1b[?1;2c");
|
||||
} else {
|
||||
if (this.isterm("linux")) {
|
||||
return this.handler("\x1b[?6c");
|
||||
return this.send("\x1b[?6c");
|
||||
}
|
||||
}
|
||||
} else if (this.prefix === ">") {
|
||||
if (this.isterm("xterm")) {
|
||||
return this.handler("\x1b[>0;276;0c");
|
||||
return this.send("\x1b[>0;276;0c");
|
||||
} else if (this.isterm("rxvt-unicode")) {
|
||||
return this.handler("\x1b[>85;95;0c");
|
||||
return this.send("\x1b[>85;95;0c");
|
||||
} else if (this.isterm("linux")) {
|
||||
return this.handler(params[0] + "c");
|
||||
return this.send(params[0] + "c");
|
||||
} else {
|
||||
if (this.isterm("screen")) {
|
||||
return this.handler("\x1b[>83;40003;0c");
|
||||
return this.send("\x1b[>83;40003;0c");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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
@@ -79,6 +79,7 @@ class Terminal
|
||||
while i--
|
||||
div = @document.createElement('div')
|
||||
div.className = 'line'
|
||||
div.textContent = ' '
|
||||
@element.appendChild(div)
|
||||
@children.push(div)
|
||||
|
||||
@@ -185,7 +186,7 @@ class Terminal
|
||||
erased
|
||||
|
||||
focus: ->
|
||||
@handler('\x1b[I') if @sendFocus
|
||||
@send('\x1b[I') if @sendFocus
|
||||
@showCursor()
|
||||
@element.classList.add('focus')
|
||||
@element.classList.remove('blur')
|
||||
@@ -193,7 +194,7 @@ class Terminal
|
||||
blur: ->
|
||||
@cursorState = 1
|
||||
@refresh(@y, @y)
|
||||
@handler('\x1b[O') if @sendFocus
|
||||
@send('\x1b[O') if @sendFocus
|
||||
@element.classList.add('blur')
|
||||
@element.classList.remove('focus')
|
||||
|
||||
@@ -270,13 +271,13 @@ class Terminal
|
||||
pos.y -= 32
|
||||
pos.x++
|
||||
pos.y++
|
||||
@handler "\x1b[" + button + ";" + pos.x + ";" + pos.y + "M"
|
||||
@send "\x1b[" + button + ";" + pos.x + ";" + pos.y + "M"
|
||||
return
|
||||
|
||||
if @sgrMouse
|
||||
pos.x -= 32
|
||||
pos.y -= 32
|
||||
@handler "\x1b[<" + (
|
||||
@send "\x1b[<" + (
|
||||
if (button & 3) is 3 then button & ~3 else button
|
||||
) + ";" + pos.x + ";" + pos.y + (
|
||||
if (button & 3) is 3 then "m" else "M"
|
||||
@@ -287,7 +288,7 @@ class Terminal
|
||||
encode data, button
|
||||
encode data, pos.x
|
||||
encode data, pos.y
|
||||
@handler "\x1b[M" + String.fromCharCode.apply(String, data)
|
||||
@send "\x1b[M" + String.fromCharCode.apply(String, data)
|
||||
|
||||
getButton = (ev) =>
|
||||
# two low bits:
|
||||
@@ -1069,7 +1070,7 @@ class Terminal
|
||||
@updateRange @y
|
||||
|
||||
when "PROMPT"
|
||||
@handler content
|
||||
@send content
|
||||
|
||||
when "TEXT"
|
||||
l += content.length
|
||||
@@ -1104,12 +1105,12 @@ class Terminal
|
||||
console.error "Unknown DCS Pt: %s.", pt
|
||||
pt = ""
|
||||
|
||||
@handler "\x1bP" + +valid + "$r" + pt + "\x1b\\"
|
||||
@send "\x1bP" + +valid + "$r" + pt + "\x1b\\"
|
||||
|
||||
when "+q"
|
||||
pt = @currentParam
|
||||
valid = false
|
||||
@handler "\x1bP" + +valid + "+r" + pt + "\x1b\\"
|
||||
@send "\x1bP" + +valid + "+r" + pt + "\x1b\\"
|
||||
|
||||
else
|
||||
console.error "Unknown DCS prefix: %s.", @prefix
|
||||
@@ -1373,7 +1374,7 @@ class Terminal
|
||||
return true unless key
|
||||
|
||||
@showCursor()
|
||||
@handler(key)
|
||||
@send(key)
|
||||
cancel ev
|
||||
|
||||
|
||||
@@ -1415,7 +1416,7 @@ class Terminal
|
||||
key = String.fromCharCode(key)
|
||||
|
||||
@showCursor()
|
||||
@handler key
|
||||
@send key
|
||||
false
|
||||
|
||||
bell: (cls="bell")->
|
||||
@@ -1551,7 +1552,7 @@ class Terminal
|
||||
isterm: (term) ->
|
||||
"#{@termName}".indexOf(term) is 0
|
||||
|
||||
handler: (data) ->
|
||||
send: (data) ->
|
||||
@out data
|
||||
|
||||
handleTitle: (title) ->
|
||||
@@ -1880,16 +1881,16 @@ class Terminal
|
||||
switch params[0]
|
||||
when 5
|
||||
# status report
|
||||
@handler "\x1b[0n"
|
||||
@send "\x1b[0n"
|
||||
when 6
|
||||
# cursor position
|
||||
@handler "\x1b[" + (@y + 1) + ";" + (@x + 1) + "R"
|
||||
@send "\x1b[" + (@y + 1) + ";" + (@x + 1) + "R"
|
||||
else if @prefix is "?"
|
||||
# modern xterm doesnt seem to
|
||||
# respond to any of these except ?6, 6, and 5
|
||||
if params[0] is 6
|
||||
# cursor position
|
||||
@handler "\x1b[?" + (@y + 1) + ";" + (@x + 1) + "R"
|
||||
@send "\x1b[?" + (@y + 1) + ";" + (@x + 1) + "R"
|
||||
|
||||
|
||||
## Additions ##
|
||||
@@ -2049,22 +2050,22 @@ class Terminal
|
||||
return if params[0] > 0
|
||||
unless @prefix
|
||||
if @isterm("xterm") or @isterm("rxvt-unicode") or @isterm("screen")
|
||||
@handler "\x1b[?1;2c"
|
||||
else @handler "\x1b[?6c" if @isterm("linux")
|
||||
@send "\x1b[?1;2c"
|
||||
else @send "\x1b[?6c" if @isterm("linux")
|
||||
|
||||
else if @prefix is ">"
|
||||
# xterm and urxvt
|
||||
# seem to spit this
|
||||
# out around ~370 times (?).
|
||||
if @isterm("xterm")
|
||||
@handler "\x1b[>0;276;0c"
|
||||
@send "\x1b[>0;276;0c"
|
||||
else if @isterm("rxvt-unicode")
|
||||
@handler "\x1b[>85;95;0c"
|
||||
@send "\x1b[>85;95;0c"
|
||||
else if @isterm("linux")
|
||||
# not supported by linux console.
|
||||
# linux console echoes parameters.
|
||||
@handler params[0] + "c"
|
||||
else @handler "\x1b[>83;40003;0c" if @isterm("screen")
|
||||
@send params[0] + "c"
|
||||
else @send "\x1b[>83;40003;0c" if @isterm("screen")
|
||||
|
||||
|
||||
# CSI Pm d
|
||||
|
||||
Reference in New Issue
Block a user