Closed Bug 1006108 Opened 12 years ago Closed 12 years ago

DXR sometimes doesn't scroll to the highlighted area.

Categories

(Webtools Graveyard :: DXR, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: janx, Assigned: vedad)

Details

I'm currently working on code-highlighter.js and will submit a fix for this bug on my next pull request. I still haven't got my editbugs privileges, so it would be nice if someone assigned me.
Assignee: nobody → vedadux
I opened a pull request here: https://github.com/mozilla/dxr/pull/319
Commits pushed to master at https://github.com/mozilla/dxr https://github.com/mozilla/dxr/commit/bb690f4ab91955f3f94092ec4d2fe9d67cbdfdb9 Redoing code-highlighter.js and dxr.css for better file display Fixes bugs: 1006108 and 1055142 Here is how things used to work: The file would be displayed as a table with two overlaying columns. Clicking the line number would change that line numbers background color, making it seem as if the user highlighted the code. That lead following problems: - long lines would be only partially highlighted - line numbers with more than 3 digits aren't displayed properly I fixed the above problems by standardisning the columns in a similar fashion like search results and tweaking the js to highlight both line number and code. The auto scrolling didn't work properly because of bad handling of strings and integers. I cleared that up and changed the way the url's are changed and processed. -----Changes to code-highlighter.js----- Added function sortRangeAsc which sorts selection ranges both as strings or arrays. In function generateSelectedArrays: Changed the way multiSelected and singleSelected get their value (employed jQuery). Made the function return sortedsingleLinesArray and rangesArray. In function setWindowHash: Removed variables singles and ranges, which are no longer used for the display of the hash. Added a loop that eliminates singleLines which are already a part of a range. Added a loop that adds lines and ranges to the hash in order - example now: #12-15,17,20-25,30-33,42 - example before: #17,42,12-15,20-25,30-33 In function getSortedHashLines: Seperated reCleanup. Added cleaning of whitespace upfront. Changed the way ranges are sorted form string sorting to newly added function sortRangeAsc. Changed the way a range is added to rangesArray in order to account for backward ranges (150-120 and such). Made firstRange take an array as value instead of a string so that it's value can be compared and scrolling made possible. Modified the way highlights is cleaned form trash. If something slips through the process above added testing for NaN in highlights. Repaired the if block that determines the position to be scrolled to. Made the function return singleLinesArray and rangesArray for later convenience. Big changes to the .line-number onClick events: Moved the value assignment for variables to take place before the if block to avoid repetition. lastSelected is now lastSelectedLine and includes both a .line-number and code element. selected is replaced by selectedLineNums and selectedLineCode. https://github.com/mozilla/dxr/commit/815955cc23038c88716aa6d09291311c843afd0c Fix line-number overlap and scroll-to-highlight failure. Fix bug 1006108. Fix bug 1055142. Close #319.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Commits pushed to es at https://github.com/mozilla/dxr https://github.com/mozilla/dxr/commit/bb690f4ab91955f3f94092ec4d2fe9d67cbdfdb9 Redoing code-highlighter.js and dxr.css for better file display https://github.com/mozilla/dxr/commit/815955cc23038c88716aa6d09291311c843afd0c Fix line-number overlap and scroll-to-highlight failure. Fix bug 1006108. Fix bug 1055142. Close #319.
Product: Webtools → Webtools Graveyard
You need to log in before you can comment on or make changes to this bug.