From cca308b6079ee778c564c0197756595faf63ec88 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 7 Jul 2020 14:33:45 +0300 Subject: IEView: - text in groupchats isn't scrolled down; - unused flag removed from IEE_GET_SELECTION processing; - minor code optimization --- plugins/HistoryPlusPlus/hpp_external.pas | 2 +- plugins/HistoryPlusPlus/hpp_externalgrid.pas | 20 +++++--------------- 2 files changed, 6 insertions(+), 16 deletions(-) (limited to 'plugins/HistoryPlusPlus') diff --git a/plugins/HistoryPlusPlus/hpp_external.pas b/plugins/HistoryPlusPlus/hpp_external.pas index 3ec3937f37..53843d277f 100644 --- a/plugins/HistoryPlusPlus/hpp_external.pas +++ b/plugins/HistoryPlusPlus/hpp_external.pas @@ -203,7 +203,7 @@ begin ExtGrid.EndUpdate; end; IEE_GET_SELECTION: begin - Result := uint_ptr(ExtGrid.GetSelection(boolean(event.dwFlags and IEEF_NO_UNICODE))); + Result := uint_ptr(ExtGrid.GetSelection()); end; IEE_SAVE_DOCUMENT: begin ExtGrid.SaveSelected; diff --git a/plugins/HistoryPlusPlus/hpp_externalgrid.pas b/plugins/HistoryPlusPlus/hpp_externalgrid.pas index 0ecc0d3a67..c19a755f76 100644 --- a/plugins/HistoryPlusPlus/hpp_externalgrid.pas +++ b/plugins/HistoryPlusPlus/hpp_externalgrid.pas @@ -145,7 +145,7 @@ type Codepage: Integer; RTL: Boolean; DoScroll: Boolean); procedure SetPosition(x, y, cx, cy: Integer); procedure ScrollToBottom; - function GetSelection(NoUnicode: Boolean): PAnsiChar; + function GetSelection(): PAnsiChar; procedure SaveSelected; procedure Clear; property ParentWindow: HWND read FParentWindow; @@ -623,10 +623,9 @@ begin SetWindowPos(Grid.Handle, 0, x, y, cx, cy, SWP_SHOWWINDOW); end; -function TExternalGrid.GetSelection(NoUnicode: Boolean): PAnsiChar; +function TExternalGrid.GetSelection(): PAnsiChar; var - TextW: String; - TextA: AnsiString; + TextW: WideString; Source: Pointer; Size: Integer; begin @@ -634,17 +633,8 @@ begin if Length(TextW) > 0 then begin TextW := TextW + #0; - if NoUnicode then - begin - TextA := WideToAnsiString(TextW, CP_ACP); - Source := @TextA[1]; - Size := Length(TextA); - end - else - begin - Source := @TextW[1]; - Size := Length(TextW) * SizeOf(Char); - end; + Source := @TextW[1]; + Size := Length(TextW) * SizeOf(WideChar); ReallocMem(FSelection, Size); Move(Source^, FSelection^, Size); Result := FSelection; -- cgit v1.2.3