From 4603c34b1017fafc8773801f8350f19ab9f518ca Mon Sep 17 00:00:00 2001 From: nightwing Date: Thu, 1 Jan 2015 01:58:19 +0400 Subject: [PATCH] workaround for webkit focus bug --- lib/ace/keyboard/textinput.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/ace/keyboard/textinput.js b/lib/ace/keyboard/textinput.js index 605f5b8e..faf73a4a 100644 --- a/lib/ace/keyboard/textinput.js +++ b/lib/ace/keyboard/textinput.js @@ -102,6 +102,11 @@ var TextInput = function(parentNode, host) { function resetSelection(isEmpty) { if (inComposition) return; + + // this prevents infinite recursion on safari 8 + // see https://github.com/ajaxorg/ace/issues/2114 + inComposition = true; + if (inputHandler) { selectionStart = 0; selectionEnd = isEmpty ? 0 : text.value.length - 1; @@ -113,6 +118,8 @@ var TextInput = function(parentNode, host) { try { text.setSelectionRange(selectionStart, selectionEnd); } catch(e){} + + inComposition = false; } function resetValue() {