mergetools: vimdiff: fix single window layouts
Layouts with a single window other than "MERGED" do not work (e.g. "LOCAL" or "MERGED+LOCAL"). This is because as the documentation of bufdo says: The last buffer (or where an error occurred) becomes the current buffer. And we do always do bufdo the end. Additionally, we do it only once, when it should be per tab. Fix this by doing it once per tab right after it's created and before any buffer is switched. Cc: Fernando Ramos <greenfoo@u92.eu> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Reviewed-by: Fernando Ramos <greenfoo@u92.eu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
ffcc33f6a6
commit
b6014eeac0
@ -325,21 +325,17 @@ gen_cmd () {
|
||||
CMD="$CMD | tabnew"
|
||||
fi
|
||||
|
||||
# If this is a single window diff with all the buffers
|
||||
if ! echo "$tab" | grep ",\|/" >/dev/null
|
||||
then
|
||||
CMD="$CMD | silent execute 'bufdo diffthis'"
|
||||
fi
|
||||
|
||||
CMD=$(gen_cmd_aux "$tab" "$CMD")
|
||||
done
|
||||
IFS=$oldIFS
|
||||
|
||||
|
||||
# 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 | silent 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
|
||||
@ -552,7 +548,7 @@ run_unit_tests () {
|
||||
EXPECTED_CMD_01="-c \"set hidden diffopt-=hiddenoff | echo | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 2b | wincmd l | 3b | wincmd j | 4b | tabdo windo diffthis\" -c \"tabfirst\""
|
||||
EXPECTED_CMD_02="-c \"set hidden diffopt-=hiddenoff | echo | leftabove vertical split | 1b | wincmd l | 3b | tabdo windo diffthis\" -c \"tabfirst\""
|
||||
EXPECTED_CMD_03="-c \"set hidden diffopt-=hiddenoff | echo | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 4b | wincmd l | 3b | tabdo windo diffthis\" -c \"tabfirst\""
|
||||
EXPECTED_CMD_04="-c \"set hidden diffopt-=hiddenoff | echo | 4b | silent bufdo diffthis\" -c \"tabfirst\""
|
||||
EXPECTED_CMD_04="-c \"set hidden diffopt-=hiddenoff | echo | silent execute 'bufdo diffthis' | 4b | tabdo windo diffthis\" -c \"tabfirst\""
|
||||
EXPECTED_CMD_05="-c \"set hidden diffopt-=hiddenoff | echo | leftabove split | 1b | wincmd j | leftabove split | 4b | wincmd j | 3b | tabdo windo diffthis\" -c \"tabfirst\""
|
||||
EXPECTED_CMD_06="-c \"set hidden diffopt-=hiddenoff | echo | leftabove vertical split | leftabove split | 1b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\""
|
||||
EXPECTED_CMD_07="-c \"set hidden diffopt-=hiddenoff | echo | leftabove vertical split | 4b | wincmd l | leftabove split | 1b | wincmd j | 3b | tabdo windo diffthis\" -c \"tabfirst\""
|
||||
|
Loading…
Reference in New Issue
Block a user