Commit Graph

29 Commits

Author SHA1 Message Date
dumbbell
035cb01fbb vt(4): Adjust the cursor position after changing the window size
A new terminal_set_cursor() is added: it wraps the existing
teken_set_cursor() function.

In vtbuf_grow(), the cursor position is adjusted at the end of the
function. In vt_change_font(), we call terminal_set_cursor() just after
terminal_set_winsize_blank(), while the terminal is mute.

This fixes a bug where, after loading a kernel video driver which
increases the terminal window size, the cursor remains at its old
position, in other words, in the middle of the display content.

PR:		194421
MFC after:	1 week
2014-11-01 17:05:15 +00:00
bz
95348c7323 Make gcc happy by initialising the variable only set in a couple of
case statements without a default.

MFC after:	2 days
X-MFC with:	r271871
2014-09-20 08:18:48 +00:00
dumbbell
bd0370dde7 vt(4): Rewrite history scrolling
It's now possible to scroll up the 500 hard-coded lines of history, not
just a fraction of them. For instance, one can reach the top of the boot
process.

Sometimes, when scrolling or when changing the screen size (by changing
the font or loading a KMS driver for instance), one could see the
history cycling (old content appeared below latest lines). This is
fixed.

Now, when the resolution changes are more lines can be shown, the
displayed area is adjusted so that, if the screen was filled with
content before, it's filled with content after as well: more history
is visible, instead of having blank lines below the previously visible
content.

MFC after:	3 days
2014-09-19 12:20:43 +00:00
dumbbell
2e7b781164 vt(4): Remove vt_buf->vb_dirtymask
This structure and the associated functions were unused since the
implementation of vd_bitblt_text_t callbacks.

MFC after:	3 days
2014-09-19 11:02:44 +00:00
ray
b2dcc83c3f Fix stray char on paste.
Tested by:	dumbbell and me
MFC after:	1 week
2014-09-12 14:17:09 +00:00
ray
25f116b73a spelling fixes
Submitted by:	"Sam Fourman Jr." <sfourman@gmail.com>
MFC after:	1 week
2014-09-10 11:27:33 +00:00
dumbbell
e4c6496a54 vt(4): Change vb_history_size from "int" to "unsigned int"
CID:		1230002, 1230003
MFC after:	1 week
2014-08-29 08:16:31 +00:00
dumbbell
94c90531be vt(4): When creating a window buffer, fill it entirely
... not just the visible part.

This fixes a bug where, when switching from eg. vt_vga to vt_fb (ie. the
resolution goes up), the originally hidden, uninitialized area of the
buffer is displayed on the screen. This leads to a missing text cursor
when it's over an unitialized area.

This was also visible when selecting text: the uninitialized area was
not highlighted.

Internally, this area was zeroed: characters were all 0x00000000,
meaning the foreground and background color was black. Now, everything
is filled with a space with a gray foreground color, like the visible
area.

While here, remove the check for the mute flag and always use
TERMINAL_NORM_ATTR as the character attribute (ie. gray foreground,
black background).

MFC after:	1 week
2014-08-26 17:48:05 +00:00
dumbbell
e0854dd7f7 vt(4): Use the actual size of the mouse when marking its position as dirty
This fixes a bug where part of the cursor was not erased.

MFC after:	1 week
2014-08-22 17:09:31 +00:00
dumbbell
9674998316 vt(4): Constify vt_buf argument of vtbuf_iscursor()
MFC after:	1 week
2014-08-21 18:26:32 +00:00
dumbbell
2a8fc9388e vt(4): Add vtbuf_dirty*_locked() to lock vtbuf once, not twice
In several functions, vtbuf_putchar() in particular, the lock on vtbuf
is acquired twice:
    1. once by the said functions;
    2. once in vtbuf_dirty().

Now, vtbuf_dirty_locked() and vtbuf_dirty_cell_locked() allow to
acquire that lock only once.

This improves the input speed of vt(4). To measure the gain, a
50,000-lines file was displayed on the console using cat(1). The time
taken by cat(1) is reported below:
    o  On amd64, with vt_vga:
        - before: 1.0"
	- after:  0.5"
    o  On sparc64, with creator_vt:
        - before: 13.6"
	- after:  10.5"

MFC after:	1 week
2014-08-10 15:02:51 +00:00
marius
15fe259895 In order to get vt(4) a bit closer to the feature set provided by sc(4),
implement options TERMINAL_{KERN,NORM}_ATTR. These are aliased to
SC_{KERNEL_CONS,NORM}_ATTR and like these latter, allow to change the
default colors of normal and kernel text respectively.
Note on the naming: Although affecting the output of vt(4), technically
kern/subr_terminal.c is primarily concerned with changing default colors
so it would be inconsistent to term these options VT_{KERN,NORM}_ATTR.
Actually, if the architecture and abstraction of terminal+teken+vt would
be perfect, dev/vt/* wouldn't be touched by this commit at all.

Reviewed by:	emaste
MFC after:	3 days
Sponsored by:	Bally Wulff Games & Entertainment GmbH
2014-06-27 19:57:57 +00:00
emaste
8ef756fbbe Update size in vt_grow if we don't have to reallocate
vt_grow may be called with a new size that's larger than previous but
does not require reallocation - for example, when the number of columns
is the same and new number of rows is less than the history size.
Prior to this change we would fail to update vb_scr_size, and then hit
a KASSERT when trying to write to the newly visible rows.

Sponsored by:	The FreeBSD Foundation
2014-05-29 21:10:33 +00:00
emaste
57a402ba9d Correct KASSERT strings
Rows refer to height and cols to width.
2014-05-29 20:26:01 +00:00
ray
8fb9f18d80 Fix scrollback.
Sponsored by:	The FreeBSD Foundation
2014-05-08 13:46:36 +00:00
ray
97d6ba6169 Respect SC_NO_CUTPASTE option. It disable mouse cursor and cut/paste support
for vt(9). Note: /dev/sysmouse not affected.

Sponsored by:	The FreeBSD Foundation
2013-12-09 15:01:34 +00:00
ray
3a1474f1ca Done cut/paste "word" selection mode support.
It still selects everything which is not space around.

Sponsored by:	The FreeBSD Foundation

Sponsored by:	The FreeBSD Foundation
2013-11-14 15:44:22 +00:00
ray
2393e1d45d wrap long lines.
Sponsored by:	The FreeBSD Foundation
Sponsored by:	The FreeBSD Foundation
2013-11-14 15:14:27 +00:00
ray
ba5a321719 Save last mouse event and check if the button1-up event happen w/o movement,
then ignore it. Otherwise such events broke double/triple click sequence.

Sponsored by:	The FreeBSD Foundation
2013-11-14 13:25:47 +00:00
ray
bf95a4a20c Simplify a bit vtbuf_set_mark.
Sponsored by:   The FreeBSD Foundation
2013-11-14 00:00:55 +00:00
ray
86dec2aac1 Do not add <CR><LF> for last (single) line of paste buffer.
Sponsored by:	The FreeBSD Foundation
2013-11-13 14:35:00 +00:00
ray
d90e7c4086 o Simplify POS_INDEX macro calculation.
o New macro POS_COPY to copy between term_pos_t.
o Add vtbuf_wth/vtbuf_htw helpers, to translate between screen coordinates and
	circular history buffer location.
o Update vtbuf_iscursor to mark region selected by mouse.
o New helper vtbuf_flush_mark, to update regions where copy/paste mark changed.
o New method vtbuf_get_marked_len to get storage size for paste buffer.
o vtbuf_extract_marked fill (caller allocated buffer) with selected region data.
o Simplify mouse handler for copy/paste, and use vtbuf_flush_mark to update.
o New method vtbuf_scroll_mode, to help indicate Scroll mode by hiding cursor.
o Update header with new vtbuf methods.
o Add new vt_driver method vd_markedwin, to hold last window with selection.
o Enable paste support in core module.

Sponsored by:	The FreeBSD Foundation
Pointed by:	Claude Buisson <clbuisson@orange.fr> (Scroll mode indication)
2013-11-13 12:32:41 +00:00
ray
0ff0e79509 Add mouse related vtbuf operations.
Sponsored by:	The FreeBSD Foundation
2013-11-11 11:50:17 +00:00
ray
3ec83506b8 Fix copyrights.
Sponsored by:	The FreeBSD Foundation
2013-11-02 14:20:29 +00:00
ray
41788ddb71 o Fix scroll calculations.
o Make vthistory_seek to return amount of lines to update +on_top/-on_bottom of
    screen.

Sponsored by:	The FreeBSD Foundation
2013-10-24 21:43:46 +00:00
ray
baa491bf97 Turn off confusing rotation of scroll history.
Sponsored by:	The FreeBSD Foundation
2013-10-23 14:15:46 +00:00
ray
6ed638c56a Don't forget to clean terminal window memory. But colors makes more smiles.
Sponsored by:	The FreeBSD Foundation
2013-10-22 13:53:58 +00:00
ray
c7a97e97fa o Implement history buffer.
o Join history buffer with screen buffer. Same type of things.
o Reimplement buffer as an array of rows. Make it circular, so no overflow
	tracking.
o Implement VT_PROCESS mode. Locking of VT switching by owner process.
o Add debug and deadtimer sysctls. deadtimer - defaulting to 15 seconds, time
	to wait process answer in VT_PROCESS mode, to do VT switch in case when
	process hang.
o Implement later console attach.
o Fix (partially yet) keyboard allocation.
o Add drivers priority. Disallow to replace KMS driver with VGA.
o Add ability to resize terminals.

Sponsored by:	The FreeBSD Foundation
2013-10-08 12:40:04 +00:00
ed
98e93f6b12 Readd the vt(4) driver and corresponding tools. 2011-03-22 21:31:31 +00:00