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
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to