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

x/mobile: ivy example does not preserve indentation in output text #48693

Closed
robpike opened this issue Sep 30, 2021 · 3 comments
Closed

x/mobile: ivy example does not preserve indentation in output text #48693

robpike opened this issue Sep 30, 2021 · 3 comments
Labels
FrozenDueToAge mobile Android, iOS, and x/mobile NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@robpike
Copy link
Contributor

robpike commented Sep 30, 2021

I have updated ivy to the newest code in my environment (see #48677) and it works fine, but the help text output has no indentation or columnation, making it much harder to understand. It looks like some part of the gomobile wrapper is collapsing all white space to a space or even, in the case of tabs, an empty string.

@gopherbot gopherbot added the mobile Android, iOS, and x/mobile label Sep 30, 2021
@gopherbot gopherbot added this to the Unreleased milestone Sep 30, 2021
@robpike robpike changed the title x/mobile: ivy example does not indent help text x/mobile: ivy example does not preserve indentation in output text Sep 30, 2021
@robpike
Copy link
Contributor Author

robpike commented Sep 30, 2021

This also messes up the layout for matrices. For instance, this is what ivy looks like on a real computer:

3 4 rho iota 12
 1  2  3  4
 5  6  7  8
 9 10 11 12

while this is what it looks like on mobile:

3 4 rho iota 12
1 2 3 4
5 6 7 8
9 10 11 12

I have updated the summary line.

@mknyszek mknyszek added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Oct 4, 2021
@mknyszek
Copy link
Contributor

mknyszek commented Oct 4, 2021

@robpike robpike self-assigned this Oct 5, 2021
robpike added a commit to robpike/ivy that referenced this issue Oct 14, 2021
Fix for golang/go#48693

The output from ivy on mobile gets passed to an HTML renderer.
There was protection for < and > but not all things. And that
protection stops me running a full HTML escaper.

So instead, we escape that stuff that empirically causes trouble,
convert spaces to non-breaking spaces so they don't collapse,
and turn tabs (which outside of user-written code only appear
at the beginning of lines) into 4 spaces for display on mobile.

Because the standard tests lazily leaned on the mobile
framework to run the tests, that laziness had to be fixed.
Now there is much cleaner separation between mobile and
the rest, and the mobile code gets more help from ivy
in the task of running scripts.

Mostly much cleaner. Not much new code, it's mostly
deleting, rearranging, and tweaking, but it's a substantial
rearrangement of the tests.
@robpike
Copy link
Contributor Author

robpike commented Oct 14, 2021

Fixed by robpike/ivy@66c48de although not yet deployed to the marketplace. Tested on iOS only.

@robpike robpike closed this as completed Oct 14, 2021
@rsc rsc unassigned robpike Jun 23, 2022
@golang golang locked and limited conversation to collaborators Jun 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge mobile Android, iOS, and x/mobile NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants