History log of /freebsd-current/sys/teken/teken_subr.h
Revision Date Author Comments
# 95ee2897 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: two-line .h pattern

Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

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


# 577df3d6 19-Feb-2019 Bruce Evans <bde@FreeBSD.org>

Attempt to complete fixing programmable function keys for syscons.

The flag for the driver capability of supporting the fix is independent
of the flag for cons25 mode so that it can be managed independently, but
I forget to preserve it when resetting the terminal.


# e06f6f73 19-Feb-2019 Ed Schouten <ed@FreeBSD.org>

Place an upper bound on the number of iterations for REP.

Right now it's possible to invoke the REP escape sequence with a maximum
of tens of millions of iterations. In practice, there is never any need
to do this. Calling it more frequently than the number of cells in the
terminal hardly makes any sense. By placing a limit on it, we can
prevent users from exhausting resources in inside the terminal emulator.

As support for this escape sequence is not present in any of the stable
branches, there is no need to MFC.

Reported by: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11255


# 7c27c925 19-Feb-2019 Ed Schouten <ed@FreeBSD.org>

Add missing __unused attributes to unused function arguments.

This fixes the userspace build of libteken.


# 3eb27bf0 21-Oct-2018 Poul-Henning Kamp <phk@FreeBSD.org>

Implement ECMA-48 "REP", some Linuxen have started emitting them recently.

Approved by: ed


# b554075d 21-May-2018 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

teken: Rename the "Set Cursor Style" sequence to match vt100.net docs

This fixes inconsistencies with the rest of the `sequences` file.

No functional changes.

Requested by: ed


# 8dcd2ed3 20-May-2018 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

teken, vt(4): Parse the "Cursor style" escape sequence

The escape sequence (e.g. `^[[2 q`) was unsupported before and the
letter `q` was displayed as a typed character. The sequence is used by
Neovim for instance.

Now, it is properly parsed. However, it is ignored, so it won't change
the cursor style.

Because the escape sequence contains a space character, the
`gensequences` script had to be modified to support that. In the
`sequences` file, a space is represented as the string `SP`.


# 92223bdd 08-Apr-2018 Poul-Henning Kamp <phk@FreeBSD.org>

Pedantic polishing of code to please FlexeLint.

Approved by: ed


# fe267a55 27-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

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.


# b8d356b3 24-Aug-2015 Ed Schouten <ed@FreeBSD.org>

Sync HPA and VPA implementations with CUP.

After fixing the 16-bits integer arithmetic overflow in 286981, we
should also make sure to fix the VPA sequence. Bring HPA and VPA in sync
with how we now implement CUP.

PR: 202612
Reported by: kcwu csie org
MFC after: 1 month


# 9a71fa37 21-Aug-2015 Ed Schouten <ed@FreeBSD.org>

Don't truncate cursor arithmetic to 16 bits.

When updating the row number when the cursor position escape sequence is
issued, we should make sure to store the intermediate result in a 32-bit
integer. If we fail to do this, the cursor may be set above the origin
region, which is bad.

This could cause libteken to crash when INVARIANTS is enabled, due to
the strict set of assertions that libteken has.

PR: 202540
Reported by: kcwu csie org
MFC after: 1 month


# 67f2a03a 22-Dec-2013 Ed Schouten <ed@FreeBSD.org>

Fix linewrapping behaviour for CJK fullwidth characters.

Instead of only wrapping when in the 'wrapped state', also force
wrapping when the character to be rendered does not fit on the line
anymore.

Tested by: lwhsu


# a6c26592 20-Dec-2013 Ed Schouten <ed@FreeBSD.org>

Extend libteken to support CJK fullwidth characters.

Introduce a new formatting bit (TF_CJK_RIGHT) that is set when putting a
cell that is the right part of a CJK fullwidth character. This will
allow drivers like vt(9) to support fullwidth characters properly.

emaste@ has a patch to extend vt(9)'s font handling to increase the
number of Unicode -> glyph maps from 2 ({normal,bold)} to 4
({normal,bold} x {left,right}). This will need to use this formatting
bit to determine whether to draw the left or right glyph.

Reviewed by: emaste


# 27cf7d04 05-Dec-2013 Aleksandr Rybalko <ray@FreeBSD.org>

Merge VT(9) project (a.k.a. newcons).

Reviewed by: nwhitehorn
MFC_to_10_after: re approval

Sponsored by: The FreeBSD Foundation


# 231c19b1 10-Oct-2011 Ed Schouten <ed@FreeBSD.org>

Properly use the cursor to bound the position for CUP.

We must take the origin region into account when clamping the cursor
position.

MFC after: 3 days


# d8554e5c 06-Oct-2011 Ed Schouten <ed@FreeBSD.org>

Tab should not blank cells.

It seems I was under the impression that a tab differs from a single
forward tabulation, namely that it blanks the underlying cells. This
seems not to be the case. They are identical.

This should fix applications like jove(1) that use tabs instead of
explicit cursor position setting.

Reported by: Brett Glass <brett lariat net>
MFC after: 3 days, after it's tested


# aaa232d4 26-Jun-2011 Ed Schouten <ed@FreeBSD.org>

Fix various whitespace inconsistencies in sys/teken.


# 9d67d221 05-Dec-2010 Ed Schouten <ed@FreeBSD.org>

Use proper bounds checking on VPA.

We must check against tp->t_cursor.tp_row, not row, to figure out
whether we must clamp the cursor position.

Submitted by: luigi
MFC after: 3 weeks


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# 0abe3145 09-Aug-2010 Ed Schouten <ed@FreeBSD.org>

Make ^L with cons25 and origin mode bit more sane.

Even though cons25 normally doesn't support origin regions, this
emulator does allow you to do it. It makes more sense to blank only the
origin region when emitting ^L instead of blanking the entire screen.
Apart from that, we should always place the cursor inside the origin
region, which doesn't happen right now.


# 3a8a07ea 11-Nov-2009 Ed Schouten <ed@FreeBSD.org>

Allow Syscons terminal emulators to provide function key strings.

xterm and cons25 have some incompatibilities when it comes to escape
sequences for special keys, such as F1 to F12, home, end, etc. Add a new
te_fkeystr() that can be used to override the strings.

scterm-sck won't do anything with this, but scterm-teken will use
teken_get_sequences() to obtain the proper sequence.


# 0475bba7 11-Nov-2009 Ed Schouten <ed@FreeBSD.org>

Always home the cursor when changing the scrolling region.

I thought this only had to be done when in origin mode, to ensure that
the cursor is not placed outside the origin, but it seems this is also
done when not in origin mode.

This fixes some artifacts when pressing ^L while running irssi in tmux.
(Almost) nobody noticed this, because cons25 doesn't have scrolling
regions.


# 4a11e7f1 08-Oct-2009 Ed Schouten <ed@FreeBSD.org>

Discard Device Control Strings and Operating System Commands.

These strings often contain things like:

- Window titles.
- Extended key map functionality.
- Color palette switching.

We could look at these features in the future (if people consider them
to be important enough), but we'd better discard them now. This fixes
some artifacts people reported when using TERM=xterm.

Reported by: des@, Paul B. Mahol


# 53e69c0c 27-Sep-2009 Ed Schouten <ed@FreeBSD.org>

Add support for VT200-style mouse input.

Right now if applications want to use the mouse on the command line,
they use sysmouse(4) and install a signal handler in the kernel to
deliver signals when mouse events arrive. This conflicts with my plan to
change to TERM=xterm, so implement proper VT200-style mouse input.

Because mouse input is now streamed through the TTY, it means you can
now SSH to another system on the console and use the mouse there as
well. The disadvantage of the VT200 mouse protocol, is that it doesn't
seem to generate events when moving the cursor. Only when pressing and
releasing mouse buttons.

There are different protocols as well, but this one seems to be most
commonly supported.

Reported by: Paul B. Mahol <onemda gmail com>
Tested with: vim(1)


# 56a4365b 26-Sep-2009 Ed Schouten <ed@FreeBSD.org>

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>


# f311d560 26-Sep-2009 Ed Schouten <ed@FreeBSD.org>

Properly get out of origin mode if the cursor has to move outside of it.

In some cases events may occur that move the cursor outside the
scrolling region while in origin mode, which is normally not possible.
Events like these include:

- Alignment test.
- Restore cursor.

Properly switch off origin mode in these cases.

MFC after: 1 month


# cd531e74 26-Sep-2009 Ed Schouten <ed@FreeBSD.org>

Get rid of now deprecated SCS wrappers.

We always build SCS, even when processing 8-bit data. There is no reason
why we should be able to disable it now.


# c56bcdbb 25-Sep-2009 Ed Schouten <ed@FreeBSD.org>

Conformance: ignore {delete,insert} line while outside the scrolling region.

I noticed a small inconsistency in delete and insert line between xterm
and libteken. libteken allows these actions to happen while the cursor
is placed outside the scrolling region, while xterm does not.

This behaviour seems to be VT100-like. Confirmation:

http://www.vt100.net/docs/vt102-ug/chapter5.html
"This sequence is ignored when cursor is outside scrolling region."

MFC after: 1 month


# fbcd1b6e 24-Sep-2009 Ed Schouten <ed@FreeBSD.org>

Make SCS work in 8-bit mode.

This means we can finally do things like VT100 box drawing when using
Syscons (8-bit characters). As far as I know, the only remaining issue
is the absense of proper escape sequences for special keyboard
characters (cursor, F1 to F12, etc) and xterm emulation should be ready
for general use.

Enabling xterm would have the following advantages:

- Easier possible migration to Unicode. cons25 termcap entries are very
8-bit centric. They use things like CP437 characters for box drawing,
etc.

- Better support for SSH'ing to other operating systems/devices. Most
switches use VT100-style admin interfaces.

- Reduced bandwidth, because applications can now use things like
scrolling regions.

- You can finally use applications like dtach(1) on both the console and
inside an xterm.


# eba77f5c 11-Sep-2009 Ed Schouten <ed@FreeBSD.org>

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.


# e06d84fc 12-Sep-2009 Ed Schouten <ed@FreeBSD.org>

Make 8-bit support run-time configurable.

Now to do the same for xterm support. This means people can eventually
toy around with xterm+UTF-8 without recompiling their kernel.


# b03552b5 12-Sep-2009 Ed Schouten <ed@FreeBSD.org>

Make resizing of teken terminals a bit more safe.

Just perform a full reset when resizing the terminal. This means the
cursor, scrolling region, etc. are never positioned outside the
terminal.


# 9b934d09 03-Sep-2009 Ed Schouten <ed@FreeBSD.org>

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.