From cb0003d894e5eb327b2e762716536abafe642ccf Mon Sep 17 00:00:00 2001 From: Ken Gregson Date: Sun, 5 Feb 2012 19:40:29 -0500 Subject: [PATCH] Issue #2105 refined Fix updated as suggested by michaelficarra --- lib/coffee-script/repl.js | 6 ++---- src/repl.coffee | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/coffee-script/repl.js b/lib/coffee-script/repl.js index 2024877e..291dbbca 100644 --- a/lib/coffee-script/repl.js +++ b/lib/coffee-script/repl.js @@ -1,6 +1,6 @@ // Generated by CoffeeScript 1.2.1-pre (function() { - var ACCESSOR, CoffeeScript, Module, REPL_CHOMP, REPL_PROMPT, REPL_PROMPT_CONTINUATION, REPL_PROMPT_MULTILINE, SIMPLEVAR, Script, autocomplete, backlog, completeAttribute, completeVariable, enableColours, error, getCompletions, inspect, multilineMode, pipedInput, readline, repl, run, stdin, stdout; + var ACCESSOR, CoffeeScript, Module, REPL_PROMPT, REPL_PROMPT_CONTINUATION, REPL_PROMPT_MULTILINE, SIMPLEVAR, Script, autocomplete, backlog, completeAttribute, completeVariable, enableColours, error, getCompletions, inspect, multilineMode, pipedInput, readline, repl, run, stdin, stdout; stdin = process.openStdin(); @@ -22,8 +22,6 @@ REPL_PROMPT_CONTINUATION = '......> '; - REPL_CHOMP = /(\n|\r)+$/; - enableColours = false; if (process.platform !== 'win32') { @@ -94,7 +92,7 @@ run = function(buffer) { var code, returnValue, _; - buffer = buffer.replace(REPL_CHOMP, ""); + buffer = buffer.replace(/[\r\n]+$/, ""); if (multilineMode) { backlog += "" + buffer + "\n"; repl.setPrompt(REPL_PROMPT_CONTINUATION); diff --git a/src/repl.coffee b/src/repl.coffee index ddd20ec6..f2ca8b18 100644 --- a/src/repl.coffee +++ b/src/repl.coffee @@ -21,7 +21,6 @@ Module = require 'module' REPL_PROMPT = 'coffee> ' REPL_PROMPT_MULTILINE = '------> ' REPL_PROMPT_CONTINUATION = '......> ' -REPL_CHOMP = /(\n|\r)+$/ enableColours = no unless process.platform is 'win32' enableColours = not process.env.NODE_DISABLE_COLORS @@ -76,7 +75,7 @@ backlog = '' # Attempt to evaluate the command. If there's an exception, print it out instead # of exiting. run = (buffer) -> - buffer = buffer.replace REPL_CHOMP, "" + buffer = buffer.replace /[\r\n]+$/, "" if multilineMode backlog += "#{buffer}\n" repl.setPrompt REPL_PROMPT_CONTINUATION