Use a zero-width nbsp as our fold character

This commit is contained in:
Antonio Scandurra 2016-04-05 11:28:16 +02:00
parent a083a754a5
commit e6cfb8d587
2 changed files with 6 additions and 3 deletions

View File

@ -5352,7 +5352,7 @@ describe "TextEditor", ->
# folds are also duplicated
expect(editor.isFoldedAtScreenRow(5)).toBe(true)
expect(editor.isFoldedAtScreenRow(7)).toBe(true)
expect(editor.lineTextForScreenRow(7)).toBe " while(items.length > 0) {"
expect(editor.lineTextForScreenRow(7)).toBe " while(items.length > 0) {" + editor.displayLayer.foldCharacter
expect(editor.lineTextForScreenRow(8)).toBe " return sort(left).concat(pivot).concat(sort(right));"
it "duplicates all folded lines for empty selections on folded lines", ->

View File

@ -9,6 +9,8 @@ Decoration = require './decoration'
LayerDecoration = require './layer-decoration'
{isDoubleWidthCharacter, isHalfWidthCharacter, isKoreanCharacter, isWrapBoundary} = require './text-utils'
ZERO_WIDTH_NBSP = '\ufeff'
class BufferToScreenConversionError extends Error
constructor: (@message, @metadata) ->
super
@ -123,8 +125,9 @@ class DisplayBuffer extends Model
softWrapColumn: softWrapColumn
showIndentGuides: @config.get('editor.showIndentGuide', scope: scopeDescriptor)
tabLength: @getTabLength(),
ratioForCharacter: @ratioForCharacter.bind(this)
isWrapBoundary: isWrapBoundary
ratioForCharacter: @ratioForCharacter.bind(this),
isWrapBoundary: isWrapBoundary,
foldCharacter: ZERO_WIDTH_NBSP
})
updateAllScreenLines: ->