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

Half-page scroll actions #813

Merged
merged 29 commits into from
Nov 8, 2021
Merged

Half-page scroll actions #813

merged 29 commits into from
Nov 8, 2021

Conversation

oromate
Copy link
Contributor

@oromate oromate commented Oct 28, 2021

I managed to make it this far. I think there is still a lack of documentation and tests, what do you think? I basically replicated the page scroll code and did the division by two, so maybe it would be nice to avoid code duplication. #794

@oromate oromate changed the title Half-page scroll actions #794 Half-page scroll actions Oct 29, 2021
* fix(performance): do not hang when resizing large line wraps

* style(fmt): make rustfmt happy

* style(clippy): make clippy happy
* fix(compatibility): handle home/end keys properly from terminfo

* style(fmt): make rustfmt happy

* style(fmt): remove unused import
.get_mut(&PaneId::Terminal(active_terminal_id))
.unwrap();
// prevent overflow when row == 0
let scroll_columns = (active_terminal.rows().max(1) - 1)/2;

Choose a reason for hiding this comment

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

Should be scroll_rows, right?

Copy link
Member

Choose a reason for hiding this comment

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

Yes! But to be fair this is also a mistake in the other methods this was copied from. If you'd like to fix this @oromate that would be cool.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can fix this. Do you think it makes sense for me to also correct the variable name in the other method?

Copy link
Member

Choose a reason for hiding this comment

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

That would be great, thanks! There are a few of those.

imsnif and others added 21 commits October 30, 2021 10:56
* Behaves like the `Write` action, but one can specify
  strings themselves instead of their bytecodes.

  Usage:

  WriteChars: "cargo make test",
* specifies the minimum version the package can be compiled with,
  may be ignored with `--ignore-rust-version` option

  ref: https://doc.rust-lang.org/nightly/cargo/reference/manifest.html#the-rust-version-field
* fix(unix): forkpty => openpty

* style(fmt): make rustfmt happy
* `colors_transform` is deprecated and superceded by `colorsys`

  ref: https://crates.io/crates/colors-transform
Copy link
Member

@imsnif imsnif left a comment

Choose a reason for hiding this comment

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

Hey @oromate - thank you for your patience and apologies it took me a few days to get to this.

All in all this looks great. There's the issue with the variable name mistake in the code comments if you feel like fixing it there and in the other methods, but no biggie all in all.

Aside from that, the CI tells us this needs to be formatted. You can do that with rustfmt (I run cargo fmt you can see more details in our CONTRIBUTING doc), and the e2e tests.

The e2e tests are failing because the controls line changed for Scroll mode and they're comparing it against the previous snapshot and finding a difference. We use cargo insta to compare snapshots (https://insta.rs/docs/cli/). You can update the snapshots with their CLI tool once you've run the tests and then commit them to this branch.

Once that is done, I'd be happy to merge this. Please let me know if anything is unclear! I'll try to be quicker on the uptake with the changes.

.get_mut(&PaneId::Terminal(active_terminal_id))
.unwrap();
// prevent overflow when row == 0
let scroll_columns = (active_terminal.rows().max(1) - 1)/2;
Copy link
Member

Choose a reason for hiding this comment

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

Yes! But to be fair this is also a mistake in the other methods this was copied from. If you'd like to fix this @oromate that would be cool.

@oromate
Copy link
Contributor Author

oromate commented Nov 6, 2021

I believe I managed to resolve the reviews. I hope everything works out.

Taking the opportunity to share a little of the journey:

  • I needed to change the version of docker-compose.yml to 3.3 because of an error with the volume type
  • I needed to install the "musl-tools" dependency
  • The command to update the snapshots is "cargo insta review --workspace-root src/tests/". As I didn't know that, it could be nice to leave notes to let the next ones know :)

@imsnif
Copy link
Member

imsnif commented Nov 8, 2021

Hey @oromate - thanks for the fixes! I went ahead and ran cargo fmt on the code because the CI was still red and I didn't want to do another round just for that :)

Thanks for your observations with docker-compose! Would you like to maybe format them a little and add them to CONTRIBUTING.md? They have the best chance of being seen there.

Thanks for your contribution!

@imsnif imsnif merged commit 8f06f11 into zellij-org:main Nov 8, 2021
@oromate oromate deleted the half-page-scroll branch November 9, 2021 14:21
This pull request was closed.
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.

7 participants