Add active line class

This commit is contained in:
Florian Mounier
2015-10-09 12:02:31 +02:00
parent ab8e65924d
commit 9c36b0c8c1
7 changed files with 43 additions and 23 deletions

View File

@@ -27,6 +27,9 @@ body
overflow-x: hidden
overflow-y: scroll
.line.active
background-color: $active-bg
&::-webkit-scrollbar
background: $scroll-bg
width: $scroll-width

View File

@@ -24,12 +24,13 @@ $fg: #f4ead5 !default
/* Background */
$bg: #110f13 !default
$default-bg: $bg !default
$default-bg: transparent !default
$active-bg: transparent !default
$default-fg: $fg !default
$reverse-transparent: $bg !default
/* 16 Colors in this orders :Black, Red, Green, Yellow, Blue, Magenta, Cyan, White, Bright Black, Bright Red, Bright Green, Bright Yellow, Bright Blue, Bright Magenta, Bright Cyan, Bright White */
/* 16 Colors in this orders: Black, Red, Green, Yellow, Blue, Magenta, Cyan, White, Bright Black, Bright Red, Bright Green, Bright Yellow, Bright Blue, Bright Magenta, Bright Cyan, Bright White */
$colors: #2e3436, #cc0000, #4e9a06, #c4a000, #3465a4, #75507b, #06989a, #d3d7cf, #555753, #ef2929, #8ae234, #fce94f, #729fcf, #ad7fa8, #34e2e2, #eeeeec !default
/** Text effects */

File diff suppressed because one or more lines are too long

View File

@@ -31,7 +31,7 @@
/** Colors */
/* Foreground */
/* Background */
/* 16 Colors in this orders :Black, Red, Green, Yellow, Blue, Magenta, Cyan, White, Bright Black, Bright Red, Bright Green, Bright Yellow, Bright Blue, Bright Magenta, Bright Cyan, Bright White */
/* 16 Colors in this orders: Black, Red, Green, Yellow, Blue, Magenta, Cyan, White, Bright Black, Bright Red, Bright Green, Bright Yellow, Bright Blue, Bright Magenta, Bright Cyan, Bright White */
/** Text effects */
/* The shadow is the size of the blur (in px for instance) */
/* The shadow alpha is the opacity of the shadow */
@@ -2771,14 +2771,14 @@ body {
background-color: #eeeeee !important; }
.bg-color-256 {
background-color: #110f13; }
background-color: transparent; }
.bg-color-256.reverse-video {
color: #110f13 !important; }
.fg-color-256 {
color: #110f13; }
color: transparent; }
.fg-color-256.reverse-video {
background-color: #110f13 !important; }
background-color: transparent !important; }
.bg-color-257 {
background-color: #f4ead5; }
@@ -2815,6 +2815,8 @@ body {
overflow-x: hidden;
overflow-y: scroll;
/* Pop ups */ }
body .line.active {
background-color: transparent; }
body::-webkit-scrollbar {
background: #110f13;
width: 0.75em; }

View File

@@ -509,7 +509,7 @@
};
Terminal.prototype.refresh = function(force) {
var attr, ch, classes, cursor, data, fg, group, i, j, k, len, len1, len2, len3, line, lines, m, newOut, o, out, q, ref, ref1, ref2, ref3, ref4, skipnext, styles, u, x;
var active, attr, ch, classes, cursor, data, fg, group, i, j, k, len, len1, len2, len3, len4, line, lines, m, newOut, o, out, q, ref, ref1, ref2, ref3, ref4, ref5, skipnext, styles, u, v, x;
if (force == null) {
force = false;
}
@@ -518,10 +518,15 @@
cursor = ref[k];
cursor.parentNode.replaceChild(this.document.createTextNode(cursor.textContent), cursor);
}
ref1 = this.body.querySelectorAll(".line.active");
for (m = 0, len1 = ref1.length; m < len1; m++) {
active = ref1[m];
active.classList.remove('active');
}
newOut = '';
ref1 = this.screen;
for (j = m = 0, len1 = ref1.length; m < len1; j = ++m) {
line = ref1[j];
ref2 = this.screen;
for (j = o = 0, len2 = ref2.length; o < len2; j = ++o) {
line = ref2[j];
if (!(line.dirty || force)) {
continue;
}
@@ -533,7 +538,7 @@
}
attr = this.cloneAttr(this.defAttr);
skipnext = false;
for (i = o = 0, ref2 = this.cols - 1; 0 <= ref2 ? o <= ref2 : o >= ref2; i = 0 <= ref2 ? ++o : --o) {
for (i = q = 0, ref3 = this.cols - 1; 0 <= ref3 ? q <= ref3 : q >= ref3; i = 0 <= ref3 ? ++q : --q) {
data = line.chars[i];
if (data.html) {
out += data.html;
@@ -651,8 +656,11 @@
}
if (this.children[j]) {
this.children[j].innerHTML = out;
if (x !== -Infinity) {
this.children[j].classList.add('active');
}
} else {
newOut += "<div class=\"line\">" + out + "</div>";
newOut += "<div class=\"line" + (x !== -Infinity && ' active' || '') + "\">" + out + "</div>";
}
this.screen[j].dirty = false;
}
@@ -665,14 +673,14 @@
this.shift = 0;
lines = document.querySelectorAll('.line');
if (lines.length > this.scrollback) {
ref3 = Array.prototype.slice.call(lines, 0, lines.length - this.scrollback);
for (q = 0, len2 = ref3.length; q < len2; q++) {
line = ref3[q];
ref4 = Array.prototype.slice.call(lines, 0, lines.length - this.scrollback);
for (u = 0, len3 = ref4.length; u < len3; u++) {
line = ref4[u];
line.remove();
}
ref4 = document.querySelectorAll('.group:empty');
for (u = 0, len3 = ref4.length; u < len3; u++) {
group = ref4[u];
ref5 = document.querySelectorAll('.group:empty');
for (v = 0, len4 = ref5.length; v < len4; v++) {
group = ref5[v];
group.remove();
}
lines = document.querySelectorAll('.line');

File diff suppressed because one or more lines are too long

View File

@@ -401,6 +401,9 @@ class Terminal
for cursor in @body.querySelectorAll(".cursor")
cursor.parentNode.replaceChild(
@document.createTextNode(cursor.textContent), cursor)
for active in @body.querySelectorAll(".line.active")
active.classList.remove('active')
newOut = ''
for line, j in @screen
@@ -508,8 +511,11 @@ class Terminal
out += '\u23CE' if line.wrap
if @children[j]
@children[j].innerHTML = out
if x isnt -Infinity
@children[j].classList.add 'active'
else
newOut += "<div class=\"line\">#{out}</div>"
newOut += "<div class=\"line#{
x isnt -Infinity and ' active' or ''}\">#{out}</div>"
@screen[j].dirty = false
if newOut isnt ''