From e399bd8e8dded1d337a511b70bbde985c5527df6 Mon Sep 17 00:00:00 2001 From: Zane Duffield Date: Wed, 9 Apr 2025 15:28:30 +1000 Subject: [PATCH] Fix stderr reporting when special cursor line isn't found An easy way to reproduce this issue is to run the plugin with an old version of pasfmt from before the `--cursor` option was added. In this case it will tell you an error occurred but won't be able to tell you anything about it. --- CHANGELOG.md | 1 + Pasfmt.FormatCore.pas | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ab92415..05dab43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed * Ignore formatting requests for files without matching file extensions (pas, dpr, dpk, inc). +* Fix error logging when cursor metadata is not parsed correctly. ### Changed diff --git a/Pasfmt.FormatCore.pas b/Pasfmt.FormatCore.pas index ae119ae..8e4214f 100644 --- a/Pasfmt.FormatCore.pas +++ b/Pasfmt.FormatCore.pas @@ -39,6 +39,7 @@ function ExtractCursorTag(Data: string; out TagValue: string): string; StartPos: Integer; EndPos: Integer; begin + Result := Data; TagPos := System.Pos(CTag, Data); if TagPos > 0 then begin StartPos := TagPos + Length(CTag);