mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-04 06:07:29 +01:00
Syncron-Edit: Improved cell selection, go to next different cell via tab / Handle Mouse correctly, if Mouse up and other actions are assigned to gutter
git-svn-id: trunk@21211 -
This commit is contained in:
parent
cc05f18a30
commit
86a763c003
@ -1221,7 +1221,7 @@ begin
|
||||
(AnInfo.MouseY >= r.Top) and (AnInfo.MouseY < r.Bottom);
|
||||
|
||||
if Result then
|
||||
Result := HandleActionProc(FMouseActions, AnInfo);
|
||||
HandleActionProc(FMouseActions, AnInfo);
|
||||
end;
|
||||
|
||||
function TSynPluginSyncroEdit.DoHandleMouseAction(AnAction: TSynEditMouseAction;
|
||||
@ -1336,10 +1336,10 @@ begin
|
||||
|
||||
Handled := True;
|
||||
case Cmd of
|
||||
ecSynPSyncroEdNextCell: NextCell(False);
|
||||
ecSynPSyncroEdNextCellSel: NextCell(True);
|
||||
ecSynPSyncroEdPrevCell: PreviousCell(False);
|
||||
ecSynPSyncroEdPrevCellSel: PreviousCell(True);
|
||||
ecSynPSyncroEdNextCell: NextCell(False, True);
|
||||
ecSynPSyncroEdNextCellSel: NextCell(True, True);
|
||||
ecSynPSyncroEdPrevCell: PreviousCell(False, True);
|
||||
ecSynPSyncroEdPrevCellSel: PreviousCell(True, True);
|
||||
ecSynPSyncroEdCellHome: CellCaretHome;
|
||||
ecSynPSyncroEdCellEnd: CellCaretEnd;
|
||||
ecSynPSyncroEdCellSelect: SelectCurrentCell;
|
||||
|
||||
@ -214,8 +214,8 @@ type
|
||||
property LastCell: Integer read FLastCell;
|
||||
protected
|
||||
procedure SelectCurrentCell(Reverse: Boolean = False);
|
||||
procedure PreviousCell(SetSelect: Boolean = True);
|
||||
procedure NextCell(SetSelect: Boolean = True);
|
||||
procedure PreviousCell(SetSelect: Boolean = True; SkipSameIndex: Boolean = False);
|
||||
procedure NextCell(SetSelect: Boolean = True; SkipSameIndex: Boolean = False);
|
||||
procedure CellCaretHome;
|
||||
procedure CellCaretEnd;
|
||||
public
|
||||
@ -1057,20 +1057,23 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TSynPluginCustomSyncroEdit.PreviousCell(SetSelect: Boolean);
|
||||
procedure TSynPluginCustomSyncroEdit.PreviousCell(SetSelect: Boolean; SkipSameIndex: Boolean = False);
|
||||
var
|
||||
i, j: Integer;
|
||||
i, j, x: Integer;
|
||||
Pos: TPoint;
|
||||
begin
|
||||
Pos := CaretObj.LineBytePos;
|
||||
i := Cells.IndexOf(Pos.x, Pos.y, True);
|
||||
if i < 0 then begin
|
||||
x := -1;
|
||||
i := 0;
|
||||
while (i < Cells.Count) and
|
||||
((Cells[i].Group < 0) or (CompareCarets(Cells[i].LogEnd, Pos) >= 0))
|
||||
do
|
||||
inc(i);
|
||||
end;
|
||||
end
|
||||
else
|
||||
x := Cells[i].Group;
|
||||
|
||||
j := 0;
|
||||
Repeat
|
||||
@ -1078,7 +1081,9 @@ begin
|
||||
inc(j);
|
||||
if i < 0 then
|
||||
i := Cells.Count - 1;
|
||||
until (j > Cells.Count) or (Cells[i].Group >= 0);
|
||||
until (j > Cells.Count) or
|
||||
((Cells[i].Group >= 0) and
|
||||
((not SkipSameIndex) or (Cells[i].Group <> x)) );
|
||||
CurrentCell := i;
|
||||
|
||||
if CurrentCell < 0 then
|
||||
@ -1090,20 +1095,24 @@ begin
|
||||
Editor.BlockBegin := Cells[CurrentCell].LogEnd;
|
||||
end;
|
||||
|
||||
procedure TSynPluginCustomSyncroEdit.NextCell(SetSelect: Boolean);
|
||||
procedure TSynPluginCustomSyncroEdit.NextCell(SetSelect: Boolean; SkipSameIndex: Boolean = False);
|
||||
var
|
||||
Pos: TPoint;
|
||||
i, j: Integer;
|
||||
i, j, x: Integer;
|
||||
begin
|
||||
Pos := CaretObj.LineBytePos;
|
||||
i := Cells.IndexOf(Pos.x, Pos.y, True);
|
||||
if i < 0 then begin
|
||||
x := -1;
|
||||
i := Cells.Count - 1;
|
||||
while (i >= 0) and
|
||||
((Cells[i].Group < 0) or (CompareCarets(Cells[i].LogEnd, Pos) <= 0))
|
||||
do
|
||||
dec(i);
|
||||
end;
|
||||
end
|
||||
else
|
||||
x := Cells[i].Group;
|
||||
|
||||
|
||||
j := 0;
|
||||
Repeat
|
||||
@ -1111,7 +1120,9 @@ begin
|
||||
inc(j);
|
||||
if i >= Cells.Count then
|
||||
i := 0
|
||||
until (j > Cells.Count) or (Cells[i].Group >= 0);
|
||||
until (j > Cells.Count) or
|
||||
((Cells[i].Group >= 0) and
|
||||
((not SkipSameIndex) or (Cells[i].Group <> x)) );
|
||||
CurrentCell := i;
|
||||
if CurrentCell < 0 then
|
||||
exit;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user