Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flickering on scrolling by arrow keys with semantic highlight enabled #5199

Closed
cridemichel opened this issue Nov 23, 2024 · 5 comments · Fixed by #5208
Closed

flickering on scrolling by arrow keys with semantic highlight enabled #5199

cridemichel opened this issue Nov 23, 2024 · 5 comments · Fixed by #5208

Comments

@cridemichel
Copy link
Contributor

cridemichel commented Nov 23, 2024

Result from CocInfo

## versions

vim version: VIM - Vi IMproved 9.1 9010727
node version: v23.3.0
coc.nvim version: 0.0.82-aacbbca 2024-11-23 13:34:02 +0800
coc.nvim directory: /Users/demichel/.vim/plugged/coc.nvim
term: iTerm.app
platform: darwin

## Log of coc.nvim

2024-11-23T07:46:51.206 WARN (pid:21649) [workspace] - Extension "coc-lists" registered synchronized autocmd "VimLeavePre", which could be slow.
2024-11-23T07:46:51.225 INFO (pid:21649) [extension:coc-tabnine] - Using tabnine from /Users/demichel/.config/coc/extensions/coc-tabnine-data/binaries/4.205.0/aarch64-apple-darwin/TabNine
2024-11-23T07:46:51.248 INFO (pid:21649) [plugin] - coc.nvim initialized with node: v23.3.0 after 408
2024-11-23T07:46:51.256 INFO (pid:21649) [services] - LanguageClient clangd state change: stopped => starting
2024-11-23T07:46:51.258 INFO (pid:21649) [language-client-index] - Language server "clangd" started with 21688
2024-11-23T07:46:51.296 INFO (pid:21649) [services] - LanguageClient clangd state change: starting => running
2024-11-23T07:46:51.299 INFO (pid:21649) [services] - service clangd started
2024-11-23T08:04:56.121 INFO (pid:21649) [attach] - receive notification: doAutocmd [
  2,
  {
    regcontents: [
      'ntype K=calcK();',
      '            Hs=calcShadow(K, Us);',
      '            std::cout << std::setprecision(15) << "[step #" << t << "] \\nTotal energy=" << (K+Us)/pars.Np << "\\n";',
      '            std::cout << std::setprecision(8) << "Shadow energy=" << Hs/pars.Np << "\\n";',
      '         '
    ],
    visual: true,
    inclusive: true,
    regname: '+',
    regtype: 'v',
    operator: 'y'
  },
  2,
  1001
]
2024-11-23T08:05:16.254 INFO (pid:21649) [attach] - receive notification: doAutocmd [
  2,
  {
    regcontents: [
      '   ntype K=calcK();',
      '        Hs=calcShadow(K, Us);',
      '        std::cout << std::setprecision(15) << "[step #" << t << "] \\nTotal energy=" << (K+Us)/pars.Np << "\\n";',
      '        std::cout << std::setprecision(15) << "Shadow energy=" << Hs/pars.Np << "\\n";',
      '      '
    ],
    visual: true,
    inclusive: true,
    regname: '+',
    regtype: 'v',
    operator: 'y'
  },
  2,
  1001
]
2024-11-23T08:05:48.273 INFO (pid:21649) [attach] - receive notification: doAutocmd [
  2,
  {
    regcontents: [ 'n' ],
    visual: false,
    inclusive: false,
    regname: '',
    regtype: 'v',
    operator: 'd'
  },
  2,
  1001
]
2024-11-23T08:05:48.426 INFO (pid:21649) [attach] - receive notification: doAutocmd [
  2,
  {
    regcontents: [ 't' ],
    visual: false,
    inclusive: false,
    regname: '',
    regtype: 'v',
    operator: 'd'
  },
  2,
  1001
]
2024-11-23T08:05:48.555 INFO (pid:21649) [attach] - receive notification: doAutocmd [
  2,
  {
    regcontents: [ 'y' ],
    visual: false,
    inclusive: false,
    regname: '',
    regtype: 'v',
    operator: 'd'
  },
  2,
  1001
]
2024-11-23T08:05:48.709 INFO (pid:21649) [attach] - receive notification: doAutocmd [
  2,
  {
    regcontents: [ 'p' ],
    visual: false,
    inclusive: false,
    regname: '',
    regtype: 'v',
    operator: 'd'
  },
  2,
  1001
]
2024-11-23T08:05:48.840 INFO (pid:21649) [attach] - receive notification: doAutocmd [
  2,
  {
    regcontents: [ 'e' ],
    visual: false,
    inclusive: false,
    regname: '',
    regtype: 'v',
    operator: 'd'
  },
  2,
  1001
]
2024-11-23T08:05:49.041 INFO (pid:21649) [attach] - receive notification: doAutocmd [
  2,
  {
    regcontents: [ ' ' ],
    visual: false,
    inclusive: false,
    regname: '',
    regtype: 'v',
    operator: 'd'
  },
  2,
  1001
]
2024-11-23T08:14:37.190 INFO (pid:21649) [attach] - receive notification: jumpDefinition []
2024-11-23T08:17:26.804 INFO (pid:21649) [attach] - receive notification: doAutocmd [
  2,
  {
    regcontents: [
      'friend std::ostream& operator<<(std::ostream& os, const pvector& vec)',
      '    {',
      '      os << "(";',
      '      for (int i=0; i < NT; i++)',
      '        {',
      '          os << vec.v[i];',
      '          if (i < NT-1)',
      '           os << ","; ',
      '        }',
      '      os << ")";',
      '      return os;',
      '    }'
    ],
    visual: true,
    inclusive: true,
    regname: '+',
    regtype: 'v',
    operator: 'y'
  },
  15,
  1001
]
2024-11-23T08:18:34.276 INFO (pid:21649) [attach] - receive notification: doAutocmd [
  2,
  {
    regcontents: [
      '                std::cout << "f[" <<  n <<"]" << parts[n].f << "\\n";;'
    ],
    visual: false,
    inclusive: false,
    regname: '+',
    regtype: 'V',
    operator: 'd'
  },
  2,
  1001
]
2024-11-23T08:29:20.942 INFO (pid:21649) [attach] - receive notification: doAutocmd [
  2,
  {
    regcontents: [ '            calc_forces(Us, U);', ' ' ],
    visual: true,
    inclusive: true,
    regname: '+',
    regtype: 'v',
    operator: 'y'
  },
  2,
  1001
]
2024-11-23T08:30:16.339 INFO (pid:21649) [attach] - receive notification: doAutocmd [
  2,
  {
    regcontents: [ '        ' ],
    visual: false,
    inclusive: false,
    regname: '+',
    regtype: 'V',
    operator: 'd'
  },
  2,
  1001
]
2024-11-23T08:30:16.945 INFO (pid:21649) [attach] - receive notification: doAutocmd [
  2,
  {
    regcontents: [ '        calc_forces(Us, U);' ],
    visual: false,
    inclusive: false,
    regname: '+',
    regtype: 'V',
    operator: 'd'
  },
  2,
  1001
]
2024-11-23T08:30:53.638 INFO (pid:21649) [attach] - receive notification: doAutocmd [
  2,
  {
    regcontents: [ '-' ],
    visual: false,
    inclusive: false,
    regname: '',
    regtype: 'v',
    operator: 'd'
  },
  2,
  1000
]
2024-11-23T08:32:18.124 INFO (pid:21649) [attach] - receive notification: doAutocmd [
  2,
  {
    regcontents: [ '        calc_forces(Us, U);' ],
    visual: false,
    inclusive: false,
    regname: '+',
    regtype: 'V',
    operator: 'd'
  },
  2,
  1001
]
2024-11-23T08:32:25.441 INFO (pid:21649) [attach] - receive notification: jumpDefinition []
2024-11-23T08:32:52.680 INFO (pid:21649) [attach] - receive notification: doAutocmd [
  2,
  {
    regcontents: [ '-' ],
    visual: false,
    inclusive: false,
    regname: '',
    regtype: 'v',
    operator: 'd'
  },
  2,
  1001
]
2024-11-23T08:35:00.709 INFO (pid:21649) [attach] - receive notification: doAutocmd [
  2,
  {
    regcontents: [ '            alpha = -0.5 * pars.dt;' ],
    visual: false,
    inclusive: false,
    regname: '+',
    regtype: 'V',
    operator: 'd'
  },
  2,
  1001
]
2024-11-23T08:35:07.968 INFO (pid:21649) [attach] - receive notification: doAutocmd [
  2,
  {
    regcontents: [ '-' ],
    visual: false,
    inclusive: false,
    regname: '',
    regtype: 'v',
    operator: 'd'
  },
  2,
  1001
]
2024-11-23T08:35:13.840 INFO (pid:21649) [attach] - receive notification: doAutocmd [
  2,
  {
    regcontents: [ '              else' ],
    visual: false,
    inclusive: false,
    regname: '+',
    regtype: 'V',
    operator: 'd'
  },
  2,
  1001
]
2024-11-23T08:35:14.227 INFO (pid:21649) [attach] - receive notification: doAutocmd [
  2,
  {
    regcontents: [ '                delE ' ],
    visual: false,
    inclusive: false,
    regname: '+',
    regtype: 'V',
    operator: 'd'
  },
  2,
  1001
]
2024-11-23T08:35:14.761 INFO (pid:21649) [attach] - receive notification: doAutocmd [
  2,
  {
    regcontents: [ '              if (pars.simtype==1)' ],
    visual: false,
    inclusive: false,
    regname: '+',
    regtype: 'V',
    operator: 'd'
  },
  2,
  1001
]
2024-11-23T08:46:14.983 INFO (pid:21649) [attach] - receive notification: doAutocmd [
  2,
  {
    regcontents: [ '#if DEBUG' ],
    visual: false,
    inclusive: false,
    regname: '+',
    regtype: 'V',
    operator: 'd'
  },
  2,
  1001
]
2024-11-23T08:46:15.043 INFO (pid:21649) [attach] - receive notification: doAutocmd [
  2,
  {
    regcontents: [ '        ntype K=calcK();' ],
    visual: false,
    inclusive: false,
    regname: '+',
    regtype: 'V',
    operator: 'd'
  },
  2,
  1001
]
2024-11-23T08:46:15.108 INFO (pid:21649) [attach] - receive notification: doAutocmd [
  2,
  {
    regcontents: [ '        Hs=calcShadow(K, Us);' ],
    visual: false,
    inclusive: false,
    regname: '+',
    regtype: 'V',
    operator: 'd'
  },
  2,
  1001
]
2024-11-23T08:46:15.175 INFO (pid:21649) [attach] - receive notification: doAutocmd [
  2,
  {
    regcontents: [ '' ],
    visual: false,
    inclusive: false,
    regname: '+',
    regtype: 'V',
    operator: 'd'
  },
  2,
  1001
]
2024-11-23T08:46:15.248 INFO (pid:21649) [attach] - receive notification: doAutocmd [
  2,
  {
    regcontents: [
      '        std::cout << std::setprecision(15) << "BEFORE [step #" << t << "] \\nTotal energy=" << (K+Us)/pars.Np << "\\n";'
    ],
    visual: false,
    inclusive: false,
    regname: '+',
    regtype: 'V',
    operator: 'd'
  },
  2,
  1001
]
2024-11-23T08:46:15.312 INFO (pid:21649) [attach] - receive notification: doAutocmd [
  2,
  {
    regcontents: [
      '        std::cout << std::setprecision(15) << "BEFORE Shadow energy=" << Hs/pars.Np << "\\n";'
    ],
    visual: false,
    inclusive: false,
    regname: '+',
    regtype: 'V',
    operator: 'd'
  },
  2,
  1001
]
2024-11-23T08:46:15.667 INFO (pid:21649) [attach] - receive notification: doAutocmd [
  2,
  {
    regcontents: [ '#endif' ],
    visual: false,
    inclusive: false,
    regname: '+',
    regtype: 'V',
    operator: 'd'
  },
  2,
  1001
]
2024-11-23T08:46:22.272 INFO (pid:21649) [attach] - receive notification: doAutocmd [
  2,
  {
    regcontents: [ '#if DEBUG' ],
    visual: false,
    inclusive: false,
    regname: '+',
    regtype: 'V',
    operator: 'd'
  },
  2,
  1001
]
2024-11-23T08:46:22.336 INFO (pid:21649) [attach] - receive notification: doAutocmd [
  2,
  {
    regcontents: [ '        calc_forces(Us, U);' ],
    visual: false,
    inclusive: false,
    regname: '+',
    regtype: 'V',
    operator: 'd'
  },
  2,
  1001
]
2024-11-23T08:46:22.400 INFO (pid:21649) [attach] - receive notification: doAutocmd [
  2,
  {
    regcontents: [ '        K=calcK();' ],
    visual: false,
    inclusive: false,
    regname: '+',
    regtype: 'V',
    operator: 'd'
  },
  2,
  1001
]
2024-11-23T08:46:22.468 INFO (pid:21649) [attach] - receive notification: doAutocmd [
  2,
  {
    regcontents: [ '        Hs=calcShadow(K, Us);' ],
    visual: false,
    inclusive: false,
    regname: '+',
    regtype: 'V',
    operator: 'd'
  },
  2,
  1001
]
2024-11-23T08:46:22.535 INFO (pid:21649) [attach] - receive notification: doAutocmd [
  2,
  {
    regcontents: [
      '        std::cout << std::setprecision(15) << "AFTER [step #" << t << "] \\nTotal energy=" << (K+Us)/pars.Np << "\\n";'
    ],
    visual: false,
    inclusive: false,
    regname: '+',
    regtype: 'V',
    operator: 'd'
  },
  2,
  1001
]
2024-11-23T08:46:22.603 INFO (pid:21649) [attach] - receive notification: doAutocmd [
  2,
  {
    regcontents: [
      '        std::cout << std::setprecision(15) << "AFTER Shadow energy=" << Hs/pars.Np << "\\n\\n";'
    ],
    visual: false,
    inclusive: false,
    regname: '+',
    regtype: 'V',
    operator: 'd'
  },
  2,
  1001
]
2024-11-23T08:46:23.018 INFO (pid:21649) [attach] - receive notification: doAutocmd [
  2,
  {
    regcontents: [ '#endif' ],
    visual: false,
    inclusive: false,
    regname: '+',
    regtype: 'V',
    operator: 'd'
  },
  2,
  1001
]
2024-11-23T08:47:26.970 INFO (pid:21649) [attach] - receive notification: doAutocmd [
  2,
  {
    regcontents: [ ':' ],
    visual: false,
    inclusive: true,
    regname: '',
    regtype: 'v',
    operator: 'd'
  },
  2,
  1001
]
2024-11-23T08:47:36.927 INFO (pid:21649) [attach] - receive notification: jumpDefinition []
2024-11-23T08:47:44.250 INFO (pid:21649) [attach] - receive notification: doAutocmd [
  2,
  {
    regcontents: [ '      calc_forces(Us, U);' ],
    visual: false,
    inclusive: false,
    regname: '+',
    regtype: 'V',
    operator: 'd'
  },
  2,
  1001
]
2024-11-23T08:47:48.898 INFO (pid:21649) [attach] - receive notification: jumpDefinition []
2024-11-23T09:02:57.820 INFO (pid:21649) [attach] - receive notification: showInfo []

Describe the bug

After one of last update on cocnvim on github with semantinc highligh enabled
if I scroll by using arrow keys it annoyingly flickers. I attach also a video where
in the first part I use arrow keys to scroll (when it flickers) and in the second part
I scroll by using the mouse wheel (and it does not flickers)

Reproduce the bug

We will close your issue when you don't provide minimal vimrc and we can't
reproduce it

set nocompatible
set runtimepath^=/Users/demichel/.vim/plugged/coc.nvim/
" Use <c-space> to trigger completion
syntax on
set nohidden
  • Start (neo)vim with command: vim -u mini.vim

  • open the following file:
    sim.hpp.zip

  • type G then CTRL-O to go back to first line

  • start scrolling down by pressing once "page down" and then repeatedly pressing "down arrow"

  • it flickers

Screenshots (optional)

flickering.mp4
@fannheyward
Copy link
Member

fannheyward commented Nov 25, 2024

Reproduced with vim, works as expected on nvim.

fannheyward added a commit that referenced this issue Nov 26, 2024
From [start-height*1.5, end+height*1.5] to [start-height/2, end+height/2], decrease items to highlight

Related #5199, should reduce flickering happened
fannheyward added a commit that referenced this issue Nov 26, 2024
From [start-height*1.5, end+height*1.5] to [start-height/2, end+height/2], decrease items to highlight

Related #5199, should reduce flickering happened
@fannheyward
Copy link
Member

Please try the master branch, which includes improvements for highlighting.

@cridemichel
Copy link
Contributor Author

cridemichel commented Nov 26, 2024 via email

@cridemichel
Copy link
Contributor Author

cridemichel commented Nov 26, 2024

Hi,
I did some tests, apparently it is a bit better but
the only way to have flicker free semantic
highlights is to set

let g:coc_highlight_maximum_count=1200

in .vimrc

best Cristiano

@fannheyward
Copy link
Member

fannheyward commented Nov 27, 2024

I've increased the default number to 500. The number is used to limit how many items to highlight per time. If the server returns a large count items, coc.nvim will repeatedly to highlight multiple times, this makes the flickering.

In my test, 500 is enough for most cases, coc.nvim only performs highlighting one or two times.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants