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

Fix multiline outputs only showing the first line #128

Merged
merged 2 commits into from
Dec 18, 2024

Conversation

jdholtz
Copy link
Contributor

@jdholtz jdholtz commented Dec 18, 2024

Fixes #124 and #88. Instead of just truncating on the first line, display all bytes read (minus the newline) from stdout as the result. Here's the output with this fix:
rofi-calc-fix

The only issue I found is that the history will save a separate entry for each newline (in the picture above, the history would have x=1 first and ((3 x x) + 2) = 5 below it). This may be desired to allow users to be able to select just the variable solution or just the equation. However, if this isn't desired, then I can add another patch to replace all newlines in each history entry with a semicolon, so the entry would instead be ((3 x x) + 2) = 5;x=1.

@svenstaro
Copy link
Owner

I think your suggested fix for the history would be good. It's probably better than the alternative.

This keeps each entry grouped into one line instead of splitting the
entry into multiple different entries in the history (as each entry in
the history is separated by a newline).
@jdholtz
Copy link
Contributor Author

jdholtz commented Dec 18, 2024

The other option could be to split the history on a different separator than a newline (perhaps two newlines?), which would lead to results with variable answers saving as multiple lines in the same entry.

@svenstaro
Copy link
Owner

The other option could be to split the history on a different separator than a newline (perhaps two newlines?), which would lead to results with variable answers saving as multiple lines in the same entry.

Did you try that? If it renders properly, that would be the best option I think.

@jdholtz
Copy link
Contributor Author

jdholtz commented Dec 18, 2024

Did you try that? If it renders properly, that would be the best option I think.

I have not yet. The issue is that it isn't backwards compatible, so it would mess up people's current history (putting everything currently in their history as the same entry).

@svenstaro
Copy link
Owner

That's a good point actually. Let's see whether the current approach is good enough for folks.

Copy link
Owner

@svenstaro svenstaro left a comment

Choose a reason for hiding this comment

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

This is working brilliantly, great work!

@svenstaro svenstaro merged commit 9781d4f into svenstaro:master Dec 18, 2024
2 checks passed
svenstaro added a commit that referenced this pull request Dec 18, 2024
@DeeeeLAN
Copy link

I like the idea of two separate history entries.

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.

Can't see the full answer when writing an algebraic equation
3 participants