Fix bug where you can't move rightward over fold placeholders

Fold placeholders needed to be real token objects so their screen / buffer deltas would be defined in ScreenLineFragment.proto.translateColumn
This commit is contained in:
Nathan Sobo
2012-04-06 15:37:27 -06:00
parent 47685aab7b
commit 54396a7646
4 changed files with 10 additions and 4 deletions

View File

@@ -57,7 +57,7 @@ class Point
isEqual: (other) ->
other = Point.fromObject(other)
@compare(other) == 0
@row == other.row and @column == other.column
isLessThan: (other) ->
@compare(other) < 0
@@ -75,4 +75,4 @@ class Point
"(#{@row}, #{@column})"
toString: ->
"#{@row},#{@column}"
"#{@row},#{@column}"

View File

@@ -6,6 +6,7 @@ EventEmitter = require 'event-emitter'
Range = require 'range'
Fold = require 'fold'
ScreenLineFragment = require 'screen-line-fragment'
Token = require 'token'
foldPlaceholderLength = 3
module.exports =
@@ -193,7 +194,7 @@ class Renderer
folds.sort (a, b) -> a.compare(b)
buildFoldPlaceholder: (fold) ->
token = { value: '...', type: 'fold-placeholder', fold, isAtomic: true }
token = new Token(value: '...', type: 'fold-placeholder', fold: fold, isAtomic: true)
new ScreenLineFragment([token], token.value, [0, token.value.length], fold.getRange().toDelta())
screenLineRangeForBufferRange: (bufferRange) ->

View File

@@ -4,7 +4,7 @@ class Token
type: null
isAtomic: null
constructor: ({@value, @type, @isAtomic, @bufferDelta}) ->
constructor: ({@value, @type, @isAtomic, @bufferDelta, @fold}) ->
@screenDelta = @value.length
@bufferDelta ?= @screenDelta