Skip to content

Fix problem in Save Snippet Information dialogue box plain text preview #164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
delphidabbler opened this issue Apr 22, 2025 · 1 comment
Assignees
Labels
accepted Accepted for implementation / fixing bug Bug report no changelog Don't include this issue on change log ⚠️ Urgent fix required

Comments

@delphidabbler
Copy link
Owner

Plain text is always previewed in Unicode. This works fine for the Unicode LE & BE encodings and UTF-8. But this doesn't work properly if the user selected ANSI text. For example if a snippet with a character that is not supported in the default ANSI code page, the ANSI rendering could be different to the Unicode encodings, but the preview will be correct.

For example, the following output, rendered in Unicode, is:

Σ

Sums an array of integers.

function Σ(const A: array of Integer): Integer;
var
  Elem: Integer;
begin
  Result := 0;
  for Elem in A do
    Result := Result + Elem;
end;

Snippet Type:
    Routine
Category:
    User Defined Snippets
Required units:
    None.
Required snippets:
    None.
See also:
    None.

Compiler test results:
Delphi XE      Compiles OK
Delphi 12.x    Compiles OK

But when ANSI is selected (in the UK), the preview is as above, but the actual file content is:

S

Sums an array of integers.

function S(const A: array of Integer): Integer;
var
  Elem: Integer;
begin
  Result := 0;
  for Elem in A do
    Result := Result + Elem;
end;

Snippet Type:
    Routine
Category:
    User Defined Snippets
Required units:
    None.
Required snippets:
    None.
See also:
    None.

Compiler test results:
Delphi XE      Compiles OK
Delphi 12.x    Compiles OK
@delphidabbler delphidabbler self-assigned this Apr 22, 2025
@delphidabbler delphidabbler added accepted Accepted for implementation / fixing bug Bug report labels Apr 22, 2025
@github-project-automation github-project-automation bot moved this to Considering in CodeSnip Apr 22, 2025
@delphidabbler delphidabbler moved this from Considering to Accepted in CodeSnip Apr 22, 2025
@delphidabbler delphidabbler added the no changelog Don't include this issue on change log label Apr 22, 2025
@delphidabbler
Copy link
Owner Author

⚠ If this issue is resolved before the next release, the DO NOT add this issue to the change log.

@delphidabbler delphidabbler added the ⚠️ Urgent fix required label Apr 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Accepted for implementation / fixing bug Bug report no changelog Don't include this issue on change log ⚠️ Urgent fix required
Projects
Status: Accepted
Development

No branches or pull requests

1 participant