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

Option to not strip leading (or trailing) whitespace in line-wrapped text? #86

Open
eclarkso opened this issue May 23, 2022 · 1 comment

Comments

@eclarkso
Copy link

I believe this is a feature request, but a workaround or solution would be great if one exists: an option/method to preserve leading whitespace would be desirable when markup (XML, JSON) snippets are the cell contents.

Perhaps we could have:

Format::enable_trim(bool en) { enable_trim_left(en); enable_trim_right(en) };
Format::enable_trim_left(bool);
Format::enable_trim_right(bool);
// or
enum class TrimDir{ none = 0, left = 1, right = 2, both = left | right /* remains default */};
Format::enable_trim(TrimDir);

// example usage
universal_contants.format()
  .width(50)
  .enable_trim(false);
// or
universal_contants.format()
  .width(50)
  .enable_trim(TrimDir::right); // better for JSON formatting

?

Not sure I can think of a good use case for keeping trailing whitespace... but there's probably one somewhere?

@Jokeren
Copy link

Jokeren commented Aug 10, 2022

I don't think there's any existing solution. I came across exactly the same problem. The way I dealt with it is commenting the invocation of trim_left functions.

What you proposed seems good.

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

No branches or pull requests

2 participants