mirror of https://gitlab.com/basile.b/dexed.git
dastworx, todo list fixes
* fix special char literals for pascal strings not verified when the text doesn't contain a single quote. * fix len limit not applied correctly * fix single quote after special char put unconditionally * prevent loading when deserialization fail
This commit is contained in:
parent
dfac54d407
commit
94c2b5a713
|
@ -197,10 +197,14 @@ string patchPascalString(size_t lenLimit = 0)(string value)
|
|||
{
|
||||
bool needed;
|
||||
foreach(i; 0 .. value.length)
|
||||
if (value[i] == '\'')
|
||||
switch (value[i])
|
||||
{
|
||||
needed = true;
|
||||
break;
|
||||
case '\'' :
|
||||
case '\r' :
|
||||
case '\n' :
|
||||
needed = true;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
if (!needed)
|
||||
return value;
|
||||
|
@ -212,7 +216,7 @@ string patchPascalString(size_t lenLimit = 0)(string value)
|
|||
const size_t len = value.length;
|
||||
app.reserve(len);
|
||||
bool skip;
|
||||
L: foreach (immutable i; 0..value.length)
|
||||
L: foreach (immutable i; 0..len)
|
||||
{
|
||||
const char c = value[i];
|
||||
switch (c)
|
||||
|
@ -228,7 +232,9 @@ string patchPascalString(size_t lenLimit = 0)(string value)
|
|||
if (skip)
|
||||
app ~= value[i];
|
||||
else
|
||||
app ~= "'#39'";
|
||||
app ~= "'#39";
|
||||
if (i != len-1)
|
||||
app ~= "'";
|
||||
skip = false;
|
||||
break;
|
||||
}
|
||||
|
@ -237,7 +243,9 @@ string patchPascalString(size_t lenLimit = 0)(string value)
|
|||
if (skip)
|
||||
app ~= value[i];
|
||||
else
|
||||
app ~= "'#10'";
|
||||
app ~= "'#10";
|
||||
if (i != len-1)
|
||||
app ~= "'";
|
||||
skip = false;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -491,7 +491,12 @@ end;
|
|||
procedure TTodoListWidget.toolTerminated(Sender: TObject);
|
||||
begin
|
||||
fToolProc.StdoutEx.Position := 0;
|
||||
fTodos.loadFromTxtStream(fToolProc.StdoutEx);
|
||||
try
|
||||
fTodos.loadFromTxtStream(fToolProc.StdoutEx);
|
||||
except
|
||||
fToolProc.OnTerminate := nil;
|
||||
exit;
|
||||
end;
|
||||
fillTodoList;
|
||||
fToolProc.OnTerminate := nil;
|
||||
end;
|
||||
|
|
Loading…
Reference in New Issue