In add_buff()
if buf->bh_index != 0
, the string in the buffer is shortened by bh_index
characters. However, when this happens bh_space
was not updated to reflect the change.
In start_stuff()
, bh_space
is set to 0 losing it's original value. This will cause add_buff()
to create a new buffer regardless of whether it is needed or not.
In the situation where bh_index
!= 0 and start_stuff()
has not just been called, the buffer contents will be shortened but bh_space
will be left with an incorrect value.
I changed add_buff()
to update bh_space
in the event that the string in the buffer is shortened by bh_index
characters. This means if start_stuff()
has just been called, add_buff()
will not create a new buffer. To preserve current behaviour I added new (TRUE/FALSE) field bh_create_newblock
to struct buffheader
. When TRUE add_buff()
will always create a new buffer. This field is set to TRUE in start_stuff()
.
This will keep bh_space
value valid in the situation described above where bh_index
!= 0 and start_stuff()
has not just been called.
I hope this makes sense.
https://github.com/vim/vim/pull/16017
(2 files)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
@basilisk0315 pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.
@chrisbra commented on this pull request.
In src/getchar.c:
> @@ -194,7 +197,9 @@ get_recorded(void) char_u * get_inserted(void) { - return get_buffcont(&redobuff, FALSE); + size_t len; + + return get_buffcont(&redobuff, FALSE, &len);⬇️ Suggested change
- return get_buffcont(&redobuff, FALSE, &len); + return get_buffcont(&redobuff, FALSE, NULL);
And then in get_buffcont()
check whether a pointer or NULL has been given
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Thanks. I haven't yet checked the add_buf()
changes. Need a bit more time for that.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
@basilisk0315 pushed 1 commit.
You are receiving this because you are subscribed to this thread.
@basilisk0315 commented on this pull request.
In src/getchar.c:
> @@ -194,7 +197,9 @@ get_recorded(void) char_u * get_inserted(void) { - return get_buffcont(&redobuff, FALSE); + size_t len; + + return get_buffcont(&redobuff, FALSE, &len);
No worries.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Thanks. I think this is fine
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.