svn commit: r347388 - in head/stand: efi/libefi i386/libi386

Toomas Soome tsoome at FreeBSD.org
Thu May 9 10:37:58 UTC 2019


Author: tsoome
Date: Thu May  9 10:37:57 2019
New Revision: 347388
URL: https://svnweb.freebsd.org/changeset/base/347388

Log:
  loader: implement proper 8 char tab stops
  
  The current console code is printing out 8 spaces for tab, calculate
  the amount of spaces based on tab stops.

Modified:
  head/stand/efi/libefi/efi_console.c
  head/stand/i386/libi386/vidconsole.c

Modified: head/stand/efi/libefi/efi_console.c
==============================================================================
--- head/stand/efi/libefi/efi_console.c	Thu May  9 10:23:42 2019	(r347387)
+++ head/stand/efi/libefi/efi_console.c	Thu May  9 10:37:57 2019	(r347388)
@@ -135,11 +135,13 @@ efi_cons_rawputchar(int c)
 	UINTN x, y;
 	conout->QueryMode(conout, conout->Mode->Mode, &x, &y);
 
-	if (c == '\t')
-		/* XXX lame tab expansion */
-		for (i = 0; i < 8; i++)
+	if (c == '\t') {
+		int n;
+
+		n = 8 - ((curx + 8) % 8);
+		for (i = 0; i < n; i++)
 			efi_cons_rawputchar(' ');
-	else {
+	} else {
 #ifndef	TERM_EMU
 		if (c == '\n')
 			efi_cons_efiputchar('\r');

Modified: head/stand/i386/libi386/vidconsole.c
==============================================================================
--- head/stand/i386/libi386/vidconsole.c	Thu May  9 10:23:42 2019	(r347387)
+++ head/stand/i386/libi386/vidconsole.c	Thu May  9 10:37:57 2019	(r347388)
@@ -136,11 +136,13 @@ vidc_rawputchar(int c)
 {
     int		i;
 
-    if (c == '\t')
-	/* lame tab expansion */
-	for (i = 0; i < 8; i++)
+    if (c == '\t') {
+	int n;
+
+	n = 8 - ((curx + 8) % 8);
+	for (i = 0; i < n; i++)
 	    vidc_rawputchar(' ');
-    else {
+    } else {
 #ifndef TERM_EMU
         vidc_biosputchar(c);
 #else


More information about the svn-src-all mailing list