{"action":"created","issue":{"url":"https://api.github.com/repos/supercollider/supercollider/issues/1637","labels_url":"https://api.github.com/repos/supercollider/supercollider/issues/1637/labels{/name}","comments_url":"https://api.github.com/repos/supercollider/supercollider/issues/1637/comments","events_url":"https://api.github.com/repos/supercollider/supercollider/issues/1637/events","html_url":"https://github.com/supercollider/supercollider/issues/1637","id":99939779,"number":1637,"title":"Qt GUI: TextView's enterInterpretsSelection treats line wrapping like a hard line break","user":{"login":"jamshark70","id":318301,"avatar_url":"https://avatars.githubusercontent.com/u/318301?v=3","gravatar_id":"","url":"https://api.github.com/users/jamshark70","html_url":"https://github.com/jamshark70","followers_url":"https://api.github.com/users/jamshark70/followers","following_url":"https://api.github.com/users/jamshark70/following{/other_user}","gists_url":"https://api.github.com/users/jamshark70/gists{/gist_id}","starred_url":"https://api.github.com/users/jamshark70/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamshark70/subscriptions","organizations_url":"https://api.github.com/users/jamshark70/orgs","repos_url":"https://api.github.com/users/jamshark70/repos","events_url":"https://api.github.com/users/jamshark70/events{/privacy}","received_events_url":"https://api.github.com/users/jamshark70/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-09T23:25:34Z","updated_at":"2015-08-17T09:31:10Z","closed_at":null,"body":"```\r\n(\r\nt = TextView(nil, Rect(800, 200, 500, 400))\r\n.font_(Font.monospace(24))\r\n.string_(\"if(10.rand.even) { \\\"it was an even number\\\".postln } { \\\"it was an odd number\\\".postln };\")\r\n.select(2, 0)\r\n.front;\r\n)\r\n\r\nt.currentLine;\r\n```\r\n\r\nHere, `t.currentLine` retrieves the entire line, stopping only at newline characters. But, if you ctrl-return, SC will try to evaluate a single *visual* line of code -- stopping where the long line wraps at the right margin. So you get a parse error.\r\n\r\nThe reason is in QcTextEdit.cpp (https://github.com/supercollider/supercollider/blob/master/QtCollider/widgets/QcTextEdit.cpp, lines 182-185):\r\n\r\n```\r\n    if ( !c.hasSelection() ) {\r\n      c.movePosition( QTextCursor::StartOfLine );\r\n      c.movePosition( QTextCursor::EndOfLine, QTextCursor::KeepAnchor );\r\n    }\r\n```\r\n\r\n`StartOfLine` and `EndOfLine` must be going by visible, not textual, line breaks.\r\n\r\nBy contrast, `currentLine` returns `textCursor().block().text()` (line 105).\r\n\r\nShouldn't both use the same method to access the text? In particular, the enterInterpretsSelection behavior seems useless (and it's messing me up in my TextView-based live-coding interface...).\r\n\r\nI propose: https://github.com/jamshark70/supercollider-rename/commit/fe6bc709d496f51bd2133ebb2f4bd69ce270d8f9."},"comment":{"url":"https://api.github.com/repos/supercollider/supercollider/issues/comments/131743025","html_url":"https://github.com/supercollider/supercollider/issues/1637#issuecomment-131743025","issue_url":"https://api.github.com/repos/supercollider/supercollider/issues/1637","id":131743025,"user":{"login":"telephon","id":1810559,"avatar_url":"https://avatars.githubusercontent.com/u/1810559?v=3","gravatar_id":"","url":"https://api.github.com/users/telephon","html_url":"https://github.com/telephon","followers_url":"https://api.github.com/users/telephon/followers","following_url":"https://api.github.com/users/telephon/following{/other_user}","gists_url":"https://api.github.com/users/telephon/gists{/gist_id}","starred_url":"https://api.github.com/users/telephon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/telephon/subscriptions","organizations_url":"https://api.github.com/users/telephon/orgs","repos_url":"https://api.github.com/users/telephon/repos","events_url":"https://api.github.com/users/telephon/events{/privacy}","received_events_url":"https://api.github.com/users/telephon/received_events","type":"User","site_admin":false},"created_at":"2015-08-17T09:31:10Z","updated_at":"2015-08-17T09:31:10Z","body":">I propose: jamshark70@fe6bc70.\r\n\r\nlooks much better."}}