lichray / nvi2

A multibyte fork of the nvi editor for BSD
Other
144 stars 34 forks source link

ex: fix printing of line number when the 's' command is used with the 'c' flag and the number option is set. #115

Closed millert closed 1 year ago

millert commented 1 year ago

Currently, given the line:

Five women came to the party.

issuing the command in ex when the number option is enabled (the output is fine if number is not enabled):

:s/men/MEN/c

will display:

Five women came to the party.
               ^^^[ynq]

The confirmation line is indented properly for output when the number option is enabled, but the line above it lacks the expected line number. The output should be, e.g.:

     1  Five women came to the party.
               ^^^[ynq]

The line number is also missing when the line is reprinted after the confirmation prompt. With the changes in this PR, the output becomes:

:set number
:s/men/MEN/c
     1  Five women came to the party.
               ^^^[ynq]n
     1  Five women came to the party.

This matches historic ex behavior and appears to match POSIX, though it is not 100% clear on this specific issue.

lichray commented 1 year ago

It's indeed confusing. Thanks for the change!