Skip to content

Fix + QoL + eye candy for Windows error boxes.

Rika requested to merge runewalsh/source:errorbox into main
  1. Run this program on Windows:
{$mode objfpc} {$longstrings on} {$apptype gui}
uses
	StrUtils;
begin
	write(stderr, DupeString('a', 1019));
	write(stderr, ' hello world');
end.

You will get these two messageboxes:

aaa-before-1  aaa-before-2

With this patch, they become correct:

aaa-after-1  aaa-after-2

  1. Run this program on Windows:
{$mode objfpc} {$longstrings on} {$apptype gui}
uses
	StrUtils;
begin
	write(stderr, DupeString('abc ', 2500));
end.

You will get 10 messageboxes one after another. The patch adds “Cancel” button that mutes them for a second.

  1. Prefer breaking (intermediate) messages at line endings, if there’s a suitable one. Try this program with -gh: Use heaptrace unit (heaptrc with GUI applications is also a well-known real-life case of all of the above):
{$apptype gui}
var
	i: int32;
begin
	for i := 0 to 499 do GetMem(i);
end.

First and third message (out of... many) before:

heaptrc-before-1  heaptrc-before-3

After (and again, you can cancel their stream if and when you get bored):

heaptrc-after-1  heaptrc-after-3

Edited by Rika

Merge request reports