All of lore.kernel.org
 help / color / mirror / Atom feed
* Bug with splits in new nvimdiff layout
@ 2022-07-07 16:58 Matthew Klein
  2022-07-07 18:46 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Matthew Klein @ 2022-07-07 16:58 UTC (permalink / raw)
  To: git

Hi,

I encountered a bug when using the new vimdiff layout format.

To recreate this, start with a merge conflict, and merge with this command:

    git mergetool --tool=nvimdiff

I expected the layout to be:

    ------------------------------------------
    |             |           |              |
    |   LOCAL     |   BASE    |   REMOTE     |
    |             |           |              |
    ------------------------------------------
    |                                        |
    |                MERGED                  |
    |                                        |
    ------------------------------------------

The layout when I ran the command was:

    ------------------------------------------
    |                                        |
    |                LOCAL                   |
    |                                        |
    ------------------------------------------
    |             |           |              |
    |   LOCAL     |   LOCAL   |   MERGED     |
    |             |           |              |
    ------------------------------------------

I expected the layout to be the same as what was documented to be the default
for "nvimdiff".

In my init.vim configuration file, I have these lines set:

    set splitbelow
    set splitright

These options globally change the behaviour of the "split" command so that
instead of "split" creating a new window above the current window, or to the
left when used with "vertical", it does the opposite. Docs:
https://neovim.io/doc/user/options.html#'splitbelow'

I recommend using the "leftabove" (a.k.a "aboveleft") command together with
"split". Since these windows are positioned absolutely (according to
"mergetool.nvimdiff.layout"), it shouldn't depend on the user's configuration.
Docs: https://neovim.io/doc/user/windows.html#:leftabove

The previous invocation (i.e. "4wincmd w | wincmd J") didn't run into this
issue, since its not affected by the "splitbelow" and "splitright" options.

Hope this helps,

Matthew

[System Info]
git version:
git version 2.37.0
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
uname: Linux 5.18.9-arch1-1 #1 SMP PREEMPT_DYNAMIC Sat, 02 Jul 2022
21:03:06 +0000 x86_64
compiler info: gnuc: 12.1
libc info: glibc: 2.35
$SHELL (typically, interactive shell): /bin/bash


[Enabled Hooks]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Bug with splits in new nvimdiff layout
  2022-07-07 16:58 Bug with splits in new nvimdiff layout Matthew Klein
@ 2022-07-07 18:46 ` Junio C Hamano
  2022-07-08 17:06   ` Fernando Ramos
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2022-07-07 18:46 UTC (permalink / raw)
  To: Matthew Klein, Fernando Ramos; +Cc: git

Matthew Klein <mklein994@gmail.com> writes:

> Hi,
>
> I encountered a bug when using the new vimdiff layout format.

Thanks for a report.

Fernando (the author of the layout engine)?  Can you take a look?

> To recreate this, start with a merge conflict, and merge with this command:
>
>     git mergetool --tool=nvimdiff
>
> I expected the layout to be:
>
>     ------------------------------------------
>     |             |           |              |
>     |   LOCAL     |   BASE    |   REMOTE     |
>     |             |           |              |
>     ------------------------------------------
>     |                                        |
>     |                MERGED                  |
>     |                                        |
>     ------------------------------------------
>
> The layout when I ran the command was:
>
>     ------------------------------------------
>     |                                        |
>     |                LOCAL                   |
>     |                                        |
>     ------------------------------------------
>     |             |           |              |
>     |   LOCAL     |   LOCAL   |   MERGED     |
>     |             |           |              |
>     ------------------------------------------
>
> I expected the layout to be the same as what was documented to be the default
> for "nvimdiff".
>
> In my init.vim configuration file, I have these lines set:
>
>     set splitbelow
>     set splitright
>
> These options globally change the behaviour of the "split" command so that
> instead of "split" creating a new window above the current window, or to the
> left when used with "vertical", it does the opposite. Docs:
> https://neovim.io/doc/user/options.html#'splitbelow'
>
> I recommend using the "leftabove" (a.k.a "aboveleft") command together with
> "split". Since these windows are positioned absolutely (according to
> "mergetool.nvimdiff.layout"), it shouldn't depend on the user's configuration.
> Docs: https://neovim.io/doc/user/windows.html#:leftabove
>
> The previous invocation (i.e. "4wincmd w | wincmd J") didn't run into this
> issue, since its not affected by the "splitbelow" and "splitright" options.
>
> Hope this helps,
>
> Matthew
>
> [System Info]
> git version:
> git version 2.37.0
> cpu: x86_64
> no commit associated with this build
> sizeof-long: 8
> sizeof-size_t: 8
> shell-path: /bin/sh
> uname: Linux 5.18.9-arch1-1 #1 SMP PREEMPT_DYNAMIC Sat, 02 Jul 2022
> 21:03:06 +0000 x86_64
> compiler info: gnuc: 12.1
> libc info: glibc: 2.35
> $SHELL (typically, interactive shell): /bin/bash
>
>
> [Enabled Hooks]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Bug with splits in new nvimdiff layout
  2022-07-07 18:46 ` Junio C Hamano
@ 2022-07-08 17:06   ` Fernando Ramos
  0 siblings, 0 replies; 3+ messages in thread
From: Fernando Ramos @ 2022-07-08 17:06 UTC (permalink / raw)
  To: Junio C Hamano, Matthew Klein; +Cc: git, Fernando Ramos

On 22/07/07 11:46AM, Junio C Hamano wrote:
> Matthew Klein <mklein994@gmail.com> writes:
> 
> > Hi,
> >
> > I encountered a bug when using the new vimdiff layout format.
> 
> Thanks for a report.
> 
> Fernando (the author of the layout engine)?  Can you take a look?
> 
No problem! 

The description from Matthew already includes a proposed solution (thanks!)
which should work.

Let me implement and test it this weekend and I'll get back to you.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-07-08 17:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-07 16:58 Bug with splits in new nvimdiff layout Matthew Klein
2022-07-07 18:46 ` Junio C Hamano
2022-07-08 17:06   ` Fernando Ramos

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.