{"action":"closed","issue":{"url":"https://api.github.com/repos/beautify-web/js-beautify/issues/691","labels_url":"https://api.github.com/repos/beautify-web/js-beautify/issues/691/labels{/name}","comments_url":"https://api.github.com/repos/beautify-web/js-beautify/issues/691/comments","events_url":"https://api.github.com/repos/beautify-web/js-beautify/issues/691/events","html_url":"https://github.com/beautify-web/js-beautify/issues/691","id":76864467,"number":691,"title":"Line wrapping breaks at the wrong place when the line is indented.","user":{"login":"seronal","id":3531211,"avatar_url":"https://avatars.githubusercontent.com/u/3531211?v=3","gravatar_id":"","url":"https://api.github.com/users/seronal","html_url":"https://github.com/seronal","followers_url":"https://api.github.com/users/seronal/followers","following_url":"https://api.github.com/users/seronal/following{/other_user}","gists_url":"https://api.github.com/users/seronal/gists{/gist_id}","starred_url":"https://api.github.com/users/seronal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seronal/subscriptions","organizations_url":"https://api.github.com/users/seronal/orgs","repos_url":"https://api.github.com/users/seronal/repos","events_url":"https://api.github.com/users/seronal/events{/privacy}","received_events_url":"https://api.github.com/users/seronal/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/beautify-web/js-beautify/labels/bug","name":"bug","color":"e10c02"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/beautify-web/js-beautify/milestones/14","html_url":"https://github.com/beautify-web/js-beautify/milestones/v1.5.6","labels_url":"https://api.github.com/repos/beautify-web/js-beautify/milestones/14/labels","id":1097233,"number":14,"title":"v1.5.6","description":"","creator":{"login":"bitwiseman","id":1958953,"avatar_url":"https://avatars.githubusercontent.com/u/1958953?v=3","gravatar_id":"","url":"https://api.github.com/users/bitwiseman","html_url":"https://github.com/bitwiseman","followers_url":"https://api.github.com/users/bitwiseman/followers","following_url":"https://api.github.com/users/bitwiseman/following{/other_user}","gists_url":"https://api.github.com/users/bitwiseman/gists{/gist_id}","starred_url":"https://api.github.com/users/bitwiseman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bitwiseman/subscriptions","organizations_url":"https://api.github.com/users/bitwiseman/orgs","repos_url":"https://api.github.com/users/bitwiseman/repos","events_url":"https://api.github.com/users/bitwiseman/events{/privacy}","received_events_url":"https://api.github.com/users/bitwiseman/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":14,"state":"open","created_at":"2015-05-05T17:04:50Z","updated_at":"2015-05-27T23:47:10Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2015-05-15T21:32:26Z","updated_at":"2015-05-27T23:47:10Z","closed_at":"2015-05-27T23:47:10Z","body":"The problem is related to indentation. It's as if js-beautify \"double counts\" indent spaces while calculating where to break the line. \r\n\r\nIf you beautify the following code with \"wrap_line_length\" set to 80, dummy2 and dummy3 lines get wrapped even though they should not. There are the same number of B's in each string as the number of indent spaces in that line and if you remove all the B's from those strings they won't be wrapped.\r\n\r\nThis bug does not exist in version 1.5.1, but it exists in every version released since.\r\n\r\n```javascript\r\nvar dummy = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA';\r\n\r\nfunction dummyFunction() {\r\n    var dummy2 = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBB';\r\n\r\n    function dummyFunction2() {\r\n        var dummy3 = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBB';\r\n    }\r\n}\r\n```\r\n\r\nOutput from jsbeautifier.org\r\n```javascript\r\nvar dummy = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA';\r\n\r\nfunction dummyFunction() {\r\n    var dummy2 =\r\n        'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBB';\r\n\r\n    function dummyFunction2() {\r\n        var dummy3 =\r\n            'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBB';\r\n    }\r\n}\r\n```"}}