1 | package com.jsql.view.swing.text.action; | |
2 | ||
3 | import javax.swing.text.BadLocationException; | |
4 | import javax.swing.text.DefaultEditorKit; | |
5 | import javax.swing.text.Document; | |
6 | ||
7 | /** | |
8 | * Action to cancel Beep sound when deleting last character. | |
9 | * Used on TextPane and TextArea. | |
10 | */ | |
11 | public class DeleteNextCharAction extends AbstractCharAction { | |
12 | | |
13 | /** | |
14 | * Create this object with the appropriate identifier. | |
15 | */ | |
16 | public DeleteNextCharAction() { | |
17 | super(DefaultEditorKit.deleteNextCharAction); | |
18 | } | |
19 | ||
20 | @Override | |
21 | protected void delete(Document doc, int dot) throws BadLocationException { | |
22 |
2
1. delete : negated conditional → NO_COVERAGE 2. delete : changed conditional boundary → NO_COVERAGE |
if (dot < doc.getLength()) { |
23 | | |
24 | var delChars = 1; | |
25 | ||
26 |
3
1. delete : negated conditional → NO_COVERAGE 2. delete : changed conditional boundary → NO_COVERAGE 3. delete : Replaced integer subtraction with addition → NO_COVERAGE |
if (dot < doc.getLength() - 1) { |
27 | | |
28 | String dotChars = doc.getText(dot, 2); | |
29 | var c0 = dotChars.charAt(0); | |
30 | var c1 = dotChars.charAt(1); | |
31 | ||
32 |
8
1. delete : negated conditional → NO_COVERAGE 2. delete : negated conditional → NO_COVERAGE 3. delete : changed conditional boundary → NO_COVERAGE 4. delete : changed conditional boundary → NO_COVERAGE 5. delete : changed conditional boundary → NO_COVERAGE 6. delete : changed conditional boundary → NO_COVERAGE 7. delete : negated conditional → NO_COVERAGE 8. delete : negated conditional → NO_COVERAGE |
if (c0 >= '\uD800' && c0 <= '\uDBFF' && c1 >= '\uDC00' && c1 <= '\uDFFF') { |
33 | delChars = 2; | |
34 | } | |
35 | } | |
36 | ||
37 |
1
1. delete : removed call to javax/swing/text/Document::remove → NO_COVERAGE |
doc.remove(dot, delChars); |
38 | } | |
39 | } | |
40 | } | |
Mutations | ||
22 |
1.1 2.2 |
|
26 |
1.1 2.2 3.3 |
|
32 |
1.1 2.2 3.3 4.4 5.5 6.6 7.7 8.8 |
|
37 |
1.1 |