From 4260b6a221b4d36c1611171e658243b03d597dc9 Mon Sep 17 00:00:00 2001 From: Jason Woofenden Date: Thu, 31 Jan 2013 00:03:57 -0500 Subject: [PATCH] when clearing, careful of cursor being after right-most column --- terminal.coffee | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/terminal.coffee b/terminal.coffee index 19296bf..913d874 100644 --- a/terminal.coffee +++ b/terminal.coffee @@ -169,7 +169,12 @@ class Terminal @text[@y][i] = ' ' @attributes[@y][i] = @a when '1' # erase to left - for i in [0..@x] + # @x can equal @width (after printing to right-most column) + if @x < @width + max = @x + else + max = @width - 1 + for i in [0..max] @text[@y][i] = ' ' @attributes[@y][i] = @a when '2' # erase whole line -- 1.7.10.4