Merge branch 'master' into scrollback-position-indicator

This commit is contained in:
Daniel Eklöf 2020-07-26 12:40:00 +02:00
commit 82d7cfdfe4
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
10 changed files with 114 additions and 88 deletions

View file

@ -15,6 +15,9 @@
* Section to [README.md](README.md) describing how to programmatically * Section to [README.md](README.md) describing how to programmatically
identify foot. identify foot.
* [LICENSE](LICENSE), [README.md](README.md) and
[CHANGELOG.md](CHANGELOG.md) are now installed to
`${datadir}/doc/foot`.
### Changed ### Changed
@ -40,10 +43,15 @@
### Removed ### Removed
### Fixed ### Fixed
* Crash in scrollback search
* Crash when starting a selection inside the margins. * Crash when starting a selection inside the margins.
### Security ### Security
### Contributors
* [birger](https://codeberg.org/birger)
* [cherti](https://codeberg.org/cherti)
## 1.4.2 ## 1.4.2

View file

@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2018 Daniel Eklöf Copyright (c) 2019 Daniel Eklöf
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View file

@ -42,6 +42,7 @@ check() {
package_foot-git() { package_foot-git() {
pkgdesc="A wayland native terminal emulator" pkgdesc="A wayland native terminal emulator"
changelog=CHANGELOG.md
optdepends=('foot-terminfo: terminfo for foot') optdepends=('foot-terminfo: terminfo for foot')
conflicts=('foot') conflicts=('foot')
provides=('foot') provides=('foot')

View file

@ -5,6 +5,7 @@ The fast, lightweight and minimalistic Wayland terminal emulator.
## Index ## Index
1. [Features](#features) 1. [Features](#features)
1. [Configuration](#configuration)
1. [Troubleshooting](#troubleshooting) 1. [Troubleshooting](#troubleshooting)
1. [Why the name 'foot'?](#why-the-name-foot) 1. [Why the name 'foot'?](#why-the-name-foot)
1. [Fonts](#fonts) 1. [Fonts](#fonts)
@ -34,7 +35,6 @@ The fast, lightweight and minimalistic Wayland terminal emulator.
1. [Bugs](#bugs) 1. [Bugs](#bugs)
1. [Mastodon](#mastodon) 1. [Mastodon](#mastodon)
## Features ## Features
* Fast (see [benchmarks](doc/benchmark.md)) * Fast (see [benchmarks](doc/benchmark.md))
@ -53,6 +53,14 @@ The fast, lightweight and minimalistic Wayland terminal emulator.
![wow](doc/sixel-wow.png "Sixel screenshot") ![wow](doc/sixel-wow.png "Sixel screenshot")
## Configuration
**foot** can be configured by creating a file `$XDG_CONFIG_HOME/footrc` (defaulting to `~/.config/footrc`).
A template for that can usually be found in `/usr/share/foot/footrc` or
[here](https://codeberg.org/dnkl/foot/src/branch/master/footrc).
Further information can be found in foot's manpage `foot(5)`.
## Troubleshooting ## Troubleshooting
@ -223,14 +231,14 @@ want to launch a new terminal.
By default, foot prefixes _Meta characters_ with ESC. This corresponds By default, foot prefixes _Meta characters_ with ESC. This corresponds
to XTerm's `metaSendsEscape` option set to `true`. to XTerm's `metaSendsEscape` option set to `true`.
This can be disabled programatically with `\E[?1036l` (and enabled This can be disabled programmatically with `\E[?1036l` (and enabled
again with `\E[?1036h`). again with `\E[?1036h`).
When disabled, foot will instead set the 8:th bit of meta character When disabled, foot will instead set the 8:th bit of meta character
and then UTF-8 encode it. This corresponds to XTerm's `eightBitMeta` and then UTF-8 encode it. This corresponds to XTerm's `eightBitMeta`
option set to `true`. option set to `true`.
This can also be disabled programatically with `rmm` (_reset meta This can also be disabled programmatically with `rmm` (_reset meta
mode_, `\E[?1034l`), and enabled again with `smm` (_set meta mode_, mode_, `\E[?1034l`), and enabled again with `smm` (_set meta mode_,
`\E[?1034h`). `\E[?1034h`).

View file

@ -18,7 +18,7 @@ terminal. This is done **20** times for each test. Then it calculates
the _mean_ and _standard deviation_ for each test. the _mean_ and _standard deviation_ for each test.
## 2020-06-05 ## 2020-07-25
### System ### System
@ -40,17 +40,17 @@ Scrollback: 10000 lines
### Results ### Results
| Benchmark | Foot (GCC+PGO) 1.3.0.r59 | Alacritty 0.4.3 | URxvt 9.22 | XTerm 356 | | Benchmark | Foot (GCC+PGO) 1.4.2.r14 | Alacritty 0.4.3 | URxvt 9.22 | XTerm 358 |
|------------------------|-------------------------:|---------------------:|---------------:|---------------:| |------------------------|-------------------------:|---------------------:|---------------:|---------------:|
| alt-random | 0.450s ±0.009 | 0.905s ±0.003 | 1.151s ±0.004 | 12.906s ±0.078 | | alt-random | 0.423s ±0.014 | 0.904s ±0.006 | 1.111s ±0.003 | 12.851s ±0.087 |
| alt-random-colors | 0.451s ±0.013 | 0.931s ±0.005 | 1.192s ±0.005 | 11.858s ±0.155 | | alt-random-colors | 0.382s ±0.005 | 0.935s ±0.005 | 1.146s ±0.007 | 11.816s ±0.088 |
| scrolling | 1.181s ±0.036 | 1.096s ±0.022 | 1.080s ±0.007 | 38.244s ±0.118 | | scrolling | 1.380s ±0.048 | 1.011s ±0.012 | 1.021s ±0.016 | 38.483s ±0.122 |
| scrolling-filled-lines | 0.878s ±0.015 | 1.320s ±0.040 | 1.251s ±0.006 | 6.812s ±0.031 | | scrolling-filled-lines | 0.826s ±0.020 | 1.307s ±0.008 | 1.213s ±0.015 | 6.725s ±0.016 |
| unicode-random | 0.926s ±1.179 | 0.089s ±0.001 [^1] | 24.039s ±3.559 | 26.558s ±3.841 | | unicode-random | 0.243s ±0.006 | 0.091s ±0.003 [^1] | 24.507s ±3.264 | 26.127s ±3.891 |
## 2020-05-31 ## 2020-07-25
### System ### System
@ -73,13 +73,13 @@ Scrollback=10000 lines
### Results ### Results
| Benchmark | Foot (GCC+PGO) 1.3.0.r59 | Alacritty 0.4.2 | URxvt 9.22 | St 0.8.3 | XTerm 356 | | Benchmark | Foot (GCC+PGO) 1.4.2.r9 | Alacritty 0.4.3 | URxvt 9.22 | St 0.8.4 | XTerm 358 |
|------------------------|-------------------------:|---------------------:|---------------:|--------------:|---------------:| |------------------------|------------------------:|---------------------:|---------------:|--------------:|----------------:|
| alt-random | 0.791s ±0.080 | 1.558s ±0.038 | 1.746s ±0.065 | 2.628s ±0.085 | 1.706s ±0.064 | | alt-random | 0.784s ±0.074 | 1.568s ±0.094 | 1.600s ±0.052 | 1.917s ±0.054 | 34.487s ±0.118 |
| alt-random-colors | 0.830s ±0.076 | 1.587s ±0.041 | 2.049s ±0.118 | 3.033s ±0.129 | 2.109s ±0.131 | | alt-random-colors | 0.823s ±0.067 | 1.627s ±0.107 | 1.932s ±0.073 | 2.111s ±0.163 | 30.676s ±0.127 |
| scrolling | 1.603s ±0.070 | 1.464s ±0.098 | 1.439s ±0.035 | 3.760s ±0.113 | 1.459s ±0.036 | | scrolling | 1.612s ±0.092 | 1.492s ±0.051 | 1.504s ±0.033 | 3.767s ±0.140 | 125.202s ±0.383 |
| scrolling-filled-lines | 1.888s ±0.021 | 2.334s ±0.078 | 2.145s ±0.074 | 3.372s ±0.078 | 2.144s ±0.091 | | scrolling-filled-lines | 1.874s ±0.039 | 2.423s ±0.083 | 1.994s ±0.037 | 2.751s ±0.076 | 19.608s ±0.056 |
| unicode-random | 1.545s ±0.229 | 0.164s ±0.012 [^1] | 11.180s ±0.342 | crashed | 11.389s ±0.269 | | unicode-random | 0.458s ±0.026 | 0.159s ±0.007 [^1] | 12.416s ±0.223 | crashed | 16.336s ±0.410 |
[^1]: [Alacritty and "unicode-random"](#alacritty-and-unicode-random) [^1]: [Alacritty and "unicode-random"](#alacritty-and-unicode-random)

View file

@ -13,7 +13,7 @@ arguments, to execute (instead of the default shell).
# OPTIONS # OPTIONS
*-c*,*--config*=_PATH_ *-c*,*--config*=_PATH_
Path to configuration file. Default: *XDG_RUNTIME_DIR/footrc*. Path to configuration file. Default: *XDG_CONFIG_HOME/footrc*.
*-f*,*--font*=_FONT_ *-f*,*--font*=_FONT_
Comma separated list of fonts to use, in fontconfig format (see Comma separated list of fonts to use, in fontconfig format (see
@ -214,14 +214,14 @@ _Examples_:
By default, foot prefixes meta characters with *ESC*. This corresponds By default, foot prefixes meta characters with *ESC*. This corresponds
to XTerm's *metaSendsEscape* option set to *true*. to XTerm's *metaSendsEscape* option set to *true*.
This can be disabled programatically with *\E[?1036l* (and enabled This can be disabled programmatically with *\E[?1036l* (and enabled
again with *\E[?1036h*). again with *\E[?1036h*).
When disabled, foot will instead set the 8:th bit of meta character When disabled, foot will instead set the 8:th bit of meta character
and then UTF-8 encode it. This corresponds to XTerm's *eightBitMeta* and then UTF-8 encode it. This corresponds to XTerm's *eightBitMeta*
option set to *true*. option set to *true*.
This can also be disabled programatically with *rmm* (Reset Meta Mode, This can also be disabled programmatically with *rmm* (Reset Meta Mode,
*\E[?1034l*), and enabled again with *smm* (Set Meta Mode, *\E[?1034l*), and enabled again with *smm* (Set Meta Mode,
*\E[?1034h*). *\E[?1034h*).

View file

@ -348,7 +348,7 @@ any of these options.
Now, that was a lof of text. But what is it foot actually does? Now, that was a lof of text. But what is it foot actually does?
When receiving client data, it schedules a timer, the When receiving client data, it schedules a timer, the
*delayed-render-lower*. If we do not recieve any more client data *delayed-render-lower*. If we do not receive any more client data
before the timer has run out, we render the frame. If however, we before the timer has run out, we render the frame. If however, we
do receive more data, the timer is re-scheduled. That is, each do receive more data, the timer is re-scheduled. That is, each
time we receive client data, frame rendering is delayed another time we receive client data, frame rendering is delayed another

32
footrc
View file

@ -21,22 +21,22 @@
# alpha=1.0 # alpha=1.0
# foreground=dcdccc # foreground=dcdccc
# background=111111 # background=111111
# regular0=222222 # regular0=222222 # black
# regular1=cc9393 # regular1=cc9393 # red
# regular2=7f9f7f # regular2=7f9f7f # green
# regular3=d0bf8f # regular3=d0bf8f # yellow
# regular4=6ca0a3 # regular4=6ca0a3 # blue
# regular5=dc8cc3 # regular5=dc8cc3 # magenta
# regular6=93e0e3 # regular6=93e0e3 # cyan
# regular7=dcdccc # regular7=dcdccc # white
# bright0=666666 # bright0=666666 # bright black
# bright1=dca3a3 # bright1=dca3a3 # bright red
# bright2=bfebbf # bright2=bfebbf # bright green
# bright3=f0dfaf # bright3=f0dfaf # bright yellow
# bright4=8cd0d3 # bright4=8cd0d3 # bright blue
# bright5=fcace3 # bright5=fcace3 # bright magenta
# bright6=b3ffff # bright6=b3ffff # bright cyan
# bright7=ffffff # bright7=ffffff # bright white
[csd] [csd]
# preferred=server # preferred=server

View file

@ -148,7 +148,12 @@ custom_target(
install: true, install: true,
install_dir: join_paths(get_option('datadir'), 'terminfo')) install_dir: join_paths(get_option('datadir'), 'terminfo'))
install_data('foot.desktop', 'foot-server.desktop', install_dir: join_paths(get_option('datadir'), 'applications')) install_data(
'LICENSE', 'README.md', 'CHANGELOG.md',
install_dir: join_paths(get_option('datadir'), 'doc', 'foot'))
install_data(
'foot.desktop', 'foot-server.desktop',
install_dir: join_paths(get_option('datadir'), 'applications'))
install_data('footrc', install_dir: join_paths(get_option('datadir'), 'foot')) install_data('footrc', install_dir: join_paths(get_option('datadir'), 'foot'))
subdir('completions') subdir('completions')

100
search.c
View file

@ -104,6 +104,58 @@ search_update_selection(struct terminal *term,
int start_row, int start_col, int start_row, int start_col,
int end_row, int end_col) int end_row, int end_col)
{ {
bool move_viewport = true;
int view_end = (term->grid->view + term->rows - 1) & (term->grid->num_rows - 1);
if (view_end >= term->grid->view) {
/* Viewport does *not* wrap around */
if (start_row >= term->grid->view && end_row <= view_end)
move_viewport = false;
} else {
/* Viewport wraps */
if (start_row >= term->grid->view || end_row <= view_end)
move_viewport = false;
}
if (move_viewport) {
int old_view = term->grid->view;
int new_view = start_row - term->rows / 2;
while (new_view < 0)
new_view += term->grid->num_rows;
/* Prevent scrolling in uninitialized rows */
bool all_initialized = false;
do {
all_initialized = true;
for (int i = 0; i < term->rows; i++) {
int row_no = (new_view + i) % term->grid->num_rows;
if (term->grid->rows[row_no] == NULL) {
all_initialized = false;
new_view--;
break;
}
}
} while (!all_initialized);
/* Don't scroll past scrollback history */
int end = (term->grid->offset + term->rows - 1) % term->grid->num_rows;
if (end >= term->grid->offset) {
/* Not wrapped */
if (new_view >= term->grid->offset && new_view <= end)
new_view = term->grid->offset;
} else {
if (new_view >= term->grid->offset || new_view <= end)
new_view = term->grid->offset;
}
/* Update view */
term->grid->view = new_view;
if (new_view != old_view)
term_damage_view(term);
}
/* Selection endpoint is inclusive */ /* Selection endpoint is inclusive */
if (--end_col < 0) { if (--end_col < 0) {
end_col = term->cols - 1; end_col = term->cols - 1;
@ -133,54 +185,6 @@ search_update_selection(struct terminal *term,
selection_row < term->grid->num_rows); selection_row < term->grid->num_rows);
selection_update(term, end_col, selection_row); selection_update(term, end_col, selection_row);
} }
int view_end = (term->grid->view + term->rows - 1) & (term->grid->num_rows - 1);
if (view_end >= term->grid->view) {
/* Viewport does *not* wrap around */
if (start_row >= term->grid->view && end_row <= view_end)
return;
} else {
/* Viewport wraps */
if (start_row >= term->grid->view || end_row <= view_end)
return;
}
int old_view = term->grid->view;
int new_view = start_row - term->rows / 2;
while (new_view < 0)
new_view += term->grid->num_rows;
/* Prevent scrolling in uninitialized rows */
bool all_initialized = false;
do {
all_initialized = true;
for (int i = 0; i < term->rows; i++) {
int row_no = (new_view + i) % term->grid->num_rows;
if (term->grid->rows[row_no] == NULL) {
all_initialized = false;
new_view--;
break;
}
}
} while (!all_initialized);
/* Don't scroll past scrollback history */
int end = (term->grid->offset + term->rows - 1) % term->grid->num_rows;
if (end >= term->grid->offset) {
/* Not wrapped */
if (new_view >= term->grid->offset && new_view <= end)
new_view = term->grid->offset;
} else {
if (new_view >= term->grid->offset || new_view <= end)
new_view = term->grid->offset;
}
/* Update view */
term->grid->view = new_view;
if (new_view != old_view)
term_damage_view(term);
} }
static void static void