From 68703136cb26b66045a680097f05387db23c7aa2 Mon Sep 17 00:00:00 2001 From: Marcin Kulik Date: Thu, 19 Jan 2012 00:01:37 +0100 Subject: [PATCH] Cleanup after js2coffee --- app/assets/javascripts/ansi-interpreter.js.coffee | 13 +++---------- app/assets/javascripts/namespace.js | 1 - 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/app/assets/javascripts/ansi-interpreter.js.coffee b/app/assets/javascripts/ansi-interpreter.js.coffee index 602b865..9f0beec 100644 --- a/app/assets/javascripts/ansi-interpreter.js.coffee +++ b/app/assets/javascripts/ansi-interpreter.js.coffee @@ -23,7 +23,7 @@ class AsciiIo.AnsiInterpreter @params = [] re = /(\d+)/g m = undefined - @params.push parseInt(m[1]) while m = re.exec(match[0]) + @params.push parseInt(m[1]) while m = re.exec(match[0]) @n = @params[0] @m = @params[1] @handleCSI match[1] @@ -37,10 +37,8 @@ class AsciiIo.AnsiInterpreter modes = match[1].split(";") action = match[2] mode = undefined - i = 0 - while i < modes.length - mode = modes[i] + for mode in modes if mode is "1049" if action is "h" # Save cursor position, switch to alternate screen buffer, and clear screen. @@ -77,7 +75,6 @@ class AsciiIo.AnsiInterpreter # steady cursor else throw "unknown mode: " + mode + action - i++ "\x1b\x3d": (data) -> # DECKPAM - Set keypad to applications mode (ESCape instead of digits) @@ -129,11 +126,7 @@ class AsciiIo.AnsiInterpreter throw "no handler for CSI term: " + term compilePatterns: -> - @COMPILED_PATTERNS = [] - regexp = undefined - for re of @PATTERNS - regexp = new RegExp("^" + re) - @COMPILED_PATTERNS.push [ regexp, @PATTERNS[re] ] + @COMPILED_PATTERNS = ([new RegExp("^" + re), f] for re, f of @PATTERNS) feed: (data) -> while data.length > 0 diff --git a/app/assets/javascripts/namespace.js b/app/assets/javascripts/namespace.js index 6352222..8c69ffb 100644 --- a/app/assets/javascripts/namespace.js +++ b/app/assets/javascripts/namespace.js @@ -1,2 +1 @@ window.AsciiIo = {}; -window.SP = {};