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 dump_screen() to only dump the viewport #1794

Merged
merged 6 commits into from
Oct 19, 2022

Conversation

dannasman
Copy link
Contributor

@dannasman dannasman commented Oct 12, 2022

Hello!

First contribution here but to my understanding this small modification seemed to fix the issue #1520 .

@dannasman dannasman temporarily deployed to cachix October 15, 2022 13:14 Inactive
Copy link
Member

@jaeheonji jaeheonji left a comment

Choose a reason for hiding this comment

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

LGTM!

@imsnif
Copy link
Member

imsnif commented Oct 16, 2022

Wait... wouldn't this mean that the scrollback editor now will no longer work with the entire scrollback?

@jaeheonji
Copy link
Member

@imsnif

I think this PR is okay based on the intention of #1520. However, personally, it seems better to add options so that users can choose. (Default is current viewport, additionally all scrolls)

In my opinion, it seems good to merge this PR for now, and create a new PR. (Of course I'm going to make PR at the same time as Merge.)

What do you think about this?

@imsnif
Copy link
Member

imsnif commented Oct 17, 2022

@jaeheonji - I didn't have time to check - but with this PR, when we do ctrl+s + e - do we see the whole scrollback in the editor, not just the viewport? If we do then we can merge this.

I agree that the intention of the original issue is very vague and could be worded better. :)

@jaeheonji
Copy link
Member

jaeheonji commented Oct 17, 2022

@imsnif

For this PR, EditScrollbackAction can only edit the current viewport.
That is why additional option implementation will be needed immediately.

pub fn dump_active_terminal_screen(...) {
    ...
    let dump = active_pane.dump_screen(client_id) // must be able to forward additional option.
}

Perhaps, the original issue intention is to change the current viewport to output only, because dumping all scrolls is a lot of content.

Therefore, the default value should be the current viewport only, and the user should be able to select whether to output all additional scrolls.

@imsnif
Copy link
Member

imsnif commented Oct 17, 2022

@jaeheonji - thanks for checking this!

The dump scroll back feature (ctrl+s + e) should dump the whole scrollback as well - always. It's a little useless otherwise (a lot of users use it to search, for example). I think this is pretty much the only thing this action is used for. It's very important that we keep it this way.

How we do this internally is IMO less important. So if we would like to add options to this method, it's great - but I think we should add user-facing implementations of these options as part of the change, otherwise we won't know what we need exactly (i.e. this is an implementation detail of a feature that does not exist yet). Makes sense?

@jaeheonji
Copy link
Member

jaeheonji commented Oct 17, 2022

@imsnif

Yes, I totally agree with that. For example, if an option is added to this case, the user will be able to select as follows.

$ zellij action dump-screen -h
Dumps the pane to a file

USAGE:
    zellij action dump-screen <PATH>

ARGS:
    <PATH>

OPTIONS:
    -h, --help    Print help information
    -f, --full    Dump the pane with scrollback

@imsnif
Copy link
Member

imsnif commented Oct 17, 2022

Yes, exactly @jaeheonji ! Thanks for understanding. Sorry for coming in like this - I just didn't want to break this feature :)

@imsnif
Copy link
Member

imsnif commented Oct 17, 2022

So @jaeheonji - I think the best thing here would be to implement this as an option and keep the current default - while adding the CLI flag like you mentioned?

@jaeheonji
Copy link
Member

@imsnif

Yes, exactly @jaeheonji ! Thanks for understanding. Sorry for coming in like this - I just didn't want to break this feature :)

You don't have to be sorry. I understand you. :)

I think the best thing here would be to implement this as an option and keep the current default - while adding the CLI flag like you mentioned?

Yes, that’s right.

@jaeheonji
Copy link
Member

jaeheonji commented Oct 17, 2022

Hey, @dannasman! We need some additional implementations to go ahead with this PR.

Before I do this, I first ask you a question about whether you want to implement it. If you want to implement it, I will help you. What do you think?

@dannasman
Copy link
Contributor Author

Hi!

I would be happy to implement it.

@jaeheonji
Copy link
Member

Cool! Thank you :)
If you have any questions, please leave a comment!

@dannasman
Copy link
Contributor Author

Hello!

Here is a proposed solution for the additional improvements.

@dannasman dannasman temporarily deployed to cachix October 18, 2022 11:25 Inactive
Copy link
Member

@jaeheonji jaeheonji 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! Almost done!

I have one request. If possible, can the default output of the DumpScreen be only the viewport?

Of course, in this case, modifications would be necessary to keep the default value of other Actions referencing DumpScreen (eg EditScrollBack) to full scroll.

zellij-utils/src/cli.rs Outdated Show resolved Hide resolved
@dannasman dannasman temporarily deployed to cachix October 19, 2022 13:08 Inactive
Copy link
Member

@jaeheonji jaeheonji left a comment

Choose a reason for hiding this comment

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

Cool! It works well 👍

@jaeheonji jaeheonji merged commit 2e70a4c into zellij-org:main Oct 19, 2022
@dannasman dannasman deleted the action_to_only_dump_viewport branch October 19, 2022 19:11
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.

3 participants