Problem: Substitute may overrun destination buffer.
Solution: Disallow switching buffers in a substitute expression.
#endif
)
{
- // Can't edit another file when "curbuf_lock" is set. Only ":edit"
- // can bring us here, others are stopped earlier.
- if (*eap->arg != NUL && curbuf_locked())
+ // Can't edit another file when "textlock" or "curbuf_lock" is set.
+ // Only ":edit" or ":script" can bring us here, others are stopped
+ // earlier.
+ if (*eap->arg != NUL && text_or_buf_locked())
return;
n = readonlymode;
call delete('Xresult')
endfunc
+" This was editing a script file from the expression
+func Test_sub_edit_scriptfile()
+ new
+ norm o0000000000000000000000000000000000000000000000000000
+ func EditScript()
+ silent! scr! Xfile
+ endfunc
+ s/\%')/\=EditScript()
+
+ delfunc EditScript
+ bwipe!
+endfunc
+
" Test for the 2-letter and 3-letter :substitute commands
func Test_substitute_short_cmd()
new
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 5126,
/**/
5125,
/**/