Skip to content

Commit

Permalink
Only ignore completed functions for glueing
Browse files Browse the repository at this point in the history
  • Loading branch information
JBenda committed Apr 20, 2024
1 parent ff53aa2 commit 5077085
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion inkcpp/output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ void basic_stream::append(const value& in)
if ((in.type() == value_type::glue || in.type() == value_type::func_end) && _size > 1) {
// Run backwards
size_t i = _size - 2;
int func_end_cnt = 0;
while (true) {
value& d = _data[i];

Expand All @@ -76,7 +77,11 @@ void basic_stream::append(const value& in)
// Nullify whitespace
else if (d.type() == value_type::string && ::ink::internal::is_whitespace(d.get<value_type::string>()))
d = value{};
else if (d.type() == value_type::func_start || d.type() == value_type::func_end) {}
else if (d.type() == value_type::func_end) {
func_end_cnt ++;
} else if (d.type() == value_type::func_start && func_end_cnt > 0) {
func_end_cnt --;
}

// If it's not a newline or whitespace, stop
else
Expand Down

0 comments on commit 5077085

Please sign in to comment.