{
if (text_locked())
{
- clearopbeep(oap);
+ if (oap != NULL)
+ clearopbeep(oap);
text_locked_msg();
return TRUE;
}
return FALSE;
}
+/*
+ * If text is locked, "curbuf_lock" or "allbuf_lock" is set:
+ * Give an error message, possibly beep and return TRUE.
+ * "oap" may be NULL.
+ */
+ int
+check_text_or_curbuf_locked(oparg_T *oap)
+{
+ if (check_text_locked(oap))
+ return TRUE;
+ if (curbuf_locked())
+ {
+ if (oap != NULL)
+ clearop(oap);
+ return TRUE;
+ }
+ return FALSE;
+}
+
/*
* Handle the count before a normal command and set cap->count0.
*/
goto normal_end;
}
- if ((nv_cmds[idx].cmd_flags & NV_NCW)
- && (check_text_locked(oap) || curbuf_locked()))
+ if ((nv_cmds[idx].cmd_flags & NV_NCW) && check_text_or_curbuf_locked(oap))
// this command is not allowed now
goto normal_end;
char_u *ptr;
linenr_T lnum = -1;
- if (check_text_locked(cap->oap))
- return;
- if (curbuf_locked())
- {
- clearop(cap->oap);
+ if (check_text_or_curbuf_locked(cap->oap))
return;
- }
+
#ifdef FEAT_PROP_POPUP
if (ERROR_IF_TERM_POPUP_WINDOW)
return;
/* normal.c */
+int check_text_or_curbuf_locked(oparg_T *oap);
void normal_cmd(oparg_T *oap, int toplevel);
void check_visual_highlight(void);
void end_visual_mode(void);
bwipe!
endfunc
+" This was editing another file from the expression.
+func Test_sub_expr_goto_other_file()
+ call writefile([''], 'Xfileone', 'D')
+ enew!
+ call setline(1, ['a', 'b', 'c', 'd',
+ \ 'Xfileone zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'])
+
+ func g:SplitGotoFile()
+ exe "sil! norm 0\<C-W>gf"
+ return ''
+ endfunc
+
+ $
+ s/\%')/\=g:SplitGotoFile()
+
+ delfunc g:SplitGotoFile
+ 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 */
+/**/
+ 947,
/**/
946,
/**/
case Ctrl_F:
wingotofile:
CHECK_CMDWIN;
+ if (check_text_or_curbuf_locked(NULL))
+ break;
ptr = grab_file_name(Prenum1, &lnum);
if (ptr != NULL)
* When "new_wp" is NULL: split the current window in two.
* When "new_wp" is not NULL: insert this window at the far
* top/left/right/bottom.
- * return FAIL for failure, OK otherwise
+ * Return FAIL for failure, OK otherwise.
*/
int
win_split_ins(