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

panic if wrapped log line exceeds pager size #15

Open
KonstantinGasser opened this issue May 4, 2023 · 0 comments
Open

panic if wrapped log line exceeds pager size #15

KonstantinGasser opened this issue May 4, 2023 · 0 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@KonstantinGasser
Copy link
Owner

KonstantinGasser commented May 4, 2023

Say out pager's buffer has a size of 10 and a width of 5 chars we are able to store 10 lines each 5 chars long (not 10 items as an item's data might take up more then one line) and display these 10 lines in the pager.

Now a log is streams which is a single line with > 10*5 chars scotty panics when writing the lines into the buffer since it writes more then 10 lines into the [10]string array.

What should happen?
Since the log line wrapped will not fit into the current view and we cannot stop writing the wrapped lines once the buffer is full we need to cut of the beginning of the wrapped line.

Example:
pager: size: 4 width 2
-> each of the 4 lines can hold 2 chars

input -> 0123456789
wrapped -> 01 | 23 | 45 | 67 | 90 -> wrapping the input based on the width 2 results in 5 lines

buffer should at the end look like so: [23, 45, 67, 89] notice that the one line which is too much is cut-off at the beginning.

Another approach could be to limit the numbers of wrapped lines to N and if len(lines) > N show up to N lines with an indication that the further lines have been truncated. This could also be an solution since the complete log line can be view in browsing mode.

@KonstantinGasser KonstantinGasser added bug Something isn't working enhancement New feature or request labels May 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant