adobe / brackets

An open source code editor for the web, written in JavaScript, HTML and CSS.
http://brackets.io
MIT License
33.25k stars 7.63k forks source link

Text selection may be off when scrolling up and down in the editor. #8554

Closed RaymondLim closed 10 years ago

RaymondLim commented 10 years ago
  1. Open FindReplace.js from Brackets src folder.
  2. Try to search _getNextMatch.
  3. The first match is on line 155. Click next button to find next match.
  4. The second match is on line 294.
  5. Scroll up and down a few times until you see the second match has an extra highlight shows up above it as in the screenshot. If you can't reproduce it by scrolling up and down, try to hide and show the side bar or resize the window width a little bit and try step 5 again. highlightoff
RaymondLim commented 10 years ago

I tag [Themes] on the title since I can't reproduce it in sprint 41. My first git bisect try points to this commit c2d26f2e04f250778c9127e9a37012118066d5cc, but I'm not 100% sure since it is not easy to reproduce it. I first notice this when I was trying to select some word by double-clicking on the word, but end up getting incorrect highlight as shown in the screenshot below. Later I try with Find bar, and it is a bit easier to reproduce it. selectionoff1

redmunds commented 10 years ago

After trying everything mentioned here and seen in screen shots many times in random order, I was able to hit this once. But the state of the editor was not unforgiving (which was mentioned in standup, but is not mentioned anywhere in this issue). I simply clicked in page and it went away. So, this does not seem like a showstopper to me.

RaymondLim commented 10 years ago

@redmunds Actually, it's still a serious issue. Simply click in the page and the issue may go away. But if you scroll further down in the page and start selecting text with double-click, then you will see the highlight issue again. The issue may persist even if you reload Brackets.

dangoor commented 10 years ago

I was able to reproduce this easily. I had a hunch that this wasn't related to Themes and tried reverting CodeMirror to the version we used in 0.41: adobe/CodeMirror2@64bee58. With that version of CodeMirror, I can't reproduce this.

RaymondLim commented 10 years ago

Thanks @dangoor. I think you're right! CM updates for release 42 may be the culprit. I replaced with the version used in release 41 and can't reproduce it anymore.

marcelgerber commented 10 years ago

Bisecting CM points to https://github.com/marijnh/CodeMirror/commit/238b451301227eb8987a4204fc726e1f1207777f, which makes sense.

RaymondLim commented 10 years ago

Thanks @SAPlayer. Filed https://github.com/marijnh/CodeMirror/issues/2726 and added Tracking label.

RaymondLim commented 10 years ago

Adding viewportMargin: Infinity to CM instance does fix the issue, but CM documentation warns that it will have bad effects on performance of big documents.

redmunds commented 10 years ago

This CM change was backed out for 0.42. Changed Milestone to 0.43.

redmunds commented 10 years ago

FBNC to @RaymondLim