From 2f81ee73e1c3220f39edac25a34ecdaf96b36863 Mon Sep 17 00:00:00 2001 From: slederer Date: Mon, 13 Jan 2025 01:49:48 +0100 Subject: [PATCH] editor: abort in buildNRun if save fails - also fix possible bug in gotoLine if file is empty --- progs/editor.pas | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/progs/editor.pas b/progs/editor.pas index 070aaed..d6ec563 100644 --- a/progs/editor.pas +++ b/progs/editor.pas @@ -137,7 +137,8 @@ end; procedure getScreenSize; var c:char; begin - (* empty keyboard buffer *) + (* empty keyboard buffer to make sure GetTermSize + can read the response from the terminal *) while conavail do read(con, c); GetTermSize(screenW, screenH); @@ -1661,11 +1662,10 @@ end; procedure gotoLine(l:integer); begin - if l < 1 then - l := 1 - else if l > lineCount then l := lineCount; + if l < 1 then + l := 1; topY := l - (screenH div 2); if topY < 1 then @@ -1713,7 +1713,7 @@ var error:integer; begin success := true; if isModified then - save; + writeFile(success); if success then begin if isAsmFile(filename) then