( filename, line, column, modifiers, command )
| 677 | |
| 678 | # Both |line| and |column| need to be 1-based |
| 679 | def JumpToLocation( filename, line, column, modifiers, command ): |
| 680 | # Add an entry to the jumplist |
| 681 | vim.command( "normal! m'" ) |
| 682 | |
| 683 | if filename != GetCurrentBufferFilepath(): |
| 684 | # We prefix the command with 'keepjumps' so that opening the file is not |
| 685 | # recorded in the jumplist. So when we open the file and move the cursor to |
| 686 | # a location in it, the user can use CTRL-O to jump back to the original |
| 687 | # location, not to the start of the newly opened file. |
| 688 | # Sadly this fails on random occasions and the undesired jump remains in the |
| 689 | # jumplist. |
| 690 | if command == 'split-or-existing-window': |
| 691 | if 'tab' in modifiers: |
| 692 | if TryJumpLocationInTabs( filename, line, column ): |
| 693 | return |
| 694 | elif TryJumpLocationInTab( vim.current.tabpage, filename, line, column ): |
| 695 | return |
| 696 | command = 'split' |
| 697 | |
| 698 | # This command is kept for backward compatibility. :tab should be used with |
| 699 | # the 'split-or-existing-window' command instead. |
| 700 | if command == 'new-or-existing-tab': |
| 701 | if TryJumpLocationInTabs( filename, line, column ): |
| 702 | return |
| 703 | command = 'new-tab' |
| 704 | |
| 705 | if not JumpToFile( filename, command, modifiers ): |
| 706 | return |
| 707 | |
| 708 | if line is not None and column is not None: |
| 709 | vim.current.window.cursor = ( line, column - 1 ) |
| 710 | |
| 711 | # Open possible folding at location |
| 712 | vim.command( 'normal! zv' ) |
| 713 | # Center the screen on the jumped-to location |
| 714 | vim.command( 'normal! zz' ) |
| 715 | |
| 716 | |
| 717 | def NumLinesInBuffer( buffer_object ): |
nothing calls this directly
no test coverage detected