OSDN Git Service

Mac: add paranoia about big cursor extending beyond a terminal's bounds
authorEric Branlund <ebranlund@fastmail.com>
Tue, 25 Apr 2023 13:04:34 +0000 (07:04 -0600)
committerEric Branlund <ebranlund@fastmail.com>
Tue, 25 Apr 2023 13:04:34 +0000 (07:04 -0600)
src/main-cocoa.m

index 40d0d13..d2c75f5 100644 (file)
@@ -4773,6 +4773,8 @@ static errr Term_curs_cocoa(int x, int y)
 static errr Term_bigcurs_cocoa(int x, int y)
 {
     AngbandContext *angbandContext = (__bridge AngbandContext*) (Term->data);
+    /* Out of paranoia, coerce to remain in bounds. */
+    int w = (x + 2 <= angbandContext.cols) ? 2 : angbandContext.cols - x;
 
     [angbandContext.contents setCursorAtColumn:x row:y width:2 height:1];
     [angbandContext.changes markChangedBlockAtColumn:x row:y width:2 height:1];