mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Replace previous character when inserting accented characters
This commit is contained in:
@@ -2,7 +2,7 @@ React = require 'react'
|
||||
{extend, flatten, toArray} = require 'underscore-plus'
|
||||
EditorComponent = require '../src/editor-component'
|
||||
|
||||
describe "EditorComponent", ->
|
||||
fdescribe "EditorComponent", ->
|
||||
[editor, component, node, lineHeightInPixels, charWidth, delayAnimationFrames, nextAnimationFrame] = []
|
||||
|
||||
beforeEach ->
|
||||
@@ -489,3 +489,13 @@ describe "EditorComponent", ->
|
||||
node.dispatchEvent(new WheelEvent('mousewheel', wheelDeltaX: -15, wheelDeltaY: -5))
|
||||
expect(verticalScrollbarNode.scrollTop).toBe 10
|
||||
expect(horizontalScrollbarNode.scrollLeft).toBe 15
|
||||
|
||||
describe "input events", ->
|
||||
it "inserts the typed character into the buffer", ->
|
||||
component.onInput('x')
|
||||
expect(editor.lineForBufferRow(0)).toBe 'xvar quicksort = function () {'
|
||||
|
||||
it "replaces the last character if replaceLastCharacter is true", ->
|
||||
component.onInput('u')
|
||||
component.onInput('ü', true)
|
||||
expect(editor.lineForBufferRow(0)).toBe 'üvar quicksort = function () {'
|
||||
|
||||
@@ -332,8 +332,12 @@ EditorCompont = React.createClass
|
||||
onInputBlurred: ->
|
||||
@setState(focused: false) unless document.activeElement is @getDOMNode()
|
||||
|
||||
onInput: (char, replaceLastChar) ->
|
||||
ReactUpdates.batchedUpdates => @props.editor.insertText(char)
|
||||
onInput: (char, replaceLastCharacter) ->
|
||||
{editor} = @props
|
||||
|
||||
ReactUpdates.batchedUpdates ->
|
||||
editor.selectLeft() if replaceLastCharacter
|
||||
editor.insertText(char)
|
||||
|
||||
onVerticalScroll: ->
|
||||
scrollTop = @refs.verticalScrollbar.getDOMNode().scrollTop
|
||||
|
||||
Reference in New Issue
Block a user