This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 232180 - If And While Closing Bracket
Summary: If And While Closing Bracket
Status: RESOLVED DUPLICATE of bug 226675
Alias: None
Product: javascript
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.3.1
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Petr Pisl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-03 07:12 UTC by GjBob
Modified: 2013-07-08 10:06 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description GjBob 2013-07-03 07:12:37 UTC
Whent typing an if/while in javascript the closing bracket is inserted automatically. If a line of code is already there and i press return with the caret  after the opening bracket a new closing bracket is inserted. If backspace is pressed before the first line a new line is inserted but the line that wraps goes into a wrong position and a format/tab is needed to fix the indentation.
Comment 1 Vladimir Riha 2013-07-08 08:27:45 UTC
Could you please give us some more details (exact step by step or screencast)? I tried this in JS file:

if(true){var a = 1;

and pressed Enter before "var", result is

if(true){
    var a = 1;
}


Product Version: NetBeans IDE 7.3.1 (Build 201306052037)
Comment 2 GjBob 2013-07-08 09:55:22 UTC
Inside a php file:

<script>
    function codeFormat(content) {
        var new_content = content.replace(/<span class="[a-zA-Z0-9_ \-]*">/i, '');
        alert(new_content);
    }
</script>

if i press enter after opening bracket of the function i get

<script>
    function codeFormat(content) {
        
    }
        var new_content = content.replace(/<span class="[a-zA-Z0-9_ \-]*">/i, '');
        alert(new_content);
    }
</script>
Comment 3 Vladimir Riha 2013-07-08 10:06:14 UTC
Thank you for the sample. It seems to be caused by having "<s" inside replace() call. For instance following does not trigger the issue 

var new_content = content.replace(/<epan class="[a-zA-Z0-9_ \-]*">/i,'');

So it looks like issue 226675. Thank you for reporting

*** This bug has been marked as a duplicate of bug 226675 ***