mirror of https://gitlab.com/basile.b/dexed.git
fix #294 - Plus or Asterisk inserted just before a DDOC comment due to usage of SelStart
This commit is contained in:
parent
23fb44a6e4
commit
14fad39190
|
@ -152,6 +152,9 @@ procedure getImports(list: TLexTokenList; imports: TStrings);
|
||||||
* Compares two TPoints.
|
* Compares two TPoints.
|
||||||
*)
|
*)
|
||||||
operator = (lhs: TPoint; rhs: TPoint): boolean;
|
operator = (lhs: TPoint; rhs: TPoint): boolean;
|
||||||
|
operator > (lhs: TPoint; rhs: TPoint): boolean;
|
||||||
|
operator < (lhs: TPoint; rhs: TPoint): boolean;
|
||||||
|
operator <= (lhs: TPoint; rhs: TPoint): boolean;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
@ -161,6 +164,21 @@ begin
|
||||||
exit((lhs.y = rhs.y) and (lhs.x = rhs.x));
|
exit((lhs.y = rhs.y) and (lhs.x = rhs.x));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
operator > (lhs: TPoint; rhs: TPoint): boolean;
|
||||||
|
begin
|
||||||
|
exit((lhs.y > rhs.y) or ((lhs.y = rhs.y) and (lhs.x > rhs.x)));
|
||||||
|
end;
|
||||||
|
|
||||||
|
operator < (lhs: TPoint; rhs: TPoint): boolean;
|
||||||
|
begin
|
||||||
|
exit(rhs > lhs);
|
||||||
|
end;
|
||||||
|
|
||||||
|
operator <= (lhs: TPoint; rhs: TPoint): boolean;
|
||||||
|
begin
|
||||||
|
exit((lhs = rhs) or (lhs < rhs));
|
||||||
|
end;
|
||||||
|
|
||||||
constructor TReaderHead.Create(const text: PChar; const colAndLine: TPoint);
|
constructor TReaderHead.Create(const text: PChar; const colAndLine: TPoint);
|
||||||
begin
|
begin
|
||||||
setReader(text, colAndLine);
|
setReader(text, colAndLine);
|
||||||
|
|
|
@ -2857,21 +2857,23 @@ end;
|
||||||
function TCESynMemo.lexInDdoc: char;
|
function TCESynMemo.lexInDdoc: char;
|
||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
p: integer;
|
p: TPoint;
|
||||||
tk1: PLexToken = nil;
|
tk1: PLexToken = nil;
|
||||||
tk2: PLexToken = nil;
|
tk2: PLexToken = nil;
|
||||||
r: TStringRange = (ptr:nil; pos:0; len: 0);
|
r: TStringRange = (ptr:nil; pos:0; len: 0);
|
||||||
begin
|
begin
|
||||||
|
// note: never use SelStart here. SelStart is updated too early
|
||||||
|
// and matches to the future position, e.g the one after auto-indentation.
|
||||||
result := #0;
|
result := #0;
|
||||||
p := SelStart;
|
p := CaretXY;
|
||||||
for i := 0 to fLexToks.Count-1 do
|
for i := 0 to fLexToks.Count-1 do
|
||||||
begin
|
begin
|
||||||
tk1 := fLexToks[i];
|
tk1 := fLexToks[i];
|
||||||
if (i <> fLexToks.Count-1) then
|
if (i <> fLexToks.Count-1) then
|
||||||
begin
|
begin
|
||||||
tk2 := fLexToks[i+1];
|
tk2 := fLexToks[i+1];
|
||||||
if (tk1^.offset < p) and (tk1^.kind in [ltkComment, ltkIllegal])
|
if (tk1^.position < p) and (tk1^.kind in [ltkComment, ltkIllegal])
|
||||||
and (tk1^.Data[1] in ['*','+']) and (tk2^.offset > p) then
|
and (p <= tk2^.position) and (tk1^.Data[1] in ['*','+']) then
|
||||||
begin
|
begin
|
||||||
r.init(tk1^.Data);
|
r.init(tk1^.Data);
|
||||||
r.popUntil(#10)^.popFront;
|
r.popUntil(#10)^.popFront;
|
||||||
|
@ -2886,10 +2888,10 @@ begin
|
||||||
end
|
end
|
||||||
else exit(tk1^.Data[1])
|
else exit(tk1^.Data[1])
|
||||||
end
|
end
|
||||||
else if (tk1^.offset > p) then
|
else if (tk1^.position > p) then
|
||||||
exit;
|
exit;
|
||||||
end
|
end
|
||||||
else if (tk1^.offset < p) and (tk1^.kind in [ltkComment, ltkIllegal])
|
else if (tk1^.position < p) and (tk1^.kind in [ltkComment, ltkIllegal])
|
||||||
and (tk1^.Data[1] in ['*','+']) then
|
and (tk1^.Data[1] in ['*','+']) then
|
||||||
exit(tk1^.Data[1]);
|
exit(tk1^.Data[1]);
|
||||||
end;
|
end;
|
||||||
|
|
Loading…
Reference in New Issue