vi: fix read outside of text buffer during insert

Signed-off-by: S Harris <S.E.Harris@kent.ac.uk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
S Harris 2021-06-21 11:04:49 +01:00 committed by Denys Vlasenko
parent e03b49477a
commit 5c89e5a04e

View File

@ -2144,7 +2144,7 @@ static char *char_insert(char *p, char c, int undo) // insert the char c at 'p'
cmdcnt = 0;
end_cmd_q(); // stop adding to q
last_status_cksum = 0; // force status update
if ((p[-1] != '\n') && (dot > text)) {
if ((dot > text) && (p[-1] != '\n')) {
p--;
}
#if ENABLE_FEATURE_VI_SETOPTS