vim-scripts/Conque-GDB — pull request #1 by susam (2014-09-28 20:04:50+00:00)
Title: Go to original window after updating breakpoint

Fix an issue that causes the cursor to sometimes jump to the taglist
window while debugging with Conque GDB while taglist window is open.

Perform the following steps to reproduce the issue.

Install exuberant-ctags, taglist and Conque GDB.

aptitude install exuberant-ctags
wget http://www.vim.org/scripts/download_script.php?src_id=19574 -O taglist.zip
unzip taglist.zip -d ~/.vim
wget "http://www.vim.org/scripts/download_script.php?src_id=22163" -O conque_gdb.vmb
vim +"silent so % | q" conque_gdb.vmb

Create a file called foo.c with the following C code.

#include

void foo()
{
printf("1\n");
printf("2\n");
printf("3\n");
}

int main()
{
printf("1\n");
printf("2\n");
foo();
printf("3\n");
return 0;
}

Compile the C code. Then launch Vim with the source code.

$ gcc -g foo.c
$ vim foo.c

In Vim, execute the following commands.

:TlistOpen
Ctrl-w w
:ConqueGdb a.out

Then in GDB, execute the following commands.

break main
next
next
step
next

At some point while executing these commands, the cursor moves
to the taglist window. One now was to enter
` Ctrl-w w Ctrl-w w` to return back to the GDB window. This
is a major inconvenience while debugging.

This occurs because in conque_gdb#breakpoint function, after
moving to another window, it uses the `noautocmd wincmd p`
command to return to the previous window. Normally, this works
fine because this is the sequence in which Conque GDB moves from
one window to another:

(Previous window)
+--------------+
V |
GDB window -> Code window

But when taglist is also being used, previous window is no
longer the GDB window. When we `step` into a new function using
GDB, and execute `next`, taglist moves to the taglist window to
update what it shows and then returns to the code window.
Therefore, now when GDB tries to move to the previous window,
the previous window is the taglist window as shown below.

(Previous window)
+----------------+
V |
GDB window -> Code window -> taglist window -> Code window

This is the cause of the issue.