richmemo: prevent win32 scrolling on changing text attributes

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5974 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
skalogryz
2017-07-07 18:01:02 +00:00
parent e2bb5a34d6
commit 26520b92c9
3 changed files with 29 additions and 11 deletions

View File

@@ -864,7 +864,6 @@ var
p : TFontParams;
allowInternalChange: Boolean;
fp : TFontParams;
h,v : integer;
const
AllFontStyles : TFontStyles = [fsBold, fsItalic, fsUnderline, fsStrikeOut];
begin
@@ -872,8 +871,6 @@ begin
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);
if allowInternalChange and (TWSCustomRichMemoClass(WidgetSetClass).isInternalChange(Self, ModifyMask)) then
@@ -886,8 +883,6 @@ begin
Exit;
end;
//todo: this is temporary workaround
// the style changing should not be adjusting the scroll
Lines.BeginUpdate;
try
// manually looping from text ranges and re-applying
@@ -912,10 +907,6 @@ begin
inc(i, l);
end;
finally
// 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;