Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Mar 2020 17:37:31 +0000 (UTC)
From:      Ryan Moeller <freqlabs@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r359371 - in head/stand: forth lua
Message-ID:  <202003271737.02RHbV0d080460@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: freqlabs
Date: Fri Mar 27 17:37:31 2020
New Revision: 359371
URL: https://svnweb.freebsd.org/changeset/base/359371

Log:
  loader: Fully reset terminal settings, not just colors
  
  Reviewed by:	kevans
  Reviewed by:	tsoome
  Approved by:	mav (mentor)
  MFC after:	1 week
  Sponsored by:	iXsystems, Inc.
  Differential Revision:	https://reviews.freebsd.org/D21733

Modified:
  head/stand/forth/loader.4th
  head/stand/forth/loader.rc
  head/stand/forth/screen.4th
  head/stand/lua/core.lua
  head/stand/lua/loader.lua

Modified: head/stand/forth/loader.4th
==============================================================================
--- head/stand/forth/loader.4th	Fri Mar 27 17:06:24 2020	(r359370)
+++ head/stand/forth/loader.4th	Fri Mar 27 17:37:31 2020	(r359371)
@@ -72,6 +72,12 @@ include /boot/check-password.4th
 
 only forth definitions
 
+: maybe-resetcons ( -- )
+  loader_color? if
+    ris
+  then
+;
+
 : bootmsg ( -- )
   loader_color? dup ( -- bool bool )
   if 7 fg 4 bg then

Modified: head/stand/forth/loader.rc
==============================================================================
--- head/stand/forth/loader.rc	Fri Mar 27 17:06:24 2020	(r359370)
+++ head/stand/forth/loader.rc	Fri Mar 27 17:37:31 2020	(r359371)
@@ -14,6 +14,7 @@ try-include /boot/loader.rc.local
 start
 
 maybe-efi-resizecons
+maybe-resetcons
 
 \ Tests for password -- executes autoboot first if a password was defined
 check-password

Modified: head/stand/forth/screen.4th
==============================================================================
--- head/stand/forth/screen.4th	Fri Mar 27 17:06:24 2020	(r359370)
+++ head/stand/forth/screen.4th	Fri Mar 27 17:37:31 2020	(r359371)
@@ -39,6 +39,9 @@ marker task-screen.4th
 \ clear screen
 : clear ( -- ) ho cld ;
 
+\ reset to initial state
+: ris ( -- ) 27 emit [char] c emit ;
+
 \ move cursor to x rows, y cols (1-based coords) ( Esc-[%d;%dH )
 : at-xy ( x y -- ) escc .# [char] ; emit .# [char] H emit ;
 

Modified: head/stand/lua/core.lua
==============================================================================
--- head/stand/lua/core.lua	Fri Mar 27 17:06:24 2020	(r359370)
+++ head/stand/lua/core.lua	Fri Mar 27 17:37:31 2020	(r359371)
@@ -103,6 +103,7 @@ core.KEY_DELETE		= 127
 -- other contexts (outside of Lua) may mean 'octal'
 core.KEYSTR_ESCAPE	= "\027"
 core.KEYSTR_CSI		= core.KEYSTR_ESCAPE .. "["
+core.KEYSTR_RESET	= core.KEYSTR_ESCAPE .. "c"
 
 core.MENU_RETURN	= "return"
 core.MENU_ENTRY		= "entry"

Modified: head/stand/lua/loader.lua
==============================================================================
--- head/stand/lua/loader.lua	Fri Mar 27 17:06:24 2020	(r359370)
+++ head/stand/lua/loader.lua	Fri Mar 27 17:37:31 2020	(r359371)
@@ -38,28 +38,21 @@ local color = require("color")
 local core = require("core")
 local config = require("config")
 local password = require("password")
--- The menu module will be brought in after config has loaded if we actually
--- need it.
-local menu
 
 config.load()
 
--- Our console may have been setup for a different color scheme before we get
--- here, so make sure we set the default.
-if color.isEnabled() then
-	printc(color.default())
-end
-try_include("local")
-if not core.isMenuSkipped() then
-	menu = require("menu")
-end
 if core.isUEFIBoot() then
 	loader.perform("efi-autoresizecons")
 end
+-- Our console may have been setup with different settings before we get
+-- here, so make sure we reset everything back to default.
+if color.isEnabled() then
+	printc(core.KEYSTR_RESET)
+end
+try_include("local")
 password.check()
--- menu might be disabled
-if menu ~= nil then
-	menu.run()
+if not core.isMenuSkipped() then
+	require("menu").run()
 else
 	-- Load kernel/modules before we go
 	config.loadelf()



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202003271737.02RHbV0d080460>