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

Add pad-extend option (like Ghostty) #2272

Open
txf wants to merge 1 commit from txf/foot:pad-extend into master
pull from: txf/foot:pad-extend
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

Adds a new boolean option pad-extend that extends edge cell
background colors into the terminal padding/margins, similar to
Ghostty's behavior. When enabled, the left/right margins use the
background color of the adjacent edge cells, and top/bottom margins
use the colors of the first/last row cells.

pad-extend = yes
Adds a new boolean option `pad-extend` that extends edge cell background colors into the terminal padding/margins, similar to Ghostty's behavior. When enabled, the left/right margins use the background color of the adjacent edge cells, and top/bottom margins use the colors of the first/last row cells. ```ini pad-extend = yes
render.c Outdated
@ -1231,0 +1241,4 @@
default:
return term->reverse ? term->colors.fg : term->colors.bg;
}
}
Owner
Copy link

This looks like copy-paste from render_cell(). Can you update it to use this function instead of duplicating the code?

This looks like copy-paste from `render_cell()`. Can you update it to use this function instead of duplicating the code?
Author
First-time contributor
Copy link

what do you think? im happy for any help, i just really really appriciate having this feature and i think anyone can learn to do so who works a lot with TUI's which have bars like nvim or tmux etc. but how i got it to work is shoehorning it in with me screaming at claude to get my idea to work without unnecesarry touching of any line of you. — i hope i somewhat sucseeded.

what do you think? im happy for any help, i just really really appriciate having this feature and i think anyone can learn to do so who works a lot with TUI's which have bars like nvim or tmux etc. but how i got it to work is shoehorning it in with me screaming at claude to get my idea to work without unnecesarry touching of any line of you. — i hope i somewhat sucseeded.
txf force-pushed pad-extend from e954a66881
All checks were successful
builds.sr.ht/freebsd-x64 Job completed
to 7544c9aa5c
Some checks are pending
ci/woodpecker/pr/woodpecker Pipeline is pending approval
builds.sr.ht/freebsd-x64 Job completed
2026年03月06日 12:44:12 +01:00
Compare
txf force-pushed pad-extend from 7544c9aa5c
Some checks are pending
ci/woodpecker/pr/woodpecker Pipeline is pending approval
builds.sr.ht/freebsd-x64 Job completed
to 6bb0eb1dd3
Some checks are pending
ci/woodpecker/pr/woodpecker Pipeline is pending approval
builds.sr.ht/freebsd-x64 Job completed
2026年03月06日 19:53:33 +01:00
Compare
First-time contributor
Copy link

FWIW, I've been running this for quite some time, no issues so far.

foot version: 1.26.1-1-g83794ec2 (Mar 18 2026, branch 'HEAD') +pgo +ime +graphemes +toplevel-tag -blur -assertions
FWIW, I've been running this for quite some time, no issues so far. ``` foot version: 1.26.1-1-g83794ec2 (Mar 18 2026, branch 'HEAD') +pgo +ime +graphemes +toplevel-tag -blur -assertions ```
txf force-pushed pad-extend from 7c81816612
Some checks are pending
ci/woodpecker/pr/woodpecker Pipeline is pending approval
builds.sr.ht/freebsd-x64 Job completed
to 2fd2255ad3
Some checks are pending
ci/woodpecker/pr/woodpecker Pipeline is pending approval
builds.sr.ht/freebsd-x64 Job completed
2026年04月22日 18:14:39 +02:00
Compare
First-time contributor
Copy link

Found a bug where the "pad-extend" border gets an alpha channel even though I'm in "default" alpha-mode.

Might want to copy the alpha component from the function I wrote here into your cell_bg_color.
#2310/files

(Screenshot taken with 25x25 padding)

image

Found a bug where the "pad-extend" border gets an alpha channel even though I'm in "default" alpha-mode. Might want to copy the alpha component from the function I wrote here into your cell_bg_color. https://codeberg.org/dnkl/foot/pulls/2310/files#diff-2e57baf99c679e010d0fbf76a6fda450e8f5047e (Screenshot taken with 25x25 padding) ![image](/attachments/c504673b-f6e6-4608-8f20-b22a9a3d78ac)
txf force-pushed pad-extend from 2fd2255ad3
Some checks are pending
ci/woodpecker/pr/woodpecker Pipeline is pending approval
builds.sr.ht/freebsd-x64 Job completed
to 2008199659
Some checks are pending
ci/woodpecker/pr/woodpecker Pipeline is pending approval
builds.sr.ht/freebsd-x64 Job completed
2026年06月03日 11:43:07 +02:00
Compare
txf force-pushed pad-extend from 2008199659
Some checks are pending
ci/woodpecker/pr/woodpecker Pipeline is pending approval
builds.sr.ht/freebsd-x64 Job completed
to e137f92542
Some checks are pending
ci/woodpecker/pr/woodpecker Pipeline is pending approval
builds.sr.ht/freebsd-x64 Job completed
2026年06月03日 12:11:26 +02:00
Compare
Author
First-time contributor
Copy link

@cow_enthusiast thanks for choosing this PR, i feel honored; and for catching the alpha-issue (i never use transparencies whereever i can turn it off, so i would have never ever catched that!). Should be fixed: since these edge fills are guarded by != _bg, the cells can't have a default background, so they only need to be opaque unless alpha-mode=all.

@dnkl I also tryed to gate the edge-extend to full-height renders, so the partial scroll-restore paths stop redoing margin work the per-frame re-render already covers, to keep it lighter on damage.

One deliberate scope call I want to flag:
cell_bg_color() resolves the plain background, so a reverse-video edge cell currently bleeds its background instead of its visible color into the padding. The minimal fix could be ~8 lines, to return the foreground when the cell is reversed:

 if (unlikely(cell->attrs.reverse)) {
 switch (cell->attrs.fg_src) {
 case COLOR_RGB: return cell->attrs.fg;
 case COLOR_BASE16:
 case COLOR_BASE256: return term->colors.table[cell->attrs.fg];
 case COLOR_DEFAULT: return term->reverse ? term->colors.bg :
 term->colors.fg;
 }
 }

I left it out to keep the diff minimal — and i'm flagging it not because i ever actually noticed it, but to respect what #2310 (closed in favor of this) would have covered. Selected edge cells and the reverse-video + alpha-mode=all combo are the remaining gaps, both niche/transient, so I'd punt on those unless you disagree.
🐮's cell_effective_bg() is the full-coverage version if we ever want all of it.

@cow_enthusiast thanks for choosing this PR, i feel honored; and for catching the alpha-issue (i never use transparencies whereever i can turn it off, so i would have never ever catched that!). Should be fixed: since these edge fills are guarded by `!= _bg`, the cells can't have a default background, so they only need to be opaque unless `alpha-mode=all`. @dnkl I also tryed to gate the edge-extend to full-height renders, so the partial scroll-restore paths stop redoing margin work the per-frame re-render already covers, to keep it lighter on damage. One deliberate scope call I want to flag: `cell_bg_color()` resolves the plain background, so a reverse-video edge cell currently bleeds its background instead of its visible color into the padding. The minimal fix could be ~8 lines, to return the foreground when the cell is reversed: ``` if (unlikely(cell->attrs.reverse)) { switch (cell->attrs.fg_src) { case COLOR_RGB: return cell->attrs.fg; case COLOR_BASE16: case COLOR_BASE256: return term->colors.table[cell->attrs.fg]; case COLOR_DEFAULT: return term->reverse ? term->colors.bg : term->colors.fg; } } ``` I left it out to keep the diff minimal — and i'm flagging it not because i ever actually noticed it, but to respect what [#2310](https://codeberg.org/dnkl/foot/pulls/2310/files#diff-2e57baf99c679e010d0fbf76a6fda450e8f5047e) (closed in favor of this) would have covered. Selected edge cells and the reverse-video + `alpha-mode=all` combo are the remaining gaps, both niche/transient, so I'd punt on those unless you disagree. [🐮's](https://codeberg.org/cow_enthusiast) `cell_effective_bg()` is the full-coverage version if we ever want all of it.
txf force-pushed pad-extend from e137f92542
Some checks are pending
ci/woodpecker/pr/woodpecker Pipeline is pending approval
builds.sr.ht/freebsd-x64 Job completed
to 51d6237662
Some checks are pending
ci/woodpecker/pr/woodpecker Pipeline is pending approval
builds.sr.ht/freebsd-x64 Job completed
2026年06月22日 15:14:35 +02:00
Compare
Some checks are pending
ci/woodpecker/pr/woodpecker Pipeline is pending approval
builds.sr.ht/freebsd-x64 Job completed
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u pad-extend:txf-pad-extend
git switch txf-pad-extend

Merge

Merge the changes and update on Forgejo.
git switch master
git merge --no-ff txf-pad-extend
git switch txf-pad-extend
git rebase master
git switch master
git merge --ff-only txf-pad-extend
git switch txf-pad-extend
git rebase master
git switch master
git merge --no-ff txf-pad-extend
git switch master
git merge --squash txf-pad-extend
git switch master
git merge --ff-only txf-pad-extend
git switch master
git merge txf-pad-extend
git push origin master
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
4 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!2272
Reference in a new issue
dnkl/foot
No description provided.
Delete branch "txf/foot:pad-extend"

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?