patch 9.1.1152: Patch v9.1.1151 causes problems

Problem:  Patch v9.1.1151 causes problems
Solution: partially revert it (John Marriott)

closes: #16736

Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
John Marriott
2025-02-26 19:14:06 +01:00
committed by Christian Brabandt
parent 397700e507
commit 18bacc811c
4 changed files with 15 additions and 25 deletions

View File

@ -88,8 +88,6 @@ static char_u noremapbuf_init[TYPELEN_INIT]; // initial typebuf.tb_noremap
static size_t last_recorded_len = 0; // number of last recorded chars
static size_t last_get_recorded_len = 0; // length of the string returned from the
// last call to get_recorded()
static size_t last_get_inserted_len = 0; // length of the string returned from the
// last call to get_inserted()
@ -173,8 +171,9 @@ get_buffcont(
get_recorded(void)
{
char_u *p;
size_t len;
p = get_buffcont(&recordbuff, TRUE, &last_get_recorded_len);
p = get_buffcont(&recordbuff, TRUE, &len);
if (p == NULL)
return NULL;
@ -184,35 +183,22 @@ get_recorded(void)
* Remove the characters that were added the last time, these must be the
* (possibly mapped) characters that stopped the recording.
*/
if (last_get_recorded_len >= last_recorded_len)
if (len >= last_recorded_len)
{
last_get_recorded_len -= last_recorded_len;
p[last_get_recorded_len] = NUL;
len -= last_recorded_len;
p[len] = NUL;
}
/*
* When stopping recording from Insert mode with CTRL-O q, also remove the
* CTRL-O.
*/
if (last_get_recorded_len > 0 && restart_edit != 0
&& p[last_get_recorded_len - 1] == Ctrl_O)
{
--last_get_recorded_len;
p[last_get_recorded_len] = NUL;
}
if (len > 0 && restart_edit != 0 && p[len - 1] == Ctrl_O)
p[len - 1] = NUL;
return (p);
}
/*
* Return the length of string returned from the last call of get_recorded().
*/
size_t
get_recorded_len(void)
{
return last_get_recorded_len;
}
/*
* Return the contents of the redo buffer as a single string.
* K_SPECIAL and CSI in the returned string are escaped.