mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-05-03 06:46:42 -04:00
config: new option - trim-trailing-spaces-from-selection
When enabled, trailing spaces are trimmed from both regular and block selections.
This commit is contained in:
parent
194cf1ce87
commit
20aab0871f
6 changed files with 15 additions and 5 deletions
|
|
@ -52,14 +52,15 @@
|
|||
bindings. By default, they are bound to `ctrl+v ctrl+y` and
|
||||
`shift+insert` respectively, and lets you paste from the clipboard
|
||||
or primary selection into the search buffer.
|
||||
* **trim-trailing-spaces-from-selection** option to `foot.init`. When
|
||||
enabled, trailing spaces are trimmed from both regular and block
|
||||
selections (https://codeberg.org/dnkl/foot/issues/181).
|
||||
|
||||
|
||||
### Changed
|
||||
|
||||
* Blinking text now uses the foreground color, but dimmed down in its
|
||||
off state, instead of the background color.
|
||||
* Trailing spaces are trimmed when copying a block selection
|
||||
(https://codeberg.org/dnkl/foot/issues/181).
|
||||
|
||||
|
||||
### Deprecated
|
||||
|
|
|
|||
4
config.c
4
config.c
|
|
@ -601,6 +601,9 @@ parse_section_main(const char *key, const char *value, struct config *conf,
|
|||
mbstowcs(conf->word_delimiters, value, chars + 1);
|
||||
}
|
||||
|
||||
else if (strcmp(key, "trim-trailing-spaces-from-selection") == 0)
|
||||
conf->trim_trailing_spaces_from_selection = str_to_bool(value);
|
||||
|
||||
else if (strcmp(key, "scrollback") == 0) {
|
||||
LOG_WARN("deprecated: %s:%d: [default]: scrollback: use 'scrollback.lines' instead'", path, lineno);
|
||||
|
||||
|
|
@ -2081,6 +2084,7 @@ config_load(struct config *conf, const char *conf_path,
|
|||
.server_socket_path = get_server_socket_path(),
|
||||
.presentation_timings = false,
|
||||
.hold_at_exit = false,
|
||||
.trim_trailing_spaces_from_selection = false,
|
||||
|
||||
.tweak = {
|
||||
.fcft_filter = FCFT_SCALING_FILTER_LANCZOS3,
|
||||
|
|
|
|||
1
config.h
1
config.h
|
|
@ -168,6 +168,7 @@ struct config {
|
|||
char *server_socket_path;
|
||||
bool presentation_timings;
|
||||
bool hold_at_exit;
|
||||
bool trim_trailing_spaces_from_selection;
|
||||
|
||||
struct {
|
||||
enum fcft_scaling_filter fcft_filter;
|
||||
|
|
|
|||
|
|
@ -128,6 +128,10 @@ in this order:
|
|||
text. Note that whitespace characters are _always_ word
|
||||
delimiters, regardless of this setting. Default: _,│`|:"'()[]{}<>_
|
||||
|
||||
*trim-trailing-spaces-from-selection*
|
||||
Boolean. If enabled, trailing spaces are trimmed from selections
|
||||
(both regular and block selections). Default: _no_.
|
||||
|
||||
|
||||
# SECTION: scrollback
|
||||
|
||||
|
|
|
|||
1
foot.ini
1
foot.ini
|
|
@ -14,6 +14,7 @@
|
|||
# workers=<number of logical CPUs>
|
||||
# bell=none
|
||||
# word-delimiters=,│`|:"'()[]{}<>
|
||||
# trim-trailing-spaces-from-selection=no
|
||||
|
||||
[scrollback]
|
||||
# lines=1000
|
||||
|
|
|
|||
|
|
@ -224,10 +224,9 @@ selection_to_text(const struct terminal *term)
|
|||
if (term->selection.end.row == -1)
|
||||
return NULL;
|
||||
|
||||
const enum selection_kind kind = term->selection.kind;
|
||||
const bool trim_trailing_spaces = kind == SELECTION_BLOCK;
|
||||
struct extraction_context *ctx = extract_begin(
|
||||
term->selection.kind, term->conf->trim_trailing_spaces_from_selection);
|
||||
|
||||
struct extraction_context *ctx = extract_begin(kind, trim_trailing_spaces);
|
||||
if (ctx == NULL)
|
||||
return NULL;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue