{"action":"opened","issue":{"url":"https://api.github.com/repos/bonecode/TBCEditor/issues/34","labels_url":"https://api.github.com/repos/bonecode/TBCEditor/issues/34/labels{/name}","comments_url":"https://api.github.com/repos/bonecode/TBCEditor/issues/34/comments","events_url":"https://api.github.com/repos/bonecode/TBCEditor/issues/34/events","html_url":"https://github.com/bonecode/TBCEditor/issues/34","id":75588267,"number":34,"title":"GetWordAtCursor interferes with upward selection","user":{"login":"EricGrange","id":2197210,"avatar_url":"https://avatars.githubusercontent.com/u/2197210?v=3","gravatar_id":"","url":"https://api.github.com/users/EricGrange","html_url":"https://github.com/EricGrange","followers_url":"https://api.github.com/users/EricGrange/followers","following_url":"https://api.github.com/users/EricGrange/following{/other_user}","gists_url":"https://api.github.com/users/EricGrange/gists{/gist_id}","starred_url":"https://api.github.com/users/EricGrange/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EricGrange/subscriptions","organizations_url":"https://api.github.com/users/EricGrange/orgs","repos_url":"https://api.github.com/users/EricGrange/repos","events_url":"https://api.github.com/users/EricGrange/events{/privacy}","received_events_url":"https://api.github.com/users/EricGrange/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-05-12T12:38:09Z","updated_at":"2015-05-12T12:38:09Z","closed_at":null,"body":"How to reproduce: use a TTimer, and in the timer event, call Editor.GetWordAtCursor\r\nNow you are extending the selection \"upward\" (either with the mouse or with the keyboard sfhit + arrow up), whenever the timer is triggered it will reset the selection.\r\n\r\nThe issue does not happen when selecting \"downward\"\r\n\r\nI suspect the issue is that GetSelectionBeginPosition/EndPosition do some \"normalization\", which is lost when assigning back the selection.\r\n\r\nA fix & improvement would be to extract the inner function 'DoGetSelectedText' into a method that would get text between begin/end positions (rather than just those of the selection), this way GetWordAtCursor (and other methods) could use it to extract text without having to involve the selection mechanism.\r\n"}}