dnkl/foot
41
2.0k
Fork
You've already forked foot
243

vt: underline colors and style from kitty #1099

Closed
kraftwerk28 wants to merge 10 commits from kraftwerk28/foot:add-extended-underlines into master
pull from: kraftwerk28/foot:add-extended-underlines
merge into: dnkl:master
dnkl:master
dnkl:osc-5522
dnkl:sixel-heap-buffer-overflow
dnkl:releases/1.27
dnkl:releases/1.26
dnkl:releases/1.25
dnkl:releases/1.24
dnkl:multi-cursor
dnkl:releases/1.23
dnkl:pixman-16f-2
dnkl:releases/1.22
dnkl:releases/1.21
dnkl:releases/1.20
dnkl:releases/1.19
dnkl:releases/1.18
dnkl:releases/1.17
dnkl:releases/1.16
dnkl:releases/1.15
dnkl:releases/1.14
dnkl:releases/1.13
dnkl:releases/1.12
dnkl:releases/1.11
dnkl:releases/1.10
dnkl:releases/1.9
dnkl:releases/1.8
dnkl:releases/1.7
dnkl:releases/1.6
dnkl:releases/1.5
dnkl:releases/1.4
dnkl:releases/1.3
dnkl:releases/1.2
dnkl:releases/1.1
dnkl:releases/1.0
First-time contributor
Copy link
No description provided.
kraftwerk28 force-pushed add-extended-underlines from 52c68a1e2d
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
to 1eb1cfc8e9
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
2022年06月26日 18:08:22 +02:00
Compare
Author
First-time contributor
Copy link

Closes #828

Closes https://codeberg.org/dnkl/foot/issues/828
kraftwerk28 force-pushed add-extended-underlines from 46c44667d5
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
to 99afece98e 2022年07月03日 08:19:57 +02:00
Compare
kraftwerk28 force-pushed add-extended-underlines from 99afece98e to 46c44667d5
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
2022年07月03日 08:26:44 +02:00
Compare
Owner
Copy link

Thanks for contributing! From a quick look, this looks good. Nice and clean.

I'm trying to decide whether I want to merge this as-is, or try to come up with an alternative way of storing extra data. I have a budding idea but haven't thought it through, and don't have the time to test it out yet.

I'm going to leave this open for the time being.

Thanks for contributing! From a quick look, this looks good. Nice and clean. I'm trying to decide whether I want to merge this as-is, or try to come up with an alternative way of storing extra data. I have a budding idea but haven't thought it through, and don't have the time to test it out yet. I'm going to leave this open for the time being.
dnkl left a comment
Copy link

A couple of things I'd like to see changed before I consider merging this:

  • Default to extended underlines being disabled (i.e. flip the default value of the new meson option).
  • Add +/-ucurl to the foot version string (see version_and_features() in both main.c and client.c).
  • Document the new SGR sequences in doc/foot-ctlseq.7.scd.
A couple of things I'd like to see changed before I consider merging this: * Default to extended underlines being **disabled** (i.e. flip the default value of the new meson option). * Add +/-ucurl to the foot version string (see `version_and_features()` in **both** `main.c` and `client.c`). * Document the new SGR sequences in `doc/foot-ctlseq.7.scd`.
kraftwerk28 force-pushed add-extended-underlines from 46c44667d5
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
to 99ae228d5b
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
2022年07月30日 11:03:59 +02:00
Compare
Contributor
Copy link

Hey all! I gave these changes a try, as I've been looking into a low latency/high performance terminal to use for rendering NeoVim. What was missing was support for displaying underlines/undercurls with a color, which this PR aims to add.

Functionality wise it's working, though I had to set VTE_VERSION=6800 (like gnome-terminal, not sure what the exact value should be for foot) to get coloring to work. This is a neovim issue though, as it seems to use this variable to detect terminal support.

One thing I noticed is that underlines are quite thin. I ended up doubling the thickenss with this patch, and it looks a bit better (see the screenshots attached):

diff --git a/render.c b/render.c
index 233e9edb..622027f9 100644
--- a/render.c
+++ b/render.c
@@ -395,7 +395,7 @@ draw_ext_underline(const struct terminal *term, pixman_image_t *pix,
 {
 if (style == UNDERLINE_NONE)
 return;
- const int thickness = font->underline.thickness;
+ const int thickness = font->underline.thickness * 2;
 
 int y_ofs;
 /* Make sure the line isn't positioned below the cell */

Would it be possible to allow customising the thickness (or perhaps increasing the thickness if no option is desired)? Thanks!

Hey all! I gave these changes a try, as I've been looking into a low latency/high performance terminal to use for rendering NeoVim. What was missing was support for displaying underlines/undercurls with a color, which this PR aims to add. Functionality wise it's working, though I had to set `VTE_VERSION=6800` (like gnome-terminal, not sure what the exact value should be for foot) to get coloring to work. This is a neovim issue though, as it seems to use this variable to detect terminal support. One thing I noticed is that underlines are quite thin. I ended up doubling the thickenss with this patch, and it looks a bit better (see the screenshots attached): ```diff diff --git a/render.c b/render.c index 233e9edb..622027f9 100644 --- a/render.c +++ b/render.c @@ -395,7 +395,7 @@ draw_ext_underline(const struct terminal *term, pixman_image_t *pix, { if (style == UNDERLINE_NONE) return; - const int thickness = font->underline.thickness; + const int thickness = font->underline.thickness * 2; int y_ofs; /* Make sure the line isn't positioned below the cell */ ``` Would it be possible to allow customising the thickness (or perhaps increasing the thickness if no option is desired)? Thanks!
Owner
Copy link

Would it be possible to allow customising the thickness (or perhaps increasing the thickness if no option is desired)? Thanks!

It's currently not possible. Normally, the font itself defines the underline thickness. When the font doesn't, fcft (the font library used by foot) estimates a thickness.

Since we already allow customizing a lot of other font metrics (offsets, line height etc), adding an option for overriding the underline thickness is not out of scope for foot. So feel free to open a feature request for this. Or even better - a PR that implements it ;)

> Would it be possible to allow customising the thickness (or perhaps increasing the thickness if no option is desired)? Thanks! It's currently not possible. Normally, the font itself defines the underline thickness. When the font doesn't, fcft (the font library used by foot) estimates a thickness. Since we already allow customizing a lot of other font metrics (offsets, line height etc), adding an option for overriding the underline thickness is not out of scope for foot. So feel free to open a feature request for this. Or even better - a PR that implements it ;)
Contributor
Copy link

Would it be possible to allow customising the thickness (or perhaps increasing the thickness if no option is desired)? Thanks!

It's currently not possible. Normally, the font itself defines the underline thickness. When the font doesn't, fcft (the font library used by foot) estimates a thickness.

Since we already allow customizing a lot of other font metrics (offsets, line height etc), adding an option for overriding the underline thickness is not out of scope for foot. So feel free to open a feature request for this. Or even better - a PR that implements it ;)

That makes sense, I created an issue for it in #1136 :)

> > Would it be possible to allow customising the thickness (or perhaps increasing the thickness if no option is desired)? Thanks! > > It's currently not possible. Normally, the font itself defines the underline thickness. When the font doesn't, fcft (the font library used by foot) estimates a thickness. > > Since we already allow customizing a lot of other font metrics (offsets, line height etc), adding an option for overriding the underline thickness is not out of scope for foot. So feel free to open a feature request for this. Or even better - a PR that implements it ;) That makes sense, I created an issue for it in https://codeberg.org/dnkl/foot/issues/1136 :)
Contributor
Copy link

Just as an FYI: should #1140 be merged, its changes would have to be applied to draw_ext_underline as well.

Just as an FYI: should https://codeberg.org/dnkl/foot/pulls/1140 be merged, its changes would have to be applied to `draw_ext_underline` as well.
Author
First-time contributor
Copy link

@dnkl, done w/ changes you requested, although I feel that https://codeberg.org/dnkl/foot/src/branch/master/doc/foot-ctlseqs.7.scd#L198 should be more documented on the meaning of each specifier (i.e. 48 - background, 58 - underline etc)

@dnkl, done w/ changes you requested, although I feel that https://codeberg.org/dnkl/foot/src/branch/master/doc/foot-ctlseqs.7.scd#L198 should be more documented on the meaning of each specifier (i.e. 48 - background, 58 - underline etc)
Author
First-time contributor
Copy link

Here are some screenshots of how the new underlines look like

image

image

Here are some screenshots of how the new underlines look like ![image](/attachments/0998e3cf-8506-4153-9476-aa3df876c5e8) ![image](/attachments/087418d0-13ac-4c24-a5f5-0b0decb20146)
Owner
Copy link

done w/ changes you requested

Thanks! Still debating with myself whether to merge this now, or wait until I have implemented a better solution for "extra" cell data. I have an idea that should cover both this, as well as OSC-8 URLs, but there will be some time before I can start working on it.

although I feel that https://codeberg.org/dnkl/foot/src/branch/master/doc/foot-ctlseqs.7.scd#L198 should be more documented on the meaning of each specifier (i.e. 48 - background, 58 - underline etc)

Possibly, but I don't think that's necessary. foot-ctlseqs isn't meant to be a reference manual on how the escapes work. Just a list of escapes that foot implements.

Users are expected to lookup the documentation from the source (typically XTerm's ctlseq document) for details on a specific escape.

> done w/ changes you requested Thanks! Still debating with myself whether to merge this now, or wait until I have implemented a better solution for "extra" cell data. I have an idea that should cover both this, as well as OSC-8 URLs, but there will be some time before I can start working on it. > although I feel that https://codeberg.org/dnkl/foot/src/branch/master/doc/foot-ctlseqs.7.scd#L198 should be more documented on the meaning of each specifier (i.e. 48 - background, 58 - underline etc) Possibly, but I don't think that's necessary. `foot-ctlseqs` isn't meant to be a reference manual on _how_ the escapes work. Just a list of escapes that foot implements. Users are expected to lookup the documentation from the source (typically XTerm's ctlseq document) for details on a specific escape.
First-time contributor
Copy link

Thank you for working on this! This, along with vi mode for the scrollback, are the only two features that I'm really missing in foot.

I compiled this branch and tested it out, and for the most part, it works great! However, I ran into an address boundary error when attempting to use one of the ANSI colors in the facespec for the underline:

fish: Job 3, 'foot' terminated by signal SIGSEGV (Address boundary error)

This does not happen in kitty, so I think this is an issue with foot.

EDIT: I was able to confirm with certainty that the issue is with foot. If you run a foot server and connect one client to kak, then perform the steps, the entire server crashes and all clients close. A kitty window connected to the same kak session displays the red just fine.

To reproduce

  • Compile this PR
  • Install kakoune
  • Add the following to your kakrc:
declare-optionrange-specsface_test_rangesdefine-command-params1test-face%{add-highlighter-overridewindow/face-test-rangesrangesface_test_rangesset-facewindowtest_face%arg{1}set-optionwindowface_test_ranges%val{timestamp}"%val{selection_desc}|test_face"}
  • Open a file in kak, select some text with w (or anything you want)
  • Run :test-face ",,rgb:ff0000+c", and see how the text is curly underlined in red
  • Run :test-face ",,red+c", and see crash

image

One other question: why is this locked behind a compile time flag? Does it really add that much overhead compared to not having it, that it shouldn't work by default? I would like to be able to use the distribution package manager for foot, since it is one of the most essential programs on my system.

Thank you for working on this! This, along with vi mode for the scrollback, are the only two features that I'm really missing in foot. I compiled this branch and tested it out, and for the most part, it works great! However, I ran into an address boundary error when attempting to use one of the ANSI colors in the facespec for the underline: ``` fish: Job 3, 'foot' terminated by signal SIGSEGV (Address boundary error) ``` This does not happen in kitty, so I think this is an issue with foot. **EDIT:** I was able to confirm with certainty that the issue is with foot. If you run a foot server and connect one client to kak, then perform the steps, the entire server crashes and all clients close. A kitty window connected to the same kak session displays the red just fine. ### To reproduce - Compile this PR - Install [kakoune](https://github.com/mawww/kakoune) - Add the following to your `kakrc`: ```kak declare-option range-specs face_test_ranges define-command -params 1 test-face %{ add-highlighter -override window/face-test-ranges ranges face_test_ranges set-face window test_face %arg{1} set-option window face_test_ranges %val{timestamp} "%val{selection_desc}|test_face" } ``` - Open a file in kak, select some text with `w` (or anything you want) - Run `:test-face ",,rgb:ff0000+c"`, and see how the text is curly underlined in red - Run `:test-face ",,red+c"`, and see crash ![image](attachments/eb8956b4-be4a-4da8-88ef-78e46fe4423b) One other question: why is this locked behind a compile time flag? Does it really add that much overhead compared to not having it, that it shouldn't work by default? I would like to be able to use the distribution package manager for foot, since it is one of the most essential programs on my system.
First-time contributor
Copy link

I believe this misses setal in the terminfo description (+ maybe a new setrgbl using the format of setrgbf / setrgbb with their own values for R, G and B instead of the combined one from setal).

In libvte (TERM=vte-direct) one can successfully do this for example:

$ printf "%sfoo %s bar\n" "$(tput setal 0xff0000)" "$(tput Smulx 3)underlined$(tput Smulx 0)"
foo underlined bar
$ tput setal 0xff0000 | cat -v
^[[58:2::255:0:0m

Edit:
Added setrgbl suggestion.

I believe this [misses](https://invisible-island.net/ncurses/terminfo.ti.html#tic-set_underline_colors_nonstandard_) `setal` in the terminfo description (+ maybe a new `setrgbl` using the format of `setrgbf` / `setrgbb` with their own values for R, G and B instead of the combined one from `setal`). In libvte (`TERM=vte-direct`) one can successfully do this for example: ```bash $ printf "%sfoo %s bar\n" "$(tput setal 0xff0000)" "$(tput Smulx 3)underlined$(tput Smulx 0)" foo underlined bar $ tput setal 0xff0000 | cat -v ^[[58:2::255:0:0m ``` Edit: Added `setrgbl` suggestion.
kraftwerk28 force-pushed add-extended-underlines from 852d27dae1
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
to 650b4061f9
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
2022年09月29日 20:05:52 +02:00
Compare
First-time contributor
Copy link

The crash I reported earlier with using ANSI facespecs for underlines in kakoune no longer occurs, but instead the underlines don't show up at all. It continues to work fine in kitty.

The crash I reported earlier with using ANSI facespecs for underlines in kakoune no longer occurs, but instead the underlines don't show up at all. It continues to work fine in kitty.
kraftwerk28 force-pushed add-extended-underlines from 650b4061f9
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
to 32b96e8a23 2022年11月28日 11:15:51 +01:00
Compare
kraftwerk28 force-pushed add-extended-underlines from 32b96e8a23 to e3a3a50214 2022年11月28日 11:24:22 +01:00 Compare
kraftwerk28 force-pushed add-extended-underlines from e3a3a50214 to 774e738ba4 2022年11月28日 13:08:14 +01:00 Compare
kraftwerk28 force-pushed add-extended-underlines from 774e738ba4 to 0c0ee9736f 2022年11月28日 13:10:14 +01:00 Compare
kraftwerk28 force-pushed add-extended-underlines from 0c0ee9736f to 60fdc92659 2022年11月28日 13:11:21 +01:00 Compare
kraftwerk28 force-pushed add-extended-underlines from 60fdc92659 to b6bd9a6e44 2022年12月30日 23:25:49 +01:00 Compare
kraftwerk28 force-pushed add-extended-underlines from b6bd9a6e44 to 59d2e86455 2023年03月13日 01:46:35 +01:00 Compare
kraftwerk28 force-pushed add-extended-underlines from 13c33b1f25 to b9c8d68845 2023年03月13日 01:58:00 +01:00 Compare
Author
First-time contributor
Copy link

@raiguard, the issue you mentioned should be gone in b9c8d68845, am being a victim of blind copy-pasting. Let me know if you find any more bugs with it.

image

why is this locked behind a compile time flag

Because of #828 (comment), I initially planned to make this feature optional so users can choose between more-features and less-bloat. And because this feature affects how structure (of a cell) is laying in memory, it is static.

P.S. I'm sorry for making you wait for it that long.

@raiguard, the issue you mentioned should be gone in https://codeberg.org/dnkl/foot/commit/b9c8d68845251419377a9b402c912e0f1e983031, am being a victim of blind copy-pasting. Let me know if you find any more bugs with it. ![image](/attachments/a52d3778-58bb-4c61-8036-2a4c4f74d998) > why is this locked behind a compile time flag Because of https://codeberg.org/dnkl/foot/issues/828#issuecomment-284301, I initially planned to make this feature optional so users can choose between more-features and less-bloat. And because this feature affects how structure (of a cell) is laying in memory, it is static. P.S. I'm sorry for making you wait for it that long.
110 KiB
First-time contributor
Copy link

Underlines in the IME preedit area disappear in the current code.

This patch can fix it.

diff --git a/render.c b/render.c
index e92247b4..d619d7d5 100644
--- a/render.c
+++ b/render.c
@@ -926,12 +926,13 @@ render_cell(struct terminal *term, pixman_image_t *pix,
 
 /* Underline */
 #if FOOT_EXT_UNDERLINE
- draw_ext_underline(term, pix, font, &ul, cell->attrs.ul_style,
- x, y, cell_cols);
-#else
+ if (cell->attrs.ul_style != UNDERLINE_NONE) {
+ draw_ext_underline(term, pix, font, &ul, cell->attrs.ul_style,
+ x, y, cell_cols);
+ } else
+#endif
 if (cell->attrs.underline)
 draw_underline(term, pix, font, &fg, x, y, cell_cols);
-#endif
 
 if (cell->attrs.strikethrough)
 draw_strikeout(term, pix, font, &fg, x, y, cell_cols);
Underlines in the IME preedit area disappear in the current code. This patch can fix it. ```patch diff --git a/render.c b/render.c index e92247b4..d619d7d5 100644 --- a/render.c +++ b/render.c @@ -926,12 +926,13 @@ render_cell(struct terminal *term, pixman_image_t *pix, /* Underline */ #if FOOT_EXT_UNDERLINE - draw_ext_underline(term, pix, font, &ul, cell->attrs.ul_style, - x, y, cell_cols); -#else + if (cell->attrs.ul_style != UNDERLINE_NONE) { + draw_ext_underline(term, pix, font, &ul, cell->attrs.ul_style, + x, y, cell_cols); + } else +#endif if (cell->attrs.underline) draw_underline(term, pix, font, &fg, x, y, cell_cols); -#endif if (cell->attrs.strikethrough) draw_strikeout(term, pix, font, &fg, x, y, cell_cols); ```
First-time contributor
Copy link

Are these features supported in latest foot now (version 1.15.3)?

Are these features supported in latest foot now (version 1.15.3)?
First-time contributor
Copy link

Are these features supported in latest foot now (version 1.15.3)?

This PR has not been merged into the master branch yet, for now the only thing you could do is clone the fork of the PR and build from source.

> Are these features supported in latest foot now (version 1.15.3)? This PR has not been merged into the master branch yet, for now the only thing you could do is clone the fork of the PR and build from source.
First-time contributor
Copy link

It does not seem like the built in terminfo reflects the extended underline capabilities? Am i missing something?

For now i was able to get curly underlines to work in neovim by manually adding the line Smulx=\E[4:3m, to foot.info before building, or by building normally and running foot --term=xterm-kitty.

It does not seem like the built in terminfo reflects the extended underline capabilities? Am i missing something? For now i was able to get curly underlines to work in neovim by manually adding the line `Smulx=\E[4:3m,` to `foot.info` before building, or by building normally and running `foot --term=xterm-kitty`.
First-time contributor
Copy link

I rebased this PR onto the last foot release (1.16.1). For anyone who is interested: queezle/foot@85d680151c

@kraftwerk28 Thanks for the feature, it is essential when working with a language server and I would not be using foot without it.

I rebased this PR onto the last foot release ([1.16.1](https://codeberg.org/dnkl/foot/releases/tag/1.16.1)). For anyone who is interested: https://codeberg.org/queezle/foot/commit/85d680151c2b8e94eb282410baaab88d015b74ef @kraftwerk28 Thanks for the feature, it is essential when working with a language server and I would not be using foot without it.
kraftwerk28 force-pushed add-extended-underlines from b9c8d68845 to 2fac14a22b
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
2023年10月17日 04:33:55 +02:00
Compare
First-time contributor
Copy link

For now i was able to get curly underlines to work in neovim by manually adding the line Smulx=\E[4:3m, to foot.info before building, or by building normally and running foot --term=xterm-kitty.

Where do I have to put the line Smulx=\E[4:3m, for it to work? I pasted it at the end of the foot.info file and it didn't work.

> For now i was able to get curly underlines to work in neovim by manually adding the line `Smulx=\E[4:3m,` to `foot.info` before building, or by building normally and running `foot --term=xterm-kitty`. Where do I have to put the line `Smulx=\E[4:3m,` for it to work? I pasted it at the end of the foot.info file and it didn't work.
First-time contributor
Copy link

Where do I have to put the line Smulx=\E[4:3m, for it to work? I pasted it at the end of the foot.info file and it didn't work.

That should probably be Smulx=\E[4:%p1%dm, (copied from kittys terminfo). Setting it to \E[4:3m, only allows for curly underlines, but this PR supports different styles as well.

@gmr458 At the end of the foot.info is correct (see queezle/foot@70a3c2f505), but this is a terminfo file which has to be compiled and installed in your system. It's needed by other programs to select the right escape codes to talk to foot.

> Where do I have to put the line `Smulx=\E[4:3m,` for it to work? I pasted it at the end of the foot.info file and it didn't work. That should probably be `Smulx=\E[4:%p1%dm,` (copied from kittys terminfo). Setting it to `\E[4:3m,` only allows for curly underlines, but this PR supports different styles as well. @gmr458 At the end of the foot.info is correct (see https://codeberg.org/queezle/foot/commit/70a3c2f505de128b32d725bbe87306a4f7b1e9cb), but this is a terminfo file which has to be compiled and installed in your system. It's needed by other programs to select the right escape codes to talk to foot.
kraftwerk28 force-pushed add-extended-underlines from 8c92949141
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
to e95b52edc0
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline failed
2023年10月20日 17:46:37 +02:00
Compare
Author
First-time contributor
Copy link

@queezle you're right, added such termcap into foot.info.

@queezle you're right, added such termcap into `foot.info`.
Author
First-time contributor
Copy link

For those who are using arch and it's derivatives: I've made an AUR package containing this patch. It also installs additional terminfos into /usr/share/terminfo/f (to avoid clash with ncurses's files) and changes the default $TERM to foot-ext-underline. Enjoy and let me know if I made any AUR-related mistakes.

For those who are using arch and it's derivatives: I've made an [AUR package containing this patch](https://aur.archlinux.org/packages/foot-ext-underline-git). It also installs additional terminfos into `/usr/share/terminfo/f` (to avoid clash with `ncurses`'s files) and changes the default `$TERM` to `foot-ext-underline`. Enjoy and let me know if I made any AUR-related mistakes.
First-time contributor
Copy link

Please care underlines in IME pre-edit area.

diff --git a/ime.c b/ime.c
index f3a3ec18..7cadc0f2 100644
--- a/ime.c
+++ b/ime.c
@@ -350,7 +350,11 @@ done(void *data, struct zwp_text_input_v3 *zwp_text_input_v3,
 for (size_t i = 0, cell_idx = 0; i < wchars; cell_idx += widths[i], i++) {
 if (hidden || start == end || cell_idx < start || cell_idx >= end) {
 struct cell *cell = &seat->ime.preedit.cells[cell_idx];
+#if FOOT_EXT_UNDERLINE
+ cell->attrs.ul_style = UNDERLINE_STRAIGHT;
+#else
 cell->attrs.underline = true;
+#endif
 }
 }
 

This patch serves the same purpose as the patch in #1099 (comment) in a more appropriate way.

Please care underlines in IME pre-edit area. ```diff diff --git a/ime.c b/ime.c index f3a3ec18..7cadc0f2 100644 --- a/ime.c +++ b/ime.c @@ -350,7 +350,11 @@ done(void *data, struct zwp_text_input_v3 *zwp_text_input_v3, for (size_t i = 0, cell_idx = 0; i < wchars; cell_idx += widths[i], i++) { if (hidden || start == end || cell_idx < start || cell_idx >= end) { struct cell *cell = &seat->ime.preedit.cells[cell_idx]; +#if FOOT_EXT_UNDERLINE + cell->attrs.ul_style = UNDERLINE_STRAIGHT; +#else cell->attrs.underline = true; +#endif } } ``` This patch serves the same purpose as the patch in https://codeberg.org/dnkl/foot/pulls/1099#issuecomment-889955 in a more appropriate way.
First-time contributor
Copy link

For those who are using arch and it's derivatives: I've made an AUR package containing this patch. ...

Thank you, it works wonderfully, just a question: Is it expected that underline thickness cannot be changed? I tried changing the offset according to the foot.ini manpage which worked correctly, but underline-thickness=5px or any other value hadn't changed anything about the appearance of the underlines. I am unsure if this is related to foot itself or to this PR, but so far I haven't encountered any other issues.

> For those who are using arch and it's derivatives: I've made an [AUR package containing this patch](https://aur.archlinux.org/packages/foot-ext-underline-git). ... Thank you, it works wonderfully, just a question: Is it expected that underline thickness cannot be changed? I tried changing the offset according to the `foot.ini` manpage which worked correctly, but `underline-thickness=5px` or any other value hadn't changed anything about the appearance of the underlines. I am unsure if this is related to foot itself or to this PR, but so far I haven't encountered any other issues.
First-time contributor
Copy link

I can confirm that underline-thickness doesn't appear to do anything. Additionally, the thickness doesn't appear to account for display scale. Is that a known issue?

Additionally, URL selection appears to be entirely broken.

Font size 10.5, display scale 1.25:

image

Font size 13.0, display scale 1.0:

image

I can confirm that `underline-thickness` doesn't appear to do anything. Additionally, the thickness doesn't appear to account for display scale. Is that a known issue? Additionally, URL selection appears to be entirely broken. Font size 10.5, display scale 1.25: ![image](/attachments/0eab6bda-1d4e-4be4-8be4-be63cfb693ad) Font size 13.0, display scale 1.0: ![image](/attachments/0548096d-a2b9-4b1d-b8ee-54c035c90c91)
First-time contributor
Copy link

I'm currently using the changes from this PR rebased unto the master branch. (削除) The undercurl peaks/valleys look a bit sharp , but (削除ここまで) I'm pleased and will be staying with this setup.

Edit: I believe the undercurl "sharpness" is defined by the font.

image

image

I'm currently using the changes from this PR rebased unto the master branch. ~~The undercurl peaks/valleys look a bit sharp , but~~ I'm pleased and will be staying with this setup. Edit: I believe the undercurl "sharpness" is defined by the font. ![image](/attachments/e9dce64a-2a06-4abe-85d5-77ff987802ad) ![image](/attachments/7de9f006-1ad4-424f-824e-c0335db690ef)
First-time contributor
Copy link

If anyone is using this branch and would like the characters to sit within the dips of the undercurl rather than upon the peaks, this patch will work:

diff --git a/render.c b/render.c
index f88d9ba3..294e0dd6 100644
--- a/render.c
+++ b/render.c
@@ -456,13 +456,13 @@ draw_ext_underline(const struct terminal *term, pixman_image_t *pix,
 const pixman_trapezoid_t traps[] = {
 {
 I(top), I(bot),
- {{I(x), I(bot - th)}, {I(half_x), I(top - th)}},
- {{I(x), I(bot + th)}, {I(half_x), I(top + th)}},
+ {{I(x), I(top + th)}, {I(half_x), I(bot + th)}},
+ {{I(x), I(top - th)}, {I(half_x), I(bot - th)}},
 },
 {
 I(top), I(bot),
- {{I(half_x), I(top + th)}, {I(full_x), I(bot + th)}},
- {{I(half_x), I(top - th)}, {I(full_x), I(bot - th)}},
+ {{I(half_x), I(bot - th)}, {I(full_x), I(top - th)}},
+ {{I(half_x), I(bot + th)}, {I(full_x), I(top + th)}},
 }};
 pixman_image_t *fill = pixman_image_create_solid_fill(color);
 pixman_composite_trapezoids(

image

If anyone is using this branch and would like the characters to sit within the dips of the undercurl rather than upon the peaks, this patch will work: ``` diff --git a/render.c b/render.c index f88d9ba3..294e0dd6 100644 --- a/render.c +++ b/render.c @@ -456,13 +456,13 @@ draw_ext_underline(const struct terminal *term, pixman_image_t *pix, const pixman_trapezoid_t traps[] = { { I(top), I(bot), - {{I(x), I(bot - th)}, {I(half_x), I(top - th)}}, - {{I(x), I(bot + th)}, {I(half_x), I(top + th)}}, + {{I(x), I(top + th)}, {I(half_x), I(bot + th)}}, + {{I(x), I(top - th)}, {I(half_x), I(bot - th)}}, }, { I(top), I(bot), - {{I(half_x), I(top + th)}, {I(full_x), I(bot + th)}}, - {{I(half_x), I(top - th)}, {I(full_x), I(bot - th)}}, + {{I(half_x), I(bot - th)}, {I(full_x), I(top - th)}}, + {{I(half_x), I(bot + th)}, {I(full_x), I(top + th)}}, }}; pixman_image_t *fill = pixman_image_create_solid_fill(color); pixman_composite_trapezoids( ``` ![image](/attachments/67faa8d3-1480-4471-ba0f-511cbce91be3)
dnkl referenced this pull request from a commit 2024年06月24日 00:59:23 +02:00
Owner
Copy link

Replaced by #1747

Replaced by https://codeberg.org/dnkl/foot/pulls/1747
dnkl closed this pull request 2024年06月24日 01:55:56 +02:00
dnkl referenced this pull request from a commit 2024年06月25日 08:08:46 +02:00
dnkl referenced this pull request from a commit 2024年06月25日 08:14:17 +02:00
dnkl referenced this pull request from a commit 2024年06月25日 08:20:19 +02:00
dnkl referenced this pull request from a commit 2024年06月26日 18:39:29 +02:00
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline failed

Pull request closed

Please reopen this pull request to perform a merge.
Sign in to join this conversation.
No reviewers
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
12 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
dnkl/foot!1099
Reference in a new issue
dnkl/foot
No description provided.
Delete branch "kraftwerk28/foot:add-extended-underlines"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?