mirror of
https://github.com/paradoxxxzero/butterfly.git
synced 2026-05-26 23:19:43 +00:00
Fix send
This commit is contained in:
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
@@ -275,7 +275,7 @@
|
||||
|
||||
Terminal.prototype.focus = function() {
|
||||
if (this.sendFocus) {
|
||||
this.handler('\x1b[I');
|
||||
this.send('\x1b[I');
|
||||
}
|
||||
this.showCursor();
|
||||
this.element.classList.add('focus');
|
||||
@@ -286,7 +286,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');
|
||||
@@ -354,20 +354,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) {
|
||||
@@ -1122,7 +1122,7 @@
|
||||
this.updateRange(this.y);
|
||||
break;
|
||||
case "PROMPT":
|
||||
this.handler(content);
|
||||
this.send(content);
|
||||
break;
|
||||
case "TEXT":
|
||||
l += content.length;
|
||||
@@ -1152,12 +1152,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);
|
||||
@@ -1406,7 +1406,7 @@
|
||||
return true;
|
||||
}
|
||||
this.showCursor();
|
||||
this.handler(key);
|
||||
this.send(key);
|
||||
return cancel(ev);
|
||||
};
|
||||
|
||||
@@ -1452,7 +1452,7 @@
|
||||
}
|
||||
key = String.fromCharCode(key);
|
||||
this.showCursor();
|
||||
this.handler(key);
|
||||
this.send(key);
|
||||
return false;
|
||||
};
|
||||
|
||||
@@ -1655,7 +1655,7 @@
|
||||
return ("" + this.termName).indexOf(term) === 0;
|
||||
};
|
||||
|
||||
Terminal.prototype.handler = function(data) {
|
||||
Terminal.prototype.send = function(data) {
|
||||
return this.out(data);
|
||||
};
|
||||
|
||||
@@ -1899,13 +1899,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");
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -2050,22 +2050,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
@@ -186,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')
|
||||
@@ -194,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')
|
||||
|
||||
@@ -271,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"
|
||||
@@ -288,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:
|
||||
@@ -1058,7 +1058,7 @@ class Terminal
|
||||
@updateRange @y
|
||||
|
||||
when "PROMPT"
|
||||
@handler content
|
||||
@send content
|
||||
|
||||
when "TEXT"
|
||||
l += content.length
|
||||
@@ -1093,12 +1093,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
|
||||
@@ -1362,7 +1362,7 @@ class Terminal
|
||||
return true unless key
|
||||
|
||||
@showCursor()
|
||||
@handler(key)
|
||||
@send(key)
|
||||
cancel ev
|
||||
|
||||
|
||||
@@ -1404,7 +1404,7 @@ class Terminal
|
||||
key = String.fromCharCode(key)
|
||||
|
||||
@showCursor()
|
||||
@handler key
|
||||
@send key
|
||||
false
|
||||
|
||||
bell: (cls="bell")->
|
||||
@@ -1540,7 +1540,7 @@ class Terminal
|
||||
isterm: (term) ->
|
||||
"#{@termName}".indexOf(term) is 0
|
||||
|
||||
handler: (data) ->
|
||||
send: (data) ->
|
||||
@out data
|
||||
|
||||
handleTitle: (title) ->
|
||||
@@ -1869,16 +1869,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 ##
|
||||
@@ -2037,22 +2037,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