{"action":"created","issue":{"url":"https://api.github.com/repos/FXMisc/RichTextFX/issues/742","repository_url":"https://api.github.com/repos/FXMisc/RichTextFX","labels_url":"https://api.github.com/repos/FXMisc/RichTextFX/issues/742/labels{/name}","comments_url":"https://api.github.com/repos/FXMisc/RichTextFX/issues/742/comments","events_url":"https://api.github.com/repos/FXMisc/RichTextFX/issues/742/events","html_url":"https://github.com/FXMisc/RichTextFX/issues/742","id":320813574,"number":742,"title":"Triple click doesn't select paragraph; CaretSelectionBindImpl.moveToParEnd wrongly calculates position","user":{"login":"alesp","id":556182,"avatar_url":"https://avatars2.githubusercontent.com/u/556182?v=4","gravatar_id":"","url":"https://api.github.com/users/alesp","html_url":"https://github.com/alesp","followers_url":"https://api.github.com/users/alesp/followers","following_url":"https://api.github.com/users/alesp/following{/other_user}","gists_url":"https://api.github.com/users/alesp/gists{/gist_id}","starred_url":"https://api.github.com/users/alesp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alesp/subscriptions","organizations_url":"https://api.github.com/users/alesp/orgs","repos_url":"https://api.github.com/users/alesp/repos","events_url":"https://api.github.com/users/alesp/events{/privacy}","received_events_url":"https://api.github.com/users/alesp/received_events","type":"User","site_admin":false},"labels":[{"id":59076389,"url":"https://api.github.com/repos/FXMisc/RichTextFX/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-05-07T13:53:33Z","updated_at":"2018-05-07T16:00:53Z","closed_at":null,"author_association":"NONE","body":"Triple clicking a paragraph should select it. This works fine if you triple click the first paragraph. If you click any other paragraph, it will select some text before that paragraph.\r\n\r\nThis could be due to the fact that CaretSelectionBindImpl.moveToParEnd doesn't take into account that the cursor may not be in the first paragraph. It calculates new position as:\r\n\r\nint newPos = getArea().getParagraphLength(getParagraphIndex());\r\n\r\nThis position is ok _relative to_ the current paragraph, but the next line (moveTo) apparently expects _absolute position_:\r\n\r\nmoveTo(newPos, selectionPolicy);\r\n\r\nCompare that with moveTo in moveToParStart:\r\n\r\nmoveTo(getPosition() - getColumnPosition(), selectionPolicy);\r\n\r\nIn other words, moveTo in moveToParEnd should probably be:\r\n\r\nmoveTo(newPos + getPosition() - getColumnPosition(), selectionPolicy);"},"comment":{"url":"https://api.github.com/repos/FXMisc/RichTextFX/issues/comments/387113482","html_url":"https://github.com/FXMisc/RichTextFX/issues/742#issuecomment-387113482","issue_url":"https://api.github.com/repos/FXMisc/RichTextFX/issues/742","id":387113482,"user":{"login":"JordanMartinez","id":8413037,"avatar_url":"https://avatars2.githubusercontent.com/u/8413037?v=4","gravatar_id":"","url":"https://api.github.com/users/JordanMartinez","html_url":"https://github.com/JordanMartinez","followers_url":"https://api.github.com/users/JordanMartinez/followers","following_url":"https://api.github.com/users/JordanMartinez/following{/other_user}","gists_url":"https://api.github.com/users/JordanMartinez/gists{/gist_id}","starred_url":"https://api.github.com/users/JordanMartinez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JordanMartinez/subscriptions","organizations_url":"https://api.github.com/users/JordanMartinez/orgs","repos_url":"https://api.github.com/users/JordanMartinez/repos","events_url":"https://api.github.com/users/JordanMartinez/events{/privacy}","received_events_url":"https://api.github.com/users/JordanMartinez/received_events","type":"User","site_admin":false},"created_at":"2018-05-07T16:00:53Z","updated_at":"2018-05-07T16:00:53Z","author_association":"MEMBER","body":"By the way, this bug can be fixed by overriding the default behavior\r\n````java\r\nNodes.addInputMap(area, InputMap.consume(\r\n    mouseClick().onlyIf(e -> e.getButton == PRIMARY && e.getClickCount == 3,\r\n    e -> {\r\n        CaretSelectionBind c = area.getCaretSelectionBind();\r\n        int paragraphLength = area.getParagraphLength(c.getParagraphIndex());\r\n        SelectionPolicy selPolicy = SelectionPolicy.ADJUST // might be Extend for mac users\r\n        area.moveTo(c.getPosition() - c.getColumnPosition() + parLength, selPolicy);\r\n})\r\n````"}}
{"actor":{"display_login":"JordanMartinez"}}