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

'attempt to subtract with overflow' when pressing enter in response view #15

Closed
BdN3504 opened this issue Apr 16, 2024 · 4 comments · Fixed by #29
Closed

'attempt to subtract with overflow' when pressing enter in response view #15

BdN3504 opened this issue Apr 16, 2024 · 4 comments · Fixed by #29
Assignees
Labels
enhancement New feature or request good first contribution Good for newcomers

Comments

@BdN3504
Copy link

BdN3504 commented Apr 16, 2024

https://github.com/Julien-cpsn/ATAC/blob/main/src/app/ui/param_tabs/headers_tab.rs#L117 throws 'attempt to subtract with overflow' when pressing enter in the response body view, avoid this by using wrapping_sub:

let text_input = Paragraph::new(format!("{:fill$}", header_text, fill = cell_width.wrapping_sub(horizontal_margin) as usize));

@Julien-cpsn
Copy link
Owner

Thanks for your feedback!
Is it solved by #18 ?

@Julien-cpsn Julien-cpsn self-assigned this Apr 16, 2024
@BdN3504
Copy link
Author

BdN3504 commented Apr 16, 2024

Does not seem to be solved by #18 , still getting

Thread 'main' panicked at src/app/ui/param_tabs/headers_tab.rs:117:41:
attempt to subtract with overflow

@BdN3504
Copy link
Author

BdN3504 commented Apr 16, 2024

You also have a typo here, it should be called cell_width instead of cell_with.

https://github.com/Julien-cpsn/ATAC/pull/18/files#diff-f38ad632f6b9a4d059e3dff29ae6525bd3f0808f2c65f8c2a0ac34c5a6ce2982R95

From a UX standpoint it's also questionable why this error is thrown in the first place. I now understand what's happening a bit better, but it's weird that this is possible.

When you cycle views and you are viewing the response tab in full screen, pressing 'tab' should not switch menu items for the request tab in the background, because you don't see it. If the response tab is in full screen, pressing 'tab' should cycle through the menu items in the response tab. The way it is right now, you have to press shift+tab to cycle the response tab items, that's pretty counter-intuitive when that tab is in full screen.

See the attached video, and notice how the menu items on the bottom right change when being in full screen mode, but the tab remains the same:
Screencast from 2024-04-16 23-34-32.webm

@Julien-cpsn
Copy link
Owner

You also have a typo here, it should be called cell_width instead of cell_with.

https://github.com/Julien-cpsn/ATAC/pull/18/files#diff-f38ad632f6b9a4d059e3dff29ae6525bd3f0808f2c65f8c2a0ac34c5a6ce2982R95

Thanks for that one, I'll correct it.

From a UX standpoint it's also questionable why this error is thrown in the first place. I now understand what's happening a bit better, but it's weird that this is possible.

I'll check that

When you cycle views and you are viewing the response tab in full screen, pressing 'tab' should not switch menu items for the request tab in the background, because you don't see it. If the response tab is in full screen, pressing 'tab' should cycle through the menu items in the response tab. The way it is right now, you have to press shift+tab to cycle the response tab items, that's pretty counter-intuitive when that tab is in full screen.

See the attached video, and notice how the menu items on the bottom right change when being in full screen mode, but the tab remains the same: Screencast from 2024-04-16 23-34-32.webm

You are totally right, I did not event think of that. I will also give it a look
Thanks for your feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first contribution Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants