mirror of
https://github.com/paradoxxxzero/butterfly.git
synced 2026-05-26 07:08:08 +00:00
Merge both behaviors
This commit is contained in:
@@ -26,7 +26,8 @@ html, body
|
|||||||
overflow: hidden
|
overflow: hidden
|
||||||
white-space: nowrap
|
white-space: nowrap
|
||||||
|
|
||||||
[data-native-scroll="yes"]
|
body[data-native-scroll="yes"]
|
||||||
|
#wrapper
|
||||||
overflow-y: auto
|
overflow-y: auto
|
||||||
|
|
||||||
.terminal
|
.terminal
|
||||||
|
|||||||
@@ -86,8 +86,9 @@ html, body {
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap; }
|
white-space: nowrap; }
|
||||||
#wrapper [data-native-scroll="yes"] {
|
|
||||||
overflow-y: auto; }
|
body[data-native-scroll="yes"] #wrapper {
|
||||||
|
overflow-y: auto; }
|
||||||
|
|
||||||
.terminal {
|
.terminal {
|
||||||
outline: none; }
|
outline: none; }
|
||||||
|
|||||||
@@ -454,7 +454,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
Terminal.prototype.refresh = function(start, end) {
|
Terminal.prototype.refresh = function(start, end) {
|
||||||
var attr, bg, ch, classes, data, fg, flags, html, i, j, k, l, line, m, o, out, parent, ref, ref1, ref2, ref3, ref4, x;
|
var attr, bg, ch, classes, data, fg, flags, html, i, j, k, l, line, m, o, out, parent, ref, ref1, ref2, ref3, ref4, row, x;
|
||||||
if (!this.native_scroll && end - start >= this.rows / 3) {
|
if (!this.native_scroll && end - start >= this.rows / 3) {
|
||||||
parent = this.element.parentNode;
|
parent = this.element.parentNode;
|
||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
@@ -471,7 +471,8 @@
|
|||||||
}
|
}
|
||||||
end = Math.min(end, this.screen.length - 1);
|
end = Math.min(end, this.screen.length - 1);
|
||||||
for (j = m = ref1 = start, ref2 = end; ref1 <= ref2 ? m <= ref2 : m >= ref2; j = ref1 <= ref2 ? ++m : --m) {
|
for (j = m = ref1 = start, ref2 = end; ref1 <= ref2 ? m <= ref2 : m >= ref2; j = ref1 <= ref2 ? ++m : --m) {
|
||||||
line = this.screen[row + this.ydisp];
|
row = j + this.ydisp;
|
||||||
|
line = this.screen[row];
|
||||||
out = "";
|
out = "";
|
||||||
if (j === this.y && !this.cursorHidden && (this.native_scroll || this.ydisp === this.ybase || this.selectMode)) {
|
if (j === this.y && !this.cursorHidden && (this.native_scroll || this.ydisp === this.ybase || this.selectMode)) {
|
||||||
x = this.x;
|
x = this.x;
|
||||||
@@ -630,9 +631,9 @@
|
|||||||
row = this.ybase + this.rows - 1;
|
row = this.ybase + this.rows - 1;
|
||||||
row -= this.rows - 1 - this.scrollBottom;
|
row -= this.rows - 1 - this.scrollBottom;
|
||||||
if (row === this.screen.length) {
|
if (row === this.screen.length) {
|
||||||
this.screen.push(this.blankLine());
|
this.screen.push(this.blank_line());
|
||||||
} else {
|
} else {
|
||||||
this.screen.splice(row, 0, this.blankLine());
|
this.screen.splice(row, 0, this.blank_line());
|
||||||
}
|
}
|
||||||
if (this.scrollTop !== 0) {
|
if (this.scrollTop !== 0) {
|
||||||
if (this.ybase !== 0) {
|
if (this.ybase !== 0) {
|
||||||
@@ -736,7 +737,7 @@
|
|||||||
ch = this.charset[ch];
|
ch = this.charset[ch];
|
||||||
}
|
}
|
||||||
if (this.x >= this.cols) {
|
if (this.x >= this.cols) {
|
||||||
this.lines[this.y + this.ybase][this.x] = [this.curAttr, '\u23CE'];
|
this.screen[this.y + this.ybase][this.x] = [this.curAttr, '\u23CE'];
|
||||||
this.x = 0;
|
this.x = 0;
|
||||||
this.next_line();
|
this.next_line();
|
||||||
}
|
}
|
||||||
@@ -1121,7 +1122,7 @@
|
|||||||
this.updateRange(this.y);
|
this.updateRange(this.y);
|
||||||
this.next_line();
|
this.next_line();
|
||||||
} else {
|
} else {
|
||||||
this.lines[this.y + this.ybase][this.x] = [this.curAttr, html];
|
this.screen[this.y + this.ybase][this.x] = [this.curAttr, html];
|
||||||
line = 0;
|
line = 0;
|
||||||
while (line < this.get_html_height_in_lines(html) - 1) {
|
while (line < this.get_html_height_in_lines(html) - 1) {
|
||||||
this.y++;
|
this.y++;
|
||||||
@@ -2021,7 +2022,7 @@
|
|||||||
} else {
|
} else {
|
||||||
j = this.rows - 1 - this.scrollBottom;
|
j = this.rows - 1 - this.scrollBottom;
|
||||||
j = this.rows - 1 + this.ybase - j;
|
j = this.rows - 1 + this.ybase - j;
|
||||||
this.screen.splice(j + 1, 0, this.blankLine(true));
|
this.screen.splice(j + 1, 0, this.blank_line(true));
|
||||||
}
|
}
|
||||||
this.screen.splice(this.y, 1);
|
this.screen.splice(this.y, 1);
|
||||||
}
|
}
|
||||||
@@ -2206,7 +2207,7 @@
|
|||||||
case 1047:
|
case 1047:
|
||||||
if (!this.normal) {
|
if (!this.normal) {
|
||||||
normal = {
|
normal = {
|
||||||
lines: this.lines,
|
lines: this.screen,
|
||||||
ybase: this.ybase,
|
ybase: this.ybase,
|
||||||
ydisp: this.ydisp,
|
ydisp: this.ydisp,
|
||||||
x: this.x,
|
x: this.x,
|
||||||
@@ -2272,7 +2273,7 @@
|
|||||||
case 47:
|
case 47:
|
||||||
case 1047:
|
case 1047:
|
||||||
if (this.normal) {
|
if (this.normal) {
|
||||||
this.lines = this.normal.lines;
|
this.screen = this.normal.lines;
|
||||||
this.ybase = this.normal.ybase;
|
this.ybase = this.normal.ybase;
|
||||||
this.ydisp = this.normal.ydisp;
|
this.ydisp = this.normal.ydisp;
|
||||||
this.x = this.normal.x;
|
this.x = this.normal.x;
|
||||||
@@ -2363,7 +2364,7 @@
|
|||||||
Terminal.prototype.repeatPrecedingCharacter = function(params) {
|
Terminal.prototype.repeatPrecedingCharacter = function(params) {
|
||||||
var ch, line, param, results;
|
var ch, line, param, results;
|
||||||
param = params[0] || 1;
|
param = params[0] || 1;
|
||||||
line = this.lines[this.ybase + this.y];
|
line = this.screen[this.ybase + this.y];
|
||||||
ch = line[this.x - 1] || [this.defAttr, " "];
|
ch = line[this.x - 1] || [this.defAttr, " "];
|
||||||
results = [];
|
results = [];
|
||||||
while (param--) {
|
while (param--) {
|
||||||
@@ -2430,7 +2431,7 @@
|
|||||||
r = params[3];
|
r = params[3];
|
||||||
attr = params[4];
|
attr = params[4];
|
||||||
while (t < b + 1) {
|
while (t < b + 1) {
|
||||||
line = this.lines[this.ybase + t];
|
line = this.screen[this.ybase + t];
|
||||||
i = l;
|
i = l;
|
||||||
while (i < r) {
|
while (i < r) {
|
||||||
line[i] = [attr, line[i][1]];
|
line[i] = [attr, line[i][1]];
|
||||||
@@ -2470,7 +2471,7 @@
|
|||||||
b = params[3];
|
b = params[3];
|
||||||
r = params[4];
|
r = params[4];
|
||||||
while (t < b + 1) {
|
while (t < b + 1) {
|
||||||
line = this.lines[this.ybase + t];
|
line = this.screen[this.ybase + t];
|
||||||
i = l;
|
i = l;
|
||||||
while (i < r) {
|
while (i < r) {
|
||||||
line[i] = [line[i][0], String.fromCharCode(ch)];
|
line[i] = [line[i][0], String.fromCharCode(ch)];
|
||||||
@@ -2495,7 +2496,7 @@
|
|||||||
r = params[3];
|
r = params[3];
|
||||||
ch = [this.eraseAttr(), " "];
|
ch = [this.eraseAttr(), " "];
|
||||||
while (t < b + 1) {
|
while (t < b + 1) {
|
||||||
line = this.lines[this.ybase + t];
|
line = this.screen[this.ybase + t];
|
||||||
i = l;
|
i = l;
|
||||||
while (i < r) {
|
while (i < r) {
|
||||||
line[i] = ch;
|
line[i] = ch;
|
||||||
@@ -2521,8 +2522,8 @@
|
|||||||
while (param--) {
|
while (param--) {
|
||||||
i = this.ybase;
|
i = this.ybase;
|
||||||
while (i < l) {
|
while (i < l) {
|
||||||
this.lines[i].splice(this.x + 1, 0, ch);
|
this.screen[i].splice(this.x + 1, 0, ch);
|
||||||
this.lines[i].pop();
|
this.screen[i].pop();
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2537,8 +2538,8 @@
|
|||||||
while (param--) {
|
while (param--) {
|
||||||
i = this.ybase;
|
i = this.ybase;
|
||||||
while (i < l) {
|
while (i < l) {
|
||||||
this.lines[i].splice(this.x, 1);
|
this.screen[i].splice(this.x, 1);
|
||||||
this.lines[i].push(ch);
|
this.screen[i].push(ch);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
4
butterfly/static/main.min.js
vendored
4
butterfly/static/main.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -397,7 +397,8 @@ class Terminal
|
|||||||
end = Math.min(end, @screen.length - 1)
|
end = Math.min(end, @screen.length - 1)
|
||||||
|
|
||||||
for j in [start..end]
|
for j in [start..end]
|
||||||
line = @screen[row + @ydisp]
|
row = j + @ydisp
|
||||||
|
line = @screen[row]
|
||||||
out = ""
|
out = ""
|
||||||
|
|
||||||
if j is @y and not @cursorHidden and (
|
if j is @y and not @cursorHidden and (
|
||||||
@@ -527,10 +528,10 @@ class Terminal
|
|||||||
# pushing is faster than splicing
|
# pushing is faster than splicing
|
||||||
# when they amount to the same
|
# when they amount to the same
|
||||||
# behavior.
|
# behavior.
|
||||||
@screen.push @blankLine()
|
@screen.push @blank_line()
|
||||||
else
|
else
|
||||||
# add our new line
|
# add our new line
|
||||||
@screen.splice row, 0, @blankLine()
|
@screen.splice row, 0, @blank_line()
|
||||||
|
|
||||||
if @scrollTop isnt 0
|
if @scrollTop isnt 0
|
||||||
if @ybase isnt 0
|
if @ybase isnt 0
|
||||||
@@ -624,7 +625,7 @@ class Terminal
|
|||||||
if ch >= " "
|
if ch >= " "
|
||||||
ch = @charset[ch] if @charset?[ch]
|
ch = @charset[ch] if @charset?[ch]
|
||||||
if @x >= @cols
|
if @x >= @cols
|
||||||
@lines[@y + @ybase][@x] = [@curAttr, '\u23CE']
|
@screen[@y + @ybase][@x] = [@curAttr, '\u23CE']
|
||||||
@x = 0
|
@x = 0
|
||||||
@next_line()
|
@next_line()
|
||||||
|
|
||||||
@@ -1075,7 +1076,7 @@ class Terminal
|
|||||||
@updateRange @y
|
@updateRange @y
|
||||||
@next_line()
|
@next_line()
|
||||||
else
|
else
|
||||||
@lines[@y + @ybase][@x] = [
|
@screen[@y + @ybase][@x] = [
|
||||||
@curAttr
|
@curAttr
|
||||||
html
|
html
|
||||||
]
|
]
|
||||||
@@ -2016,7 +2017,7 @@ class Terminal
|
|||||||
else
|
else
|
||||||
j = @rows - 1 - @scrollBottom
|
j = @rows - 1 - @scrollBottom
|
||||||
j = @rows - 1 + @ybase - j
|
j = @rows - 1 + @ybase - j
|
||||||
@screen.splice j + 1, 0, @blankLine(true)
|
@screen.splice j + 1, 0, @blank_line(true)
|
||||||
@screen.splice @y, 1
|
@screen.splice @y, 1
|
||||||
|
|
||||||
@updateRange @y
|
@updateRange @y
|
||||||
@@ -2301,7 +2302,7 @@ class Terminal
|
|||||||
when 1049, 47, 1047 # alt screen buffer
|
when 1049, 47, 1047 # alt screen buffer
|
||||||
unless @normal
|
unless @normal
|
||||||
normal =
|
normal =
|
||||||
lines: @lines
|
lines: @screen
|
||||||
ybase: @ybase
|
ybase: @ybase
|
||||||
ydisp: @ydisp
|
ydisp: @ydisp
|
||||||
x: @x
|
x: @x
|
||||||
@@ -2434,7 +2435,7 @@ class Terminal
|
|||||||
@cursorHidden = true
|
@cursorHidden = true
|
||||||
when 1049, 47, 1047 # normal screen buffer - clearing it first
|
when 1049, 47, 1047 # normal screen buffer - clearing it first
|
||||||
if @normal
|
if @normal
|
||||||
@lines = @normal.lines
|
@screen = @normal.lines
|
||||||
@ybase = @normal.ybase
|
@ybase = @normal.ybase
|
||||||
@ydisp = @normal.ydisp
|
@ydisp = @normal.ydisp
|
||||||
@x = @normal.x
|
@x = @normal.x
|
||||||
@@ -2536,7 +2537,7 @@ class Terminal
|
|||||||
# CSI Ps b Repeat the preceding graphic character Ps times (REP).
|
# CSI Ps b Repeat the preceding graphic character Ps times (REP).
|
||||||
repeatPrecedingCharacter: (params) ->
|
repeatPrecedingCharacter: (params) ->
|
||||||
param = params[0] or 1
|
param = params[0] or 1
|
||||||
line = @lines[@ybase + @y]
|
line = @screen[@ybase + @y]
|
||||||
ch = line[@x - 1] or [@defAttr, " "]
|
ch = line[@x - 1] or [@defAttr, " "]
|
||||||
line[@x++] = ch while param--
|
line[@x++] = ch while param--
|
||||||
|
|
||||||
@@ -2710,7 +2711,7 @@ class Terminal
|
|||||||
r = params[3]
|
r = params[3]
|
||||||
attr = params[4]
|
attr = params[4]
|
||||||
while t < b + 1
|
while t < b + 1
|
||||||
line = @lines[@ybase + t]
|
line = @screen[@ybase + t]
|
||||||
i = l
|
i = l
|
||||||
while i < r
|
while i < r
|
||||||
line[i] = [attr, line[i][1]]
|
line[i] = [attr, line[i][1]]
|
||||||
@@ -2869,7 +2870,7 @@ class Terminal
|
|||||||
b = params[3]
|
b = params[3]
|
||||||
r = params[4]
|
r = params[4]
|
||||||
while t < b + 1
|
while t < b + 1
|
||||||
line = @lines[@ybase + t]
|
line = @screen[@ybase + t]
|
||||||
i = l
|
i = l
|
||||||
while i < r
|
while i < r
|
||||||
line[i] = [line[i][0], String.fromCharCode(ch)]
|
line[i] = [line[i][0], String.fromCharCode(ch)]
|
||||||
@@ -2907,7 +2908,7 @@ class Terminal
|
|||||||
r = params[3]
|
r = params[3]
|
||||||
ch = [@eraseAttr(), " "]
|
ch = [@eraseAttr(), " "]
|
||||||
while t < b + 1
|
while t < b + 1
|
||||||
line = @lines[@ybase + t]
|
line = @screen[@ybase + t]
|
||||||
i = l
|
i = l
|
||||||
while i < r
|
while i < r
|
||||||
line[i] = ch
|
line[i] = ch
|
||||||
@@ -2991,8 +2992,8 @@ class Terminal
|
|||||||
while param--
|
while param--
|
||||||
i = @ybase
|
i = @ybase
|
||||||
while i < l
|
while i < l
|
||||||
@lines[i].splice @x + 1, 0, ch
|
@screen[i].splice @x + 1, 0, ch
|
||||||
@lines[i].pop()
|
@screen[i].pop()
|
||||||
i++
|
i++
|
||||||
@maxRange()
|
@maxRange()
|
||||||
|
|
||||||
@@ -3007,8 +3008,8 @@ class Terminal
|
|||||||
while param--
|
while param--
|
||||||
i = @ybase
|
i = @ybase
|
||||||
while i < l
|
while i < l
|
||||||
@lines[i].splice @x, 1
|
@screen[i].splice @x, 1
|
||||||
@lines[i].push ch
|
@screen[i].push ch
|
||||||
i++
|
i++
|
||||||
@maxRange()
|
@maxRange()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user