question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Label trimming whitespace when height > 1

See original GitHub issue

The following code will strip the leading whitespace from the label:

Label appNameView = new Label() { X = 0, Y = 0, Height = 2, Width = Dim.Fill() };
appNameView.Text = "     how about this?";

image

Currently the WordWrap is implied based on the height of the label - not sure why…

https://github.com/migueldeicaza/gui.cs/blob/3ea9b23a27e393d148dbf99e1c3a39b463c1d7e5/Terminal.Gui/Core/TextFormatter.cs#L133

Might be useful to be able to set a property on the Label to enable/disable WordWrap.

Discovered when updating to the latest code base:

image

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
tigcommented, Jul 14, 2020

Great work @tig - now it’s looking great again 😃

No need for a wordwrap option that I can currently foresee.

Thanks so much!

Great. BTW, I tested (and fixed a bug regarding) using the Unicode non-breaking space char (/u00A0) as a way of forcing word wrap to not happen. Works great. Just do .Replace (' ', '/u00A0') to the Text.

1reaction
tigcommented, Jul 14, 2020

@daltskin I believe I fixed your issue with #785.

I did it without adding an API to turn off word wrap: I just made word wrap work correctly by not stripping whitespace (and I fixed another bug that was related).

You good with this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

vaadin - Label height increasing with white-spaces in value
Strange thing is, when a label's value contains white-spaces (space, hyphen, etc.) it increases it's height by adding empty space below the ...
Read more >
Removing white space surrounding pgfplot labels
does anyone knows how to remove the white space below the x-label and left of the y-label in pgfplots? (Not the space between...
Read more >
white-space - CSS: Cascading Style Sheets - MDN Web Docs
The white-space CSS property sets how white space inside an element is handled. ... nowrap, Collapse, Collapse, No wrap, Remove, Hang.
Read more >
white-space
The CSS white-space property controls how text is handled on the element it is applied to. Let's say you have HTML exactly like...
Read more >
Label - .NET MAUI
LineHeight property changes the line height of text that fits on a single line, and text that wraps onto multiple lines. On Android,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found