From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: from zero.zsh.org (zero.zsh.org [IPv6:2a02:898:31:0:48:4558:7a:7368]) by inbox.vuxu.org (Postfix) with ESMTP id 3D0A620E61 for ; Tue, 9 Apr 2024 09:28:43 +0200 (CEST) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1712647723; b=DjPXQN+yALGsgHaUMXhTiK2mJu5pYoTcUThyihUPQNgB+bBhGjWPcriR61oGVAY29UN9jNiPDm JZ08eW+6IoemMDTOAJlDc8Uc/ockiBZHcy6aVwFZ88DkF5pbteVIAcGLL45ZXc9kJ/cAW0I/ZQ 2sCtINj1lMQfpQYounafJHxwX9xEn5SDjizC6IGcWdUOHKOFSBMiK6Pxqul5v6LLpP61dMqMpB BRYf3LlogTkJePeFBy21JFqwMB/6Z5ZqBt/rQwm8R6m2d26xhUudpYtjrqwC25zCUGNe4mbWl7 IZPfGTbQ3XcwZg08/qtZQ79wGSysvMRGjmmrGVH9LCVjxw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-io1-f51.google.com) smtp.remote-ip=209.85.166.51; dkim=pass header.d=gmail.com header.s=20230601 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1712647723; bh=IudrAIWVYB8WdNeZdsYsMhdYc+OMxafyfxnGIvlQVMI=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:To:Subject:Message-ID:Date:From:MIME-Version: DKIM-Signature:DKIM-Signature; b=KM+1F7LVSNUmTN/xaxCOBuVC5JpIh0kllR9M5ZkTlzsXcQ7UUQHaz6/8K++zj85j6TI1Ly+4kU wLv+uo3cyxpLh5CyAiX9aY+kFV1N2lrfuzLM2im3+UrspDZen+Rv9pik6X/c4eyNUyKoBVtmwv egZuoRLaAc46BNE1YBq7DqgaydsSKpaZQ4pO6MzT6xW3LC/BjNmE4zAW3AYC/moGpFQANDJyVi Yh2hV6Kchqr0D8NI1HWIS9WsWprSaDnMnzbQxLwb8KlBFO01tbDC8VMleDQFNkSUyMz0o1tbaB Nn60LTM6A3et94ujAGMzsLJq+cKwtQa8xN3K8RGcq3spiw==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:To:Subject:Message-ID: Date:From:MIME-Version:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=IudrAIWVYB8WdNeZdsYsMhdYc+OMxafyfxnGIvlQVMI=; b=e+Nag6v/TYDCDgBWdw6Mdx/oZh Cal35S64KoVcowNdlHX5xCb2JBAMETm2AG827kuZCaE4SQgS5aAIRf9cnZ82LX8qHkY4hD1gAgPz5 eJjrZMTrLefL+4a8lLjmA5iOk/6rJWLTmCwO1ekayes9Euvk2430K2mmCtjjR7YUsCVqXWV/FmXj1 3d5QAKYXWZ2nJ0vvVzMTYVJhJzOLw43HXLVhDhfyyNvDjHW+Nxu0IhlQrOWyaZIu96FNhAwc4XBNX INB1P/N08eEyhbG5oqqAMZRJ0AZYsH6IlGYynyo7HgKrISBs4smZhRN0OXJ+HKUcTs5JJQf8VGYiP FvVgkxlQ==; Received: by zero.zsh.org with local id 1ru5uL-000FUq-T2; Tue, 09 Apr 2024 07:28:41 +0000 Authentication-Results: zsh.org; iprev=pass (mail-io1-f51.google.com) smtp.remote-ip=209.85.166.51; dkim=pass header.d=gmail.com header.s=20230601 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-io1-f51.google.com ([209.85.166.51]:37995) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1ru5u5-000FD6-7b; Tue, 09 Apr 2024 07:28:25 +0000 Received: by mail-io1-f51.google.com with SMTP id ca18e2360f4ac-7cc5e664d52so82788239f.0 for ; Tue, 09 Apr 2024 00:28:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712647702; x=1713252502; darn=zsh.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=IudrAIWVYB8WdNeZdsYsMhdYc+OMxafyfxnGIvlQVMI=; b=cUT+EWJoi/rJRlazp0CSu3PWHo8dOD0xwUtPRLa9l8O2+Jp8HnDIDQOhzOAJU4KOCV cnk6lHutxReNkAAd6BiUviiPPmmJq6JocP+2qOAH09uaDYI5I2seeW7mnNxijFtQPzEf pnK0/OBIhiL6+DKrXpXtQRJ4aj/SBYR2qRAYsoH2tLnpQrkll8FZlIImqSfiHp3UWYl9 K0WQZCstgmR4VxGef9sQIkKVvmCigaC+aNpY6kWaaUpYzFlIX/inBDyOz0UFGeUMo2In bIZwXmRn+YqiZmiB8SElA58PYDdfz42bUEYD/c1lGjR9RcO24VN613PE3u9bp5JaExuF P1oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712647702; x=1713252502; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=IudrAIWVYB8WdNeZdsYsMhdYc+OMxafyfxnGIvlQVMI=; b=Qn3z6DENo7n8/mehDo85DcM8ZonbKXTc4sx8HaxOYLaPeXuSUKz7G8DBjhr0ApOipW Is4lk+btz3ec8M2o351ZDrErKYXLxaB4+SwrsWfG+WPLj3DFCidUSnrAnLyk/IhgcgSq TDEHM9LzCPw2wbQZhDDS63tBkLsUWrhMj6j8UdZNG4mvW8uKxUHKR8naXAFLr+kNGO9q 5j+OxuVHFemdnt92mOFlzwndiLzlVfqtNkuQ2r6PZhiqTF+XUaqi2qeGJHXXh7nUugPh NkPqNA60hrj14BKWbVv1liU+fiP/KcnBmRRTFWP2eVUEhnlu3Yb+6wckDsxriyK78eqa Vrjw== X-Gm-Message-State: AOJu0YxOJFOU1TxV35tAew1SV37x2EpkQVi5B/LBkQajpNcAN9+5nrZu 8ZfpcSffXW0YEK37+W/Iw8TjiNTOc0oJGiODcMb9vkQTDk7DUKGulDNSiiTpnZUUKoOmIChfRfB VgfmbUTa37fSvAY64GwZQhZlLz9TeMA67ljo= X-Google-Smtp-Source: AGHT+IGvz54+204HDAbzi7tCIrlGoBjGwc7O8qQAk547DOIaaBaZZe1sbAg1UJ0eCjZ9sVAcgo0hPsDf5QNb7QuDXDU= X-Received: by 2002:a92:d185:0:b0:36a:d96:83d5 with SMTP id z5-20020a92d185000000b0036a0d9683d5mr9942328ilz.3.1712647702019; Tue, 09 Apr 2024 00:28:22 -0700 (PDT) MIME-Version: 1.0 From: Marlon Richert Date: Tue, 9 Apr 2024 10:27:45 +0300 Message-ID: Subject: [BUG] Incorrect usage of $PREFIX and $SUFFIX in completion functions To: Zsh hackers list Content-Type: multipart/alternative; boundary="000000000000e78bea0615a4dddf" X-Seq: 52882 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: --000000000000e78bea0615a4dddf Content-Type: text/plain; charset="UTF-8" Many completion functions in the Zsh code base use $PREFIX$SUFFIX to get the word to complete on the command line. However, this seems incorrect to me, because it prevents the _prefix completer from functioning correctly for those completion functions. Shouldn't all completion functions simply use $PREFIX to get the word to complete, since it is the responsibility of the completer function (_complete, _prefix, etc.) to decide whether the character to the right should be considered part of the word to be completed? Shouldn't _complete do `PREFIX+=$SUFFIX; SUFFIX=` before calling completion functions, since, otherwise, there is no meaningful difference between it and _prefix? Additionally, if _complete should indeed do `PREFIX+=$SUFFIX; SUFFIX=`, then shouldn't compinit always enable COMPLETE_IN_WORD, since, without it, _prefix is not able to function correctly and _complete should behave the same regardless? --000000000000e78bea0615a4dddf Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Many completion functions in the Zsh code base use $PREFIX$SUFFIX= to get the word to complete on the command=C2=A0line. However, this seems = incorrect to me, because it prevents the _prefix completer from functioning= correctly for those completion functions.

Shouldn't all completion fu= nctions simply use $PREFIX to get the word to complete,=C2=A0since it is th= e responsibility of the completer function (_complete, _prefix, etc.) to de= cide whether the character to the right should be considered part of the wo= rd to be completed?

Shouldn't _complete do `PREFIX+=3D$SUFFIX; SUFFIX= =3D` before calling completion functions, since, otherwise, there is no mea= ningful difference between it and _prefix?

Additionally, if _complete = should indeed do `PREFIX+=3D$SUFFIX; SUFFIX=3D`, then shouldn't compini= t always enable COMPLETE_IN_WORD, since, without it, _prefix is not able to= function correctly and _complete should behave the same regardless?
<= div class=3D"gmail_default" style=3D"font-family:arial,sans-serif">
--000000000000e78bea0615a4dddf--