Patch 8.0.1668
Problem:    Terminal debugger: can't re-open source code window.
Solution:   Add the :Source command.  Also create the window if needed when
            gdb stops at a source line.
Files:      runtime/pack/dist/opt/termdebug/plugin/termdebug.vim,
            runtime/doc/terminal.txt


*** ../vim-8.0.1667/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim        
2018-03-29 18:29:47.297127408 +0200
--- runtime/pack/dist/opt/termdebug/plugin/termdebug.vim        2018-04-06 
22:17:33.335916792 +0200
***************
*** 246,251 ****
--- 246,252 ----
    command -range -nargs=* Evaluate call s:Evaluate(<range>, <q-args>)
    command Gdb call win_gotoid(s:gdbwin)
    command Program call win_gotoid(s:ptywin)
+   command Source call s:GotoStartwinOrCreateIt()
    command Winbar call s:InstallWinbar()
  
    " TODO: can the K mapping be restored?
***************
*** 269,281 ****
  
  " Install the window toolbar in the current window.
  func s:InstallWinbar()
!   nnoremenu WinBar.Step   :Step<CR>
!   nnoremenu WinBar.Next   :Over<CR>
!   nnoremenu WinBar.Finish :Finish<CR>
!   nnoremenu WinBar.Cont   :Continue<CR>
!   nnoremenu WinBar.Stop   :Stop<CR>
!   nnoremenu WinBar.Eval   :Evaluate<CR>
!   call add(s:winbar_winids, win_getid(winnr()))
  endfunc
  
  " Delete installed debugger commands in the current window.
--- 270,284 ----
  
  " Install the window toolbar in the current window.
  func s:InstallWinbar()
!   if has('menu') && &mouse != ''
!     nnoremenu WinBar.Step   :Step<CR>
!     nnoremenu WinBar.Next   :Over<CR>
!     nnoremenu WinBar.Finish :Finish<CR>
!     nnoremenu WinBar.Cont   :Continue<CR>
!     nnoremenu WinBar.Stop   :Stop<CR>
!     nnoremenu WinBar.Eval   :Evaluate<CR>
!     call add(s:winbar_winids, win_getid(winnr()))
!   endif
  endfunc
  
  " Delete installed debugger commands in the current window.
***************
*** 450,455 ****
--- 453,466 ----
    echoerr substitute(a:msg, '.*msg="\(.*\)"', '\1', '')
  endfunc
  
+ func s:GotoStartwinOrCreateIt()
+   if !win_gotoid(s:startwin)
+     new
+     let s:startwin = win_getid(winnr())
+     call s:InstallWinbar()
+   endif
+ endfunc
+ 
  " Handle stopping and running message from gdb.
  " Will update the sign that shows the current position.
  func s:HandleCursor(msg)
***************
*** 461,491 ****
      let s:stopped = 0
    endif
  
!   if win_gotoid(s:startwin)
!     let fname = substitute(a:msg, '.*fullname="\([^"]*\)".*', '\1', '')
!     if a:msg =~ '^\(\*stopped\|=thread-selected\)' && filereadable(fname)
!       let lnum = substitute(a:msg, '.*line="\([^"]*\)".*', '\1', '')
!       if lnum =~ '^[0-9]*$'
!       if expand('%:p') != fnamemodify(fname, ':p')
!         if &modified
!           " TODO: find existing window
!           exe 'split ' . fnameescape(fname)
!           let s:startwin = win_getid(winnr())
!         else
!           exe 'edit ' . fnameescape(fname)
!         endif
        endif
-       exe lnum
-       exe 'sign unplace ' . s:pc_id
-       exe 'sign place ' . s:pc_id . ' line=' . lnum . ' name=debugPC file=' . 
fname
-       setlocal signcolumn=yes
        endif
!     else
        exe 'sign unplace ' . s:pc_id
      endif
! 
!     call win_gotoid(wid)
    endif
  endfunc
  
  " Handle setting a breakpoint
--- 472,503 ----
      let s:stopped = 0
    endif
  
!   call s:GotoStartwinOrCreateIt()
! 
!   let fname = substitute(a:msg, '.*fullname="\([^"]*\)".*', '\1', '')
!   if a:msg =~ '^\(\*stopped\|=thread-selected\)' && filereadable(fname)
!     let lnum = substitute(a:msg, '.*line="\([^"]*\)".*', '\1', '')
!     if lnum =~ '^[0-9]*$'
!       if expand('%:p') != fnamemodify(fname, ':p')
!       if &modified
!         " TODO: find existing window
!         exe 'split ' . fnameescape(fname)
!         let s:startwin = win_getid(winnr())
!         call s:InstallWinbar()
!       else
!         exe 'edit ' . fnameescape(fname)
        endif
        endif
!       exe lnum
        exe 'sign unplace ' . s:pc_id
+       exe 'sign place ' . s:pc_id . ' line=' . lnum . ' name=debugPC file=' . 
fname
+       setlocal signcolumn=yes
      endif
!   else
!     exe 'sign unplace ' . s:pc_id
    endif
+ 
+   call win_gotoid(wid)
  endfunc
  
  " Handle setting a breakpoint
*** ../vim-8.0.1667/runtime/doc/terminal.txt    2018-04-05 22:59:37.198608805 
+0200
--- runtime/doc/terminal.txt    2018-04-06 22:22:04.258510491 +0200
***************
*** 731,736 ****
--- 731,741 ----
  You can add the window toolbar in other windows you open with: >
    :Winbar
  
+ If gdb stops at a source line and there is no window currently showing the
+ source code, a new window will be created for the source code.  This also
+ happens if the buffer in the source code window has been modified and can't be
+ abandoned.
+ 
  
  Inspecting variables ~
                                                        *termdebug-variables*
***************
*** 745,752 ****
  
  Other commands ~
                                                        *termdebug-commands*
!  :Gdb        jump to the gdb window
!  :Program      jump to the window with the running program
  
  
  Communication ~
--- 750,759 ----
  
  Other commands ~
                                                        *termdebug-commands*
!  :Gdb      jump to the gdb window
!  :Program    jump to the window with the running program
!  :Source     jump to the window with the source code, create it if there
!            isn't one
  
  
  Communication ~
*** ../vim-8.0.1667/src/version.c       2018-04-06 20:22:01.851568646 +0200
--- src/version.c       2018-04-06 22:23:38.306023254 +0200
***************
*** 764,765 ****
--- 764,767 ----
  {   /* Add new patch number below this line */
+ /**/
+     1668,
  /**/

-- 
Amnesia is one of my favorite words, but I forgot what it means.

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui