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 50006 - wrong quotes completion
Summary: wrong quotes completion
Status: RESOLVED DUPLICATE of bug 67775
Alias: None
Product: editor
Classification: Unclassified
Component: Completion & Templates (show other bugs)
Version: 4.x
Hardware: All All
: P3 blocker with 1 vote (vote)
Assignee: Martin Roskanin
URL:
Keywords:
: 51194 55018 58198 58367 60801 61035 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-10-06 12:21 UTC by Milos Kleint
Modified: 2007-11-05 13:38 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
test (prolly wrong because it's not failing. (1.03 KB, patch)
2004-10-06 12:23 UTC, Milos Kleint
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Milos Kleint 2004-10-06 12:21:14 UTC
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..
Comment 1 Milos Kleint 2004-10-06 12:23:06 UTC
Created attachment 18077 [details]
test (prolly wrong because it's not failing.
Comment 2 cezariusz 2004-10-06 12:34:40 UTC
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|;
Comment 3 Milos Kleint 2004-10-06 12:50:10 UTC
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.
Comment 4 cezariusz 2004-10-06 13:10:34 UTC
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.
Comment 5 Miloslav Metelka 2004-10-28 19:45:39 UTC
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.
Comment 6 Jan Lahoda 2004-11-05 16:55:47 UTC
*** Issue 51194 has been marked as a duplicate of this issue. ***
Comment 7 dynamite 2004-11-12 10:39:15 UTC
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.
Comment 8 Martin Roskanin 2005-02-16 14:05:59 UTC
*** Issue 55018 has been marked as a duplicate of this issue. ***
Comment 9 Roman Strobl 2005-04-29 16:02:37 UTC
We should really revise the automagic behaviour of quotes. It happens too often
that undesired quotes are added.
Comment 10 Martin Roskanin 2005-05-03 09:21:01 UTC
*** Issue 58367 has been marked as a duplicate of this issue. ***
Comment 11 Roman Strobl 2005-07-08 15:44:54 UTC
*** Issue 60801 has been marked as a duplicate of this issue. ***
Comment 12 Roman Strobl 2005-07-16 09:20:17 UTC
*** Issue 61035 has been marked as a duplicate of this issue. ***
Comment 13 Tomas Hurka 2005-09-15 15:30:40 UTC
This is not Mac specific issue. 
Comment 14 Dusan Balek 2005-11-01 10:58:56 UTC
*** Issue 58198 has been marked as a duplicate of this issue. ***
Comment 15 Dusan Balek 2005-11-08 09:15:22 UTC
Making a duplicate of a higher priority issue.

*** This issue has been marked as a duplicate of 67775 ***