Bug#177735: marked as forwarded (vim: when formatprg is set, "gq" moves cursor to beginning rather than end)

Debian Bug Tracking System owner@bugs.debian.org
Tue, 15 Mar 2005 12:34:09 -0800

Your message dated Tue, 15 Mar 2005 21:25:21 +0100
with message-id <20050315202521.GA9523@fistandantilus.takhisis.org>
has caused the Debian Bug report #177735,
regarding vim: when formatprg is set, "gq" moves cursor to beginning rather than end
to be marked as having been forwarded to the upstream software
author(s) Bram Moolenaar <Bram@moolenaar.net>.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

Received: (at 177735-forwarded) by bugs.debian.org; 15 Mar 2005 20:26:03 +0000
>From zack@bononia.it Tue Mar 15 12:26:01 2005
Return-path: <zack@bononia.it>
Received: from ms001msg.fastwebnet.it [] 
	by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
	id 1DBIc4-0006Ai-00; Tue, 15 Mar 2005 12:26:01 -0800
Received: from fistandantilus.takhisis.org ( by ms001msg.fastwebnet.it (
        id 4235CA0700050B52; Tue, 15 Mar 2005 21:25:29 +0100
Received: by fistandantilus.takhisis.org (Postfix, from userid 3148)
	id 842623F4085; Tue, 15 Mar 2005 21:25:21 +0100 (CET)
Date: Tue, 15 Mar 2005 21:25:21 +0100
From: Stefano Zacchiroli <zack@debian.org>
To: Bram Moolenaar <Bram@moolenaar.net>
Cc: ccshan@post.harvard.edu, 177735-forwarded@bugs.debian.org
Subject: [vim] cursor placement after "gq" wrt "formatprg"
Message-ID: <20050315202521.GA9523@fistandantilus.takhisis.org>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="AhhlLboLdkugWU4S"
Content-Disposition: inline
User-Agent: Mutt/1.5.6+20040907i
Delivered-To: 177735-forwarded@bugs.debian.org
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2005_01_02 
	(1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=-3.0 required=4.0 tests=BAYES_00 autolearn=no 

Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Cursor placemente after gq depends on formatprg. If it is set then the
cursor stays where it was, otherwise it moves (smartly) to the end of
the formatter area.

As reported by a debian user this inconsistency is annoying. I digged a
bit in the code; "gq" when formatprg is set is handled via stuffReadbuff
in normal.c. I don't know how to discover how many lines of text have
been generated by the external program, but once this datum is known
cursor could be set properly since the OP_FORMAT case is handled
separately from others.

If you give me a pointer on how to discover the number of lines I could
provide a patch for this bug.

Full bug report from the user (Cc-ed) follows.

> Package: vim
> Version: 1:6.1-290+1
> Severity: normal
> Hello,
> When the 'formatprg' option is set, the "gq" command in Vim moves the
> cursor to the beginning rather than the end of the reformatted region of
> text.  This inconsistency is gratuitous and should be removed (or would
> backward compatibility with existing macros be an issue?).

Stefano Zacchiroli -*- Computer Science PhD student @ Uny Bologna, Italy
zack@{cs.unibo.it,debian.org,bononia.it} -%- http://www.bononia.it/zack/
If there's any real truth it's that the entire multidimensional infinity
of the Universe is almost certainly being run by a bunch of maniacs. -!-

Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

Version: GnuPG v1.4.0 (GNU/Linux)