Browse Source

Fix an off-by-one error introduced in #190 breaking the databinding sample

Michael Ragazzon 4 years ago
parent
commit
a33b379b71
2 changed files with 2 additions and 1 deletions
  1. 1 1
      Source/Core/DataViewDefault.cpp
  2. 1 0
      Tests/Source/UnitTests/DataBinding.cpp

+ 1 - 1
Source/Core/DataViewDefault.cpp

@@ -354,7 +354,7 @@ bool DataViewText::Initialize(DataModel& model, Element* element, const String&
 		{
 		{
 			DataEntry entry;
 			DataEntry entry;
 			entry.index = text.size();
 			entry.index = text.size();
-			entry.data_expression = MakeUnique<DataExpression>(String(in_text.begin() + begin_brackets + 1, in_text.begin() + cur - 2));
+			entry.data_expression = MakeUnique<DataExpression>(String(in_text.begin() + begin_brackets + 1, in_text.begin() + cur - 1));
 
 
 			if (entry.data_expression->Parse(expression_interface, false))
 			if (entry.data_expression->Parse(expression_interface, false))
 				data_entries.push_back(std::move(entry));
 				data_entries.push_back(std::move(entry));

+ 1 - 0
Tests/Source/UnitTests/DataBinding.cpp

@@ -141,6 +141,7 @@ static const String inside_string_rml = R"(
 <p>{{ 'i{}23' }}</p>
 <p>{{ 'i{}23' }}</p>
 <p>before {{ 'i{{test}}23' }} test</p>
 <p>before {{ 'i{{test}}23' }} test</p>
 <p>a {{ 'i' }} b {{ 'j' }} c</p>
 <p>a {{ 'i' }} b {{ 'j' }} c</p>
+<p>{{i0}}</p>
 
 
 </div>
 </div>
 </body>
 </body>