Subtract the scrollbar's width when calculating editor's width in chars

Fixes #1342
This commit is contained in:
Nathan Sobo
2014-03-04 15:46:07 -07:00
parent 6242bd7eb7
commit 834dd963ef

View File

@@ -667,11 +667,15 @@ class EditorView extends View
@editor.setSoftWrap(not @editor.getSoftWrap())
calculateWidthInChars: ->
Math.floor(@scrollView.width() / @charWidth)
Math.floor((@scrollView.width() - @getScrollbarWidth()) / @charWidth)
calculateHeightInLines: ->
Math.ceil($(window).height() / @lineHeight)
getScrollbarWidth: ->
scrollbarElement = @verticalScrollbar[0]
scrollbarElement.offsetWidth - scrollbarElement.clientWidth
# Public: Enables/disables soft wrap on the editor.
#
# softWrap - A {Boolean} which, if `true`, enables soft wrap