dhananjaylatkar / cscope_maps.nvim

For old school code navigation. Adds cscope support to Neovim 0.9+.
MIT License
144 stars 32 forks source link

Cannot return to the previous jump position using Ctrl+O with the latest version #42

Closed zaiqiang-dong closed 3 months ago

zaiqiang-dong commented 3 months ago

Describe the bug Cannot return to the previous jump position using Ctrl+O with the latest version back to : commit 4086cbb0fa1553830a3a27e3efe57adf6ebe5531 Author: Dhananjay dhananjay.latkar@gmail.com Date: Thu Jul 4 14:02:37 2024 +0530

FUNDING

works ok!!!

To Reproduce Steps to reproduce the behavior:

  1. cscope find s "xxx"
  2. select and jump to
  3. repeat 1 and 2 many times
  4. return with ctrl+o

Expected behavior ctrl+o can return old position.

Screenshots If applicable, add screenshots to help explain your problem.

nvim version (please complete the following information): NVIM v0.10.0 Build type: Release LuaJIT 2.1.1713484068 Run "nvim -V1 -v" for more info

dhananjaylatkar commented 3 months ago

Hi @zaiqiang-dong

I'm not able to repro this issue. Can elaborate on steps to repro. Also provide your config.

PS. cscope_maps.nvim does not modify jumplist so it should not create any regression for it.

zaiqiang-dong commented 3 months ago

my cscope_maps.nvim config is:

return {
    "dhananjaylatkar/cscope_maps.nvim",
    event = "VeryLazy",
    -- commit = "4086cbb0fa1553830a3a27e3efe57adf6ebe5531",
    dependencies = {
        { "tpope/vim-surround" },
        { "dhananjaylatkar/cscope_maps.nvim" },
        { "folke/which-key.nvim" },
        { "nvim-telescope/telescope.nvim" },
    },
    config = function()
        require("cscope_maps").setup({
            cscope = {
                db_file = "./cscope.out", -- location of cscope db file
                exec = "cscope", -- "cscope" or "gtags-cscope"
                use_telescope = true, -- true will show results in telescope picker
                picker = "telescope",
                db_build_cmd_args = { "-bqkv" }, -- args used for db build (:Cscope build)
            },
            disable_maps = true,
            vim.api.nvim_set_keymap(
                "n",
                "cs",
                [[<cmd>lua require('cscope_maps').cscope_prompt('s', vim.fn.expand("<cword>"))<cr><cr>]],
                { noremap = true, silent = false }
            ),
            vim.api.nvim_set_keymap(
                "n",
                "cd",
                [[<cmd>lua require('cscope_maps').cscope_prompt('g', vim.fn.expand("<cword>"))<cr><cr>]],
                { noremap = true, silent = false }
            ),
            vim.api.nvim_set_keymap(
                "n",
                "cc",
                [[<cmd>lua require('cscope_maps').cscope_prompt('c', vim.fn.expand("<cword>"))<cr><cr>]],
                { noremap = true, silent = false }
            ),
        })
    end,
}

video

jump is like this:

  1. ipc/mqueue.c:1705 kmem_cache_create
  2. mm/slab_common.c:569 kmem_cache_create
  3. mm/slab_common.c:462 kmem_cache_create_usercopy
  4. mm/slab_common.c:387 create_cache
  5. mm/slub.c:4397 __kmem_cache_create
  6. mm/slub.c:3710 kmem_cache_open
  7. mm/slub.c:3569 calculate_sizes

return whih ctrl+o like this:

  1. mm/slub.c:3569 calculate_sizes ctrl+o
  2. mm/slab_common.c:387 create_cache ctrl+o
  3. ipc/mqueue.c:1705 kmem_cache_create
dhananjaylatkar commented 3 months ago

hey @zaiqiang-dong

issue is due to how telescope handles absolute paths. When abs path is given to telescope, it only changes cursor position. Changing cursor position does not update jumplist.

I would suggest you to use <C-t> until telescope merges https://github.com/nvim-telescope/telescope.nvim/pull/3205.

dhananjaylatkar commented 3 months ago

BTW, which colorscheme are you using?

zaiqiang-dong commented 3 months ago

hey @zaiqiang-dong

issue is due to how telescope handles absolute paths. When abs path is given to telescope, it only changes cursor position. Changing cursor position does not update jumplist.

I would suggest you to use <C-t> until telescope merges nvim-telescope/telescope.nvim#3205.

OK,got it, thanks,.

zaiqiang-dong commented 3 months ago

BTW, which colorscheme are you using?

I only use a colors.vim and config by myself.

dhananjaylatkar commented 3 months ago

Added workaround in cscope since it will take time for telescope PR to merge!