From 09bc6119d4ddb9c3ce2919528dfcf4cc3901b2f6 Mon Sep 17 00:00:00 2001 From: nightwing Date: Tue, 30 Apr 2013 12:19:04 +0400 Subject: [PATCH 1/4] fix ime issues --- lib/ace/keyboard/textinput.js | 19 ++++++++++++++++--- lib/ace/virtual_renderer.js | 2 +- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/lib/ace/keyboard/textinput.js b/lib/ace/keyboard/textinput.js index 591c6e31..e23fa565 100644 --- a/lib/ace/keyboard/textinput.js +++ b/lib/ace/keyboard/textinput.js @@ -231,6 +231,7 @@ var TextInput = function(parentNode, host) { afterContextMenu = false; }; var onInput = function(e) { + // console.log("onInput", inComposition) if (inComposition) return; var data = text.value; @@ -349,6 +350,8 @@ var TextInput = function(parentNode, host) { // COMPOSITION var onCompositionStart = function(e) { + if (inComposition) return; + // console.log("onCompositionStart", inComposition) inComposition = {}; host.onCompositionStart(); setTimeout(onCompositionUpdate, 0); @@ -362,6 +365,7 @@ var TextInput = function(parentNode, host) { }; var onCompositionUpdate = function() { + // console.log("onCompositionUpdate", inComposition && JSON.stringify(text.value)) if (!inComposition) return; host.onCompositionUpdate(text.value); if (inComposition.lastValue) @@ -378,19 +382,28 @@ var TextInput = function(parentNode, host) { }; var onCompositionEnd = function(e) { + // console.log("onCompositionEnd", inComposition &&inComposition.lastValue) var c = inComposition; inComposition = false; var timer = setTimeout(function() { var str = text.value.replace(/\x01/g, ""); - if (!inComposition && str == c.lastValue) + console.log(str, c.lastValue) + if (inComposition) + return + else if (str == c.lastValue) resetValue(); + else if (!c.lastValue && str) { + resetValue(); + sendText(str); + } }); inputHandler = function compositionInputHandler(str) { + // console.log("onCompositionEnd", str, c.lastValue) clearTimeout(timer); str = str.replace(/\x01/g, ""); if (str == c.lastValue) return ""; - if (!str) { + if (str) { if (c.lastValue) host.undo(); } @@ -398,7 +411,7 @@ var TextInput = function(parentNode, host) { } host.onCompositionEnd(); host.removeListener("mousedown", onCompositionEnd); - if (e.type == "compositionend") { + if (e.type == "compositionend" && c.range) { host.selection.setRange(c.range); } }; diff --git a/lib/ace/virtual_renderer.js b/lib/ace/virtual_renderer.js index 4dae29bb..5fc902ac 100644 --- a/lib/ace/virtual_renderer.js +++ b/lib/ace/virtual_renderer.js @@ -545,7 +545,7 @@ var VirtualRenderer = function(container, theme) { var w = this.characterWidth; if (this.$composition) { var val = this.textarea.value.replace(/^\x01+/, ""); - w *= this.session.$getStringScreenWidth(val)[0]; + w *= (this.session.$getStringScreenWidth(val)[0]+2); h += 2; posTop -= 1; } From 6d4b91f89fcb54066c9daddcc9ea92f81996a4c9 Mon Sep 17 00:00:00 2001 From: nightwing Date: Tue, 30 Apr 2013 13:29:29 +0400 Subject: [PATCH 2/4] linux ime --- lib/ace/keyboard/textinput.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/ace/keyboard/textinput.js b/lib/ace/keyboard/textinput.js index e23fa565..e7fbab5b 100644 --- a/lib/ace/keyboard/textinput.js +++ b/lib/ace/keyboard/textinput.js @@ -387,7 +387,7 @@ var TextInput = function(parentNode, host) { inComposition = false; var timer = setTimeout(function() { var str = text.value.replace(/\x01/g, ""); - console.log(str, c.lastValue) + // console.log(str, c.lastValue) if (inComposition) return else if (str == c.lastValue) @@ -403,10 +403,8 @@ var TextInput = function(parentNode, host) { str = str.replace(/\x01/g, ""); if (str == c.lastValue) return ""; - if (str) { - if (c.lastValue) - host.undo(); - } + if (c.lastValue) + host.undo(); return str; } host.onCompositionEnd(); From a443507f0018fcd9fa79f2d96f596ce18bf98550 Mon Sep 17 00:00:00 2001 From: nightwing Date: Tue, 30 Apr 2013 13:46:44 +0400 Subject: [PATCH 3/4] add more sites --- index.html | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 5b09d666..49f4634b 100644 --- a/index.html +++ b/index.html @@ -947,7 +947,7 @@ oop.inherits(FoldMode, BaseFoldMode);
  • + style="position: relative; left: -5px; width: 111px;top: 20px;"> Decor
  • @@ -956,7 +956,7 @@ oop.inherits(FoldMode, BaseFoldMode); Divshot
  • - Codio
  • @@ -972,6 +972,18 @@ oop.inherits(FoldMode, BaseFoldMode); style="position: relative; left: 4px; width: 96px;top: -17px;"> MultiPlay.io +
  • + + Codeshare.io +
  • +
  • + + Runnable +
  • +
  • + + DocsCamp +
  • Sky Edit
  • From af77bb00f86b83109d866748965f519620274f90 Mon Sep 17 00:00:00 2001 From: nightwing Date: Tue, 30 Apr 2013 16:42:38 +0400 Subject: [PATCH 4/4] increase requirejs waitSeconds --- kitchen-sink.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kitchen-sink.html b/kitchen-sink.html index 0e91e619..90f1827e 100644 --- a/kitchen-sink.html +++ b/kitchen-sink.html @@ -294,7 +294,8 @@ baseUrl: window.location.protocol + "//" + window.location.host + window.location.pathname.split("/").slice(0, -1).join("/"), paths: { ace: "lib/ace" - } + }, + waitSeconds: 30 };