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:
55d03d7
)
init: don't send spaces at end of lines
author
Jason Woofenden
<jason@jasonwoof.com>
Fri, 1 Feb 2013 04:54:25 +0000
(23:54 -0500)
committer
Jason Woofenden
<jason@jasonwoof.com>
Fri, 1 Feb 2013 04:54:25 +0000
(23:54 -0500)
server.coffee
patch
|
blob
|
history
diff --git
a/server.coffee
b/server.coffee
index
bf3a750
..
5beaa97
100644
(file)
--- a/
server.coffee
+++ b/
server.coffee
@@
-77,11
+77,15
@@
io.sockets.on 'connection', (socket) ->
encode_screen = (height, width, text, attributes) ->
state = ''
for y in [0...height]
encode_screen = (height, width, text, attributes) ->
state = ''
for y in [0...height]
- for x in [0...width]
- if attributes[y][x] isnt a
- state += attr_diff a, attributes[y][x]
- a = attributes[y][x]
- state += text[y][x]
+ max = width - 1
+ while max >= 0 and text[y][max] is ' ' and (attributes[y][max] & 0x08ff00) is 0
+ max -= 1
+ if max >= 0
+ for x in [0..max]
+ if attributes[y][x] isnt a
+ state += attr_diff a, attributes[y][x]
+ a = attributes[y][x]
+ state += text[y][x]
if y < height - 1
state += '\n'
return state
if y < height - 1
state += '\n'
return state