Skip to content

feat(window): add configurable padding_x/padding_y#75

Open
roramirez wants to merge 1 commit into
mainfrom
feat/config-padding
Open

feat(window): add configurable padding_x/padding_y#75
roramirez wants to merge 1 commit into
mainfrom
feat/config-padding

Conversation

@roramirez

Copy link
Copy Markdown
Owner

Summary

Splits the single hard-coded PANE_PADDING = 4 constant into two configurable, DPI-scaled values: window.padding_x and window.padding_y. These control the inner padding (in pixels) between a pane's border and its text grid on each axis independently. Both default to 4, preserving current behavior.

Changes

  • config: add padding_x / padding_y to WindowConfig (serde defaults of 4) and to assets/config.toml; expose both as editable UInt fields in the in-app config panel (tui_config.rs), renumbering the F_* slots.
  • main: replace pane_padding() with pane_padding_x() / pane_padding_y() reading the config and applying Scale::chrome.
  • grid sizing: spawn_pane_into and sync_pane_sizes_tab subtract pad_x*2 / pad_y*2 separately; sync_pane_sizes_tab now takes both paddings, with all callers updated.
  • renderer: PaneView carries pad_x / pad_y; render_row, Sixel draw_images, and cell_out_of_pane_bounds clipping use per-axis padding. Removed the now-unused PANE_PADDING constant.
  • hit-testing: App::pixel_to_cell insets the pane rect by the scaled padding so a click at the padded origin maps to cell (0, 0); pane_at_pixel stays full-rect.
  • docs: doc/SPEC.md, README.md, CHANGELOG.md.
  • tests: updated field-count / padding / geometry tests; added a test proving padding_x != padding_y shifts render offsets per-axis, and a pixel_to_cell padded-origin test.

How to test

  • cargo test — full suite passes (1219 tests).
  • cargo clippy --locked -- -D warnings — clean.
  • Manual: set padding_x = 20 / padding_y = 4 under [window] in ~/.config/mmterm/config.toml (or via the in-app config panel), relaunch, and confirm the grid is inset further horizontally than vertically and that mouse selection still lands on the correct cells.

Split the single 4 px PANE_PADDING constant into two DPI-scaled config
values controlling the horizontal and vertical inner padding between a
pane's border and its grid. Padding is threaded through grid sizing,
the renderer's per-row/image draw origin, cell clipping, and mouse
hit-testing (pixel_to_cell insets the pane rect so a click at the
padded origin maps to cell (0,0)). Exposed as editable fields in the
in-app config panel.
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.

1 participant