You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Word at cursor should return word even cursor is just behind the word. Current behavior:
|word - true
wo|rd - true
word| - false
I suggest to make modification of this behavior
Unit Synedit.PAS
function TCustomSynEdit.GetWordAtRowCol(XY: TBufferCoord): string;
var
Line: string;
Len, Start, Stop: Integer;
begin
Result := '';
if (XY.Line >= 1) and (XY.Line <= Lines.Count) then
begin
Line := Lines[XY.Line - 1];
Len := Length(Line);
{ Len + 1 is for case when word is the last word and cursor is behind it }
if (Len > 0) and
((XY.Char >= 1) and (XY.Char <= Len + 1)) and
(IsIdentChar(Line[XY.Char]) or IsIdentChar(Line[XY.Char-1])) then //Fiala
begin
if IsIdentChar(Line[XY.Char]) then //Fiala
Start := XY.Char
else
Start := XY.Char - 1;
while (Start > 1) and IsIdentChar(Line[Start - 1]) do
Dec(Start);
Stop := XY.Char; //Fiala
while (Stop <= Len + 1) and IsIdentChar(Line[Stop]) do
Inc(Stop);
Result := Copy(Line, Start, Stop - Start);
end;
end;
end;
The text was updated successfully, but these errors were encountered:
JaFi-cz
changed the title
Word at cursor - proposal
Synedit - Word at cursor - proposal
May 7, 2021
functionTCustomSynEdit.GetWordAtRowCol(XY: TBufferCoord): string;
var
Line: string;
Len, Start, Stop: Integer;
begin
Result := '';
if (XY.Line >= 1) and (XY.Line <= Lines.Count) thenbegin
Line := Lines[XY.Line - 1];
Len := Length(Line);
if (Len > 0) and InRange(XY.Char, 1, Len + 1) thenbegin
Start := XY.Char;
while (Start > 1) and IsIdentChar(Line[Start - 1]) do
Dec(Start);
Stop := XY.Char;
while (Stop <= Len) and IsIdentChar(Line[Stop]) do
Inc(Stop);
Result := Copy(Line, Start, Stop - Start);
end;
end;
end;
Word at cursor should return word even cursor is just behind the word. Current behavior:
|word - true
wo|rd - true
word| - false
I suggest to make modification of this behavior
Unit Synedit.PAS
The text was updated successfully, but these errors were encountered: