Skip to content

Commit

Permalink
#2780 Fixed line numbering for the frames
Browse files Browse the repository at this point in the history
Perl provides us zero-based line numbers
  • Loading branch information
hurricup committed Oct 15, 2023
1 parent c4d6d76 commit 5b4c452
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public PerlStackFrame(PerlStackFrameDescriptor frameDescriptor, PerlExecutionSta
@Override
public void customizePresentation(@NotNull ColoredTextContainer component) {
@NlsSafe var frameName =
String.join(":", myFrameDescriptor.getFileDescriptor().getNameOrPath(), String.valueOf(myFrameDescriptor.getLine()));
String.join(":", myFrameDescriptor.getFileDescriptor().getNameOrPath(), String.valueOf(myFrameDescriptor.getOneBasedLine()));
component.append(frameName, SimpleTextAttributes.REGULAR_ATTRIBUTES);
component.setIcon(AllIcons.Debugger.Frame);
}
Expand All @@ -94,7 +94,7 @@ public void customizePresentation(@NotNull ColoredTextContainer component) {
public @Nullable XSourcePosition getSourcePosition() {
VirtualFile virtualFile = myVirtualFile.getValue();
if (virtualFile != null) {
return XSourcePositionImpl.create(virtualFile, myFrameDescriptor.getLine());
return XSourcePositionImpl.create(virtualFile, myFrameDescriptor.getZeroBasedLine());
}
return super.getSourcePosition();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2015-2022 Alexandr Evstigneev
* Copyright 2015-2023 Alexandr Evstigneev
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -33,10 +33,14 @@ public PerlLoadedFileDescriptor getFileDescriptor() {
return file;
}

public int getLine() {
public int getZeroBasedLine() {
return line;
}

public int getOneBasedLine() {
return line + 1;
}

public PerlValueDescriptor[] getLexicals() {
return lexicals;
}
Expand Down

0 comments on commit 5b4c452

Please sign in to comment.