Got questions, comments, patches, etc.?
Contact Jason Woofenden
gitweb
/
watch-my-terminal.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a8e7951
)
don't show spaces at end of lines (better copy/paste)
author
Jason Woofenden
<jason@jasonwoof.com>
Fri, 3 Apr 2015 15:21:38 +0000
(11:21 -0400)
committer
Jason Woofenden
<jason@jasonwoof.com>
Fri, 3 Apr 2015 15:21:38 +0000
(11:21 -0400)
htmlterm.coffee
patch
|
blob
|
history
diff --git
a/htmlterm.coffee
b/htmlterm.coffee
index
fd4ad55
..
1cfef45
100644
(file)
--- a/
htmlterm.coffee
+++ b/
htmlterm.coffee
@@
-97,7
+97,7
@@
class HTMLTerminal
cursor_x = @term.width - 1
else
cursor_x = @term.x
cursor_x = @term.width - 1
else
cursor_x = @term.x
- # invert the cursor TODO: make it blink
+ # invert the cursor
if @term.cursor_visible
@term.attributes[@term.y][cursor_x] ^= 0x080000
for i in [0...@term.text.length]
if @term.cursor_visible
@term.attributes[@term.y][cursor_x] ^= 0x080000
for i in [0...@term.text.length]
@@
-112,7
+112,21
@@
class HTMLTerminal
a = @term.attributes[i][j]
txt += @term.text[i][j]
if txt.length
a = @term.attributes[i][j]
txt += @term.text[i][j]
if txt.length
- div.append(@stylize(txt, a))
+ if a is 0x000007
+ # don't output spaces at the end, for better copy/paste
+ ns = txt.length - 1
+ while ns >= 0 and txt.charAt(ns) is ' '
+ ns -= 1
+ if ns >= 0
+ if ns < txt.length - 1
+ txt = txt.substr 0, ns + 1
+ div.append(@stylize(txt, a))
+ else
+ # if entire line is spaces
+ if txt.length is @term.width
+ div.append('<br>')
+ else
+ div.append(@stylize(txt, a))
@parent_element.append(div)
if @term.cursor_visible
@term.attributes[@term.y][cursor_x] ^= 0x080000
@parent_element.append(div)
if @term.cursor_visible
@term.attributes[@term.y][cursor_x] ^= 0x080000