Commit Graph

14 Commits

Author SHA1 Message Date
Warner Losh
95ee2897e9 sys: Remove $FreeBSD$: two-line .h pattern
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
2023-08-16 11:54:11 -06:00
Warner Losh
4d846d260e spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
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
2023-05-12 10:44:03 -06:00
Ed Maste
cf8880d52b teken: color #3 is yellow not brown - use TC_YELLOW as the name
The console escape code standard (ECMA-48) specifies color #3 (escape
code 33) as yellow.  A brown console color is an artifact of the VGA
palette, which replaces dim (but not bright) yellow with brown.

Reviewed by:	adrian, imp
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34531
2022-03-12 09:17:29 -05:00
Poul-Henning Kamp
92223bdded Pedantic polishing of code to please FlexeLint.
Approved by:	ed
2018-04-08 19:23:50 +00:00
Pedro F. Giffuni
fe267a5590 sys: general adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

No functional change intended.
2017-11-27 15:23:17 +00:00
Bruce Evans
15e0c6511a Fix syscons escape sequence for setting the local cursor type. This sequence
was aliased to a vt sequence, causing and fixing various bugs.

For syscons, this restores support for arg 2 which sets blinking block
too forcefully, and restores bugs for arg 0 and 1.  Arg 2 is used for
vs in the cons25 entry in termcap, but I've never noticed an application
that uses this.  The bugs involve replacing local settings by global
ones and need better handling of defaults to fix.

For vt, this requires moving the aliasing code from teken to vt where
it belongs.  This sequences is very important for cons25 compatibility
in vt since it is used by the cons25 termcap entries for ve, vi and
vs.  vt can't properly support vs for either cons25 or xterm since it
doesn't support blinking.  For xterm, the termcap entry for vs asks
for something different using 12;25h instead of 25h.

Rename C25CURS for this to C25LCT and change its description to be closer
to echoing the old comment about it.  CURS is too generic.

Fix missing syscons escape sequence for setting the global cursor shape
(and type).  Only support this in syscons since vt can't emulate anything
in it.
2017-08-18 15:40:40 +00:00
Bruce Evans
97933a41fb Improve names for cons25 sequences.
In a recent commit, I forgot to expand an X to an abbreviation of "BORDER".
Fix this and some nearby bad names.

The descriptions were copied from comments in scterm-sc.c, but some
of these are bad.  The border [color] was inconsistently described as
a property of the "display", but I had changed this to "adapter" to
match the descriptions for other color settings.  All colors supported
by the cons25 sequences are actually properties of the current vty and
that should not be described.  But the other colors are defaults.
Change "adapter" to "default" for them and remove "adapter" for the
border.  Reduce the verbosity of the abbreviation from AD to D.
2017-08-18 14:04:14 +00:00
Bruce Evans
dd833891de Fix missing syscons escape sequence for setting the border color. 2017-08-18 10:38:49 +00:00
Bruce Evans
4eb235fb4f Fix bright colors for syscons, and make them work for the first time
for vt.  Restore syscons' rendering of background (bg) brightness as
foreground (fg) blinking and vice versa, and add rendering of blinking
as background brightness to vt.

Bright/saturated is conflated with light/white in the implementation
and in this description.

Bright colors were broken in all cases, but appeared to work in the
only case shown by "vidcontrol show".  A boldness hack was applied
only in 1 layering-violation place (for some syscons sequences) where
it made some cases seem to work but was undone by clearing bold using
ANSI sequences, and more seriously was not undone when setting
ANSI/xterm dark colors so left them bright.  Move this hack to drivers.

The boldness hack is only for fg brightness.  Restore/add a similar hack
for bg brightness rendered as fg blinking and vice versa.  This works
even better for vt, since vt changes the default text mode to give the
more useful bg brightness instead of fg blinking.

The brightness bit in colors was unnecessarily removed by the boldness
hack.  In other cases, it was lost later by teken_256to8().  Use
teken_256to16() to not lose it.  teken_256to8() was intended to be
used for bg colors to allow finer or bg-specific control for the more
difficult reduction to 8; however, since 16 bg colors actually work
on VGA except in syscons text mode and the conversion isn't subtle
enough to significantly in that mode, teken_256to8() is not used now.

There are still bugs, especially in vidcontrol, if bright/blinking
background colors are set.

Restore XOR logic for bold/bright fg in syscons (don't change OR
logic for vt).  Remove broken ifdef on FG_UNDERLINE and its wrong
or missing bit and restore the correct hard-coded bit.  FG_UNDERLINE
is only for mono mode which is not really supported.

Restore XOR logic for blinking/bright bg in syscons (in vt, add
OR logic and render as bright bg).  Remove related broken ifdef
on BG_BLINKING and its missing bit and restore the correct
hard-coded bit.  The same bit means blinking or bright bg depending
on the mode, and we want to ignore the difference everywhere.

Simplify conversions of attributes in syscons.  Don't pretend to
support bold fonts.  Don't support unusual encodings of brightness.
It is as good as possible to map 16 VGA colors to 16 xterm-16
colors.  E.g., VGA brown -> xterm-16 Olive will be converted back
to VGA brown, so we don't need to convert to xterm-256 Brown.  Teken
cons25 compatibility code already does the same, and duplicates some
small tables.  This is mostly for the sc -> te direction.  The other
direction uses teken_256to16() which is too generic.
2017-03-18 11:13:54 +00:00
Ed Schouten
68fdfe2926 Partially implement the mysterious cons25 \e[x escape sequence.
It seems the terminfo library on some systems (OS X, Linux) may emit the
sequence \e[x to reset to default attributes. Apart from using the
zero-command, this escape sequence allows many more operations, such as
setting ANSI colors. I don't see this used anywhere, so this should be
sufficient for now.

This deficiency was spotted by the Debian GNU/kFreeBSD. They have their
own patch, which is slightly flawed in my opinion. I don't know why they
never reported this issue to us.

MFC after:	1 week
2010-11-05 00:56:21 +00:00
Ed Schouten
56a4365bde Add 256 color support.
It is quite inconvenient that if an application for xterm uses 256 color
mode, text suddenly starts to blink (because of ;5; in the middle).
We'd better just implement 256 color mode and add a conversion routine
from 256 to 8 color mode, which doesn't seem to be too bad in practice.

Remapping colors is done quite simple. If one of the channels is most
actively represented, primary colors are used. If two channels are most
actively represented, secondary colors are used. If all three channels
are equal (gray), it picks between black and white.

Reported by:	Paul B. Mahol <onemda gmail com>
2009-09-26 15:26:32 +00:00
Ed Schouten
2c549cc439 Add a new escape sequence to switch between cons25 and xterm.
Just run this to switch to xterm:

	printf '\e[=T'

If you get bored and want to switch back to cons25, run this:

	printf '\e[=1T'

I can now send an email to the lists, asking whether people are
interested in trying the xterm emulator.
2009-09-25 13:51:01 +00:00
Ed Schouten
eba77f5c40 Commit all local modifications I have to libteken:
- Make xterm/cons25 support runtime configurable. This allows me to
  share libteken between syscons and my new vt driver.
- Add a fix to print blanks after printing a double width character to
  prevent rendering artifacts.
- Add some more utility functions that I use in the vt driver.
2009-09-12 12:44:21 +00:00
Ed Schouten
9b934d0930 Move libteken out of the syscons directory.
I initially committed libteken to sys/dev/syscons/teken, but now that
I'm working on a console driver myself, I noticed this was not a good
decision. Move it to sys/teken to make it easier for other drivers to
use a terminal emulator.

Also list teken.c in sys/conf/files, instead of listing it in all the
files.arch files separately.
2009-09-03 09:33:57 +00:00