From nobody Thu Jul 13 14:36:51 2023 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4R1xyC4N49z4n5tK for ; Thu, 13 Jul 2023 14:36:51 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4R1xyC3Jb4z3Cb4 for ; Thu, 13 Jul 2023 14:36:51 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1689259011; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=srfDtVmaPgpQeU9SZunjZU9n7wXeqnqOtyIIU/DJWwU=; b=oukZyUTJTwnZ+nqUsRyBZxEWwLn0j3vcE0eQqpknFb1uhpQnd9xAzRelmZsGHK70Ty35HT 8Q4bdOQE0HyCci0ka4/xRHLk77kgWvRa+FIsyStw60c7VZs6jQVx5sjDKOIfh/oWCTPqdi vwSrechx/tlqlE6Y4+aNTrHB4VosdXFEQldIxqo5MV0COfqS1CuE6LPRpH2aiIISMpPF6k O7W7Lf6bksyKB4ufdhEub8Yw+VtOQc0jR/zYCvSjZsFJRnXmmC86zfkSlpdCd28rcNB43C xBRUNEJhJJxEB7fBycg7TkvbjJBz0z85csaH1g0l4XpXkdR71i1+GhFni/zT7Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1689259011; a=rsa-sha256; cv=none; b=hWOlUq0wxielHzgi7l1CN0BJ3C1p30NSXN4K1084BNC+f187Fm2QAYvLm9swox0bIkkaH7 X5ibRIa/DY1rglBPcDOA6hs4Cf6JBcg+reTshktjjXnyXoAbjDmhEtYaCkezVfWwp2DQAa 3YhDp3ow6TxVWFejgj4kASL1IrYBUuTAuObU+x67skWSIcX/yZ821gHvysZU5unNKCZEkt 8QCKoHjnnPk/Wsv2rSgN9o5LFGn0cLtZAGaMjD3o9/rpZjaby/rAVrfxvlAZ1Yth8FPLEs GbFCXYNBJkRpH5l4Bbz1zncn/48CqrDTFRXO4B8E9VAupm+gU6lbCJqbDw2jGQ== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4R1xyC2N9GzvpW for ; Thu, 13 Jul 2023 14:36:51 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 36DEapKP064494 for ; Thu, 13 Jul 2023 14:36:51 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 36DEapUt064493 for bugs@FreeBSD.org; Thu, 13 Jul 2023 14:36:51 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 272487] vi/nvi: :t wrongly adjusts current-line in the context of a :g command Date: Thu, 13 Jul 2023 14:36:51 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: Unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: freebsd@tim.thechases.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D272487 Bug ID: 272487 Summary: vi/nvi: :t wrongly adjusts current-line in the context of a :g command Product: Base System Version: Unspecified Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: freebsd@tim.thechases.com With the following file: $ cat < test.txt blank line above pattern line one pattern line two EOF The aim was to copy that first blank line before each of the /pattern/ lines. This works fine in ed(1): $ ed test.txt 52 g/^pattern/1t- ,p blank line above pattern line one pattern line two However, when I use either of these commands in vi: :g/^pattern/1t- :g/^pattern/1t.- it errors with Usage: [line [,line]] t line [flags]. Additionally, if I explicitly spell out the relative line count with either :g/^pattern/1t-1 :g/^pattern/1t.-1 it errors with Reference to a line number less than 0 It seems to set the current-line aspect with the absolute line-number of "1" before processing the relative "-" or ".-" (which should be relative to the :g/ match) If I am on one of the /pattern/ lines and issue the same command: 3G :1t- it works as expected, copying the first/blank line before the current line. And strangely, if I do something with the line beforehand (printing it, showing the line-number with `=3D`, etc), it works too: :g/^pattern/.=3D|1t- Similarly, if I put the blank line at the bottom of the file: :1m$ :g/^pattern/$t- it also works as expected. And, FWIW, the original/problematic command works fine in vim. Seems to be an `nvi(1)` thing, presenting in both FreeBSD & OpenBSD --=20 You are receiving this mail because: You are the assignee for the bug.=