justmoon / relative-numbers

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

Additional artifact in gutter #34

Closed efleming969 closed 7 years ago

efleming969 commented 7 years ago

I don't know if this is related to the plugin, but a rogue number shows up in the gutter and it goes away if I disable the plugin.

See the 1 next to the closing curly brace.

screen shot 2017-03-17 at 7 14 03 pm
elclanrs commented 7 years ago

Looks like there are two elements with the class line-number and that creates a conflict. I was able to fix this temporarily by overriding line 109 in line-number-view.coffee to query a more specific selector:

# lineNumberElements = @editorView.rootElement?.querySelectorAll('.line-number')
lineNumberElements = @editorView.rootElement?.querySelectorAll('.line-numbers .line-number')
thancock20 commented 7 years ago

I came here for the same issue, and I can verify that the solution from @elclanrs worked for me as well.

elclanrs commented 7 years ago

@justmoon, if you think this is the right solution I can submit a PR. I just don't know the codebase enough to tell if there is a better way...

fl0w commented 7 years ago

Oh, I was going crazy, it came post an update and I thought it was a feature.

fuddmain commented 7 years ago

I had the same issue. I assume everyone here updated to the latest linter-default-ui. That's when it showed up for me. Adding this to styles.less solved it:

.linter-cursor-line .relative { display: none !important;}

Cheers.

fuddmain commented 7 years ago

Taking a real quick look, linter-ui-default is adding a gutter to the editor, Then, either this package, or the code for the Atom gutter is inserting the line-number elements into any .gutter class. So, the main gutter and the linter gutter get line-numbers.

Seems like @elclanrs is on the right track for a permanent solution. This package can be more specific as to which gutter gets the relative-numbers.

nwaywood commented 7 years ago

Is it just me or does @fuddmain's solution not fix the problem in files with less than 10 lines (in insert mode)?

despairblue commented 7 years ago

@nwaywood it's not just you.

fuddmain commented 7 years ago

@nwaywood @despairblue

Didn't show for me because I've done a bunch of gutter tweaking. I rolled back a bunch of the tweaks and saw what you describe. I had a min-width set for the gutter which hid the problem.

Taking another quick look, I think this is the best solution:

.linter-row { .absolute, .relative { display:none; } }

YMMV

Cheers

nwaywood commented 7 years ago

Thanks @fuddmain 😄

that didn't exactly fix the problem for me, but when I added the !important flag it did.

.linter-row { .absolute, .relative { display:none !important; } }