| Commit message (Collapse) | Author | Age | Lines |
| ... | |
| |
|
|
|
|
|
| |
We've just re-set the grid offsets, meaning rows 0..term->rows may not
all have been initialized.
Call grid_row_and_alloc() to ensure they are.
|
| |
|
|
|
| |
Mouse tracking always reports clicks, so using a cursor that suggests
you can click makes sense I think.
|
| |
|
|
|
|
|
|
|
|
| |
Show 'text' cursor when:
* we have no mouse tracking enabled
* forced selection has been enabled (shift being held down)
* We're *not* scrollback searching
In all other cases, show the 'left_ptr' cursor.
|
| | |
|
| |
|
|
|
|
|
|
|
| |
When trying to write (to e.g. the slave, or to a clipboard receiver),
we first try to send the data synchronously, and only if that fails do
we switch to asynchronous mode.
However, the first synchronous may (in fact, is likely to) succeed
partially.
|
| |
|
|
| |
TODO: use actual output PPI. Question is *which* output...
|
| | |
|
| |
|
|
|
|
|
|
|
|
| |
When we're shutting down a terminal, we destroy our Wayland window,
and assume that will unmap us.
There are cases when this isn't true (most likely when e.g. a screen
locker is active, and the unmap is being deferred).
Handle by explicitly setting focused to NULL.
|
| | |
|
| |
|
|
|
|
| |
In the legacy mouse reporting mode, line and column numbers are
limited to 223 (255-32). In case the current coordinate falls outside
this, simply ignore it (don't report it).
|
| |
|
|
|
| |
This mouse mode is never enabled. I.e. we don't support it. Add
asserts to catch usage of it, should we ever decide to implement it.
|
| |
|
|
|
|
|
|
| |
When support was added for DECOM (absolute/relative row addressing), a
small but noticeable (~3.5%) performance regression was introduced.
Try to improve the situation by simplifying the relative-to-absolute
conversion; only the row needs to be transformed.
|
| |
|
|
| |
This reverts commit 686405b7031736445eeb35206e4a797a8dd78d91.
|
| |
|
|
|
|
|
| |
Adds a linebreak (+ scroll if necessary) if we're in a deferred wrap
and auto-margins are enabled.
Return true when we wrapped, false otherwise.
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
This list is intended to store tab stop columns
|
| |
|
|
|
|
|
|
|
|
|
| |
The default is absolute mode, where 0,0 is the upper left corner of
the screen.
In relative mode, the origin is relative the top scroll margin.
Internally, we always track the current cursor position in absolute
mode. Every time we the client *sets* or *queries* the cursor position
in relative mode, we translate it to absolute.
|
| | |
|
| | |
|
| |
|
|
| |
TODO: try writing synchronously first
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
A terminal with lots of scrollback history will have allocated a lot
of memory.
Normally, free() wont return this memory to the OS, and we don't seem
to trigger the automatic trim calls.
This means the server would accumulate quite a lot of memory over
time, as terminals come and go.
Now we explicitly trim the memory every time a terminal is destroyed.
|
| | |
|
| | |
|
| |
|
|
|
| |
Break out actual writing to a separate function, and call this
function both from the synchronous and the asynchronous code paths.
|
| |
|
|
|
|
|
|
|
|
| |
Make ptmx non-blocking. Then, when writing data to the slave would
have blocked, use the FDM to asynchronously write the remaining data.
This is done by enabling EPOLLOUT on ptmx, and enqueueing all outgoing
data. The FDM handler will go through the enqueued data, and once all
of it has been written, we turn off EPOLLOUT again (thus switching
back to synchronous writes)
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
While unusual, it *is* possible for a client *not* to terminate when
we close ptmx.
We need to handle this *somehow*. Since it is so unusual, we'll go
with a fairly easy, but synchronous method:
* Register a signal handler for SIGALRM, and setup a 2 second alarm
* Wait for slave to die
* If it didn't die, sent SIGTERM, then re-set the alarm for another 2
seconds.
* If it still hasn't died, send SIGKILL (this time without an alarm).
|
| | |
|
| |
|
|
|
|
| |
When there hasn't been a timeout (or in our case, there was a timeout,
but we reset the timer before we got to the read()), read() returns,
not 0, but -1 with errno == EAGAIN.
|
| |
|
|
|
|
|
|
|
|
|
| |
Since we cancel the timers every now and then, there's a (small)
chance that one handler cancels a timer that has triggered in the same
epoll() iteration.
When this happens, read() blocks.
Fix by making the timer FDs non-blocking, and simply returning when we
read 0 bytes.
|
| | |
|
| | |
|
| |
|
|
| |
main uses this to get the exit code of the terminal.
|
| |
|
|
|
| |
* Close FDs, then delay destruction to next epoll() call
* Destroy window before destroying terminal
|
| | |
|
| |
|
|
| |
This would happen if *both* timers triggered in the same epoll() call.
|
| | |
|
| |
|
|
|
| |
We use epoll() to determine when we can read/write FDs so there's
absolutely no need for non-blocking.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
| |
* Configure all FDs *completely* before moving on
* Start client before creating the wayland window
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This function unmaps the terminal window, removes itself from the
wayland list of terminals and then finally destroys itself.
We ensure we don't get any callbacks/events referring to a free:d
terminal struct, we close all terminal related FDs and unmap the
wayland window.
Then, to be really really sure there aren't any (by the FDM) queued up
events, we delay the self-destruction to the next FDM poll iteration,
by opening an event FD and adding it to the FDM.
The callback for the event FD removes the FD from the FDM again, and
closes it. And then proceeds to destroy the terminal.
|
| |
|
|
|
| |
The wayland 'term' member is gone and replaced by a list,
'terms'. This list contains all currently running terminal (windows).
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
| |
Since we now initialize the worker threads from term_init(), which
returns before the threads terminate, we can no longer use
stack-allocated worker contexts.
We _could_ put them in the terminal struct. But a simpler solution is
to allocate them in term_init(), and let the threads free them when
they don't need them anymore.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
| |
We do however need access to it, so provide a pointer. The difference
is that now we can have a *single* wayland instance, but multiple
terminal instances.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With this assumption, we can replace 'a % b' with 'a & (b - 1)'. In
terms of instructions, this means a fast 'and' instead of a slow
'div'.
Further optimize scrolling by:
* not double-initializing empty rows. Previously, grid_row_alloc()
called calloc(), which was then followed by a memset() when
scrolling. This is of course unnecessary.
* Don't loop the entire set of visible rows (this was done to ensure
all visible rows had been allocated, and to prefetch the cell
contents).
This isn't necessary; only newly pulled in rows can be NULL. For
now, don't prefetch at all.
|
| | |
|
| |
|
|
|
|
| |
That is, remove the 'regular' and 'bright' color arrays. This is
possible since the 256-color array is defined such that the first 16
colors map to the regular and bright colors.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
| |
If we scroll enough, we'll eventually end up wrapping around the
entire scrollback buffer. At this point, a selection is no longer
valid, so cancel it.
Note: this was very obvious when scrolling in the alt screen, since
its scrollback buffer is what you see on the screen (i.e. it has no
scrollback).
|
| | |
|
| |
|
|
| |
BACK should be 4, FORWARD 5.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
| |
The 'attributes' struct is now 8 bytes and naturally packed (used to
be 9 bytes, artificially packed).
'cell' struct is now 12 bytes, naturally packed (used to be 13 bytes,
artificially packed).
Furthermore, the glyph is stored as a wchar instead of a char*. This
makes it easier (faster) to do glyph lookup when rendering.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
| |
This patch takes a bit from the foreground color value in a
cell (todo: split up foreground/background into bitfields with a
separate field for 'foreground/background' has been set), and only
re-renders cells that aren't marked as clean.
Note: we use a 'clean' bit rather than a 'dirty' bit to make it easy
to erase cells - we can (keep doing) do that by simply memsetting a
cell range to 0.
|
| | |
|
| | |
|
| |
|
|
| |
This reduces the cell size, and thus improves the cache behavour
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Since newly scrolled in lines will be erased, we want them in the
cache.
So, allocate and prefetch new lines, then repair non-scrolling
regions (to give the prefetch time to actually fetch the
data). Finally, erase the newly scrolled in lines.
This also fixes a bug where the fixup for the non-scrolling regions
could crash on an unallocated row (we were accessing rows that would
be, but hadn't yet been, scrolled in).
|
| | |
|
| |
|
|
|
|
|
|
|
|
| |
The row array may now contain NULL pointers. This means the
corresponding row hasn't yet been allocated and initialized.
On a resize, we explicitly allocate the visible rows.
Uninitialized rows are then allocated the first time they are
referenced.
|
| |
|
|
|
|
|
|
| |
linefeed moves cursor down one row (columns stays the same), or, if
the cursor is at the last row, scrolls up one row.
reverse_index does the opposite; it moves the cursor *up* one row, or,
if the cursor is at the top row, scrolls *down* one row.
|
| |
|
|
|
| |
This ensures everything *visible* (i.e. maybe scrolled back content)
is re-rendered.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Can scroll up and down, and stops when the beginning/end of history is
reached.
However, it probably breaks when the entire scrollback buffer has been
filled - we need to detect when the view has wrapped around to the
current terminal offset.
The detection of when we've reached the bottom of the history is also
flawed, and only works when we overshoot the bottom with at least a
page.
Resizing the windows while in a view most likely doesn't work.
The view will not detect a wrapped around scrollback buffer. I.e. if
the user has scrolled back, and is stationary at a view, but there is
still output being produced. Then eventually the scrollback buffer
will wrap around. In this case, the correct thing to do is make the
view start following the beginning of the history. Right now it
doesn't, meaning once the scrollback buffer wraps around, you'll start
seeing command output...
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
The grid is now represented with an array of row *pointers*. Each row
contains an array of cells (the row's columns).
The main point of having row pointers is we can now move rows around
almost for free.
This is useful when scrolling with scroll margins for example, where
we previously had to copy the lines in the margins. Now it's just a
matter of swapping two pointers.
|
| | |
|
| | |
|
| |
|
|
|
| |
This style is enabled with the \e[?1006h sequence, and changes how
mouse events (button presses, releases and motion events).
|