git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Sebastián Mancilla" <smancill@smancill.dev>
To: git@vger.kernel.org
Subject: mergetools: wrong window selected for vimdiff1
Date: Thu, 5 Jan 2023 15:47:15 -0300	[thread overview]
Message-ID: <167294445271.7.3739319158947040124.89448053@smancill.dev> (raw)

The layout for the vimdiff1 mergetool is "@LOCAL,REMOTE". From the man page:

    o   layout = "@LOCAL,REMOTE"

        When MERGED is not present in the layout, you must "mark" one
        of the buffers with an asterisk. That will become the buffer
        you need to edit and save after resolving the conflicts.

            ------------------------------------------
            |                   |                    |
            |                   |                    |
            |                   |                    |
            |     LOCAL         |    REMOTE          |
            |                   |                    |
            |                   |                    |
            |                   |                    |
            ------------------------------------------

But after opening the buffers, the cursor is in the *right window*.

This is confusing, since it makes you think the right buffer is the one that
needs to be edited, instead of the left one.

Debug output (the make-conflicts.sh script in this repository [0] can be used
to quickly test a file with conflicts):

    Merging:
    poem.txt

    Normal merge conflict for 'poem.txt':
      {local}: modified file
        {remote}: modified file

        LAYOUT    : @LOCAL,REMOTE
        CMD       : echo
        NESTED MIN: 0
        CLEAN     : @LOCAL,REMOTE

        LAYOUT    : @LOCAL
        CMD       : echo | leftabove vertical split
        NESTED MIN: 0
        CLEAN     : @LOCAL

        LAYOUT    : REMOTE
        CMD       : echo | leftabove vertical split | 1b | wincmd l
        NESTED MIN: 0
        CLEAN     : REMOTE

        FINAL CMD : -c "set hidden diffopt-=hiddenoff | echo |
leftabove vertical split | 1b | wincmd l | 3b | execute 'tabdo windo
diffthis' | tabfirst"
        FINAL TAR : LOCAL
        4 files to edit

Also note that when vimdiff1 was introduced by 30bb8088af
(mergetools/vimdiff: add
vimdiff1 merge tool variant, 2021-02-13), Vim echoed a nice message to
remember which buffer shall be edited:

> +        *vimdiff1)
> +                "$merge_tool_path" -f -d \
> +                        -c 'echon "Resolve conflicts leftward then save. Use :cq to abort."' \
> +                        "$LOCAL" "$REMOTE"

But with the refactor done by 0041797449 (vimdiff: new implementation with
layout support, 2022-03-30), now the message is gone:

>          *vimdiff1)
> -                "$merge_tool_path" -f -d \
> -                        -c 'echon "Resolve conflicts leftward then save. Use :cq to abort."' \
> -                        "$LOCAL" "$REMOTE"
> -                ret="$?"
> -                if test "$ret" -eq 0
> -                then
> -                        cp -- "$LOCAL" "$MERGED"
> -                fi
> -                return "$ret"
> +                layout="@LOCAL,REMOTE"
>                  ;;


[0]: https://github.com/whiteinge/diffconflicts/tree/master/_utils

-- 
Sebastián Mancilla


                 reply	other threads:[~2023-01-05 18:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=167294445271.7.3739319158947040124.89448053@smancill.dev \
    --to=smancill@smancill.dev \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).