anchor.diff:          gHands.GetGroupsInRect(rect, fGroupsTeamNames);
           gHands.GetHousesInRect(rect, fHousesTeamNames);
         end;
  -
       end;
  -
  +end;
  +
  +
  +// This event happens every ~33ms if the Key is Down and holded
  +procedure TKMGamePlayInterface.KeyDown(Key: Word; Shift: TShiftState; aIsFirst: Boolean; var aHandled: Boolean);
  +var
  +  keyHandled: Boolean;
  +begin
  +  aHandled := True; // assume we handle all keys here
  +
  +  if gGame.IsPlayerWaiting and IsKeyBlockedOnPause(Key) then Exit;
  +
  +  if fMyControls.KeyDown(Key, Shift) then
  +  begin
  +    fViewport.ReleaseScrollKeys; // Release the arrow keys when you open a window with an edit to stop them becoming stuck
  +    Exit;
  +  end;
  +
  +  keyHandled := False;
  +  inherited KeyDown(Key, Shift, aIsFirst, keyHandled);
  +  if keyHandled then Exit;
  +
  +  HandleShowTeamKeyDown(Key);
     HandleMessageKeys(Key);
   end;
   
  
positive.code: 
    keyHandled := False;
    inherited KeyUp(Key, Shift, keyHandled);
  
    // These keys are allowed during replays
    HandleReplayPauseKey(Key, Shift);
  
negative.code: end;
  
  
  procedure TKMGamePlayInterface.HandleMessageKeys(Key: Word);
  var
    I: Integer;
    lastAlert: TKMAlert;
    msg: TKMLogMessage;
  begin
    // Messages
    if Key = gResKeys[kfCenterAlert] then
    begin
      // Spacebar centers you on the latest alert
      lastAlert := fAlerts.GetLatestAlert;
      if lastAlert <> nil then
        fViewport.Position := lastAlert.Loc
      else
      begin
        //If there are no active alerts, then centers on last unread message in log (house / unit)
        for I := gMySpectator.Hand.MessageLog.CountLog - 1 downto Max(gMySpectator.Hand.MessageLog.CountLog - MAX_LOG_MSGS, 0) do
        begin
          msg := gMySpectator.Hand.MessageLog[I];
  
          if not msg.IsRead and msg.IsGoto then
          begin
            MessageLog_ShowMessage(I);
            Break;
          end;
        end;
      end;
    end;
  
    if Key = gResKeys[kfDeleteMsg] then
      Button_MessageDelete.Click;
  
    // Enter is the shortcut to bring up chat in multiplayer
    if (Key = gResKeys[kfChat]) and CanShowChat then
    begin
      if not fGuiGameChat.Visible then
      begin
        Allies_Close(nil);
        Message_Close(nil);
        MessageLog_Close(nil);
        Label_ChatUnread.Caption := ''; // No unread messages
        fGuiGameChat.Show;
      end else
        fGuiGameChat.Focus;
    end;
  end;
  
  
  procedure TKMGamePlayInterface.HandleShowTeamKeyDown(Key: Word);
  var
    rect: TKMRect;
  begin
    // As we don't have names for teams in SP we only allow showing team names in MP or MP replays
    if (Key = gResKeys[kfShowTeams]) then
      if SHOW_UIDs or (fUIMode in [umMP, umSpectate]) or (gGameParams.Mode = gmReplayMulti) then //Only MP replays
      begin
  