From 43e3ce723beacc6286cb4bac8492c1e78035f9f4 Mon Sep 17 00:00:00 2001 From: Josh Baker Date: Thu, 13 Mar 2014 11:42:39 -0400 Subject: [PATCH] Only trim whitespace between non-whitespace and newline (Issue #158) This prevents trimming lines that only have whitespace. --- js/aceBindings.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/aceBindings.js b/js/aceBindings.js index 62ba922..231cb5c 100644 --- a/js/aceBindings.js +++ b/js/aceBindings.js @@ -133,7 +133,7 @@ define([ var range = selection.getLineRange(i); range.end.row = range.start.row; range.end.column = line.length; - line = line.replace(/\s+$/, ""); + line = line.replace(/(\S)\s+$/, "$1"); doc.replace(range, line); }); if (c) c(); @@ -166,4 +166,4 @@ define([ if (c) c(); }); -}); \ No newline at end of file +});