Skip to content

Commit 18bacc8

Browse files
John Marriottchrisbra
authored andcommitted
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>
1 parent 397700e commit 18bacc8

4 files changed

Lines changed: 15 additions & 25 deletions

File tree

src/getchar.c

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,6 @@ static char_u noremapbuf_init[TYPELEN_INIT]; // initial typebuf.tb_noremap
8888

8989
static size_t last_recorded_len = 0; // number of last recorded chars
9090

91-
static size_t last_get_recorded_len = 0; // length of the string returned from the
92-
// last call to get_recorded()
9391
static size_t last_get_inserted_len = 0; // length of the string returned from the
9492
// last call to get_inserted()
9593

@@ -173,8 +171,9 @@ get_buffcont(
173171
get_recorded(void)
174172
{
175173
char_u *p;
174+
size_t len;
176175

177-
p = get_buffcont(&recordbuff, TRUE, &last_get_recorded_len);
176+
p = get_buffcont(&recordbuff, TRUE, &len);
178177
if (p == NULL)
179178
return NULL;
180179

@@ -184,35 +183,22 @@ get_recorded(void)
184183
* Remove the characters that were added the last time, these must be the
185184
* (possibly mapped) characters that stopped the recording.
186185
*/
187-
if (last_get_recorded_len >= last_recorded_len)
186+
if (len >= last_recorded_len)
188187
{
189-
last_get_recorded_len -= last_recorded_len;
190-
p[last_get_recorded_len] = NUL;
188+
len -= last_recorded_len;
189+
p[len] = NUL;
191190
}
192191

193192
/*
194193
* When stopping recording from Insert mode with CTRL-O q, also remove the
195194
* CTRL-O.
196195
*/
197-
if (last_get_recorded_len > 0 && restart_edit != 0
198-
&& p[last_get_recorded_len - 1] == Ctrl_O)
199-
{
200-
--last_get_recorded_len;
201-
p[last_get_recorded_len] = NUL;
202-
}
196+
if (len > 0 && restart_edit != 0 && p[len - 1] == Ctrl_O)
197+
p[len - 1] = NUL;
203198

204199
return (p);
205200
}
206201

207-
/*
208-
* Return the length of string returned from the last call of get_recorded().
209-
*/
210-
size_t
211-
get_recorded_len(void)
212-
{
213-
return last_get_recorded_len;
214-
}
215-
216202
/*
217203
* Return the contents of the redo buffer as a single string.
218204
* K_SPECIAL and CSI in the returned string are escaped.

src/proto/getchar.pro

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/* getchar.c */
22
char_u *get_recorded(void);
3-
size_t get_recorded_len(void);
43
char_u *get_inserted(void);
54
size_t get_inserted_len(void);
65
int stuff_empty(void);

src/register.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ static yankreg_T *y_current; // ptr to current yankreg
2828
static int y_append; // TRUE when appending
2929
static yankreg_T *y_previous = NULL; // ptr to last written yankreg
3030

31-
static int stuff_yank(int, char_u *, size_t);
31+
static int stuff_yank(int, char_u *);
3232
static void put_reedit_in_typebuf(int silent);
3333
static int put_in_typebuf(char_u *s, int esc, int colon, int silent);
3434
static int yank_copy_line(struct block_def *bd, long y_idx, int exclude_trailing_space);
@@ -419,7 +419,7 @@ do_record(int c)
419419
old_y_previous = y_previous;
420420
old_y_current = y_current;
421421

422-
retval = stuff_yank(regname, p, get_recorded_len());
422+
retval = stuff_yank(regname, p);
423423

424424
y_previous = old_y_previous;
425425
y_current = old_y_current;
@@ -435,8 +435,10 @@ do_record(int c)
435435
* return FAIL for failure, OK otherwise
436436
*/
437437
static int
438-
stuff_yank(int regname, char_u *p, size_t plen)
438+
stuff_yank(int regname, char_u *p)
439439
{
440+
size_t plen;
441+
440442
// check for read-only register
441443
if (regname != 0 && !valid_yank_reg(regname, TRUE))
442444
{
@@ -449,6 +451,7 @@ stuff_yank(int regname, char_u *p, size_t plen)
449451
return OK;
450452
}
451453

454+
plen = STRLEN(p);
452455
get_yank_register(regname, TRUE);
453456
if (y_append && y_current->y_array != NULL)
454457
{

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ static char *(features[]) =
704704

705705
static int included_patches[] =
706706
{ /* Add new patch number below this line */
707+
/**/
708+
1152,
707709
/**/
708710
1151,
709711
/**/

0 commit comments

Comments
 (0)