From 015e8e73f430b09bf17d240a73466713a76cd124 Mon Sep 17 00:00:00 2001 From: Thomas Kluyver Date: Thu, 8 Nov 2012 23:33:15 +0000 Subject: [PATCH] Fix display of plain text containing multiple carriage returns before line feed. Closes gh-2560 --- IPython/frontend/html/notebook/static/js/utils.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/IPython/frontend/html/notebook/static/js/utils.js b/IPython/frontend/html/notebook/static/js/utils.js index c19954fe2..559f4ea2e 100644 --- a/IPython/frontend/html/notebook/static/js/utils.js +++ b/IPython/frontend/html/notebook/static/js/utils.js @@ -195,7 +195,8 @@ IPython.utils = (function (IPython) { tmp = txt; do { txt = tmp; - tmp = txt.replace(/^.*\r(?!\n)/gm, ''); + tmp = txt.replace(/\r+\n/gm, '\n'); // \r followed by \n --> newline + tmp = tmp.replace(/^.*\r+/gm, ''); // Other \r --> clear line } while (tmp.length < txt.length); return txt; }