Skip to content

Commit

Permalink
this is wiser, I guess
Browse files Browse the repository at this point in the history
  • Loading branch information
kosloot committed Feb 17, 2023
1 parent fce666a commit ce1a29f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/folia_impl.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1919,8 +1919,7 @@ namespace folia {
}
UnicodeString result;
bool pendingspace = false;
bool trim_spaces = !tp.is_set( TEXT_FLAGS::NO_TRIM_SPACES)
&& !tp.is_set( TEXT_FLAGS::ADD_FORMATTING );
bool trim_spaces = !tp.is_set( TEXT_FLAGS::NO_TRIM_SPACES);
for ( const auto& d : _data ){
if (d->isinstance( XmlText_t)) {
// 'true' text child
Expand Down
8 changes: 6 additions & 2 deletions src/folia_subclasses.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2977,7 +2977,9 @@ namespace folia {
*/
UnicodeString result = " ";
if ( tp.is_set( TEXT_FLAGS::ADD_FORMATTING ) ){
result = AbstractElement::private_text( tp );
TextPolicy tmp(tp);
tmp.set( TEXT_FLAGS::NO_TRIM_SPACES );
result = AbstractElement::private_text( tmp );
if ( result.isEmpty() ){
result = " ";
}
Expand All @@ -2994,7 +2996,9 @@ namespace folia {
*/
UnicodeString result;
if ( tp.is_set( TEXT_FLAGS::ADD_FORMATTING ) ){
result = AbstractElement::private_text( tp );
TextPolicy tmp(tp);
tmp.set( TEXT_FLAGS::NO_TRIM_SPACES );
result = AbstractElement::private_text( tmp );
if ( result.isEmpty() ){
result = "-";
}
Expand Down

0 comments on commit ce1a29f

Please sign in to comment.