mirror of
https://github.com/atom/atom.git
synced 2026-02-09 06:05:11 -05:00
Disable auto-scroll and make overflow-x hidden when soft-wrap is enabled
This commit is contained in:
@@ -128,7 +128,9 @@ class Cursor extends View
|
||||
@editor.scrollTop(desiredTop)
|
||||
|
||||
autoScrollHorizontally: (position) ->
|
||||
charsInView = @editor.lines.width() / @width()
|
||||
return if @editor.softWrap
|
||||
|
||||
charsInView = @editor.width() / @width()
|
||||
maxScrollMargin = Math.floor((charsInView - 1) / 2)
|
||||
scrollMargin = Math.min(@editor.hScrollMargin, maxScrollMargin)
|
||||
margin = scrollMargin * @width()
|
||||
|
||||
@@ -230,10 +230,13 @@ class Editor extends View
|
||||
setSoftWrap: (@softWrap) ->
|
||||
@setMaxLineLength()
|
||||
if @softWrap
|
||||
@addClass 'soft-wrap'
|
||||
@_setMaxLineLength = => @setMaxLineLength()
|
||||
$(window).on 'resize', @_setMaxLineLength
|
||||
else
|
||||
$(window).off 'resize', @_setMaxLineLength
|
||||
@removeClass 'soft-wrap'
|
||||
|
||||
|
||||
clipScreenPosition: (screenPosition, options={}) ->
|
||||
@renderer.clipScreenPosition(screenPosition, options)
|
||||
|
||||
Reference in New Issue
Block a user