Monday, March 6, 2017

substitute issue when removing text

I've seen an issue lately on my Android phone which uses Termux to run Vim (ver 8.0, included patches 1-340). When I perform this command '%s/^.*:0\n//' on the lines below, I don't get what I expect. See the two following cases below. I was wondering if this is one of two things. Whether this is an issue in ver 8.0 in one of the new patches or a compiling issue through Termux. Would it be possible for one to try this command on ver 8.0 with the patches installed using vim and gvim on the Unix side. I don't see this issue in Vim 8.0 on Windows with patches 1-2, nor in Vim 7.4 on Windows, nor in Vim 7.4 on Unix.

Case 1: Given buffer below has 11 lines below (last line is empty). The $ symbol below is not actual text but an EOL designator. Keep in mind that the line that contains f_07.txt has a 2 number at the end instead of a 0 so it should remain when this command is executed: '%s/^.*:0\n//g'. The actual result is all lines are deleted, expected result is the f_07.txt:2 line should not have been deleted.

Given buffer:
f_01.txt:0$
f_02.txt:0$
f_03.txt:0$
f_04.txt:0$
f_05.txt:0$
f_06.txt:0$
f_07.txt:2$
f_08.txt:0$
f_09.txt:0$
f_10.txt:0$
$

Buffer after command is executed (all lines are deleted which is wrong, line with f_07.txt:2 should remain):
$

Case 2: Given buffer below has 10 lines below. The $ symbol below is not actual text but an EOL designator. Keep in mind that the line that contains f_07.txt has a 2 number at the end instead of a 0 so it should remain when this command is executed: '%s/^.*:0\n//g'. The actual result is all lines are deleted except the last one and there's two of those lines (why two?).

Given buffer:
f_01.txt:0$
f_02.txt:0$
f_03.txt:0$
f_04.txt:0$
f_05.txt:0$
f_06.txt:0$
f_07.txt:2$
f_08.txt:0$
f_09.txt:0$
f_10.txt:0$

Buffer after command is executed (all lines are deleted which is wrong, line with f_07.txt:2 should remain and f_10.txt:0 should remain but why is there two of them?):
f_10.txt:0$
f_10.txt:0$

Bryce

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: