Hello,

Sorry for the cross posting. I'm trying to make NVDA work with the Windows GUI version of Vim, GVIM, but I'm a little out of my depth here and was wondering if anyone could give me some pointers / suggestions.

In summary, I think the solution I'm looking for is a way to make GVIM set the Windows caret / cursor position to the position of the vim cursor, and then hide the Windows cursor. Anyone know how to do this? For more details, a lot more, see below (you have been warned).


NVDA is an awesome open source screen reader (a program enabling blind people to use a computer, see http://nvda-project.org/). VIM, for those who don't know, is possibly the best modal text editor ever! In my humble opinion of course.

Anyways, this is the situation. The contents of the vim editor window can be read with NVDA's flat screen review mode, but when interacting with VIM in any mode produces no speech output from NVDA. The main problem seems to be that VIM draws it's own caret or cursor and doesn't set or use a standard caret which NVDA would be able to pick up. Hence, when moving around text or editing inside VIM, NVDA doesn't know that it needs to try and speak something, and even if it could pick up that it needs to speak something it would not know what to speak.

Firstly, see: http://www.nvda-project.org/ticket/812 for a bug / feature request submitted a while back relating to this.

Secondly, this is what Bram had to say about it:
*** from Bram in response to my email  ***
Kerneels -

There was a change some time back that should improve it, I don't know
why this doesn't work for NVDA.  I think the solution would be to
position the caret but make the displayed cursor invisible.

> With the OLE interface to gvim a lot of info is available for another
> application such as a screen reader (provided the screen reader can make use
> of OLE interfaces via it's scripting fascilities such as is the case with
> JAWS.
>
> I've managed to get gvim working with the commercial screen reader JAWS for > Windows, which is a very expensive application, but the hack is not ideal.
>

Did you ask on the Vim maillist?  Perhaps someone has a hint how to make
it work.

- Bram
*** End of Bram's email ***

Thirdly, here is what NVDA has to say about firstly what it can see from plain old Notepad, and secondly what it can see from the GVIM (Insert key + F1):
*** Notepad ***
Developer info for navigator object:
name: None
role: ROLE_EDITABLETEXT
states: STATE_MULTILINE, STATE_FOCUSABLE, STATE_FOCUSED
Python object: <NVDAObjects.Dynamic_IAccessibleEditWindowNVDAObject object at 0x0412F2B0> Python class mro: (<class 'NVDAObjects.Dynamic_IAccessibleEditWindowNVDAObject'>, <class 'NVDAObjects.IAccessible.IAccessible'>, <class 'NVDAObjects.window.edit.Edit'>, <class 'NVDAObjects.behaviors.EditableTextWithAutoSelectDetection'>, <class 'NVDAObjects.behaviors.EditableText'>, <class 'editableText.EditableText'>, <class 'NVDAObjects.window.Window'>, <class 'NVDAObjects.NVDAObject'>, <class 'baseObject.ScriptableObject'>, <class 'baseObject.AutoPropertyObject'>, <type 'object'>)
description: None
location: (2, 48, 1003, 688)
value: u''
appModule: <'notepad' (appName u'notepad', process ID 4508) at address 41b4ff0>
TextInfo: <class 'NVDAObjects.window.edit.EditTextInfo'>
windowHandle: 1117804
windowClassName: u'Edit'
windowControlID: 15
windowStyle: 1344274692
windowThreadID: 5760
windowText: u'\x00'
IAccessibleObject: <POINTER(IAccessible) ptr=0x236c00 at 23bf210>
IAccessibleChildID: 0
IAccessible event parameters: windowHandle=1117804, objectID=-4, childID=0
IAccessible accRole: ROLE_SYSTEM_TEXT
IAccessible accState: STATE_SYSTEM_FOCUSED, STATE_SYSTEM_FOCUSABLE, STATE_SYSTEM_VALID (1048580)

***


And here is the situation inside GVIM:
*** GVIM ***
Developer info for navigator object:
name: u'[No Name] - GVIM'
role: ROLE_PANE
states: STATE_FOCUSABLE, STATE_FOCUSED
Python object: <NVDAObjects.IAccessible.IAccessible object at 0x022DC1D0>
Python class mro: (<class 'NVDAObjects.IAccessible.IAccessible'>, <class 'NVDAObjects.window.Window'>, <class 'NVDAObjects.NVDAObject'>, <class 'baseObject.ScriptableObject'>, <class 'baseObject.AutoPropertyObject'>, <type 'object'>)
description: None
location: (8, 56, 1012, 678)
value: None
appModule: <'gvim' (appName u'gvim', process ID 5420) at address 22dc3b0>
TextInfo: <class 'NVDAObjects.NVDAObjectTextInfo'>
windowHandle: 790142
windowClassName: u'Vim'
windowControlID: 921135
windowStyle: 349110272
windowThreadID: 4704
windowText: u'[No Name] - GVIM\x00'
IAccessibleObject: <POINTER(IAccessible) ptr=0x23e638 at 4299df0>
IAccessibleChildID: 0
IAccessible event parameters: windowHandle=790142, objectID=-4, childID=0
IAccessible accRole: ROLE_SYSTEM_CLIENT
IAccessible accState: STATE_SYSTEM_FOCUSED, STATE_SYSTEM_FOCUSABLE, STATE_SYSTEM_VALID (1048580)
***


The lines:
appModule: <'notepad' (appName u'notepad', process ID 4508) at address 41b4ff0>
and
appModule: <'gvim' (appName u'gvim', process ID 5420) at address 22dc3b0>

refers to application moduels, which are NVDA add ons to add / extend functionality for specific applications. Having the following code below for both application moduels result in only notepad beeping on caret change, while gvim as expected doesn'fire this event:
*** notepad.py / gvim.py ***
# gvim App Module for NVDA

import appModuleHandler
class AppModule(appModuleHandler.AppModule):
      def event_caret(self, obj, nextHandler):
          import tones
          tones.beep(550, 50)
          nextHandler()

***

Lastly, the NVDA log for something like the cmd.exe command, the Windows shellwhich I can presume also draws it's caret on it's onw follows below. The cmd.exe does work fine with NVDA.
*** NVDA log for cmd.exe ***
Developer info for navigator object:
name: u'C:\\WINDOWS\\system32\\cmd.exe'
role: ROLE_TERMINAL
states: STATE_FOCUSABLE, STATE_FOCUSED
Python object: <NVDAObjects.Dynamic_IAccessibleWinConsoleWindowNVDAObject object at 0x042E6350> Python class mro: (<class 'NVDAObjects.Dynamic_IAccessibleWinConsoleWindowNVDAObject'>, <class 'NVDAObjects.IAccessible.IAccessible'>, <class 'NVDAObjects.window.winConsole.WinConsole'>, <class 'NVDAObjects.behaviors.Terminal'>, <class 'NVDAObjects.behaviors.LiveText'>, <class 'NVDAObjects.behaviors.EditableTextWithoutAutoSelectDetection'>, <class 'editableText.EditableTextWithoutAutoSelectDetection'>, <class 'NVDAObjects.behaviors.EditableText'>, <class 'editableText.EditableText'>, <class 'NVDAObjects.window.Window'>, <class 'NVDAObjects.NVDAObject'>, <class 'baseObject.ScriptableObject'>, <class 'baseObject.AutoPropertyObject'>, <type 'object'>)
description: None
location: (116, 102, 800, 630)
value: None
appModule: <'appModuleHandler' (appName u'cmd', process ID 4112) at address 2261bf0>
TextInfo: <class 'winConsoleHandler.WinConsoleTextInfo'>
windowHandle: 1115290
windowClassName: u'ConsoleWindowClass'
windowControlID: 0
windowStyle: 351207424
windowThreadID: 928
windowText: u'C:\\WINDOWS\\system32\\cmd.exe\x00'
IAccessibleObject: <POINTER(IAccessible) ptr=0x247b70 at 4299b20>
IAccessibleChildID: 0
IAccessible event parameters: windowHandle=1115290, objectID=-4, childID=0
IAccessible accRole: ROLE_SYSTEM_CLIENT
IAccessible accState: STATE_SYSTEM_FOCUSED, STATE_SYSTEM_FOCUSABLE, STATE_SYSTEM_VALID (1048580)

***

If you've come this far, well done!!!

I'm sceptical that a solution for the problem involving an NVDA app module only would yeald any better result than what I've already done for JAWS. The JAWS solution is basically intercepting all VIM movement keys and then uses the OLE interface to VIM to get the current line or word or character to speak. This is far from ideal.

I'm thinking at this stage the best option would be to alter the gvim Windows GUI code and get it to set some Windows cursor which NVDA could query and be notified of caret movement. Then, on caret movement it should be possible to get the relevant text to speak using the same method the flat review uses. An app module specificly for gvim could then select what exactly to speak and how to speak it.

Maybe the gvim GUI could provide additional accessibility info via MSAA and / or the newer UIA framework so that future versions will work better on Win 7?

As a quick fix I tried winvi which seems to use a different GUI frontened which does seem t provide some caret detection (allow some caret detection by NVDA) but it's not the same as vim proper.... I've also tried the ViEmu plugin for VS and other MS products, which is very good but it also doesn't work with a screen reader.

As said, any help or pointers would be greatly appreciated!

Sorry for all the verbouse output, but more is better than less isn't it?

Regards,
Kerneels Roos

--
Kerneels Roos
Cell: +27 (0)82 309 1998
Skype: cornelis.roos

"There are only two kinds of programming languages in the world; those everyone 
complains about, and those nobody uses."

--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui