Skip to content

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

Closed
@delphidabbler

Description

@delphidabbler

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

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

Issue actions