You've already forked lazarus-ccr
richmemo: temporary workaround to prevent scrolling on style change
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5970 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -864,6 +864,7 @@ var
|
|||||||
p : TFontParams;
|
p : TFontParams;
|
||||||
allowInternalChange: Boolean;
|
allowInternalChange: Boolean;
|
||||||
fp : TFontParams;
|
fp : TFontParams;
|
||||||
|
h,v : integer;
|
||||||
const
|
const
|
||||||
AllFontStyles : TFontStyles = [fsBold, fsItalic, fsUnderline, fsStrikeOut];
|
AllFontStyles : TFontStyles = [fsBold, fsItalic, fsUnderline, fsStrikeOut];
|
||||||
begin
|
begin
|
||||||
@ -871,6 +872,8 @@ begin
|
|||||||
|
|
||||||
if (ModifyMask = []) or (TextLength = 0) then Exit;
|
if (ModifyMask = []) or (TextLength = 0) then Exit;
|
||||||
|
|
||||||
|
h:=Self.HorzScrollBar.Position;
|
||||||
|
v:=Self.VertScrollBar.Position;
|
||||||
allowInternalChange:=(not (tmm_Styles in ModifyMask)) or (AddFontStyle+RemoveFontStyle=AllFontStyles);
|
allowInternalChange:=(not (tmm_Styles in ModifyMask)) or (AddFontStyle+RemoveFontStyle=AllFontStyles);
|
||||||
|
|
||||||
if allowInternalChange and (TWSCustomRichMemoClass(WidgetSetClass).isInternalChange(Self, ModifyMask)) then
|
if allowInternalChange and (TWSCustomRichMemoClass(WidgetSetClass).isInternalChange(Self, ModifyMask)) then
|
||||||
@ -883,6 +886,8 @@ begin
|
|||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
//todo: this is temporary workaround
|
||||||
|
// the style changing should not be adjusting the scroll
|
||||||
Lines.BeginUpdate;
|
Lines.BeginUpdate;
|
||||||
try
|
try
|
||||||
// manually looping from text ranges and re-applying
|
// manually looping from text ranges and re-applying
|
||||||
@ -907,7 +912,11 @@ begin
|
|||||||
inc(i, l);
|
inc(i, l);
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
Lines.EndUpdate
|
// todo: this is a workaround.
|
||||||
|
// getting position is necessary, so the cached values are refershed
|
||||||
|
if Self.HorzScrollBar.Position<>h then Self.HorzScrollBar.Position:=h;
|
||||||
|
if Self.VertScrollBar.Position<>v then Self.VertScrollBar.Position:=v;
|
||||||
|
Lines.EndUpdate;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user