SynEdit: fixed (un-)indent selection in linemode (select via gutter). Issue #0029591

git-svn-id: trunk@51578 -
This commit is contained in:
martin 2016-02-10 16:54:05 +00:00
parent fef0aed03e
commit a564fde4c8
2 changed files with 13 additions and 6 deletions

View File

@ -8172,9 +8172,9 @@ begin
end else begin
BB := BlockBegin;
BE := BlockEnd;
if (BE.X = 1)
then e := BE.y - 1
else e := BE.y;
if FBlockSelection.LastLineHasSelection
then e := BE.y
else e := BE.y - 1;
end;
Spaces := StringOfChar(#32, FBlockIndent);
@ -8237,10 +8237,10 @@ begin
BB := BlockBegin;
BE := BlockEnd;
// convert selection to complete lines
if BE.X = 1 then
e := BE.y - 1
if FBlockSelection.LastLineHasSelection then
e := BE.y
else
e := BE.y;
e := BE.y - 1;
end;
IncPaintLock;

View File

@ -123,6 +123,7 @@ type
function AdjustBytePosToCharacterStart(Line: integer; BytePos: integer): integer;
function GetFirstLineBytePos: TPoint;
function GetLastLineBytePos: TPoint;
function GetLastLineHasSelection: Boolean;
procedure SetAutoExtend(AValue: Boolean);
procedure SetCaret(const AValue: TSynEditCaret);
procedure SetEnabled(const Value : Boolean);
@ -186,6 +187,7 @@ type
// First and Last Pos are ordered according to the text flow (LTR)
property FirstLineBytePos: TPoint read GetFirstLineBytePos;
property LastLineBytePos: TPoint read GetLastLineBytePos;
property LastLineHasSelection: Boolean read GetLastLineHasSelection;
property InvalidateLinesMethod : TInvalidateLines write FInvalidateLinesMethod;
property Caret: TSynEditCaret read FCaret write SetCaret;
property Persistent: Boolean read FPersistent write SetPersistent;
@ -2362,6 +2364,11 @@ begin
Result := EndLineBytePos;
end;
function TSynEditSelection.GetLastLineHasSelection: Boolean;
begin
Result := (LastLineBytePos.x > 1) or ((FActiveSelectionMode = smLine) and FForceSingleLineSelected);
end;
procedure TSynEditSelection.SetAutoExtend(AValue: Boolean);
begin
if FAutoExtend = AValue then Exit;