From 29150acff714ab1271829b26b5c17af57bb376b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 31 Mar 2005 20:06:31 +0000 Subject: [PATCH] console_set_cursor() now clips to screen size. This actually works around a possible compiler bug that exposes with -O2 only. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12203 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/boot/platform/bios_ia32/console.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/kernel/boot/platform/bios_ia32/console.cpp b/src/kernel/boot/platform/bios_ia32/console.cpp index 401595e816..fb27bcb703 100644 --- a/src/kernel/boot/platform/bios_ia32/console.cpp +++ b/src/kernel/boot/platform/bios_ia32/console.cpp @@ -1,7 +1,7 @@ /* -** Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved. -** Distributed under the terms of the Haiku License. -*/ + * Copyright 2004-2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved. + * Distributed under the terms of the MIT License. + */ #include "console.h" @@ -118,6 +118,15 @@ console_height(void) void console_set_cursor(int32 x, int32 y) { + if (y >= (int32)sScreenHeight) + y = sScreenHeight - 1; + else if (y < 0) + y = 0; + if (x >= (int32)sScreenWidth) + x = sScreenWidth - 1; + else if (x < 0) + x = 0; + sScreenOffset = x + y * sScreenWidth; }