{"action":"created","issue":{"url":"https://api.github.com/repos/nvaccess/nvda/issues/7441","repository_url":"https://api.github.com/repos/nvaccess/nvda","labels_url":"https://api.github.com/repos/nvaccess/nvda/issues/7441/labels{/name}","comments_url":"https://api.github.com/repos/nvaccess/nvda/issues/7441/comments","events_url":"https://api.github.com/repos/nvaccess/nvda/issues/7441/events","html_url":"https://github.com/nvaccess/nvda/issues/7441","id":245303271,"number":7441,"title":"Display model bug with negative coordinates","user":{"login":"leonardder","id":3049216,"avatar_url":"https://avatars1.githubusercontent.com/u/3049216?v=4","gravatar_id":"","url":"https://api.github.com/users/leonardder","html_url":"https://github.com/leonardder","followers_url":"https://api.github.com/users/leonardder/followers","following_url":"https://api.github.com/users/leonardder/following{/other_user}","gists_url":"https://api.github.com/users/leonardder/gists{/gist_id}","starred_url":"https://api.github.com/users/leonardder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leonardder/subscriptions","organizations_url":"https://api.github.com/users/leonardder/orgs","repos_url":"https://api.github.com/users/leonardder/repos","events_url":"https://api.github.com/users/leonardder/events{/privacy}","received_events_url":"https://api.github.com/users/leonardder/received_events","type":"User","site_admin":false},"labels":[{"id":284600516,"url":"https://api.github.com/repos/nvaccess/nvda/labels/Display%20model","name":"Display model","color":"ffffff","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-07-25T06:57:50Z","updated_at":"2017-07-25T07:20:08Z","closed_at":null,"body":"CC @MichaelDCurran\r\n\r\n### Steps to reproduce:\r\n1. Start Wordpad\r\n2. Retrieve the location for the foreground object. Here, it is (-8, -8, 1382, 744)\r\n3. Create a DisplayModelTextInfo for the foreground object\r\n    ```\r\n    >>> dm=displayModel.DisplayModelTextInfo(fg,\"all\")\r\n    ```\r\n4. List all the rectangles with a left coordinate >2000\r\n    ```\r\n    >>> [rect for rect in dm._storyFieldsAndRects[1] if rect[0]>2000]\r\n    ```\r\n\r\n### Actual behavior:\r\nThe following rectangle is returned: (65528, 159, 1374, 708)\r\n\r\n### Expected behavior:\r\nThis rectangle should be (-8, 159, 1374, 708)\r\n\r\n### Technical background\r\nThe list of rectangles is provided as a wide character string by NVDAHelper. These wide characters are converted back to int using ord in displayModel.getWindowTextInRect, however this assumes that the resulting coords should be unsigned ints, which is incorrect.\r\n\r\n### System configuration:\r\nNVDA version: Next, but this will also occur in 2017.2 as this code is untouched for years\r\nNVDA Installed\r\nWindows 10 Creators update Dutch, DPI set at 100%"},"comment":{"url":"https://api.github.com/repos/nvaccess/nvda/issues/comments/317652192","html_url":"https://github.com/nvaccess/nvda/issues/7441#issuecomment-317652192","issue_url":"https://api.github.com/repos/nvaccess/nvda/issues/7441","id":317652192,"user":{"login":"michaelDCurran","id":14154141,"avatar_url":"https://avatars0.githubusercontent.com/u/14154141?v=4","gravatar_id":"","url":"https://api.github.com/users/michaelDCurran","html_url":"https://github.com/michaelDCurran","followers_url":"https://api.github.com/users/michaelDCurran/followers","following_url":"https://api.github.com/users/michaelDCurran/following{/other_user}","gists_url":"https://api.github.com/users/michaelDCurran/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelDCurran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelDCurran/subscriptions","organizations_url":"https://api.github.com/users/michaelDCurran/orgs","repos_url":"https://api.github.com/users/michaelDCurran/repos","events_url":"https://api.github.com/users/michaelDCurran/events{/privacy}","received_events_url":"https://api.github.com/users/michaelDCurran/received_events","type":"User","site_admin":false},"created_at":"2017-07-25T07:20:08Z","updated_at":"2017-07-25T07:20:08Z","body":"We need something like:\n```\ndef wchartoint(c):\n     i=ord(c)\n     return i if i<32768 else i-65536\n  ```\n\nAnd use that in place of all calls to ord on line 171 of displayModel.py\n\nWe could possibly use struct.unpack or ctypes casting, but that would \ninvolve either converting the string or accessing its raw pointer etc.\n\nIf you can validate that this gives the correct results, feel free to \ncreate a pr.\n"}}
{"actor":{"display_login":"michaelDCurran"}}