Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

characters in selecting range disapear #5087

Open
kyuwoo-choi opened this issue Nov 16, 2017 · 3 comments

Comments

Projects
None yet
3 participants
@kyuwoo-choi
Copy link

commented Nov 16, 2017

Browser: IE11

CodeMirror: 5.30.0 (I can reproduce this issue using demo on http://codemirror.net/ too at this moment)

Steps:

  1. write some korean words(may be multi type languages)
  2. backspace, delete some characters
  3. write korean characters again
  4. try select a range using mouse
  5. selected range deleted
  6. later on, the characters in range will be gone continually

ezgif com-add-text

@marijnh marijnh added the IME label Nov 20, 2017

@marijnh

This comment has been minimized.

Copy link
Member

commented Nov 20, 2017

Thanks for your report. I may be a while until someone sets up an IE11 with Korean IME to debug this. If you want to look into it yourself, the problem probably lies somewhere in the composition event handling in src/input/TextareaInput.js -- possibly it is failing to exit composition mode, either because the browser isn't sending the right events, or because of a bug in the CodeMirror code.

@kyuwoo-choi

This comment has been minimized.

Copy link
Author

commented Feb 1, 2018

@marijnh I've looked into it.
It seems that resetting textinput failed.
The TextareaInput.reset() is called on the step 4 above.
And cm.somethingSelected() returns false on IE while it does true on Chrome

reset(typing) {
if (this.contextMenuPending || this.composing) return
let cm = this.cm
if (cm.somethingSelected()) {
this.prevInput = ""
let content = cm.getSelection()
this.textarea.value = content
if (cm.state.focused) selectInput(this.textarea)
if (ie && ie_version >= 9) this.hasSelection = content
} else if (!typing) {
this.prevInput = this.textarea.value = ""
if (ie && ie_version >= 9) this.hasSelection = null
}
}

End up with passing condition below

if (text == prevInput && !cm.somethingSelected()) return false

and executing code below with wrong values.
runInOp(cm, () => {
applyTextInput(cm, text.slice(same), prevInput.length - same,
null, this.composing ? "*compose" : null)
// Don't leave long text in the textarea, since it makes further polling slow
if (text.length > 1000 || text.indexOf("\n") > -1) input.value = this.prevInput = ""
else this.prevInput = text
if (this.composing) {
this.composing.range.clear()
this.composing.range = cm.markText(this.composing.start, cm.getCursor("to"),
{className: "CodeMirror-composing"})
}
})

But I have no idea how to fix. may be similar to how you fix for #1730
I need you to guide me.

@adrianheine

This comment has been minimized.

Copy link
Contributor

commented Sep 7, 2018

This is one of many issues which are difficult to solve with the fundamental approach currently taken by CodeMirror.

We are working on a rewrite (CodeMirror 6) that will overhaul input handling and should address this issue, and we are currently raising money for this work: See the announcement for more information about the rewrite and a demo.

Note that CodeMirror 6 is by no means stable or usable in production, yet. It is highly unlikely that we pick up this issue for CodeMirror 5, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.