From 33c63b1cdccbb24e6dbaba0c045ed7e2fbb1ba7b Mon Sep 17 00:00:00 2001 From: Edvin Hultberg Date: Thu, 27 Jul 2017 17:17:18 +0200 Subject: [PATCH] Call backwardsScanInBufferRange for :%s --- lib/ex.coffee | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ex.coffee b/lib/ex.coffee index e026b96..df78b6d 100644 --- a/lib/ex.coffee +++ b/lib/ex.coffee @@ -367,7 +367,10 @@ class Ex editor.transact -> for line in [range[0]..range[1]] - editor.scanInBufferRange( + # Following some simple testing and reading the atom docs + # calling backwardsScanInBufferRange is a better solution. + # https://atom.io/docs/api/v1.18.0/TextEditor#instance-backwardsScanInBufferRange + editor.backwardsScanInBufferRange( patternRE, [[line, 0], [line + 1, 0]], ({match, replace}) ->