Merge pull request #1088 from atom/bo-changes-for-themes-with-padding

Handle themes with padding on the scroll view
This commit is contained in:
Ben Ogle
2013-11-06 14:38:34 -08:00
4 changed files with 10 additions and 9 deletions

View File

@@ -106,7 +106,7 @@
"tree-view": "0.28.0",
"visual-bell": "0.3.0",
"whitespace": "0.8.0",
"wrap-guide": "0.4.0",
"wrap-guide": "0.5.0",
"language-c": "0.2.0",
"language-clojure": "0.1.0",

View File

@@ -777,6 +777,9 @@ describe "Editor", ->
# resizes with the editor
expect(editor.width()).toBeLessThan(800)
editor.width(800)
editor.resize() # call to trigger the resize event.
region2 = selectionView.regions[1]
expect(region2.width()).toBe(editor.renderedLines.outerWidth())
region3 = selectionView.regions[2]

View File

@@ -773,6 +773,7 @@ class Editor extends View
@subscribe $(window), "resize.editor-#{@id}", =>
@setHeightInLines()
@setWidthInChars()
@updateLayerDimensions()
@requestDisplayUpdate()
@focus() if @isFocused
@@ -1156,7 +1157,7 @@ class Editor extends View
@verticalScrollbarContent.height(@layerHeight)
@scrollBottom(height) if @scrollBottom() > height
minWidth = @charWidth * @getMaxScreenLineLength() + 20
minWidth = Math.max(@charWidth * @getMaxScreenLineLength() + 20, @scrollView.width())
unless @layerMinWidth == minWidth
@renderedLines.css('min-width', minWidth)
@underlayer.css('min-width', minWidth)
@@ -1597,6 +1598,9 @@ class Editor extends View
returnLeft = null
offsetLeft = @scrollView.offset().left
paddingLeft = parseInt(@scrollView.css('padding-left'))
while textNode = iterator.nextNode()
content = textNode.textContent
@@ -1619,7 +1623,7 @@ class Editor extends View
MeasureRange.collapse()
rects = MeasureRange.getClientRects()
return 0 if rects.length == 0
left = rects[0].left - Math.floor(@scrollView.offset().left) + Math.floor(@scrollLeft())
left = rects[0].left - Math.floor(offsetLeft) + Math.floor(@scrollLeft()) - paddingLeft
if scopes?
cachedCharWidth = left - oldLeft

View File

@@ -101,12 +101,6 @@
overflow-x: hidden;
}
.editor .underlayer,
.editor .lines,
.editor .overlayer {
width: 100%;
}
.editor .underlayer {
z-index: 0;
position: absolute;