Hi Martijn,

i agree with Todd that in implementing an option invented by GNU,
we should follow GNU semantics unless there are very strong reasons
to diverge.  In this case, GNU -i semantics is maybe not the only
possibility that could be regarded as reasonable, but it certainly
isn't unreasonable:  Execute the script independently for each file
in turn, but let the 'q' command still exit the editor completely,
rather than just moving to the next file.

So, i agree with resetting the hold space when moving from one file
to the next in -i mode.  But i think the variable HS ought to remain
in process.c and not be moved to extern.h and not be manipulated from
main.c.

Instead, there already is a function to reset internal processor
state when moving to the next file with -i: resetranges().
Can you add the two lines to clear the hold space into that
function and resend the diff?

If you want, you can make the name of the function more generic,
for example reset_processor().

Also, in the manual page, while saying that the hold space is reset,
also mention what happens to line numbers and ranges, be even more
explicit that all this applies *only* for -i, and avoid the future
tense, for example like this:

  In
  .Fl i
  mode, line numbers and the hold space are reset between files,
  and no range extends from one file into the next.

Finally, in the description of the 'q' command, we can also be
more explicit:

  Branch to the end of the script and quit
  .Nm
  without starting a new cycle or a new file.

Yours,
  Ingo

Reply via email to