Commit graph

1426 commits

Author SHA1 Message Date
Daniel Eklöf
cb015d5eec
render: reflow: mark all "new" rows as dirty 2020-02-14 19:02:36 +01:00
Daniel Eklöf
4b328ead5e
render: resize: do linefeed *after* updating cursor position 2020-02-12 20:39:43 +01:00
Daniel Eklöf
a96a6c2c58
render: resize; heuristics to prevent prompt from being printed on a newline 2020-02-12 20:26:14 +01:00
Daniel Eklöf
ea52d3e570
render: resize: temporarily disable row adjustment
This was intended to prevent a new prompt from being printed on a
newline. However, it breaks normal output under certain conditions,
that have yet to be determined exactly what they are.
2020-02-12 20:16:42 +01:00
Daniel Eklöf
c28c0ab9c2
render: resize: only stay on current row if col is within grid width 2020-02-12 19:49:39 +01:00
Daniel Eklöf
69a633221f
term: formfeed: set linefeed correctly when we're at last column with lcf=1
When cursor.lcf is set, that means the cursor column was *not*
incremented when we printed the last character. Thus, we should *not*
decrement the column before setting the linefeed bit.
2020-02-12 18:06:27 +01:00
Daniel Eklöf
bcd28bcd14
render: spelling 2020-02-12 18:06:15 +01:00
Daniel Eklöf
3f282a2f2e
footrc, doc/foot.5: improve documentation of 'shell', and mention --login 2020-02-11 19:57:15 +01:00
Daniel Eklöf
335bf2e5b4
Merge branch 'text-reflow' 2020-02-11 19:39:23 +01:00
Daniel Eklöf
b28a742a00
selection: handle line break at last column correctly
Insert a newline into the selection even if the last column contained
a printable character, *if* that column also has linefeed=1.
2020-02-11 19:36:31 +01:00
Daniel Eklöf
e56523f326
render: resize: calculated cursor row *should* never be beyond the screen bottom 2020-02-10 22:40:16 +01:00
Daniel Eklöf
88e2ab21b3
render: reflow: clear new line if already allocated 2020-02-10 22:38:30 +01:00
Daniel Eklöf
3ad2ee7681
render: resize: fix cursor positioning at grid wrap around
When current view is at a grid wrap around (last emitted row index is
< grid offset), the cursor row ended up being negative which we then
mapped to the top line.

This is wrong. When we're at a wrap around, re-adjust cursor by adding
the grid's row count.
2020-02-10 22:36:39 +01:00
Daniel Eklöf
8d262e71c1
render: reflow: initial line is always unallocated 2020-02-10 22:36:17 +01:00
Daniel Eklöf
b0f98a9d0c
term: font_size_{increase,descrease}: adjust size by 0.5pt 2020-02-10 22:22:42 +01:00
Daniel Eklöf
8716430450
input: ctrl+= increases font size, not resets it 2020-02-10 21:57:55 +01:00
Daniel Eklöf
4a169f5643
vt: tag cells that were form-feed:ed, to allow correct text reflow
To handle text reflow correctly when a line has a printable character
in the last column, but was still line breaked, we need to track the
fact that the slave inserted a line break here.

Otherwise, when the window width is increased, we'll end up pulling up
the next line, when we really should have inserted a line break.
2020-02-10 21:54:37 +01:00
Daniel Eklöf
3004c650ef
README: reflow has been implemented 2020-02-10 20:46:58 +01:00
Daniel Eklöf
80e8f91270
render: reflow: no need to clear cells
We set initialize=true when allocating a new row. This initializes the
cell to 0, with clean=1.
2020-02-10 20:46:02 +01:00
Daniel Eklöf
61b43620fc
render: initial support for text reflow
The algorithm is as follows:

Start at the beginning of the scrollback. That is, at the oldest
emitted lines. This is done by taking the current offset, and adding
the number of (old) screen rows, and then iterating until we find the
first allocated line.

Next, we iterate the entire old grid. At the beginning, we allocate a
line for the new grid, and setup a global pointer for that line, and
the current cell index.

For each line in the old grid, iterate its cells. Copy the the cells
over to the new line. Whenever the new line reaches its maximum number
of columns, we line break it by increasing the current row index and
allocating a new row (if necessary - we may be overwriting old
scrollback if the new grid is smaller than the old grid).

Whenever we reach the end of a line of the old grid, we insert a line
break in the new grid's line too **if** the last cell in the old line
was empty. If it was **not** empty, we **don't** line break the new
line.

Furthermore, empty cells in general need special consideration. A line
ending with a string of empty cells doesn't have to be copied the new
line. And more importantly, should **not** increase the new line's
cell index (which may cause line breaks, which is incorrect).

However, if a string of empty cells is followed by non empty cells, we
need to copy all the preceding empty cells to the line too.

When the entire scrollback history has been reflowed, we need to
figure out the new grid's offset.

This is done by trying to put the **last** emitted line at the bottom
of the screen. I.e. the new offset is typically "last_line_idx -
term->rows". However, we need to handle empty lines. So, after
subtracting the number of screen rows, we _increase_ the offset until
we see a non-empty line. This ensures we handle grid's that doesn't
fill an entire screen.

Finally, we need to re-position the cursor. This is done by trying to
place the cursor **at** (_not_ after) the last emitted line. We keep
the current cursor column as is (but possibly truncated, if the grid's
width decreased).
2020-02-10 20:35:24 +01:00
Daniel Eklöf
d6ef3c02fb
term: log error when failing to initialize the primary fonts 2020-02-09 16:56:59 +01:00
Daniel Eklöf
f751a213d5
Merge branch 'document-text-resize' 2020-02-09 11:37:12 +01:00
Daniel Eklöf
4846e49bc7
doc: foot.1: keyboard shortcuts for font size adjument 2020-02-09 11:36:49 +01:00
Daniel Eklöf
6eb5ffdd96
README: document keyboard shortcuts for font size adjustment 2020-02-09 11:34:51 +01:00
Daniel Eklöf
8955875584
Merge branch 'text-resize' 2020-02-09 11:24:50 +01:00
Daniel Eklöf
ac11909f80
meson/PKGBUILD: adjust fcft requirements; the new version is 1.1.1 2020-02-09 11:05:59 +01:00
Daniel Eklöf
1dfd121c44
term: factor out common font changing code 2020-02-08 18:23:08 +01:00
Daniel Eklöf
fd5782d6e6
render: resize: reset scroll damage
We've resized, and reset the render's 'last-buf' pointer; any scroll
damage we have is **not** valid anymore.
2020-02-08 18:22:14 +01:00
Daniel Eklöf
1b81c700f9
input: hook ctrl+{=,0} to term_font_size_reset() 2020-02-08 17:58:06 +01:00
Daniel Eklöf
6c0d00fcee
term: add term_font_size_reset() 2020-02-08 17:57:50 +01:00
Daniel Eklöf
a96341368d
meson/PKGBUILD: bump fcft required version to 1.2.0 2020-02-08 14:10:18 +01:00
Daniel Eklöf
7ca8f85cd0
input: hook ctrl+{plus/KP-Add/minus/KP-Subtract} to term_font_size_{increase,decrease} 2020-02-08 14:09:28 +01:00
Daniel Eklöf
89cca2a5d1
term: add term_font_size_{increase,decrease}() 2020-02-08 14:09:06 +01:00
Daniel Eklöf
9e2ca2b1a3
render: add render_resize_force()
This forces a full resize operation, even though actual window
size (or scale) hasn't changed.
2020-02-08 14:08:16 +01:00
Daniel Eklöf
2560e83c54
term: reduce max number of iterations when trying to drain client 2020-02-05 20:24:46 +01:00
Daniel Eklöf
92376eae01
term: language 2020-02-05 20:23:20 +01:00
Daniel Eklöf
82b8853f17
main: add --print-pid=FILE|FD
When specified, our PID is written to the specified file (or FD),
after we've successfully started up.
2020-02-05 19:54:16 +01:00
Daniel Eklöf
00d76784f4
main: add --print-pid=FILE|FD
When specified, our PID is written to the specified file (or FD),
after we've successfully started up.

Only applicable in server mode.
2020-02-05 19:53:50 +01:00
Daniel Eklöf
9d52c422e1
term: always read *all* we can from the client before updating state
But place an upper limit on the number of iterations we read, to
prevent starvation caused by a bad behaving client to constantly
writes data.
2020-02-05 19:50:49 +01:00
Daniel Eklöf
d7d2aae053
log: log to stderr, not stdout 2020-02-04 18:29:04 +01:00
Daniel Eklöf
9c5557539f
completions: zsh: --hold has no arguments 2020-02-04 18:28:53 +01:00
Daniel Eklöf
8f4ec9aa47
Implement --hold
When specified, we don't exit when the slave/client process exits.
2020-02-03 19:58:32 +01:00
Daniel Eklöf
31baf334b3
fcft: update to 1.1.0 2020-02-01 20:20:22 +01:00
Daniel Eklöf
8c32e3ccf0
vt: ensure we never step outside our parameter and sub-parameter arrays
We only support 16 parameters, and for each parameter, 16
sub-parameters. If we ever hit that limit (or rather, if the client
writes 17 (sub) parameters), log this and stop incrementing the
parameter index variable.

For performance reason, we implement the following behavior:

* We never increment the parameter index past the supported
  number. This ensures all code *accessing* the parameter list can do
  so without verifying the validity of the index.

* The *first* time we see too many parameters, and the first time we
  see too many sub parameters, log this. Then *never* log again. Even
  if we see too many parameters in a completely different escape. This
  is so that we don't have to keep a "have warned" boolean in the
  terminal struct, but can use a simple function local static
  variable.
2020-02-01 19:44:56 +01:00
Daniel Eklöf
cc5d596cd9
csi: log only the un-handled parameter in a multi-operation CSI
Assume we don't handle 'CSI 4 X'. Furthermore, assume we receive the
following: 'CSI 1;2;3;4X'. In this case, only log '4X' as un-handled,
not the entire CSI string.
2020-02-01 19:42:31 +01:00
Daniel Eklöf
07a0c7238c
vt: collect (intermediate): log a warning if user supplied more than two intermediates 2020-02-01 19:29:31 +01:00
Daniel Eklöf
bbb7b60b17
vt: collect (intermediate): log _which_ character we collected 2020-02-01 19:29:14 +01:00
Daniel Eklöf
4dde699107
csi: implement window and cell size reporting escapes
This implements the following queries:

* report window size in pixels
* report cell size in pixels
* report window size in chars

We also log a warning for the remaining window operation queries.
2020-02-01 19:27:52 +01:00
Daniel Eklöf
dfa5cb41e0
csi: recognize the X10 mouse tracking enabler/disabler
We still don't implement it, but now we at least recognize it and log
a warning when it is implemented.
2020-02-01 19:27:06 +01:00
Daniel Eklöf
38e2e037e6
csi: drop '28' from our DA response
We don't support rectangular editing
2020-02-01 19:26:08 +01:00