mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Subtract the scrollbar's width when calculating editor's width in chars
Fixes #1342
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user