{"action":"created","issue":{"url":"https://api.github.com/repos/arduino/Arduino/issues/4363","repository_url":"https://api.github.com/repos/arduino/Arduino","labels_url":"https://api.github.com/repos/arduino/Arduino/issues/4363/labels{/name}","comments_url":"https://api.github.com/repos/arduino/Arduino/issues/4363/comments","events_url":"https://api.github.com/repos/arduino/Arduino/issues/4363/events","html_url":"https://github.com/arduino/Arduino/pull/4363","id":124360423,"number":4363,"title":"Editor cleanup","user":{"login":"matthijskooijman","id":194491,"avatar_url":"https://avatars.githubusercontent.com/u/194491?v=3","gravatar_id":"","url":"https://api.github.com/users/matthijskooijman","html_url":"https://github.com/matthijskooijman","followers_url":"https://api.github.com/users/matthijskooijman/followers","following_url":"https://api.github.com/users/matthijskooijman/following{/other_user}","gists_url":"https://api.github.com/users/matthijskooijman/gists{/gist_id}","starred_url":"https://api.github.com/users/matthijskooijman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthijskooijman/subscriptions","organizations_url":"https://api.github.com/users/matthijskooijman/orgs","repos_url":"https://api.github.com/users/matthijskooijman/repos","events_url":"https://api.github.com/users/matthijskooijman/events{/privacy}","received_events_url":"https://api.github.com/users/matthijskooijman/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":17,"created_at":"2015-12-30T15:18:53Z","updated_at":"2016-02-17T16:20:32Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/arduino/Arduino/pulls/4363","html_url":"https://github.com/arduino/Arduino/pull/4363","diff_url":"https://github.com/arduino/Arduino/pull/4363.diff","patch_url":"https://github.com/arduino/Arduino/pull/4363.patch"},"body":"This pullrequest contains a large number of cleanups and code refactorings concerning the editor part of the IDE, which takes care of loading files, showing an editor and tabs, saving files, modifying files, etc.\r\n\r\nThe original goal of this PR was to use separate RSyntaxTextArea instances for all tabs, preventing some issues resulting from sharing a single instance, and cleaning up the code around this change. The second goal was to clean up the sketch classes (e.g. Sketch, SketchData, SketchCode and SketchCodeDocument, of which it was not really clear what purpose each served). Now, there is SketchController, Sketch and SketchFile, with better defined purposes.\r\n\r\nThe commits in this PR jump around the code base a bit, since often one cleanup either required another one to happen before, or allowed one after. Also, some commits are simply small cleanups of things I came across while going through the code. It might be possible to reorder the commits to group related commits, but there are a lot of dependencies between them (both conceptual or just textual), which would make this take a lot of time, which does not seem worth the investment.\r\n\r\nSome commits do not seem to make much of an improvement in themselves (or even introduce new ugly code), but these usually prepare for a later cleanup (which often removes the ugly code again).\r\n\r\nThis PR should mostly leave behavior unchanged, only changing the code. In some cases there are some corner cases which are handled better or differently, and some small things have improved as result of some cleanups as well.\r\n\r\nA large part of this code could be further improved and decoupled by applying the Observable pattern, or some other event handling mechanism (e.g. to let the EditorHeader get notified when a file gets renamed, so it can update, instead of having the rename code explicitely refresh the EditorHeader). This is something for a future PR, though, since I haven't yet figured out what, if any, framework would best for doing this easily.\r\n\r\nThe first two commits of this PR come from #4358, so use that PR for comments about these commits."},"comment":{"url":"https://api.github.com/repos/arduino/Arduino/issues/comments/185280666","html_url":"https://github.com/arduino/Arduino/pull/4363#issuecomment-185280666","issue_url":"https://api.github.com/repos/arduino/Arduino/issues/4363","id":185280666,"user":{"login":"ArduinoBot","id":4233897,"avatar_url":"https://avatars.githubusercontent.com/u/4233897?v=3","gravatar_id":"","url":"https://api.github.com/users/ArduinoBot","html_url":"https://github.com/ArduinoBot","followers_url":"https://api.github.com/users/ArduinoBot/followers","following_url":"https://api.github.com/users/ArduinoBot/following{/other_user}","gists_url":"https://api.github.com/users/ArduinoBot/gists{/gist_id}","starred_url":"https://api.github.com/users/ArduinoBot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ArduinoBot/subscriptions","organizations_url":"https://api.github.com/users/ArduinoBot/orgs","repos_url":"https://api.github.com/users/ArduinoBot/repos","events_url":"https://api.github.com/users/ArduinoBot/events{/privacy}","received_events_url":"https://api.github.com/users/ArduinoBot/received_events","type":"User","site_admin":false},"created_at":"2016-02-17T16:20:32Z","updated_at":"2016-02-17T16:20:32Z","body":":x: Build failed."}}