editor: abort in buildNRun if save fails

- also fix possible bug in gotoLine if
  file is empty
This commit is contained in:
slederer 2025-01-13 01:49:48 +01:00
parent 74a467cba6
commit 2f81ee73e1

View file

@ -137,7 +137,8 @@ end;
procedure getScreenSize; procedure getScreenSize;
var c:char; var c:char;
begin begin
(* empty keyboard buffer *) (* empty keyboard buffer to make sure GetTermSize
can read the response from the terminal *)
while conavail do read(con, c); while conavail do read(con, c);
GetTermSize(screenW, screenH); GetTermSize(screenW, screenH);
@ -1661,11 +1662,10 @@ end;
procedure gotoLine(l:integer); procedure gotoLine(l:integer);
begin begin
if l < 1 then
l := 1
else
if l > lineCount then if l > lineCount then
l := lineCount; l := lineCount;
if l < 1 then
l := 1;
topY := l - (screenH div 2); topY := l - (screenH div 2);
if topY < 1 then if topY < 1 then
@ -1713,7 +1713,7 @@ var error:integer;
begin begin
success := true; success := true;
if isModified then if isModified then
save; writeFile(success);
if success then if success then
begin begin
if isAsmFile(filename) then if isAsmFile(filename) then