Got questions, comments, patches, etc.?
Contact Jason Woofenden
gitweb
/
watch-my-terminal.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
don't wrap after printing in last cell
[watch-my-terminal.git]
/
terminal.coffee
diff --git
a/terminal.coffee
b/terminal.coffee
index
3c8c9a9
..
19296bf
100644
(file)
--- a/
terminal.coffee
+++ b/
terminal.coffee
@@
-83,18
+83,20
@@
class Terminal
when '\x0d' # cr
@x = 0
when '\x08' # backspace
when '\x0d' # cr
@x = 0
when '\x08' # backspace
- if @x > 0
+ if @x is 0
+ @x = @width - 1
+ if @y > 0
+ @y -= 1
+ else
@x -= 1
@x -= 1
- @text[@y][@x] = ' '
- # should this set the attribute too?
when '\x0a', '\x0b' # lf, vertical tab (same thing)
@wrap_to_next_line()
else
when '\x0a', '\x0b' # lf, vertical tab (same thing)
@wrap_to_next_line()
else
+ if @x >= @width
+ @wrap_to_next_line()
@text[@y][@x] = c
@attributes[@y][@x] = @a
@x += 1
@text[@y][@x] = c
@attributes[@y][@x] = @a
@x += 1
- if @x is @width
- @wrap_to_next_line()
return
set_attribute_bits: (mask, value) ->
return
set_attribute_bits: (mask, value) ->
@@
-132,15
+134,21
@@
class Terminal
@x = column
@y = row
@x = column
@y = row
- # clear lines (implemented inclusive of the current line)
+ # clear to screen edge(es)
csi_J: (direction) ->
switch @fix_esc_arg direction, '0'
when '0' # erase down
csi_J: (direction) ->
switch @fix_esc_arg direction, '0'
when '0' # erase down
+ # rest of current line
+ @csi_K direction
+ # rest of lines
for row in [@y...@height]
for i in [0...@width]
@text[row][i] = ' '
@attributes[row][i] = @a
when '1' # erase up
for row in [@y...@height]
for i in [0...@width]
@text[row][i] = ' '
@attributes[row][i] = @a
when '1' # erase up
+ # beginning of current line
+ @csi_K direction
+ # all previous lines
for row in [0..@y]
for i in [0...@width]
@text[row][i] = ' '
for row in [0..@y]
for i in [0...@width]
@text[row][i] = ' '