Skip to content

Conversation

@emreyolcu
Copy link
Contributor

@emreyolcu emreyolcu commented Aug 16, 2025

Hey Paul, when setting/resetting margin widths Olivetti currently assumes that the default values of left-margin-width and right-margin-width are zero. This assumption was partly removed after #78 in 1690a3c, but we forgot to account for the two other places where the same assumption is made. Those places result in more subtle bugs than the previous one, so I've only recently noticed a problem. When the current window is not wide enough and Olivetti is active (not necessarily in the current window), margins are set to zero instead of their default values. This PR fixes that.

EDIT 1: I apparently forgot the mistake I made in #78 and incorporated the same change here. I'll try to see how to calculate the additional width correctly without assuming that olivetti-reset-window sets the margin widths to zero.

EDIT 2: I've changed the functions olivetti-normalize-width and olivetti-set-window to compute the window's width in pixels by taking the margins into account. If the default margin widths are zero, nothing changes from before; otherwise, margins are treated as if they are part of the window's text area (while fringes, vertical dividers, or scroll bars are still excluded). In my testing this results in the same behavior as before while also respecting the default margin widths.

@rnkn
Copy link
Owner

rnkn commented Aug 17, 2025

Looks great, thanks! Might be a week or so until I can test/merge if that's okay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants