fix(excmd): don't allow range or args for :detach/:restart (#34280)

Also remove the CMDWIN and LOCK_OK flags, so that there is no need to
check for text_locked() and curbuf_locked().
This commit is contained in:
zeertzjq
2025-06-03 09:03:43 +08:00
committed by GitHub
parent 049877d379
commit ee84518b94
3 changed files with 25 additions and 28 deletions

View File

@@ -69,8 +69,6 @@
#include "nvim/message.h"
#include "nvim/mouse.h"
#include "nvim/move.h"
#include "nvim/msgpack_rpc/channel.h"
#include "nvim/msgpack_rpc/server.h"
#include "nvim/normal.h"
#include "nvim/normal_defs.h"
#include "nvim/ops.h"
@@ -5600,17 +5598,6 @@ static void ex_restart(exarg_T *eap)
{
bool forceit = eap && eap->forceit;
// Refuse to restart if text is locked (i.e in command line etc.)
if (text_locked()) {
text_locked_msg();
return;
}
// Refuse to restart if buffer is locked.
if (curbuf_locked()) {
return;
}
win_T *wp = curwin;
// If any buffer is changed and not saved, we cannot restart.