{"action":"created","issue":{"url":"https://api.github.com/repos/devtools-html/debugger.html/issues/686","repository_url":"https://api.github.com/repos/devtools-html/debugger.html","labels_url":"https://api.github.com/repos/devtools-html/debugger.html/issues/686/labels{/name}","comments_url":"https://api.github.com/repos/devtools-html/debugger.html/issues/686/comments","events_url":"https://api.github.com/repos/devtools-html/debugger.html/issues/686/events","html_url":"https://github.com/devtools-html/debugger.html/issues/686","id":175600135,"number":686,"title":"Breakpoints disappear right away if source file uses \\r\\n line breaks","user":{"login":"juliandescottes","id":1141550,"avatar_url":"https://avatars.githubusercontent.com/u/1141550?v=3","gravatar_id":"","url":"https://api.github.com/users/juliandescottes","html_url":"https://github.com/juliandescottes","followers_url":"https://api.github.com/users/juliandescottes/followers","following_url":"https://api.github.com/users/juliandescottes/following{/other_user}","gists_url":"https://api.github.com/users/juliandescottes/gists{/gist_id}","starred_url":"https://api.github.com/users/juliandescottes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juliandescottes/subscriptions","organizations_url":"https://api.github.com/users/juliandescottes/orgs","repos_url":"https://api.github.com/users/juliandescottes/repos","events_url":"https://api.github.com/users/juliandescottes/events{/privacy}","received_events_url":"https://api.github.com/users/juliandescottes/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-09-07T20:38:00Z","updated_at":"2016-09-07T20:51:32Z","closed_at":null,"body":"STRs:\r\n\r\n- open the debugger on https://dl.dropboxusercontent.com/u/17803671/devtools/debugger-test/index.html\r\n- set a breakpoint anywhere in the page\r\n\r\nAR: Breakpoint briefly appears, but disappears right away.\r\nER: Breakpoint should remain visible\r\n\r\nThis issue comes from the fact that this source file uses `\\r\\n` line breaks. \r\nYou can compare with https://dl.dropboxusercontent.com/u/17803671/devtools/debugger-test/index-proper-endings.html , which uses unix line breaks.\r\n\r\nThe breakpoint gets deleted in Editor::componentWillReceiveProps, when calling setSourceText -> setText.\r\nIn Editor.js::setText, normally we bail out if the text is the same as the current text of the editor: \r\n\r\n    if (text == this.editor.getText()) {\r\n      return;\r\n    }\r\n\r\nBy default codemirror normalizes line breaks to \\n , so here `this.editor.getText()` will differ from `text`. \r\nThen code mirror proceeds to redraw itself and removes the current markup containing the breakpoint. \r\n\r\nRe fixing this, we could \r\n- normalise line endings on our side as well\r\n- use the lineSeparator option from CodeMirror [1] : detect the file's line endings and set it in CodeMirror (but I guess we are sharing a single instance of code mirror for all sources? might be a bit tricky?) \r\n\r\nThe comment on Editor::setText mentions that \"comparing the source text is probably inefficient\", so maybe you already have other alternatives in mind, that would also take care of this issue?\r\n\r\n[1] https://codemirror.net/doc/manual.html#option_lineSeparator"},"comment":{"url":"https://api.github.com/repos/devtools-html/debugger.html/issues/comments/245414960","html_url":"https://github.com/devtools-html/debugger.html/issues/686#issuecomment-245414960","issue_url":"https://api.github.com/repos/devtools-html/debugger.html/issues/686","id":245414960,"user":{"login":"jlongster","id":17031,"avatar_url":"https://avatars.githubusercontent.com/u/17031?v=3","gravatar_id":"","url":"https://api.github.com/users/jlongster","html_url":"https://github.com/jlongster","followers_url":"https://api.github.com/users/jlongster/followers","following_url":"https://api.github.com/users/jlongster/following{/other_user}","gists_url":"https://api.github.com/users/jlongster/gists{/gist_id}","starred_url":"https://api.github.com/users/jlongster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlongster/subscriptions","organizations_url":"https://api.github.com/users/jlongster/orgs","repos_url":"https://api.github.com/users/jlongster/repos","events_url":"https://api.github.com/users/jlongster/events{/privacy}","received_events_url":"https://api.github.com/users/jlongster/received_events","type":"User","site_admin":false},"created_at":"2016-09-07T20:51:32Z","updated_at":"2016-09-07T20:51:32Z","body":"Thanks!! I think the ideal solution would be to avoid comparing the text. There should be a solution that doesn't require that, because it will be slow on large texts. We'll look into it."}}
{"actor":{"display_login":"jlongster"}}