ashersyed / macvim

Automatically exported from code.google.com/p/macvim
0 stars 0 forks source link

Keystrokes lost when using dictation software #293

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Go into insert mode (ie: press "i").
2. Dictate some text using MacSpeech Dictate or Dragon Dictate.

What is the expected output? What do you see instead?

Expected: the text that was recognized by the dictation software should be 
entered into the buffer.

Actual: many of the keystrokes are missing. For example, if I say:

“The quick brown fox jumped over the lazy dog.”

I'll actually get something like:

“Theqick o f mped over the lazy dog.”

or

“The quikbrown fox jped over the lazy dog.”

or

“Thqickbrn fox jumped over the lz dog.”

The problem isn't that the dictation software isn't recognizing what I'm 
saying. I have it set to also generate a Growl notification when it recognizes 
text, and it is recognizing the correct text. It seems that the
keystrokes being generated by the dictation software are getting lost somehow.

What version of MacVim and OS X are you using (see "MacVim->About MacVim"
and  "Apple Menu->About This Mac" menu items, e.g. "Snapshot 40, 10.5.6
Intel")?

Snapshot 50, 10.6.4 Intel

Please provide any additional information below.

FWIW, I reported this issue to Nuance/MacSpeech and they responded: "If an 
application does not follow certain apple text handling guidelines and/or 
interface with accessibility programming correctly, it will not work reliably 
with Dragon Dictate."

Original issue reported on code.google.com by laurence...@gmail.com on 21 Oct 2010 at 6:00

GoogleCodeExporter commented 9 years ago
I don't have access to any of the programs you mention so I'm not sure what to 
do about this.  Is there any chance Nuance can be more specific in what API 
they use to interact with other applications.  Maybe if I know how they add 
text to other apps I'll be able to figure out what goes wrong.

By the way: snapshot 50 is old -- 55 is the latest (although I don't think it 
will fix your problems but it is worth a try).

Original comment by bjorn.winckler@gmail.com on 21 Oct 2010 at 7:09

GoogleCodeExporter commented 9 years ago
Thanks. I just tried snapshot 55, and as you suspected, same problem.

I'll ask Nuance if they can provide more details about the API they're using.

Original comment by laurence...@gmail.com on 21 Oct 2010 at 10:09

GoogleCodeExporter commented 9 years ago
Good.  In the meantime could you please send me the debug logs when using the 
dictation software.  This is how to do that:

1. Quit Macvim (Select File -> Quit from menu)

2. Open Terminal and enter the following three lines carefully, one at a time 
(I assume you've put MacVim in the "Applications" folder):

defaults write org.vim.MacVim MMLogToStdErr 1
defaults write org.vim.MacVim MMLogLevel 7
/Applications/MacVim.app/Contents/MacOS/Vim -g -f 2> macvim.log

3. Use dictation software (make sure it fails) and Quit MacVim again (don't 
spend too much time in MacVim or the debug logs will be too big)

4. This will create a file called "macvim.log", please attach it here

5. Stop MacVim from logging by opening up Terminal again and typing the 
following two lines one at a time:

defaults delete org.vim.MacVim MMLogToStdErr
defaults delete org.vim.MacVim MMLogLevel

Original comment by bjorn.winckler@gmail.com on 22 Oct 2010 at 12:09

GoogleCodeExporter commented 9 years ago
Thanks for the detailed instructions. :-)

Ok, it's attached. I dictated “The quick brown fox jumped over the lazy 
dog”.

I'm sure you can understand this log far better than I could, but I couldn't 
resist taking a look. It looks promising. I see that all of the incoming 
keystrokes are showing up as “NSEvent: type=KeyDown” lines, but only a 
subset of these seem to be getting translated into 
“doKeyDown:keyCode.*key=” lines:

  grep  'NSEvent: type=KeyDown' macvim.log
  grep  'doKeyDown:keyCode.*key=' macvim.log

Original comment by laurence...@gmail.com on 22 Oct 2010 at 9:26

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for the log.  I can see what the problem is from this log:

Each time a "keypress event" (in this case generated by your dictation 
software) comes with a flag that indicates if the event was generated by a key 
being held down, i.e. if the key was "repeated".  The dictation software, for 
some reason, sets this flag when it really shouldn't.

When key events arrive faster than MacVim can process them it drops events _if_ 
the repeat flag is set.  Normally this is not a problem since as a user you 
don't notice a repeated key being dropped.  In this instance it is not so good 
but I argue that this is a problem with your dictation software.  Please ask 
them why they set the "repeat" flag (specifically, -[NSEvent isARepeat] returns 
"YES").

There is not really much I can do about this on the MacVim end.

Original comment by bjorn.winckler@gmail.com on 24 Oct 2010 at 4:09

GoogleCodeExporter commented 9 years ago
Thanks. I'll pass that information along to them. Hopefully they'll fix it.

Out of curiosity: what would be the consequence if MacVim never dropped events?

Original comment by laurence...@gmail.com on 24 Oct 2010 at 8:02