Support not skipping extra spaces in ui::label
This commit is contained in:
parent
460632a118
commit
e4bd58c5ef
2 changed files with 13 additions and 0 deletions
|
|
@ -58,6 +58,9 @@ namespace psemek::ui
|
|||
virtual void set_overflow(overflow_mode value);
|
||||
virtual overflow_mode overflow() const { return overflow_; }
|
||||
|
||||
virtual void set_skip_spaces(bool value);
|
||||
virtual bool skip_spaces() const { return skip_spaces_; }
|
||||
|
||||
struct shape const & shape() const override { return shape_; }
|
||||
void reshape(geom::box<float, 2> const & bbox) override;
|
||||
|
||||
|
|
@ -74,6 +77,7 @@ namespace psemek::ui
|
|||
valignment valign_ = valignment::top;
|
||||
multiline_mode multiline_ = multiline_mode::none;
|
||||
overflow_mode overflow_ = overflow_mode::ignore;
|
||||
bool skip_spaces_ = false;
|
||||
|
||||
box_shape shape_;
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,12 @@ namespace psemek::ui
|
|||
on_state_changed();
|
||||
}
|
||||
|
||||
void label::set_skip_spaces(bool value)
|
||||
{
|
||||
skip_spaces_ = value;
|
||||
on_state_changed();
|
||||
}
|
||||
|
||||
void label::set_overflow(overflow_mode value)
|
||||
{
|
||||
overflow_ = value;
|
||||
|
|
@ -132,6 +138,9 @@ namespace psemek::ui
|
|||
for (std::size_t line = 0; line < max_lines; ++line)
|
||||
{
|
||||
if (line != 0)
|
||||
++current_glyph;
|
||||
|
||||
if (skip_spaces_)
|
||||
{
|
||||
while (current_glyph < glyphs.size() && std::isspace(glyphs[current_glyph].character))
|
||||
++current_glyph;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue