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 207151 - Overwriting highlighted text with quote
Summary: Overwriting highlighted text with quote
Status: RESOLVED DUPLICATE of bug 188774
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.1
Hardware: All All
: P3 normal (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-11 02:37 UTC by berniev
Modified: 2012-03-26 09:15 UTC (History)
0 users

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 berniev 2012-01-11 02:37:24 UTC
Product Version = NetBeans IDE 7.1 (Build 201112071828)
Operating System = Linux version 3.0.0-14-generic-pae running on i386
Java; VM; Vendor = 1.6.0_23
Runtime = OpenJDK Client VM 20.0-b11

Example:
<?php
$a = 'fred';
$a = "fred";
?>

Use mouse to highlight 'fred' or "fred" (including the quotes)
If  the next character typed is:
1. A non-quote character: Highlighted text is replaced (expected behavior);
2. A different quote character than the one enclosing the text: Both existing quotes are changed to the character typed (design feature?); or
3 The same quote character as the one enclosing the text: The new character is appended.

Case 3. is frustrating me every time I try to replace a quoted text with another. 
Is there a use-case to justify this behavior? If so then the answer is to only highlight the text within quotes.
But I for one so often just grab the whole text incl quotes and then consider what is to be typed there whether it be a variable, double quoted text or single quoted text etc.
Comment 1 Ondrej Brejla 2012-01-11 09:13:09 UTC
It seems to be a bug, I'm not sure what was the purpose of this behavior ;) But it can be simply workarounded, if you just want to rewrite the content of quotes...double-click on text, or mark it by mouse...and write what you need. Thanks for your report!
Comment 2 berniev 2012-01-11 20:18:14 UTC
Actually it is worse than my original post:

Highlighting ANY TEXT in php code and typing a quote encloses that text with quotes and places the cursor after the closing quote.

Same behaviour for single and double quote, but not back-tick.

I can find no option to disable this 'feature' :(

So any time you want to replace something with quoted text you must first delete existing text before typing the new text.
Comment 3 berniev 2012-01-12 02:25:47 UTC
I found disabling 

Options->Editor->CodeCompletion->InsertClosingBracketsAutomatically 

makes this problem (and a couple of others) go away. Editor trying to be too clever for it's own good.
Comment 4 Ondrej Brejla 2012-03-26 09:15:54 UTC
I've implemented some new feature which allows you to disable "magic" quotes behavior. It's described here http://netbeans.org/bugzilla/show_bug.cgi?id=188774#c12

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