From a16e0e126b7e968711cf3c8f1bb67ffa3a450fa3 2012-11-12 10:14:30 From: Bussonnier Matthias Date: 2012-11-12 10:14:30 Subject: [PATCH] Merge pull request #2561 from takluyver/notebook-carriage-return Fix display of plain text containing multiple carriage returns before line feed --- diff --git a/IPython/frontend/html/notebook/static/js/utils.js b/IPython/frontend/html/notebook/static/js/utils.js index c19954f..559f4ea 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; }