Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] Increase $COLUMNS when generating long option completions



On Sun, Aug 8, 2021 at 1:41 AM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> On Sat, Aug 7, 2021 at 12:56 PM Marlon Richert <marlon.richert@xxxxxxxxx> wrote:
> >
> > How does this patch look to you?
>
> Frankly, it looks unnecessarily complicated.  What's the rationale for
> using COLUMNS=999 as a command prefix in every "eval", rather than
> just declaring once
>   local -x COLUMNS=999
> at the start of the function??  Why rearrange the other declarations?

TIL you can export parameters locally. Here's a new patch.
From 0f7ed76a199710b1323c12cc7e7e17fb10f5f748 Mon Sep 17 00:00:00 2001
From: Marlon Richert <marlon.richert@xxxxxxxxx>
Date: Tue, 10 Aug 2021 22:02:11 +0300
Subject: [PATCH] Set $COLUMNS in _call_program to ensure cached command output
 is sufficiently wide

---
 Completion/Base/Utility/_call_program | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Completion/Base/Utility/_call_program b/Completion/Base/Utility/_call_program
index 73f3ef6d2..55712b04b 100644
--- a/Completion/Base/Utility/_call_program
+++ b/Completion/Base/Utility/_call_program
@@ -1,5 +1,6 @@
 #autoload +X
 
+local -xi COLUMNS=999
 local curcontext="${curcontext}" tmp err_fd=-1 clocale='_comp_locale;'
 local -a prefix
 
-- 
2.30.1 (Apple Git-130)



Messages sorted by: Reverse Date, Date, Thread, Author