mirror of https://github.com/adamdruppe/arsd.git
Fix known bug with line-folding keys or sections
This commit is contained in:
parent
c9198a4e79
commit
433593db48
13
ini.d
13
ini.d
|
|
@ -993,14 +993,12 @@ struct IniParser(
|
||||||
|
|
||||||
case '\r':
|
case '\r':
|
||||||
const idxAfterNext = idxNext + 1;
|
const idxAfterNext = idxNext + 1;
|
||||||
|
|
||||||
// CRLF?
|
// CRLF?
|
||||||
if (idxAfterNext < _source.length) {
|
if (idxAfterNext < _source.length) {
|
||||||
if (_source[idxAfterNext] == '\n') {
|
if (_source[idxAfterNext] == '\n') {
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
@ -1014,7 +1012,7 @@ struct IniParser(
|
||||||
if (foldingCount > 0) {
|
if (foldingCount > 0) {
|
||||||
static if (operatingMode!string == OperatingMode.nonDestructive) {
|
static if (operatingMode!string == OperatingMode.nonDestructive) {
|
||||||
idx += (foldingCount - 1);
|
idx += (foldingCount - 1);
|
||||||
idxLastText = idx;
|
idxCutoff = idx;
|
||||||
}
|
}
|
||||||
static if (operatingMode!string == OperatingMode.destructive) {
|
static if (operatingMode!string == OperatingMode.destructive) {
|
||||||
_source.splice(idx, foldingCount);
|
_source.splice(idx, foldingCount);
|
||||||
|
|
@ -1073,7 +1071,7 @@ struct IniParser(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const idxNextToken = (idxCutoff >= 0) ? idxCutoff : idxEOT;
|
const idxNextToken = (idxCutoff >= idxLastText) ? idxCutoff : idxEOT;
|
||||||
_source = _source[idxNextToken .. $];
|
_source = _source[idxNextToken .. $];
|
||||||
|
|
||||||
if (inQuotedString != QuotedString.none) {
|
if (inQuotedString != QuotedString.none) {
|
||||||
|
|
@ -1946,12 +1944,7 @@ key \= = value
|
||||||
{
|
{
|
||||||
parser.popFront();
|
parser.popFront();
|
||||||
assert(!parser.empty);
|
assert(!parser.empty);
|
||||||
// FIXME: Line folding does not interact properly with keys.
|
assert(parser.front.data == "key");
|
||||||
version (none) {
|
|
||||||
assert(parser.front.data == "key");
|
|
||||||
} else {
|
|
||||||
assert(parser.front.data == "key "); // bug
|
|
||||||
}
|
|
||||||
|
|
||||||
parser.popFront();
|
parser.popFront();
|
||||||
assert(!parser.empty);
|
assert(!parser.empty);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue