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 67775 - [50cat] Why editor always Duplicate " mark ? it should not duplicate it in some cases
Summary: [50cat] Why editor always Duplicate " mark ? it should not duplicate it in so...
Status: VERIFIED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 5.x
Hardware: PC Windows XP
: P2 blocker with 1 vote (vote)
Assignee: issues@editor
URL:
Keywords:
: 50006 68181 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-10-29 21:06 UTC by kalali
Modified: 2007-11-05 13:44 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 kalali 2005-10-29 21:06:45 UTC
[ JDK VERSION : 1.5.0_03 ]

When in java editor we type " editor convert it to "" ,but it should be smart enough that
if it is typed before an String just one " insert not two "s.
for example 
I want to add " before the following string
System.out.println(i have a good ide);
but it insert two of them and make my string like :
System.out.println(""i have a good ide);

I think it should check and then insert the "s .
Comment 1 Petr Hrebejk 2005-11-04 17:06:18 UTC
This is IMO a P2 candidate.
Comment 2 Roman Strobl 2005-11-04 17:20:29 UTC
I agree. This is very annoying if you write multiline string - e.g. you want to
copy them from another application. Try to convert:

pasted line 1
pasted line 2
pasted line 3

into:

String s = "pasted line 1" +
    "pasted line 2" +
    "pasted line 3";

Each time duplicate quotes are typed in.
Comment 3 Roman Strobl 2005-11-06 16:18:12 UTC
*** Issue 68181 has been marked as a duplicate of this issue. ***
Comment 4 Dusan Balek 2005-11-08 09:15:21 UTC
*** Issue 50006 has been marked as a duplicate of this issue. ***
Comment 5 Miloslav Metelka 2005-11-14 16:00:47 UTC
Right now the extra quote insertion algorithm is in
BracketCompletion.completeQuote() which is triggered after inserting of the
initial quote char. It was written by Ondra R. originally and although I mostly
understand it it's IMHO too late to check the situation AFTER the insertion of
the first quote as the lexical information is already garbled by the first quote
insertion. Ideally the situation should be checked BEFORE inserting the first
quote. The conditions when the extra quote should be added should IMHO be the
following:

1) When at EOL - i.e. there will not be unclosed string at EOL
2) When lexically before ')' or '+' or ',' or ';' or '}' (ignoring the whitespace)

Although this may differ from the present behavior it should be more consistent. 
If acceptable we will start to implement this.
Comment 6 cbulcu 2005-11-14 16:44:11 UTC
Roman's example could be a refactoring too :-)
Comment 7 Martin Roskanin 2005-11-24 10:54:42 UTC
fixed in [maintrunk]

Checking in src/org/netbeans/modules/editor/java/BracketCompletion.java;
/cvs/java/editor/src/org/netbeans/modules/editor/java/BracketCompletion.java,v 
<--  BracketCompletion.java
new revision: 1.9; previous revision: 1.8
done
Checking in src/org/netbeans/modules/editor/java/JavaKit.java;
/cvs/java/editor/src/org/netbeans/modules/editor/java/JavaKit.java,v  <-- 
JavaKit.java
new revision: 1.25; previous revision: 1.24
done
Checking in
test/unit/src/org/netbeans/modules/editor/java/JavaBracketCompletionUnitTest.java;
/cvs/java/editor/test/unit/src/org/netbeans/modules/editor/java/JavaBracketCompletionUnitTest.java,v
 <--  JavaBracketCompletionUnitTest.java
new revision: 1.2; previous revision: 1.1
done
Checking in
test/unit/src/org/netbeans/modules/editor/java/JavaFormatterUnitTest.java;
/cvs/java/editor/test/unit/src/org/netbeans/modules/editor/java/JavaFormatterUnitTest.java,v
 <--  JavaFormatterUnitTest.java
new revision: 1.6; previous revision: 1.5
done
Comment 8 kalali 2006-01-18 09:15:44 UTC
works fine now in rc1