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

use lastSelectedText instead of lastkey #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Wikunia
Copy link

@Wikunia Wikunia commented Feb 8, 2015

This maybe solves #2 (at least for me)

@technet
Copy link
Owner

technet commented Feb 28, 2015

This change won't work if you click Ctrl+C quickly, it works if you do it slowly one by one, that's why I had to write bit of complex logic inside key even handler. I tried getting your code and it works only if you presse Ctrl+C then release both keys and so on.

@Wikunia
Copy link
Author

Wikunia commented Feb 28, 2015

What do you mean with: This change won't work if you click Ctrl+C quickly,? Do you have an idea why it doesn't work when you do it "quickly"?

@technet
Copy link
Owner

technet commented Feb 28, 2015

I meant if you press Ctrl+C in quick succession to copy different parts of the document (with the help of mouse - select -> copy, select -> copy etc) key release order could be first and then . That's why I had to keep a flag for ctrl key which toggles when the ctrl up and down events occurred.

if (event.keyCode === KeyEvent.DOM_VK_CONTROL) { 
71             if (event.type === KEY_EVENT_TYPE_DOWN) { 
72                 lastKey = 1; 
73             } else if (event.type === KEY_EVENT_TYPE_UP) { 
74                 lastKey = -1; 
75             } 

Initially I also tried using current state of keyevent which was the simplest way thinking it would work with the speed of normal multiple Ctrl+C events, but it didn't.

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.

2 participants