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
|
||||
white-space: nowrap
|
||||
|
||||
[data-native-scroll="yes"]
|
||||
body[data-native-scroll="yes"]
|
||||
#wrapper
|
||||
overflow-y: auto
|
||||
|
||||
.terminal
|
||||
|
||||
@@ -86,8 +86,9 @@ html, body {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
white-space: nowrap; }
|
||||
#wrapper [data-native-scroll="yes"] {
|
||||
overflow-y: auto; }
|
||||
|
||||
body[data-native-scroll="yes"] #wrapper {
|
||||
overflow-y: auto; }
|
||||
|
||||
.terminal {
|
||||
outline: none; }
|
||||
|
||||
@@ -454,7 +454,7 @@
|
||||
};
|
||||
|
||||
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) {
|
||||
parent = this.element.parentNode;
|
||||
if (parent != null) {
|
||||
@@ -471,7 +471,8 @@
|
||||
}
|
||||
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) {
|
||||
line = this.screen[row + this.ydisp];
|
||||
row = j + this.ydisp;
|
||||
line = this.screen[row];
|
||||
out = "";
|
||||
if (j === this.y && !this.cursorHidden && (this.native_scroll || this.ydisp === this.ybase || this.selectMode)) {
|
||||
x = this.x;
|
||||
@@ -630,9 +631,9 @@
|
||||
row = this.ybase + this.rows - 1;
|
||||
row -= this.rows - 1 - this.scrollBottom;
|
||||
if (row === this.screen.length) {
|
||||
this.screen.push(this.blankLine());
|
||||
this.screen.push(this.blank_line());
|
||||
} else {
|
||||
this.screen.splice(row, 0, this.blankLine());
|
||||
this.screen.splice(row, 0, this.blank_line());
|
||||
}
|
||||
if (this.scrollTop !== 0) {
|
||||
if (this.ybase !== 0) {
|
||||
@@ -736,7 +737,7 @@
|
||||
ch = this.charset[ch];
|
||||
}
|
||||
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.next_line();
|
||||
}
|
||||
@@ -1121,7 +1122,7 @@
|
||||
this.updateRange(this.y);
|
||||
this.next_line();
|
||||
} 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;
|
||||
while (line < this.get_html_height_in_lines(html) - 1) {
|
||||
this.y++;
|
||||
@@ -2021,7 +2022,7 @@
|
||||
} else {
|
||||
j = this.rows - 1 - this.scrollBottom;
|
||||
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);
|
||||
}
|
||||
@@ -2206,7 +2207,7 @@
|
||||
case 1047:
|
||||
if (!this.normal) {
|
||||
normal = {
|
||||
lines: this.lines,
|
||||
lines: this.screen,
|
||||
ybase: this.ybase,
|
||||
ydisp: this.ydisp,
|
||||
x: this.x,
|
||||
@@ -2272,7 +2273,7 @@
|
||||
case 47:
|
||||
case 1047:
|
||||
if (this.normal) {
|
||||
this.lines = this.normal.lines;
|
||||
this.screen = this.normal.lines;
|
||||
this.ybase = this.normal.ybase;
|
||||
this.ydisp = this.normal.ydisp;
|
||||
this.x = this.normal.x;
|
||||
@@ -2363,7 +2364,7 @@
|
||||
Terminal.prototype.repeatPrecedingCharacter = function(params) {
|
||||
var ch, line, param, results;
|
||||
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, " "];
|
||||
results = [];
|
||||
while (param--) {
|
||||
@@ -2430,7 +2431,7 @@
|
||||
r = params[3];
|
||||
attr = params[4];
|
||||
while (t < b + 1) {
|
||||
line = this.lines[this.ybase + t];
|
||||
line = this.screen[this.ybase + t];
|
||||
i = l;
|
||||
while (i < r) {
|
||||
line[i] = [attr, line[i][1]];
|
||||
@@ -2470,7 +2471,7 @@
|
||||
b = params[3];
|
||||
r = params[4];
|
||||
while (t < b + 1) {
|
||||
line = this.lines[this.ybase + t];
|
||||
line = this.screen[this.ybase + t];
|
||||
i = l;
|
||||
while (i < r) {
|
||||
line[i] = [line[i][0], String.fromCharCode(ch)];
|
||||
@@ -2495,7 +2496,7 @@
|
||||
r = params[3];
|
||||
ch = [this.eraseAttr(), " "];
|
||||
while (t < b + 1) {
|
||||
line = this.lines[this.ybase + t];
|
||||
line = this.screen[this.ybase + t];
|
||||
i = l;
|
||||
while (i < r) {
|
||||
line[i] = ch;
|
||||
@@ -2521,8 +2522,8 @@
|
||||
while (param--) {
|
||||
i = this.ybase;
|
||||
while (i < l) {
|
||||
this.lines[i].splice(this.x + 1, 0, ch);
|
||||
this.lines[i].pop();
|
||||
this.screen[i].splice(this.x + 1, 0, ch);
|
||||
this.screen[i].pop();
|
||||
i++;
|
||||
}
|
||||
}
|
||||
@@ -2537,8 +2538,8 @@
|
||||
while (param--) {
|
||||
i = this.ybase;
|
||||
while (i < l) {
|
||||
this.lines[i].splice(this.x, 1);
|
||||
this.lines[i].push(ch);
|
||||
this.screen[i].splice(this.x, 1);
|
||||
this.screen[i].push(ch);
|
||||
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)
|
||||
|
||||
for j in [start..end]
|
||||
line = @screen[row + @ydisp]
|
||||
row = j + @ydisp
|
||||
line = @screen[row]
|
||||
out = ""
|
||||
|
||||
if j is @y and not @cursorHidden and (
|
||||
@@ -527,10 +528,10 @@ class Terminal
|
||||
# pushing is faster than splicing
|
||||
# when they amount to the same
|
||||
# behavior.
|
||||
@screen.push @blankLine()
|
||||
@screen.push @blank_line()
|
||||
else
|
||||
# add our new line
|
||||
@screen.splice row, 0, @blankLine()
|
||||
@screen.splice row, 0, @blank_line()
|
||||
|
||||
if @scrollTop isnt 0
|
||||
if @ybase isnt 0
|
||||
@@ -624,7 +625,7 @@ class Terminal
|
||||
if ch >= " "
|
||||
ch = @charset[ch] if @charset?[ch]
|
||||
if @x >= @cols
|
||||
@lines[@y + @ybase][@x] = [@curAttr, '\u23CE']
|
||||
@screen[@y + @ybase][@x] = [@curAttr, '\u23CE']
|
||||
@x = 0
|
||||
@next_line()
|
||||
|
||||
@@ -1075,7 +1076,7 @@ class Terminal
|
||||
@updateRange @y
|
||||
@next_line()
|
||||
else
|
||||
@lines[@y + @ybase][@x] = [
|
||||
@screen[@y + @ybase][@x] = [
|
||||
@curAttr
|
||||
html
|
||||
]
|
||||
@@ -2016,7 +2017,7 @@ class Terminal
|
||||
else
|
||||
j = @rows - 1 - @scrollBottom
|
||||
j = @rows - 1 + @ybase - j
|
||||
@screen.splice j + 1, 0, @blankLine(true)
|
||||
@screen.splice j + 1, 0, @blank_line(true)
|
||||
@screen.splice @y, 1
|
||||
|
||||
@updateRange @y
|
||||
@@ -2301,7 +2302,7 @@ class Terminal
|
||||
when 1049, 47, 1047 # alt screen buffer
|
||||
unless @normal
|
||||
normal =
|
||||
lines: @lines
|
||||
lines: @screen
|
||||
ybase: @ybase
|
||||
ydisp: @ydisp
|
||||
x: @x
|
||||
@@ -2434,7 +2435,7 @@ class Terminal
|
||||
@cursorHidden = true
|
||||
when 1049, 47, 1047 # normal screen buffer - clearing it first
|
||||
if @normal
|
||||
@lines = @normal.lines
|
||||
@screen = @normal.lines
|
||||
@ybase = @normal.ybase
|
||||
@ydisp = @normal.ydisp
|
||||
@x = @normal.x
|
||||
@@ -2536,7 +2537,7 @@ class Terminal
|
||||
# CSI Ps b Repeat the preceding graphic character Ps times (REP).
|
||||
repeatPrecedingCharacter: (params) ->
|
||||
param = params[0] or 1
|
||||
line = @lines[@ybase + @y]
|
||||
line = @screen[@ybase + @y]
|
||||
ch = line[@x - 1] or [@defAttr, " "]
|
||||
line[@x++] = ch while param--
|
||||
|
||||
@@ -2710,7 +2711,7 @@ class Terminal
|
||||
r = params[3]
|
||||
attr = params[4]
|
||||
while t < b + 1
|
||||
line = @lines[@ybase + t]
|
||||
line = @screen[@ybase + t]
|
||||
i = l
|
||||
while i < r
|
||||
line[i] = [attr, line[i][1]]
|
||||
@@ -2869,7 +2870,7 @@ class Terminal
|
||||
b = params[3]
|
||||
r = params[4]
|
||||
while t < b + 1
|
||||
line = @lines[@ybase + t]
|
||||
line = @screen[@ybase + t]
|
||||
i = l
|
||||
while i < r
|
||||
line[i] = [line[i][0], String.fromCharCode(ch)]
|
||||
@@ -2907,7 +2908,7 @@ class Terminal
|
||||
r = params[3]
|
||||
ch = [@eraseAttr(), " "]
|
||||
while t < b + 1
|
||||
line = @lines[@ybase + t]
|
||||
line = @screen[@ybase + t]
|
||||
i = l
|
||||
while i < r
|
||||
line[i] = ch
|
||||
@@ -2991,8 +2992,8 @@ class Terminal
|
||||
while param--
|
||||
i = @ybase
|
||||
while i < l
|
||||
@lines[i].splice @x + 1, 0, ch
|
||||
@lines[i].pop()
|
||||
@screen[i].splice @x + 1, 0, ch
|
||||
@screen[i].pop()
|
||||
i++
|
||||
@maxRange()
|
||||
|
||||
@@ -3007,8 +3008,8 @@ class Terminal
|
||||
while param--
|
||||
i = @ybase
|
||||
while i < l
|
||||
@lines[i].splice @x, 1
|
||||
@lines[i].push ch
|
||||
@screen[i].splice @x, 1
|
||||
@screen[i].push ch
|
||||
i++
|
||||
@maxRange()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user