{"action":"closed","issue":{"url":"https://api.github.com/repos/thehogfather/brackets-custom-region-code-folding/issues/7","labels_url":"https://api.github.com/repos/thehogfather/brackets-custom-region-code-folding/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/thehogfather/brackets-custom-region-code-folding/issues/7/comments","events_url":"https://api.github.com/repos/thehogfather/brackets-custom-region-code-folding/issues/7/events","html_url":"https://github.com/thehogfather/brackets-custom-region-code-folding/issues/7","id":109926411,"number":7,"title":"Doesn't work with uppercase char in startRegionWord","user":{"login":"Mixerito","id":14989524,"avatar_url":"https://avatars.githubusercontent.com/u/14989524?v=3","gravatar_id":"","url":"https://api.github.com/users/Mixerito","html_url":"https://github.com/Mixerito","followers_url":"https://api.github.com/users/Mixerito/followers","following_url":"https://api.github.com/users/Mixerito/following{/other_user}","gists_url":"https://api.github.com/users/Mixerito/gists{/gist_id}","starred_url":"https://api.github.com/users/Mixerito/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mixerito/subscriptions","organizations_url":"https://api.github.com/users/Mixerito/orgs","repos_url":"https://api.github.com/users/Mixerito/repos","events_url":"https://api.github.com/users/Mixerito/events{/privacy}","received_events_url":"https://api.github.com/users/Mixerito/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-10-06T02:59:53Z","updated_at":"2015-11-16T21:04:09Z","closed_at":"2015-11-16T21:04:09Z","body":"When some uppercase character is used in startRegionWord and comment happens to be unindented (no whitespaces before the comment token), then folding doesn't work.\r\n\r\nIn that case line 38 in region-fold.js:\r\n<b>(token.start + token.string.toLowerCase().indexOf(startWord)) : -1;</b>\r\nsimplifies to work as:\r\n<b>(token.start + -1) : -1;</b>\r\nWhen the line starts with comment (no whitespaces before), it simplifies to:\r\n<b>(0 + -1) : -1;</b>\r\n\r\nSo the condition on line 42 is always false then.\r\n\r\nChanging line 38 to:\r\n<b>(token.start + token.string.toLowerCase().indexOf(startWord.toLowerCase())) : -1;</b>\r\nhelps to solve this issue.\r\n"}}