justmoon / relative-numbers

Relative line numbers package for Atom
https://atom.io/packages/relative-numbers
MIT License
37 stars 16 forks source link

comment with c-style messes up code in vim-mode-plus #37

Open dylnmc opened 7 years ago

dylnmc commented 7 years ago

(using vim-plus-mode) If you don't go into insert mode, and simply replace or use dot-command, it messes up the numbers when you create multi-line comments. This clears when you move cursor, though, so not bad bug. I just don't know why the numbers would change from relative to absolute. Maybe it has something to do with the vim-plus-mode code, but since I'm not using a command to comment the code (rather I am just editing text normally), I presume it's a relative-numbers bug.

e.g. you have:

111 // code("I'm going to turned into a c-style comment);
  1 // code("I'm also going to be turned into a c-style comment);

Then, you want to convert this to c-style comment, so you add */ to the end of the second line. e.g.:

  1 // code("I'm going to turned into a c-style comment);
112  // code("I'm also going to be turned into a c-style comment); */

Then, you replace the second forward slash with an * using vim-plus-mode's r (replace command). e.g.:

111 /* code("I'm going to turned into a c-style comment);
112 // code("I'm also going to be turned into a c-style comment); */

Please note how the line numbers above went from relative (with the absolute where the cursor is) to absolute when the comments were converted from the // comments to multi-line /* */ comments.

This happens for as many lines as you comment. See screenshot below.

relnum_bug

justmoon commented 6 years ago

What's going on is that Atom is updating the line numbers after relative-numbers does, so you get the normal (absolute) numbers back until the next update.

This issue may have been fixed by #42, can you try again?