Skip to content

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

@delphidabbler

Description

@delphidabbler
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

Activity

moved this from Considering to Accepted in CodeSnipon Apr 22, 2025
delphidabbler

delphidabbler commented on Apr 22, 2025

@delphidabbler
OwnerAuthor

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

delphidabbler

delphidabbler commented on Apr 28, 2025

@delphidabbler
OwnerAuthor

Same problem with Markdown preview (added to develop at merge commit 19dc440)

added a commit that references this issue on Apr 28, 2025
6e8e0f7
delphidabbler

delphidabbler commented on Apr 28, 2025

@delphidabbler
OwnerAuthor

Fixed at commit 6e8e0f7 - do not include in change log.

added
completedWork has been completed on this issue and changes have been committed to `develop` branch..
and removed
acceptedAccepted for implementation / fixing
⚠️Urgent fix required
on Apr 28, 2025
moved this from Accepted to Done - awaiting release in CodeSnipon Apr 28, 2025
delphidabbler

delphidabbler commented on Apr 28, 2025

@delphidabbler
OwnerAuthor

Fixed at commit 4b77024 - do not include in change log.

delphidabbler

delphidabbler commented on May 2, 2025

@delphidabbler
OwnerAuthor

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

Fixed at commit 4b77024 - do not include in change log.

This issue did occur in v4.25.0 of the Save Unit and Save Annotated Source dialogue box, so this fix MUST be included in the the change log.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugBug reportcompletedWork has been completed on this issue and changes have been committed to `develop` branch..

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @delphidabbler

      Issue actions

        Fix problem in Save Snippet Information dialogue box plain text preview · Issue #164 · delphidabbler/codesnip