diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2020-08-30 12:16:05 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2020-08-30 12:16:05 +0000 |
commit | 199352491cbfe114f408de003779f5a0b9e9c254 (patch) | |
tree | 19017ef4abc2c80eb35c0c554ca61ab7ea27b9b1 /regress | |
parent | 63e944ed7a231e033c1e4649418fb2e6346c6501 (diff) |
Fix :S with anchors and replacement
gnezdo noticed that :S/old_string/new_string/ variable modifiers such
as :S/^sth/&/ and :S/sth$/&/ with an anchor in the old_string and an &
in the new_string don't work as documented (and expected) since they
replace & with old_string including the anchors.
This is because get_spatternarg() deals with skipping the anchors in
pattern->lhs only after having replaced any '&' in the buffer that will
eventually become new_string with pattern->lhs. Fix this by moving the
logic of skipping the anchors from get_spatternarg() into
common_get_patternarg() so it is done before & is handled.
ok millert
Diffstat (limited to 'regress')
0 files changed, 0 insertions, 0 deletions