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.
using current dev builds on macosx. here is the usecase, I have aline like this: String var = text I copied the text from elsewhere and need to put it in quotes. 1. typing the first quote results in this. String var = "|"text presing backspace now will delete both quotes. The way to do it is either use delete key or left arrow+backspace a bit irritating, I would expect the backspace to delete just the character on the left of the caret.. 2. now go to the end of the quoted text and type the quote character again. String var = "text"|" ERROR -> even though it should know that I'm closing the quoted text it offers me another quotes... I was advised by yarda to create a testcase for this scenario, surprisingly the testcase passes. I guess there's something wrong with the test.. attaching diff..
Created attachment 18077 [details] test (prolly wrong because it's not failing.
ad. 1. In most cases it's good that backspace deletes both quotes. In your case just use delete instead of backspace. ad. 2. It only happens at the end of line. Put a semicolon and it won't longer happen: String var = "text|;
ad 1. in what cases it's ok? I would assume that deleting both quotes makes sense in this case String name = ""| but nowhere else. ad 2. your suggestion is just a workaround IMHO. The ditor should know I'm closing the string.
ad. 1. When you wanted to type something else (like ', ;, :, /) and you accidently pressed ", I expect backspace to delete what I typed. If I typed *one* character I want *one* backspace to delete it, even if it inserted two characters. ad. 2. Yes, you're right, I just wanted to notice, that it's not a common scenario to type " at the end of line, so the problem has never hit me.
I think that the case 1) cannot be resolved while retaining the pair-character completion. You may intend to write '"xx" + text' instead of just quoting the 'text' and in that case the extra added quote would be useful. The only additional logic that could help here would be to check the 'text' in your example against a list of the local and instance variables and if the text does not match any of them then add only a single quote. But that's sort of fuzzy. Regarding the second problem we should add a check for unclosed string and in that case add only a single quote. We should be able to resolve this into promoE.
*** Issue 51194 has been marked as a duplicate of this issue. ***
I have a further observation. If I have "some text '" and I now delete the ' character it also deletes the " character as well. But, "some text ' " will leave the double-quotes. The syntax-highlighting realizes that the single-quote is in a double-quoted string. Perhaps some logic can be re-used here.
*** Issue 55018 has been marked as a duplicate of this issue. ***
We should really revise the automagic behaviour of quotes. It happens too often that undesired quotes are added.
*** Issue 58367 has been marked as a duplicate of this issue. ***
*** Issue 60801 has been marked as a duplicate of this issue. ***
*** Issue 61035 has been marked as a duplicate of this issue. ***
This is not Mac specific issue.
*** Issue 58198 has been marked as a duplicate of this issue. ***
Making a duplicate of a higher priority issue. *** This issue has been marked as a duplicate of 67775 ***