miketheman / language-diff

ARCHIVED - Atom editor itself is archived
https://atom.io/packages/language-diff
23 stars 12 forks source link

CSS class name conflict with Atom editor causes bug with text entry #2

Closed mdeaudelin closed 9 years ago

mdeaudelin commented 9 years ago

One of the styles used for unified diffs uses the CSS class "line-number". However, this same class is used internally by the Atom editor, and the styles applied include horizontal padding. This causes Atom to display the cursor in the wrong location and therefore text typed appears at the shifted by one position.

The bug can be seen in this video: https://goo.gl/photos/aHVTnZw6PTJAfSLp6

There is an easy fix: replace class "line-number" with something else, like "coordinates".

miketheman commented 9 years ago

@mdeaudelin That's a subtle, nasty little bug. Thanks for reporting, and the video shows the problem. Can you point me to where the atom editor is declaring this class?

mdeaudelin commented 9 years ago

I'm not familiar enough with Atom source code to point out in which file the conflicting class resides. However, I can see it when using the developer tools. In the DOM, it is defined inline in a <style> block immediately under the <atom-text-editor> element:

.line-number {
  white-space: nowrap;
  padding-left: .5em;
  opacity: 0.6;
}
miketheman commented 9 years ago

Thanks! I'll release a patch.