Index | Thread | Search

From:
Todd C. Miller <millert@openbsd.org>
Subject:
Re: vi(1) issue with '!)fmt' at the EOF
To:
"Andy Bradford" <amb-sendok-1782193404.phlaahieklahngdijemf@bradfords.org>
Cc:
"Walter Alejandro Iglesias" <wai@roquesor.com>, tech@openbsd.org
Date:
Sat, 25 Apr 2026 13:37:46 -0600

Download raw body.

Thread
On 23 Apr 2026 23:43:24 -0600, "Andy Bradford" wrote:

> Also, it's not just column 0. If you place the cursor on the first space
> (or any space really) on the first line of your example and then run the
> command !)fmt filter you'll get a 3rd behavior.
>
> I'm not  sure if  this is  misbehavior or just  some application  of the
> definition of "sentence" as given in the man page.

I just committed a fix for this from Walter.

 - todd

CVSROOT:        /cvs
Module name:    src
Changes by:     millert@cvs.openbsd.org 2026/04/25 11:58:56

Modified files:
        usr.bin/vi/vi  : v_sentence.c

Log message:
Fix special case of ')' when the cursor is on white-space.

The forward sentence code has a special case to support moving to
the start of the next sentence when it is in the middle of a empty
line or whitespace between sentences.  However, the logic was
incorrect and applied when the curson was on _any_ white-space.
This change adds logic to look back and detect whether the cursor
is actually in between two sentences.

Based on a diff from Walter Alejandro Iglesias.