https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ad43210b41fba808b5e0c…
commit ad43210b41fba808b5e0c5b703eeaeec6ab6c6d5
Author: Serge Gautherie <reactos-git_serge_171003(a)gautherie.fr>
AuthorDate: Wed Jul 31 15:48:46 2019 +0200
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Wed Jan 1 21:14:08 2020 +0100
[FREELDR] Reimplement i386PrintText(), adding line wrap handling. CORE-16268
Co-Authored-By: Stanislav Motylkov <x86corez(a)gmail.com>
---
boot/freeldr/freeldr/arch/i386/i386bug.c | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/boot/freeldr/freeldr/arch/i386/i386bug.c
b/boot/freeldr/freeldr/arch/i386/i386bug.c
index b0052d7e4b1..233b33332ef 100644
--- a/boot/freeldr/freeldr/arch/i386/i386bug.c
+++ b/boot/freeldr/freeldr/arch/i386/i386bug.c
@@ -49,21 +49,26 @@ i386PrintChar(CHAR chr, ULONG x, ULONG y)
static void
i386PrintText(CHAR *pszText)
{
- char chr;
- while (1)
- {
- chr = *pszText++;
+ ULONG Width, Unused;
+
+ MachVideoGetDisplaySize(&Width, &Unused, &Unused);
- if (chr == 0) break;
- if (chr == '\n')
+ for (; *pszText != ANSI_NULL; ++pszText)
+ {
+ if (*pszText == '\n')
{
- i386_ScreenPosY++;
i386_ScreenPosX = 0;
+ ++i386_ScreenPosY;
continue;
}
- MachVideoPutChar(chr, SCREEN_ATTR, i386_ScreenPosX, i386_ScreenPosY);
- i386_ScreenPosX++;
+ MachVideoPutChar(*pszText, SCREEN_ATTR, i386_ScreenPosX, i386_ScreenPosY);
+ if (++i386_ScreenPosX >= Width)
+ {
+ i386_ScreenPosX = 0;
+ ++i386_ScreenPosY;
+ }
+ // FIXME: Implement vertical screen scrolling if we are at the end of the screen.
}
}