82 Commits

Author SHA1 Message Date
David Herrmann
bdf032898e console: fix invalid cursor state after resize
Set cursor state to next valid position on resize to avoid invalid cursor
states.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-14 20:00:06 +02:00
David Herrmann
59e82152d3 console: allow erasing partial lines
Later VTs allow erasing only partial lines so add support for that in the
console backend.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-14 19:58:38 +02:00
David Herrmann
f4375dcc76 console: hide cursor if requested
When the HIDE_CURSOR flag is set, we must not draw the cursor.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-14 19:31:37 +02:00
David Herrmann
492ac8f72c console/vte: implement ICH DCH
ICH is used to insert characters into the current line. DCH is used to
delete characters from the current line. They act as described in vt220
manual.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-14 17:33:28 +02:00
David Herrmann
60b180a369 console: support "protect" character attribute
VT220 allows protecting attributes. That is, they are not erased by
special new erase-commands. The normal erase-commands still erase all
characters.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-14 16:49:35 +02:00
David Herrmann
1d87be8c98 console: add tab-stop helpers
Add three helpers to set and reset tab-stops. They will be used by the VTE
layer to add and remove tab-stops when requested by the application.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-14 14:21:43 +02:00
David Herrmann
abb4deb4b8 console: fix tab ruler to be horizontal
Whoops, current tab ruler turned out to be vertical. That's definitely not
what we want. Therefore, turn it around to be horizontal so we can
correctly move forward/backward in the console.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-14 14:20:39 +02:00
David Herrmann
10c90c6c5d console: implement console soft-reset
On soft-reset we reset the console to the initial state but keep current
line-state. That is, scrollback and cursor position are kept but the
non-visible state is reset.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-14 14:12:51 +02:00
David Herrmann
e1095b5ef2 console: add tab-ruler support
The tab-ruler is used to set console tab-stops. We use an array with one
cell per column that is set to true if it is a tab-stop and false if it is
not.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-14 13:53:52 +02:00
David Herrmann
2a648c54dd console: allow retrieving cursor state
This adds two functions to retrieve x/y positions of the cursor. This can
be used to save and restore cursor positions.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-14 13:36:46 +02:00
David Herrmann
6356dae1da vte/console: implement CSI 'M' (DL: delete line)
The 'M' CSI mode is used to delete lines. This implements this mode
similar to the "INSERT LINES" CSI.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-01 15:35:28 +02:00
David Herrmann
ff91998ad8 vte/console: implement CSI mode L (insert line: IL)
The IL CSI ('L') is used to insert a given number of lines at the current
cursor position. All lines below are moved down.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-01 15:30:23 +02:00
David Herrmann
b0c19c5c42 console: rewrite console layer
This is a rewrite of the whole console layer so we can remove the
kmscon_buffer object to speed up the console.

This removes the split between the scroll region and the two margins so we
can resize margins in O(1). This also correctly merges the remaining
console modes so vte does not have to track them.

Btw. vim runs smoothly on kmscon with this console layer now (finally!).

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-06-17 15:53:33 +02:00
David Herrmann
cdc7834ba4 vte: allow setting margins
Support changing margin size of the terminal.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-30 20:49:39 +02:00
David Herrmann
624d5e0a48 console/vte: draw cursor
If HIDE_CURSOR mode is not set, we draw the cursor at the current
position.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-30 19:02:17 +02:00
David Herrmann
c1e7a29587 vte: set color to white on cell reset
For the same reason as we reset it to white on cell creation we need to
reset it to white on cell reset. Otherwise we have odd artifacts in
reverse video mode.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-30 18:58:52 +02:00
David Herrmann
f311a506dd console: reset font color to white by default
Reset font color to white for new cells. This allows us to draw reversed
cells that are not occupied by any value. Otherwise, these cells would be
still black if reversed.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-30 18:52:20 +02:00
David Herrmann
7129a9038c terminal/vte/console: support inverse-screen-mode
In inverse screen mode we switch background and foreground colors. As our
console layer supports transparent backgrounds, we have to do this in the
terminal layer.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-30 18:19:49 +02:00
David Herrmann
2630ee585b console: allow retrieving console flags
This adds a new function that allows external subsystems to retrieve the
current flags of the console.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-30 18:19:03 +02:00
David Herrmann
320b838644 vte: implement origin mode
Convert the old relative-addressing mode of the console layer into origin
mode flag.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-30 18:00:06 +02:00
David Herrmann
cce9a5df15 console: allow setting/resetting flags
Instead of writing a function for each mode we now accept flags for the
console object. For now the flags are unused but other flags will be
added.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-30 17:59:37 +02:00
David Herrmann
addaa40562 vte: add auto-wrap support
VT510 manual says auto-wrap is disabled by default but most applications
(including bash) expect it to be on, therefore we enable it by default.

The console layer already supported it but the vte layer wasn't hooked up.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-29 17:07:53 +02:00
David Herrmann
860e7ff509 console: support INSERT mode
When INSERT mode is enabled, we move all following characters to the right
and drop all characters that are moved beyond the margin.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-29 16:57:04 +02:00
David Herrmann
75d981b7be console: add kmscon_console_reset() dummy
This dummy is supposed to hard-reset the console. As the console is far
from finished, we keep it as dummy and implement this later.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-29 11:39:07 +02:00
David Herrmann
6b4fc364df vte: remove kmscon_console_backspace()
This function is not needed at all. Instead, we should simply move one
character to the left on incoming backspace. There is no need to handle
auto-wrap on backspace.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-28 16:49:56 +02:00
David Herrmann
2396423d03 vte/font/console: support basic character attributes
This adds support for colored and bold characters. This also adds the
infrastrucure for background colors and underlined characters, however,
these are not properly implemented, yet.

The color codes are similar to xterm and optimized on black backgrounds.
So they are not too bright or shiny.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-28 12:37:12 +02:00
David Herrmann
6c23507910 console: avoid unneeded matrix transformations
We now assume a screen of -1,-1 to 1,1 instead of 0,0 to 1,1 to avoid
matrix transformations.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-04-22 16:38:53 +02:00
David Herrmann
dab18c4eb7 console: remove old font-factory code
Remove the code that is no longer needed due to the new font renderer.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-04-01 19:31:57 +02:00
David Herrmann
a220fbae1a terminal: use new font backend
Instead of using the slow old font-factory we now use the new font_screen
object which allows faster software rendering with pango/cairo.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-04-01 19:25:54 +02:00
David Herrmann
a0109ffabc console: remove margin_bottom cache
margin_bottom was always the last index of the scroll-region, in contrast
to cells->mbottom_y which is the bottom margin size. However, this cache
is inconvenient so this replaces all calls to margin_bottom with a correct
immediate calculation of the bottom margin.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-04-01 18:17:45 +02:00
David Herrmann
9c2b838054 console: remove mtop cache
We can directly access the buffer now so no need to cache the value.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-04-01 16:12:02 +02:00
David Herrmann
4897b4ce68 console: remove cells_x/y cache
We don't need this anymore as we now have direct access to the buffer
structure.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-04-01 15:00:47 +02:00
David Herrmann
d2786e12d3 console: add "fixed_position" option
The fixed_position option allows to explicitely keep the scrollback-buffer
position instead of scrolling on new input. This was already the current
behavior but now we can also scroll on new input if this is set to false.

Also fix up the formatting of the comments and remove old information.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-04-01 14:08:20 +02:00
David Herrmann
bfe6702c1e console: remove refcnt of buffer object
The buffer object is used internally only and should never be shared.
Hence, we can safely remove the refcnt.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-04-01 12:52:54 +02:00
David Herrmann
c25a2bb249 console: make buffer code private
The buffer should not be accessed from code outside of console.c so make
it private. This includes some code-moving but no bigger changes. The diff
might look scary, though.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-04-01 12:50:17 +02:00
David Herrmann
046833530c console: fix log messages
Use LOG_SUBSYSTEM and remove trailing newlines.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-30 15:55:23 +02:00
David Herrmann
af31f251f3 console: merge console_cell.c into console.c
We currently have too much layers in the console subsystem. This reduces
performance and produces ugly hacks like our "*_clear_region" function. We
now merge both files so we can directly access the buffer-structure.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 14:34:55 +01:00
David Herrmann
096f0cadc7 Move to new uterm infrastructure
This fixes all compositor/output/context/etc. uses and replaces them by
the new uterm API.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-23 14:18:50 +01:00
David Herrmann
cdb3d112a6 vte: implement backspace control
Add new helper to console subsystem which performs a backspace
operation. We must take care of auto-wrap mode so we cannot simply use
the *_move_left() function.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-05 16:02:21 +01:00
David Herrmann
d3951da865 console: add helper to erase current position
This helper erases the current cursor position.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-05 15:14:45 +01:00
David Herrmann
b02e8c8332 console: fix pending-wrap bug in erase helpers
When erasing from the cursor position to line/screen end we must include
the current cursor position in the clear-region. We already did this but
missed the fact that there might be a pending-wrap so we might miss the
current position. Fix this.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-05 15:11:34 +01:00
David Herrmann
fb6dd53aa8 console: enable auto_wrap by default
vt100 have auto_wrap enabled by default so we should do so, too.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-05 15:10:12 +01:00
David Herrmann
9a5f1df8cd console: fix bug in *_erase_screen()
We must erase the whole screen and not only until the current cursor
position. Probably a copy-paste typo.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-05 15:06:06 +01:00
David Herrmann
5e53cda8f5 console: fix bug in *_move_left()
We must take care of pending-wraps when moving left so we do not miss a
single character.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-05 15:04:43 +01:00
David Herrmann
f0bcc37cee console: add to line movement helpers
Add two helpers to move to the end or home of the current line.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-05 14:36:32 +01:00
David Herrmann
f85244ead9 console: add erase-helpers
Add functions to erase several parts of the screen.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-04 18:31:10 +01:00
David Herrmann
d8ff83c5cb console: add basic cursor movements
Add functions to move the cursor up/down/left/right. We must take care
of integer overflows here as the application may send us arbitrarily big
numbers.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-04 15:50:03 +01:00
David Herrmann
466fcc3b06 console: add auto-wrap mode
If auto-wrap mode is enabled we automatically advance the cursor to the
next line if we hit the end of line. Otherwise, we simply continue
overwriting the last character in the line.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-04 15:49:14 +01:00
David Herrmann
497d3840dc console: add *_move_to() function
*_move_to() can be used to position the pointer at an arbitrary position
inside the buffer. If in relative-addressing mode, you cannot position
it outside the scroll-region, though.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-04 15:25:44 +01:00
David Herrmann
5a0ba19d91 console: make console wrapper margin aware
Keep reference to top-most and bottom-most line of scroll buffer in
console wrapper. The margin_top and margin_bottom indexes are different
from them used in the buffer handler! We use indexes now instead of line
counts. This makes the handling much easier.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-04 14:49:06 +01:00