• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Camelcade / Perl5-IDEA / #525521660

24 Aug 2025 01:28PM UTC coverage: 75.89% (-6.3%) from 82.227%
#525521660

push

github

hurricup
Migrated coverage reporting to https://github.com/nbaztec/coveralls-jacoco-gradle-plugin

See: https://github.com/kt3k/coveralls-gradle-plugin/issues/119

14751 of 22639 branches covered (65.16%)

Branch coverage included in aggregate %.

31091 of 37767 relevant lines covered (82.32%)

0.82 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

82.22
/plugin/common/src/main/java/com/perl5/lang/pod/idea/editor/PodBackspaceHandler.java
1
/*
2
 * Copyright 2015-2025 Alexandr Evstigneev
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 * http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16

17
package com.perl5.lang.pod.idea.editor;
18

19
import com.intellij.codeInsight.editorActions.BackspaceHandlerDelegate;
20
import com.intellij.openapi.editor.CaretModel;
21
import com.intellij.openapi.editor.Editor;
22
import com.intellij.psi.PsiElement;
23
import com.intellij.psi.PsiFile;
24
import com.intellij.psi.tree.IElementType;
25
import com.perl5.lang.pod.parser.psi.PodFile;
26
import org.jetbrains.annotations.NotNull;
27

28
import static com.perl5.lang.pod.parser.PodElementTypesGenerated.POD_ANGLE_LEFT;
29
import static com.perl5.lang.pod.parser.PodElementTypesGenerated.POD_ANGLE_RIGHT;
30

31

32
public class PodBackspaceHandler extends BackspaceHandlerDelegate {
1✔
33
  @Override
34
  public void beforeCharDeleted(char c, @NotNull PsiFile file, @NotNull Editor editor) {
35

36
  }
1✔
37

38
  @Override
39
  public boolean charDeleted(char c, @NotNull PsiFile file, @NotNull Editor editor) {
40
    if (file instanceof PodFile) {
1✔
41
      CaretModel caretModel = editor.getCaretModel();
1✔
42
      int offset = caretModel.getOffset();
1✔
43
      PsiElement element = file.findElementAt(offset);
1✔
44
      IElementType elementType = element == null ? null : element.getNode().getElementType();
1!
45

46
      if (elementType == POD_ANGLE_RIGHT) {
1✔
47
        PsiElement formatterBlock = element.getParent();
1✔
48
        if (formatterBlock != null) {
1!
49

50
          PsiElement openAngles = formatterBlock.getFirstChild();
1✔
51
          openAngles = openAngles == null ? null : openAngles.getNextSibling();
1!
52

53
          if (openAngles != null) {
1!
54
            int openAnglesOffset = openAngles.getTextRange().getStartOffset();
1✔
55

56
            editor.getDocument().deleteString(openAnglesOffset, openAnglesOffset + 1);
1✔
57
            return true;
1✔
58
          }
59
        }
60
      }
×
61
      else if (elementType == POD_ANGLE_LEFT) {
1✔
62
        PsiElement formatterBlock = element.getParent();
1✔
63
        if (formatterBlock != null) {
1!
64

65
          PsiElement closeAngles = formatterBlock.getLastChild();
1✔
66

67
          if (closeAngles != null) {
1!
68
            int closeAnglesOffset = closeAngles.getTextRange().getStartOffset();
1✔
69

70
            editor.getDocument().deleteString(closeAnglesOffset - 1, closeAnglesOffset);
1✔
71
            return true;
1✔
72
          }
73
        }
74
        return true;
×
75
      }
76
    }
77
    return false;
1✔
78
  }
79
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc