Bug 215349 - [PATCH] Restore default tab file completion behavior for nvi
Summary: [PATCH] Restore default tab file completion behavior for nvi
Status: Closed Overcome By Events
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-16 22:14 UTC by Craig Leres
Modified: 2024-09-28 17:35 UTC (History)
1 user (show)

See Also:


Attachments
patch (1.04 KB, patch)
2016-12-16 22:14 UTC, Craig Leres
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Craig Leres freebsd_committer freebsd_triage 2016-12-16 22:14:46 UTC
Created attachment 178017 [details]
patch

Prior to FreeBSD 10 and nvi version 2.0.3 the filec option was undefined by default. For example you could change blanks to tabs from vi mode with:

    :%s/ /^I/g

This is the behavior for vi in System V, all versions of BSD vi, nvi up to and including 1.79 and the vi/nvi that shipped with all versions of FreeBSD prior to 10.

Head r254225 upgraded nvi from 1.79 to 2.1.1-4334a8297f which added:

    filec=\t

to opts_init() changing the default. This means to use a tab in a substitution while in vi mode you must escape it with ^V. In most cases typing a bare ^I results in the terminal bell sound.

Note that tab works the old way when editing in ex mode. This means doing substitutions is currently different between vi mode and ex mode.

The upstream repo for nvi is here:

    https://github.com/lichray/nvi2

r322 is the version that added the filec default to opts_init().

Here is the github issue about this problem:

    https://github.com/lichray/nvi2/issues/15

I believe the plan is to either remove this default or apply it contextually.

The attached patch against head/308461 restores the old filec default of undefined.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2024-09-28 00:11:56 UTC
^Triage: clear the now obsolete 'patch' keyword.

To submitter: is this aging PR still relevant?
Comment 2 Craig Leres freebsd_committer freebsd_triage 2024-09-28 17:35:40 UTC
(In reply to Mark Linimon from comment #1)
Indeed, the issue was solved upstream in 2020 via:

    https://github.com/lichray/nvi2/commit/0ef1c824648bcfe9f831a9607cb465b18e313d1d
    Don't expandtab when we're in command mode.

I'm not sure when FreeBSD picked up this fix but vi the 14.1 base has the desired pre-FreeBSD-10 behavior.

(I have always found it surprising that the bugzilla dashboard does not show me open PRs for which I am the reporter...)