aboutsummaryrefslogtreecommitdiff
path: root/stand/lua/screen.lua
Commit message (Collapse)AuthorAgeFilesLines
* loader: Fix 0 vs 1 confusion for column numbersWarner Losh2024-12-281-1/+1
| | | | | | | | | | | | | In two places we use '0' for a column number. However, the upper left hand corner of the screen is 1, 1. Fix those two confusions. Also, fix a comment that flipped the coordinates in a comment (I'm used to the vt100 convention where it's row, column (eg y, x)) and didn't notice the rest of the code uses x, y. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D46777 (cherry picked from commit 604919c47fa4092db08dadd282851afc9cba0a90)
* Remove $FreeBSD$: two-line lua tagWarner Losh2023-08-161-2/+0
| | | | Remove /^--\n--\s*\$FreeBSD\$.*$\n/
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-121-1/+1
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* lualoader: don't botch disabling of colorKyle Evans2019-10-211-2/+2
| | | | | | | | | | | | | | | When colors are disabled, color.escape{fg,bg} would return the passed in color rather than the proper ANSI sequence for the color. color.escape{fg,bg} would be wrong. Instead return '', as the associated reset* functions will also return ''. This should get rid of the funky '2' and '4' in the kernel selector if you're booting serial. Reported by: npn Notes: svn path=/head/; revision=353872
* Serial console menus for lua.Warner Losh2018-08-201-10/+0
| | | | | | | | | | | Remove a bunch of special cases for UEFI and serial consoles. We do want to do curses and menu things here. This makes us match what we do in FORTH, with the possible exception of boxes around menus. Differential Revision: https://reviews.freebsd.org/D16816 Notes: svn path=/head/; revision=338108
* lualoader: Clear up some possible naming confusionKyle Evans2018-03-211-2/+2
| | | | | | | | | | | | | | | In the original lualoader project, 'escapef' and 'escapeb' were chosen for 'escape fg' and 'escape bg'. We've carried on this naming convention, and as our use of attributes grow the likeliness of 'escapeb'/'resetb' being confused upon glance for 'escape bold'/'reset bold' increases. Fix this by renaming these four functions to {escape,reset}{fg,bg} rather than {escape,reset}{f,b} for clarity. Reported by: dteske Notes: svn path=/head/; revision=331304
* lualoader: Use global printc instead of loader.printcKyle Evans2018-03-021-5/+5
| | | | | | | | | | | | | | | | | r330282 registered loader.printc as printc, so use it instead. This makes sense for a couple reasons, the major point being that it reads a little bit easier and pairs nicely with the global 'print'. Similar cases can not really be made for other loader.* functions as most of them are either highly specific to our use-case or usually available in other modules, such as `os`. printc does not have a standard implementation in the Lua world(*), so we have a little more leeway with it, and it's kind of a special case of the globally available 'print'. (*) I've been in the Lua world for all of two weeks, so this could be wrong. Notes: svn path=/head/; revision=330283
* lualoader: Further screen cleanupKyle Evans2018-02-281-1/+4
| | | | | | | | | | | | | - Add screen.default_x and screen.default_y to determine where screen.defcursor resets the cursor to. - Use screen.setcursor in screen.defcursor instead of rewriting the escape sequence. - Use screen.default_y when resetting the cursor after writing the new twiddle character, add a comment verbally describing the position just in case. Notes: svn path=/head/; revision=330099
* lualoader: Re-do twiddleKyle Evans2018-02-281-18/+0
| | | | | | | | | | | | It worked on my test setup, but is clearly non-functional on others. Further examination of check-password.4th showed that it actually reset the cursor to 0,25 every time and overwrote the previous password prompt. Do that, and also clear the "Incorrect Password" text if the correct password gets entered. Notes: svn path=/head/; revision=330098
* lualoader: Convert instances of KEYSTR_ESCAPE .. "[" -> KEYSTR_CSIKyle Evans2018-02-271-7/+7
| | | | Notes: svn path=/head/; revision=330087
* lualoader: Replace instances of \027 with KEYSTR_ESCAPEKyle Evans2018-02-271-7/+7
| | | | | | | | | | With exception to drawing bits, which should probably be kept as-is to not make a mess out of things. Reported by: rpokala (a while ago) Notes: svn path=/head/; revision=330084
* lualoader: Add a twiddle at password promptKyle Evans2018-02-271-0/+18
| | | | | | | | | | | | | | | | | | | This gives some form of feedback while typing, and matches-(ish*) Forth behavior. The cursor generally rests two column after the password prompt, then the twiddle is drawn three columns later and the cursor reset to resting position after being drawn. I've removed the note about re-evaluating it for security considerations and instead set it up as a module-local variable that we can set later depending on environment or something. It's set to false with no chance of changing at the moment. *As close as I can tell from reading check-password.4th, because I don't have an easy test (or deployed) setup for forth loader to check how close it is. Please do mention if it's not close enough. Notes: svn path=/head/; revision=330082
* lualoader: screen argument fixesKyle Evans2018-02-261-6/+6
| | | | | | | | | | | | | | screen was also guilty of not-so-great argument names, but it was also guilty of handling color sequences on its own. Change those bits to using the color module instead. As a side note, between color and screen, I'm not 100% sure that returning the color_value is the right thing to do if we won't generate the escape sequences. This should be re-evaluated at a later time, and they should likely return nil instead. Notes: svn path=/head/; revision=330010
* Add SPDX tags to lua filesKyle Evans2018-02-231-0/+2
| | | | Notes: svn path=/head/; revision=329851
* lualoader: Remove nasty hack for not printing out ".0"Kyle Evans2018-02-211-12/+1
| | | | | | | | | | luaconf.h has a LUA_COMPAT_FLOATSTRING option that may be defined to do this instead of needing intstring. Reported by: Dan Nelson Notes: svn path=/head/; revision=329756
* lualoader: Drop excessive parenthesizingKyle Evans2018-02-211-6/+6
| | | | | | | | | | | This was also a convenience convention (for me) that is not very lua-tic. Drop it. I've maintained some parentheses where I'd prefer them, for example, 'if x or y or (z and w) then', but these situations are far and few between. Notes: svn path=/head/; revision=329685
* lualoader: Drop terminating semicolonsKyle Evans2018-02-211-19/+19
| | | | | | | | | | | This was previously chosen out of convenience, as we had a mixed style and needed to be consistent. I started learning Lua on Friday, so I switched everything over. It is not a very lua-nic convention, though, so drop it. Excessive parenthesizing around conditionals is next on the chopping block. Notes: svn path=/head/; revision=329684
* stand/lua: Consistently organize modulesKyle Evans2018-02-201-0/+1
| | | | | | | | | | | | | | | | | We follow pretty closely the following structure of a module: 1. Copyright notice 2. Module requires 3. Module local declarations 4. Module local definitions 5. Module exports 6. return Re-organize the one-offs (config/drawer) and denote the start of module exports with a comment. Notes: svn path=/head/; revision=329641
* stand/lua: Consistently declare local functions at module scopeKyle Evans2018-02-201-1/+1
| | | | | | | | | Declare these adjacent to the local definitions at the top of the module, and make sure they're actually declared local to pollute global namespace a little bit less. Notes: svn path=/head/; revision=329640
* stand/lua: Round up some more style.lua(9) concernsKyle Evans2018-02-191-5/+5
| | | | Notes: svn path=/head/; revision=329594
* stand/lua: Rename bootserial for clarityKyle Evans2018-02-191-3/+3
| | | | Notes: svn path=/head/; revision=329577
* stand/lua: Style passKyle Evans2018-02-171-11/+11
| | | | | | | | | | | | | These are the style points that I'd like to try and maintain in our lua scripts: - Parentheses around conditionals - Trailing semicolons, except on block terminators - s:method(...) instead of string.method(s, ...) where applicable There's likely more, but that'll get hammered out as we continue. Notes: svn path=/head/; revision=329435
* stand/lua: Use escaped dot instead of single character classKyle Evans2018-02-161-1/+1
| | | | Notes: svn path=/head/; revision=329393
* stand/lua: Chop off the decimal for numbers passed to setcursorKyle Evans2018-02-161-1/+13
| | | | | | | | | | | | | | | | | Decimals screw up the escape sequence and the cursor will not get set. Right now this only affects setting the cursor for drawing "Welcome to FreeBSD" -- the resulting number after our (x+(w/2)-9) calculation gets output as "14.0." This should be fixed at the interpreter level, rather than here, but this is not a widespread problem at the moment so we'll fix it up in further work. Reported by: David Wolfskill <david@catwhisker.org> Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D14375 Notes: svn path=/head/; revision=329387
* Add the lua scripts from the lua-bootloader SoCWarner Losh2018-02-121-0/+73
These are the .lua files from from Pedro Souza's 2014 Summer of Code project. Rui Paulo, Pedro Arthur and Wojciech A. Koszek also contributed. Obtained from: https://wiki.freebsd.org/SummerOfCode2014/LuaLoader Sponsored by: Google Summer of Code Improve the SoC lua menu code to bring it in line with forth menu functionality Submitted by: Zakary Nafziger Sponsored by: FreeBSD Foundation Use loader.setenv and loader.unsetenv instead of loader.perform Convert from include("/boot/foo.lua") to foo = require("foo"); to bring in line with latest lua module conventions. Enforce a uniform style for the new .lua files: o hard tab indenation for 8 spaces o don't have if foo then bar; else bas; end on one line MFC After: 1 month Relnotes: yes Differential Review: https://reviews.freebsd.org/D14295 Notes: svn path=/head/; revision=329167