Add autoWidth to TextEditor

This commit is contained in:
Antonio Scandurra
2016-08-17 14:10:11 +02:00
parent f376316d60
commit 683bf37907
3 changed files with 20 additions and 1 deletions

View File

@@ -127,7 +127,7 @@ class TextEditor extends Model
@softTabs, @firstVisibleScreenRow, @firstVisibleScreenColumn, initialLine, initialColumn, tabLength,
@softWrapped, @decorationManager, @selectionsMarkerLayer, @buffer, suppressCursorCreation,
@mini, @placeholderText, lineNumberGutterVisible, @largeFileMode, @clipboard,
@assert, grammar, @showInvisibles, @autoHeight, @scrollPastEnd, @editorWidthInChars,
@assert, grammar, @showInvisibles, @autoHeight, @autoWidth, @scrollPastEnd, @editorWidthInChars,
@tokenizedBuffer, @displayLayer, @invisibles, @showIndentGuide, @softWrapHangingIndentLength,
@softWrapped, @softWrapAtPreferredLineLength, @preferredLineLength
} = params
@@ -144,6 +144,7 @@ class TextEditor extends Model
@selections = []
@hasTerminatedPendingState = false
@autoWidth ?= false
@autoHeight ?= true
@mini ?= false
@scrollPastEnd ?= true
@@ -320,6 +321,10 @@ class TextEditor extends Model
@autoHeight = value
@editorElement?.didChangeAutoHeight()
when 'autoWidth'
if value isnt @autoWidth
@autoWidth = value
@presenter?.didChangeAutoWidth()
else
throw new TypeError("Invalid TextEditor parameter: '#{param}'")
@@ -3552,6 +3557,9 @@ class TextEditor extends Model
Grim.deprecate("This is now a view method. Call TextEditorElement::getWidth instead.")
@width
getAutoWidth: ->
@autoWidth
# Experimental: Scroll the editor such that the given screen row is at the
# top of the visible area.
setFirstVisibleScreenRow: (screenRow, fromView) ->