far-plugins icon indicating copy to clipboard operation
far-plugins copied to clipboard

FarHints 1.0.16 and Far2 with mode /w

Open GoogleCodeExporter opened this issue 8 years ago • 2 comments

Проблемы с позиционированием вывода при 
использовании новой фичи Far2 - ключа "/w".

Original issue reported on code.google.com by [email protected] on 9 Aug 2010 at 3:06

GoogleCodeExporter avatar Apr 08 '16 09:04 GoogleCodeExporter

fix: "FarHintsMain.pas"

  function GetConsoleMousePos :TPoint;
    { Вычисляем позицию мыши в консольных координатах }
  var
    vWnd  :THandle;
    vPos  :TPoint;
    vRect :TRect;
    //+
    vFarRect: TSmallRect;
    //+.
  begin
    GetCursorPos(vPos);{}
    vWnd := hConsoleWnd;
    ScreenToClient(vWnd, vPos);
    GetClientRect(vWnd, vRect);
    //+
    vFarRect := FarGetWindowRect;
    with vFarRect do begin
      dec(Bottom, Top);
      Top:=0;
      dec(Right, Left);
      Left := 0;
      Result.Y := Top + MulDivTrunc(vPos.Y, Bottom - Top + 1, vRect.Bottom - vRect.Top);
      Result.X := Left + MulDivTrunc(vPos.X, Right - Left + 1, vRect.Right - vRect.Left);
    end;
    //+.
  end;


  function ConsolePosToWindowPos(AX, AY :Integer) :TPoint;
    { Пересчитываем консольные координаты в координаты Windows }
  var
    vWnd  :THandle;
    vRect :TRect;
    //+
    vFarRect: TSmallRect;
    //+.
  begin
    vWnd := hConsoleWnd;
    GetClientRect(vWnd, vRect);
    //+
    vFarRect := FarGetWindowRect;
    with vFarRect do begin
      dec(Bottom, Top);
      Top:=0;
      dec(Right, Left);
      Left := 0;
      Result.Y := MulDiv(AY - Top, vRect.Bottom, Bottom - Top + 1);
      Result.X := MulDiv(AX - Left, vRect.Right, Right - Left + 1);
    end;
    //+.
    ClientToScreen(vWnd, Result);
  end;

Original comment by [email protected] on 20 Oct 2010 at 8:20

Attachments:

GoogleCodeExporter avatar Apr 08 '16 09:04 GoogleCodeExporter

Проверил, работает! Спасибо!

Original comment by [email protected] on 20 Oct 2010 at 7:24

GoogleCodeExporter avatar Apr 08 '16 09:04 GoogleCodeExporter