Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow alternative area explicit sizing in splits #373

Conversation

spacez320
Copy link
Contributor

@spacez320 spacez320 commented Mar 5, 2024

This change allows one to apply split options that affect the size of either area elements in a split, whereas previously only the first area element could be explicitly sized.

Users can accomplish this by providing SplitFixedFromEnd or SpltPercentFromEnd options to containers, mirroring the existing SplitFixed and SplitPercent.

A list of changes involved in this PR include:

  • Adding a new boolean container option splitReversed to indicate when the alternative area should be targeted with an explicit size. By default, this is false, retaining existing behavior.
  • Adds public container option functions SplitFixedFromEnd and SplitPercentFromEnd.
  • For fixed split math, adds private module functions HSplitReversed and VSplitReversed to mirror HSplit and VSplit. Common logic for these functions is isolated to private hSplit and vSplit functions used respectively. Added similar functions for percentage variants.
  • Added tests.
  • Fixed some test and documentation verbiage.

Fixes #292

mum4k and others added 2 commits January 29, 2024 15:18
Releasing Termdash v0.19.0.

## Added

- Support for "Backtab" (a.k.a. Shift+Tab) as a supported keystroke for tcell
  widgets.

## Changed

- Migrated CI from Travis to Github Actions.
- Bump github.com/gdamore/tcell/v2 from 2.5.4 to 2.7.0.
- Change the Go version in `go.mod` to 1.21.
- Executed `go mod tidy`.
- CI now executes tests with Golang v1.20 and v1.21.
@spacez320 spacez320 changed the title WIP Allow reverse horizontal area splits WIP Add SplitFixedFromEnd option to allow second element splits Mar 5, 2024
@mum4k mum4k changed the base branch from master to devel March 6, 2024 16:08
private/area/area.go Outdated Show resolved Hide resolved
@spacez320 spacez320 force-pushed the 292-allow-splitfixed-to-set-the-size-of-the-second-container branch from 7b0b370 to ec14443 Compare March 8, 2024 00:31
@spacez320 spacez320 marked this pull request as ready for review March 8, 2024 18:20
@spacez320 spacez320 requested a review from mum4k March 8, 2024 18:22
@spacez320 spacez320 changed the title WIP Add SplitFixedFromEnd option to allow second element splits Allow alternative area explicit sizing in splits Mar 8, 2024
Copy link
Owner

@mum4k mum4k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you again for the contribution @spacez320. Appreciate the included test coverage and the fixess to existing docs.

@mum4k mum4k merged commit ce0dd0b into mum4k:devel Mar 10, 2024
4 checks passed
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