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

CJK support, Copy and Paste support #97

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

yoshiokatsuneo
Copy link

No description provided.

@yoshiokatsuneo
Copy link
Author

The patch support CJK languages(Japanese for me) for both input(IME) and output.
Also, copy and paste (Command-C,Command-V on Mac, or context menu on Windows) works.
I tested on Safari, Chrome, Firefox on Mac OS X, and IE, Edge, Chrome, Safari on Windows.

j8enu3mvpp

@yoshiokatsuneo
Copy link
Author

To test with tty.js, following patch need to be applied.

/usr/local/lib/node_modules/tty.js/static (master)$ diff -u tty.js-orig tty.js
--- tty.js-orig 2015-11-04 17:03:14.000000000 +0900
+++ tty.js  2015-11-04 17:06:53.000000000 +0900
@@ -302,7 +302,10 @@
 Window.prototype.focus = function() {
   // Restack
   var parent = this.element.parentNode;
-  if (parent) {
+  if (parent && this.element != parent.lastChild) {
+    if (Terminal.focus) {
+        Terminal.focus.blur();
+    }
     parent.removeChild(this.element);
     parent.appendChild(this.element);
   }
@@ -637,7 +640,9 @@
 Tab.prototype._focus = Tab.prototype.focus;

 Tab.prototype.focus = function() {
-  if (Terminal.focus === this) return;
+  var prevFocus = Terminal.focus;
+  this._focus();
+  if (prevFocus === this) return;

   var win = this.window;

@@ -661,7 +666,7 @@

   this.handleTitle(this.title);

-  this._focus();
+  // this._focus();

   win.focus();

@vincentwoo
Copy link

@chjj Is there any chance of taking a look at this PR? I'd really love for #87 to be addressed, and this seems to do it. I can't claim to understand how the CJK support in this PR works, though.

@e1ee1e11
Copy link

+1

@e1ee1e11
Copy link

Hi yoshiokatsuneo,
Thanks for your contributing. It will be helpful to me.
But I encounter bugs when using yoshiokatsuneo/term.js repository.

  1. The console will become wide after I paste (ctrl + v) a long enough CJK string.
  2. I keep pressing Backspace to delete CJK string , the first character '$' in the console will be deleted.
    My OS: Win10 and my browser: Chrome ver 48.
    Best regards.

@yoshiokatsuneo
Copy link
Author

@e1ee1e11 I'm sorry but I cannot reproduce the issue. I think it is nice to have a capture image...

@liuzheng
Copy link

I'm read and test his code, it's works for me and the code seems fine.

liuzheng added a commit to jumpserver/jumpserver that referenced this pull request Feb 24, 2016
Use yoshiokatsuneo's code, fix this bug. His idea is append a textarea and bind all click event on
it. That works for us

#59  chjj/term.js#97
westlywright added a commit to rancher/term.js that referenced this pull request Mar 4, 2016
westlywright added a commit to rancher/term.js that referenced this pull request Mar 4, 2016
@codehz
Copy link

codehz commented Mar 17, 2016

Typing CJK character's problems have not been fully resolved, when pressing the backspace key, you can not delete characters correctly.
image

@liuzheng
Copy link

@codehz This can't be happen... Please give a short code to reconstruct it. I am very curious about it

@codehz
Copy link

codehz commented Mar 17, 2016

@liuzheng712 你用的是什么版本的term.js,我用的是Rancher的,还有我用的是前面提到的TTY.js修改方式对tty.js打了补丁

Which term.js version are you using? I am using rancher/term.js . And I use the patch by yoshiokatsuneo for tty.js.

@liuzheng
Copy link

@codehz I'm only using yoshiokatsuneo's verstion, if it possible , Please create a git repository.
Maybe this bug comes from your back-end code?
which technical you use for the back-end?
My is tornado .

@codehz
Copy link

codehz commented Mar 17, 2016

@liuzheng712 I use tty.js, I will create a repo tomorrow(GMT+8)...

@liuzheng
Copy link

@codehz ok, BTW I'm Chinese~ I know you are Chinese too ... I'm in Shanghai~

@codehz
Copy link

codehz commented Mar 17, 2016

@liuzheng712 I have create a repo for this. latest commit is codehz/tty.js@d45942b
And I found this problem does not occur when I use bash shell, but other program will.
image
It seem this problem will occur when program direct read text from stdin.
image

@liuzheng
Copy link

@codehz
snip20160318_19
I cloned your code and run it, no bug....

I'm use OS X Yosemite 10.10.5, Chrome 49.0.2623.87 (64-bit)

@codehz
Copy link

codehz commented Mar 18, 2016

@liuzheng712 I'm use win 10, Chrome 49, (tty.js run on Linux vm) it may be the reason.

@codehz
Copy link

codehz commented Mar 18, 2016

@liuzheng712 Can you try to use some program to get text direct from stdin, I mean do not use readline library, just use scanf function or std::cin.
Some shell can handle backspace in their own way.
You can just copy that ,compile it, and run it.

#include <iostream>
int main() {
        char test[32];
        std::cin >> test;
        std::cout << test << std::endl;
        return 0;
}

I do not believe this issue depends on OS.

@huan
Copy link

huan commented Apr 30, 2016

@yoshiokatsuneo your cjk branch code works perfect, thanks! 👍

goranprijic added a commit to goranprijic/term.js that referenced this pull request May 17, 2016
goranprijic added a commit to goranprijic/tty.js that referenced this pull request May 18, 2016
… introduce new bugs and have some wierd behaviour together with GL. Other changes are related to native scroll and we don't need that right now
goranprijic added a commit to goranprijic/term.js that referenced this pull request May 18, 2016
…his is needed for having paste option in firefox"

This reverts commit 8036480.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants