1
0
mirror of https://github.com/openbsd/src.git synced 2026-06-18 07:13:36 +02:00

Make the behavior of the '(' command match the ')' command.

Previously, the ')' command required a sentence to end with two
blanks, but '(' only required a single space.  Historic vi (and the
documentation) requires two spaces in both directions.

Based on a diff from Walter Alejandro Iglesias.
This commit is contained in:
millert
2026-06-16 22:59:03 +00:00
parent 95aaafce93
commit 9bba069e63
+8 -3
View File
@@ -1,4 +1,4 @@
/* $OpenBSD: v_sentence.c,v 1.12 2026/06/16 02:15:14 millert Exp $ */
/* $OpenBSD: v_sentence.c,v 1.13 2026/06/16 22:59:03 millert Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
@@ -219,7 +219,7 @@ v_sentenceb(SCR *sp, VICMD *vp)
recno_t slno;
size_t len, scno;
u_long cnt;
int last;
int last, next;
/*
* !!!
@@ -263,7 +263,7 @@ v_sentenceb(SCR *sp, VICMD *vp)
break;
}
for (last = 0;;) {
for (last = 0, next = '\0';;) {
if (cs_prev(sp, &cs))
return (1);
if (cs.cs_flags == CS_SOF) /* SOF is a movement sink. */
@@ -346,7 +346,12 @@ ret: slno = cs.cs_lno;
cs.cs_flags == CS_EOL || isblank(cs.cs_ch) ||
cs.cs_ch == ')' || cs.cs_ch == ']' ||
cs.cs_ch == '"' || cs.cs_ch == '\'' ? 1 : 0;
/* A sentence ends with two spaces. */
if (cs.cs_ch == ' ' && next != ' ')
last = 0;
}
next = cs.cs_ch;
}
okret: vp->m_stop.lno = cs.cs_lno;