Use softWrapAtNewLines in moveDown and moveUp

/cc: @nathansobo
This commit is contained in:
Antonio Scandurra
2015-02-19 20:01:37 +01:00
parent d3b7ea475f
commit 79c16a0d00
4 changed files with 34 additions and 14 deletions

View File

@@ -271,7 +271,7 @@ class Cursor extends Model
{ row, column } = @getScreenPosition()
column = @goalColumn if @goalColumn?
@setScreenPosition({row: row - rowCount, column: column})
@setScreenPosition({row: row - rowCount, column: column}, wrapAtSoftNewlines: true)
@goalColumn = column
# Public: Moves the cursor down one screen row.
@@ -288,7 +288,7 @@ class Cursor extends Model
{ row, column } = @getScreenPosition()
column = @goalColumn if @goalColumn?
@setScreenPosition({row: row + rowCount, column: column})
@setScreenPosition({row: row + rowCount, column: column}, wrapAtSoftNewlines: true)
@goalColumn = column
# Public: Moves the cursor left one screen column.
@@ -304,14 +304,13 @@ class Cursor extends Model
else
{row, column} = @getScreenPosition()
originalRow = row
while columnCount > column and row > 0
columnCount -= column
column = @editor.lineTextForScreenRow(--row).length
columnCount-- # subtract 1 for the row move
column = column - columnCount
@setScreenPosition({row, column}, wrapAtSoftNewlines: originalRow == row)
@setScreenPosition({row, column})
# Public: Moves the cursor right one screen column.
#

View File

@@ -846,10 +846,10 @@ class DisplayBuffer extends Model
column = screenLine.clipScreenColumn(maxScreenColumn - 1)
else if screenLine.isColumnInsidePhantomToken(column)
if wrapAtSoftNewlines
column = screenLine.clipScreenColumn(0)
else
row--
column = @screenLines[row].getMaxScreenColumn() - 1
else
column = screenLine.clipScreenColumn(0)
else if wrapBeyondNewlines and column > maxScreenColumn and row < @getLastRow()
row++
column = 0