Browse Source

Amiga: Video unit, do not draw Cursor if outside the window (would write over the window border)

git-svn-id: trunk@45161 -
marcus 5 years ago
parent
commit
8aacea8850
1 changed files with 5 additions and 5 deletions
  1. 5 5
      packages/rtl-console/src/amicommon/video.pp

+ 5 - 5
packages/rtl-console/src/amicommon/video.pp

@@ -255,7 +255,7 @@ begin
   {$endif}
 
   { FIXME/TODO: next to the hardwired selection, there could be some heuristics,
-    which sets the font size correctly on screens according to the aspect 
+    which sets the font size correctly on screens according to the aspect
     ratio. (KB) }
   VideoFont:=@vgafont;
   VideoFontHeight:=16;
@@ -584,11 +584,11 @@ begin
      SmallForce or ForceCursorUpdate then
   begin
     {$ifdef WITHBUFFERING}
-    DrawChar(BufRp, OldCursorX, OldCursorY, crHidden);
-    if CursorState then DrawChar(BufRp, CursorX, CursorY, CursorType);
+    if (OldCursorX >= 0) and (OldCursorX < ScreenWidth) and (OldCursorY >= 0) and (OldCursorY < ScreenHeight) then DrawChar(BufRp, OldCursorX, OldCursorY, crHidden);
+    if CursorState and (CursorX >= 0) and (CursorX < ScreenWidth) and (CursorY >= 0) and (CursorY < ScreenHeight) then DrawChar(BufRp, CursorX, CursorY, CursorType);
     {$else}
-    DrawChar(VideoWindow^.RPort, OldCursorX, OldCursorY, crHidden);
-    if CursorState then DrawChar(VideoWindow^.RPort, CursorX, CursorY, CursorType);
+    if (OldCursorX >= 0) and (OldCursorX < ScreenWidth) and (OldCursorY >= 0) and (OldCursorY < ScreenHeight) then DrawChar(VideoWindow^.RPort, OldCursorX, OldCursorY, crHidden);
+    if CursorState and (CursorX >= 0) and (CursorX < ScreenWidth) and (CursorY >= 0) and (CursorY < ScreenHeight) then DrawChar(VideoWindow^.RPort, CursorX, CursorY, CursorType);
     {$endif}
     OldCursorX := CursorX;
     OldCursorY := CursorY;