feat(window): add configurable padding_x/padding_y#75
Open
roramirez wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Splits the single hard-coded
PANE_PADDING = 4constant into two configurable, DPI-scaled values:window.padding_xandwindow.padding_y. These control the inner padding (in pixels) between a pane's border and its text grid on each axis independently. Both default to4, preserving current behavior.Changes
config: addpadding_x/padding_ytoWindowConfig(serde defaults of 4) and toassets/config.toml; expose both as editable UInt fields in the in-app config panel (tui_config.rs), renumbering theF_*slots.main: replacepane_padding()withpane_padding_x()/pane_padding_y()reading the config and applyingScale::chrome.spawn_pane_intoandsync_pane_sizes_tabsubtractpad_x*2/pad_y*2separately;sync_pane_sizes_tabnow takes both paddings, with all callers updated.renderer:PaneViewcarriespad_x/pad_y;render_row, Sixeldraw_images, andcell_out_of_pane_boundsclipping use per-axis padding. Removed the now-unusedPANE_PADDINGconstant.App::pixel_to_cellinsets the pane rect by the scaled padding so a click at the padded origin maps to cell(0, 0);pane_at_pixelstays full-rect.doc/SPEC.md,README.md,CHANGELOG.md.padding_x != padding_yshifts render offsets per-axis, and apixel_to_cellpadded-origin test.How to test
cargo test— full suite passes (1219 tests).cargo clippy --locked -- -D warnings— clean.padding_x = 20/padding_y = 4under[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.