{"action":"created","issue":{"url":"https://api.github.com/repos/codemirror/CodeMirror/issues/3548","labels_url":"https://api.github.com/repos/codemirror/CodeMirror/issues/3548/labels{/name}","comments_url":"https://api.github.com/repos/codemirror/CodeMirror/issues/3548/comments","events_url":"https://api.github.com/repos/codemirror/CodeMirror/issues/3548/events","html_url":"https://github.com/codemirror/CodeMirror/issues/3548","id":108243964,"number":3548,"title":"hardwrap addon can infinite loop & OOM","user":{"login":"mtaran-google","id":5050719,"avatar_url":"https://avatars.githubusercontent.com/u/5050719?v=3","gravatar_id":"","url":"https://api.github.com/users/mtaran-google","html_url":"https://github.com/mtaran-google","followers_url":"https://api.github.com/users/mtaran-google/followers","following_url":"https://api.github.com/users/mtaran-google/following{/other_user}","gists_url":"https://api.github.com/users/mtaran-google/gists{/gist_id}","starred_url":"https://api.github.com/users/mtaran-google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mtaran-google/subscriptions","organizations_url":"https://api.github.com/users/mtaran-google/orgs","repos_url":"https://api.github.com/users/mtaran-google/repos","events_url":"https://api.github.com/users/mtaran-google/events{/privacy}","received_events_url":"https://api.github.com/users/mtaran-google/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-09-25T01:12:04Z","updated_at":"2015-10-01T22:37:20Z","closed_at":null,"body":"A repro case is \r\n\r\n```\r\n    implemented using an Android [`TextureView`](http://developer.android.com/reference/android/view/TextureView.html).\r\n\r\n```\r\n(with the newline above and below, and +4 indent)\r\n\r\nif you then call editor.wrapRange({line:1, ch:0}, {line:1, ch:null}, {column:80}) it goes into an infinite loop and steadily increases memory usage of that process."},"comment":{"url":"https://api.github.com/repos/codemirror/CodeMirror/issues/comments/144867701","html_url":"https://github.com/codemirror/CodeMirror/issues/3548#issuecomment-144867701","issue_url":"https://api.github.com/repos/codemirror/CodeMirror/issues/3548","id":144867701,"user":{"login":"mtaran-google","id":5050719,"avatar_url":"https://avatars.githubusercontent.com/u/5050719?v=3","gravatar_id":"","url":"https://api.github.com/users/mtaran-google","html_url":"https://github.com/mtaran-google","followers_url":"https://api.github.com/users/mtaran-google/followers","following_url":"https://api.github.com/users/mtaran-google/following{/other_user}","gists_url":"https://api.github.com/users/mtaran-google/gists{/gist_id}","starred_url":"https://api.github.com/users/mtaran-google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mtaran-google/subscriptions","organizations_url":"https://api.github.com/users/mtaran-google/orgs","repos_url":"https://api.github.com/users/mtaran-google/repos","events_url":"https://api.github.com/users/mtaran-google/events{/privacy}","received_events_url":"https://api.github.com/users/mtaran-google/received_events","type":"User","site_admin":false},"created_at":"2015-10-01T22:37:20Z","updated_at":"2015-10-01T22:37:20Z","body":"Github seems to hate html attachments, even when they're reamed with .txt. Here you go though:\r\n\r\n```html\r\n<!doctype html>\r\n\r\n<title>CodeMirror: Hard-wrapping Demo</title>\r\n<meta charset=\"utf-8\"/>\r\n<link rel=stylesheet href=\"../doc/docs.css\">\r\n\r\n<link rel=\"stylesheet\" href=\"../lib/codemirror.css\">\r\n<script src=\"../lib/codemirror.js\"></script>\r\n<script src=\"../mode/markdown/markdown.js\"></script>\r\n<script src=\"../addon/wrap/hardwrap.js\"></script>\r\n<style type=\"text/css\">\r\n  .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}\r\n</style>\r\n<div id=nav>\r\n  <a href=\"http://codemirror.net\"><h1>CodeMirror</h1><img id=logo src=\"../doc/logo.png\"></a>\r\n\r\n  <ul>\r\n    <li><a href=\"../index.html\">Home</a>\r\n    <li><a href=\"../doc/manual.html\">Manual</a>\r\n    <li><a href=\"https://github.com/codemirror/codemirror\">Code</a>\r\n  </ul>\r\n  <ul>\r\n    <li><a class=active href=\"#\">Hard-wrapping</a>\r\n  </ul>\r\n</div>\r\n\r\n<article>\r\n<h2>Hard-wrapping Demo</h2>\r\n<form><textarea id=\"code\" name=\"code\">\r\n\r\n    implemented using an Android [`TextureView`](http://developer.android.com/reference/android/view/TextureView.html).\r\n\r\n</textarea></form>\r\n\r\n<p>Demonstration of\r\nthe <a href=\"../doc/manual.html#addon_hardwrap\">hardwrap</a> addon.\r\nThe above editor has its change event hooked up to\r\nthe <code>wrapParagraphsInRange</code> method, so that the paragraphs\r\nare reflown as you are typing.</p>\r\n\r\n<script>\r\nvar editor = CodeMirror.fromTextArea(document.getElementById(\"code\"), {\r\n  mode: \"markdown\",\r\n  lineNumbers: true\r\n});\r\n</script>\r\n\r\n</article>\r\n\r\n```\r\n\r\nAfter opening this, run `editor.wrapRange({line:1, ch:0}, {line:1, ch:null}, {column:80})` and it should hang."}}