mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Show IME's composition text on screen.
The composition text should only show on screen temporarily and gets disappered when input is cancelled or done. We simply mark the composition as selected, so it can not only indicate this is composition text instead of normal text, but also updates the composition without adding new interfaces.
This commit is contained in:
@@ -699,7 +699,18 @@ class Editor extends View
|
||||
|
||||
handleImeEvents: ->
|
||||
@on 'cursor:moved', =>
|
||||
@hiddenInput.offset(@getCursorView().offset())
|
||||
cursorView = @getCursorView()
|
||||
@hiddenInput.offset(cursorView.offset()) if cursorView.is(':visible')
|
||||
|
||||
startScreenPosition = null
|
||||
@hiddenInput.on 'compositionstart', =>
|
||||
startScreenPosition = @getCursorScreenPosition()
|
||||
@hiddenInput.on 'compositionupdate', (e) =>
|
||||
@insertText(e.originalEvent.data)
|
||||
@selectToScreenPosition(startScreenPosition)
|
||||
@hiddenInput.on 'compositionend', =>
|
||||
@delete()
|
||||
startScreenPosition = null
|
||||
|
||||
selectOnMousemoveUntilMouseup: ->
|
||||
lastMoveEvent = null
|
||||
|
||||
Reference in New Issue
Block a user