wolray / symbol-overlay

Highlight symbols with keymap-enabled overlays
346 stars 42 forks source link

Jumping to next symbol (switch-forward) skips to last on screen #96

Open MicahElliott opened 1 year ago

MicahElliott commented 1 year ago

For the following test case:

aaa ; first overlay
bbb
ccc ; second overlay
ddd
ccc ; matching overlay of course

and these steps:

  1. Place point at aaa
  2. symbol-overlay-put to highlight aaa (I guess this step is irrelevant)
  3. Move point to ccc two lines down
  4. symbol-overlay-put to highlight ccc
  5. Move point back up to bbb
  6. symbol-overlay-switch-forward: BUG! jumps to final ccc on last line, instead of the closer one on line 3

I'm certain symbol-overlay-switch-forward used to jump from bbb to the closer/middle ccc (which feels right), so this must be a bug. Feels like it's been happening for a couple months (I upgrade weekly).

An oddity is that if there's another ccc lower in the file beyond the what's in view on screen, it does not jump all the way to that one.

ClaudioGi commented 1 year ago

I have looked through the source code and it looks ok. Then I have tried to reproduce the behavior you speak about and failed to reproduce it ( Emacs 29.0.60 lucid Linux Mint 21 Cinnamon ). Try again with emacs -Q . Maybe it has something to do with your Emacs configuration.

zhchuu commented 4 months ago

@MicahElliott I simply resolved this issue by checking out the commit to c439b73a5f9713bb3dce98986b589bb901e22130. My Emacs version is 27.2 (have to use this old version for some reasons) and experienced a similar situation like your description. On another device with Emacs 28.2, everything works fine with the master branch. It seems that some compatibility issues with old versions of Emacs were introduced after that commit. Hope this helps.