18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-01 11:47:06 +01:00

Merge branch 'ui/editor-lay-flow' into feat/editor-turnout-catalogue

This commit is contained in:
maj00r
2026-11-29 22:37:12 +01:00
8 changed files with 74 additions and 22 deletions
+17 -13
View File
@@ -209,13 +209,16 @@ class record
fail(std::format("'{}' isn't a profile of the norms", text));
return norms::profile_id::plk;
}
// the rest of the line as it is written, the blanks between the words kept as one
// the rest of the line as it is written, from its next word to its last, the blanks between the words as they are: joined with one
// blank, a reason of two blanks came back changed after a save and a load
std::string rest()
{
std::string result;
for (; false == done(); ++m_at)
result += (result.empty() ? "" : " ") + std::string{m_words[m_at]};
return result;
if (done())
return {};
auto const first{m_words[m_at]};
auto const last{m_words.back()};
m_at = m_words.size();
return std::string(first.data(), static_cast<std::size_t>(last.data() + last.size() - first.data()));
}
void finish()
{
@@ -458,6 +461,15 @@ read_result read(std::string_view const Text)
continue;
}
record words{text};
// the section kept for the anchors is written back as it was read, its blank lines and its comments too
if (in == section::anchors)
{
if (words.peek() == "end" && words_of(text).size() == 1)
in = section::top;
else
project.anchors.emplace_back(text);
continue;
}
if (words.empty() || words.peek().front() == '#')
continue;
if (false == versioned)
@@ -481,14 +493,6 @@ read_result read(std::string_view const Text)
continue;
}
auto const keyword{words.peek()};
if (in == section::anchors)
{
if (keyword == "end" && words_of(text).size() == 1)
in = section::top;
else
project.anchors.emplace_back(text);
continue;
}
words.next("");
if (in == section::turnouts)
{