aboutsummaryrefslogtreecommitdiff
path: root/src/regexp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/regexp.c')
-rw-r--r--src/regexp.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/regexp.c b/src/regexp.c
index 289e64cf2c..9120c8b097 100644
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -3665,11 +3665,14 @@ static long regtry(bt_regprog_T *prog, colnr_T col)
if (REG_MULTI) {
/* Only accept single line matches. */
if (reg_startzpos[i].lnum >= 0
- && reg_endzpos[i].lnum == reg_startzpos[i].lnum)
+ && reg_endzpos[i].lnum == reg_startzpos[i].lnum
+ && reg_endzpos[i].col >= reg_startzpos[i].col) {
re_extmatch_out->matches[i] =
vim_strnsave(reg_getline(reg_startzpos[i].lnum)
- + reg_startzpos[i].col,
- reg_endzpos[i].col - reg_startzpos[i].col);
+ + reg_startzpos[i].col,
+ reg_endzpos[i].col
+ - reg_startzpos[i].col);
+ }
} else {
if (reg_startzp[i] != NULL && reg_endzp[i] != NULL)
re_extmatch_out->matches[i] =