Message ID | 20220807024941.222018-3-felipe.contreras@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | mergetools: vimdiff: regression fix and reorg | expand |
On 22/08/06 09:49PM, Felipe Contreras wrote: > > + # A single window is handled specially > + > + if ! echo "$LAYOUT" | grep ",\|/" >/dev/null > + then > + CMD=$(gen_cmd_aux "$LAYOUT") > + FINAL_CMD="-c \"$CMD | bufdo diffthis\" -c \"tabfirst\"" > + return > + fi If you make this change, it fixes the first issue I was referring to in [1] - if ! echo "$LAYOUT" | grep ",\|/" >/dev/null + if ! echo "$LAYOUT" | grep ",\|/\|\+" >/dev/null [1] https://lore.kernel.org/git/Yu9vvAKJzOpoQ5AS@zacax395.localdomain/
On Sun, Aug 7, 2022 at 9:46 AM Fernando Ramos <greenfoo@u92.eu> wrote: > > On 22/08/06 09:49PM, Felipe Contreras wrote: > > > > + # A single window is handled specially > > + > > + if ! echo "$LAYOUT" | grep ",\|/" >/dev/null > > + then > > + CMD=$(gen_cmd_aux "$LAYOUT") > > + FINAL_CMD="-c \"$CMD | bufdo diffthis\" -c \"tabfirst\"" > > + return > > + fi > > If you make this change, it fixes the first issue I was referring to in [1] > > - if ! echo "$LAYOUT" | grep ",\|/" >/dev/null > + if ! echo "$LAYOUT" | grep ",\|/\|\+" >/dev/null Yeah, but 1) that's a problem in master, not with this patch, and 2) as you already mentioned the colors are not shown so it's debatable if it's really "fixed". BTW, much easier to do "[,/|]" instead.
diff --git a/mergetools/vimdiff b/mergetools/vimdiff index ea416adcaa..9805d139bc 100644 --- a/mergetools/vimdiff +++ b/mergetools/vimdiff @@ -315,6 +315,14 @@ gen_cmd () { LAYOUT=$1 + # A single window is handled specially + + if ! echo "$LAYOUT" | grep ",\|/" >/dev/null + then + CMD=$(gen_cmd_aux "$LAYOUT") + FINAL_CMD="-c \"$CMD | bufdo diffthis\" -c \"tabfirst\"" + return + fi # Search for a "@" in one of the files identifiers ("LOCAL", "BASE", # "REMOTE", "MERGED"). If not found, use "MERGE" as the default file @@ -334,18 +342,7 @@ gen_cmd () { # Obtain the first part of vim "-c" option to obtain the desired layout CMD=$(gen_cmd_aux "$LAYOUT") - - - # Adjust the just obtained script depending on whether more than one - # windows are visible or not - - if echo "$LAYOUT" | grep ",\|/" >/dev/null - then - CMD="$CMD | tabdo windo diffthis" - else - CMD="$CMD | bufdo diffthis" - fi - + CMD="$CMD | tabdo windo diffthis" # Add an extra "-c" option to move to the first tab (notice that we # can't simply append the command to the previous "-c" string as
We clearly want to do something different in these use cases. No functional changes. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> --- mergetools/vimdiff | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-)