microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
94.85k stars 8.21k forks source link

Mouse Mode gets stuck in certain circumstances #15540

Open Zeroes1 opened 1 year ago

Zeroes1 commented 1 year ago

Windows Terminal version

1.17.11461

Windows build number

10.0.19045.2965

Other Software

Far Manager, version 3.0.6163.0 x64

Steps to reproduce

Microsoft.WindowsTerminal_1.17.11461.0_x64.zip or Microsoft.WindowsTerminalPreview_1.18.1462.0_x64.zip in portable mode, uac off, under Admin

I use WT with FAR 100% times

when start some EXE's file under far manager (twiced click L-button mouse - only this!) cursor board by Far Manager starting moving with mouse movement the effect does not stop until you click L-button mouse.

Expected Behavior

Cursor board by Far Manager not move with mouse movement

Actual Behavior

100% reproduced on some EXE's ( with 90% console app?)

for examples:

Windows\System32\

with effects:

console app: certutil.exe change.exe

gui app: appverif.exe certreq.exe

console app without effects: ARP.EXE at.exe

i also check 8year ago Far Manager Far30b3900.x86 trouble still present too

PS: i use windows 27 year far manager 25 year conemu 12 year

but never see this effects earlier... WT I try use ~week ( why not early? because i dont like UWP apps)

Zeroes1 commented 1 year ago

settings.zip

carlos-zamora commented 1 year ago

Hi @Zeroes1! Could you take a video of what this looks like when it's working in ConEmu, vs when it's not working in Windows Terminal? Thanks!

Zeroes1 commented 1 year ago

NP far+conhost+wt+conemu.zip

Zeroes1 commented 1 year ago

if try record program Bandicam area: area around cursor -> full screen (ONLY THIS! - record around mouse) WT+Far+folow the mouse record in bandicam.mp4.zip

we can see many codes in far console

Zeroes1 commented 1 year ago

i check fresh Far30b6164.x64.20230615.7z Microsoft.WindowsTerminalPreview_1.18.1462.0_x64.zip with default settings problem still exist i check process Far.exe OpenConsole.exe WindowsTerminal.exe

3rd party dll attached not found

if u want i can record video with all proccess

Zeroes1 commented 1 year ago

on my comp at work this trouble present too (but some rare...) win10 22h2

carlos-zamora commented 1 year ago

Hey @Zeroes1. Sorry, but we're still having trouble understanding the issue, exactly. Let's try this. Could you write up specific, numbered steps to reproduce the issue? You're welcome to write it in your native language, we can find someone to translate it on our side 😊.

microsoft-github-policy-service[bot] commented 1 year ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

microsoft-github-policy-service[bot] commented 1 year ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

Zeroes1 commented 1 year ago

My native language is russian. Ok, let'go!

1) Я не уверен что проблема https://github.com/microsoft/terminal/issues/15533 одинакова с этой https://github.com/microsoft/terminal/issues/15540 но что то может быть общее у них? (for example mouse events?) я пока только на одном компьютере w10 22h2 её вижу без проблем для воспроизведения уже.

2) По поводу issues-15540: проблема: если запускать некоторые EXE файлы (лучше всего проявляется на консольных) путём двойного клика мышкой (и только так!) есть определенная вероятность того что после этого курсорная доска FAR начнёт двигаться вслед за курсором мыши!

она без проблем воспроизводится в том числе на установленных с нуля OS: Win10_22H2_Russian_x64.iso Windows 11 Pro 22H2 22621.1702 x64 EN

давайте по порядку: 1) взял ISO образ Win11 2) установил её в VirtualBox 7.0.8 3) На странице: https://www.farmanager.com/download.php?l=en скачал последний дистрибутив FAR Manager v3.0 build 6167 x64 https://www.farmanager.com/nightly/Far30b6167.x64.20230626.7z распаковал C:\FAR 4) на экране десктопа правый клик мыши + выбираю Open in Terminal открывается WT v1.2 5) добавляю новый профиль FAR, указываю путь на запуск C:\FAR\far.exe 6) активирую профиль FAR 7) в консоли пишу whereis:choice.exe и жму Enter плагин FarСmds обеспечивает открытие на панели FAR директории с этим файлом c:\windows\system32\choice.exe 8) теперь важно! Дважды кликаю левой кнопкой мыши по файлу на панели (то есть его запускаю) Y,N выбираем любой ответ пробуем мышкой делать круговые движения по площади FAR окна с большой вероятностью курсорная доска FAR начнёт двигаться в след за движением курсора мыши. 9) пробуем тоже самое на GUI приложении whereis:certreq.exe кликаем по нему тоже 2 раза (то есть запускаем) отменяем появившийся диалог и опять пробуем мышкой делать круговые движения по площади FAR окна с большой вероятностью курсорная доска FAR начнёт двигаться в след за движением курсора мыши.

Эффект движения курсорной доски FAR вслед за движением мыши прекращается только! если кликнуть 1 раз левой кнопкой мыши.

я не знаю кто виноват FAR или WT в данной проблеме. Но такой проблемы нет при использовании FAR и Conhost или FAR+ConEmu проблема не в плагинах FAR, я их убирал тоже самое. Я проверил билд FAR 8летней давности x86 - тоже самое поведение. Я проверил поведение под последней версией WEZTERM (использует ваш OpenConsole.exe) - тоже самое поведение.

Я хотел проверить поведение на других консольных менеджерах File Comander http://silk.apana.org.au/fcwftp.html

Necromancer Dos Navigator http://ndn.muxe.com/download/

но при запуске их используя WT, мышка сразу начинает выделять область на файловой панели, то есть мышкой запустить файлы не могу.

с версией WT 1.18 preview на W11 всё тоже самое. все тесты были сделаны с настройками по умолчанию: FAR,WT,OS.

Zeroes1 commented 1 year ago

https://github.com/microsoft/terminal/assets/11919060/a4a91966-1bcf-49ed-ae41-056378158696

lhecker commented 1 year ago
Translation My native language is russian. Ok, let'go! 1. I'm not sure that the issue https://github.com/microsoft/terminal/issues/15533 is the same as this one https://github.com/microsoft/terminal/issues/15540 but maybe they have something in common? (for example mouse events?) I only see it so far on one computer w10 22h2 with no problem to reproduce it. 2. Regarding issues-15540: problem: if you run some EXE files (it shows up best on console files) by double-clicking them (and only this way!) there is a certain probability that after that the FAR cursor board will start following the mouse cursor! it reproduces without problem even on an OS installed from scratch: Win10_22H2_Russian_x64.iso Windows 11 Pro 22H2 22621.1702 x64 EN let's take it one step at a time: 1. take an ISO image of Win11 2. install it in VirtualBox 7.0.8 3. at https://www.farmanager.com/download.php?l=en download the latest FAR Manager v3.0 build 6167 x64 https://www.farmanager.com/nightly/Far30b6167.x64.20230626.7z and unzip it in C:\FAR 4. Right click on desktop screen + choose Open in Terminal. opens WT v1.2 5. Add new FAR profile, set path to run to C:\FAR\far.exe 6. Activate FAR profile 7. I type whereis:choice.exe in console and press Enter. FarCmds plugin opens a directory with this file in FAR panel c:\windows\system32\choice.exe 8. Now this is important - double left mouse click on the file in the panel (i.e. launch it). choose either Y/N. try to move the mouse in a circular motion over the FAR window. with high probability FAR cursor board will start moving with mouse pointer motion. 9. try the same on GUI application whereis:certreq.exe. click on it twice (i.e. launch it). cancel the dialog box that appears. try making circular movements with your mouse on the FAR window area again. with great probability the FAR cursor board will start to move as soon as the mouse pointer moves. The effect of the FAR cursor board following the mouse movement stops only (!) if you click once with the left mouse button. I don't know who is to blame FAR or WT for this problem. But there is no such problem when using FAR and Conhost or FAR+ConEmu The problem is not with FAR plugins, because I removed them too and the same thing happens. I checked the 8 year old x86 build of FAR - same behavior. I checked the behavior under the latest version of WEZTERM (which uses your OpenConsole.exe) - same behavior. I wanted to check the behavior on other console managers File Comander http://silk.apana.org.au/fcwftp.html Necromancer Dos Navigator http://ndn.muxe.com/download/ But when launching them with WT, the mouse immediately starts to select an area in the file panel, i.e. I can't launch files with the mouse anymore. the same with WT 1.18 preview on W11. all tests were done with default settings: FAR,WT,OS.

А, теперь я понял. Спасибо @Zeroes1 за шаги по воспроизведению. Шаги 7, 8 и 9 являются решающими и помогли мне воспроизвести проблему. Когда ты сказал "курсорная доска", мы не поняли, что ты имел в виду. Видео также было очень полезным.


In short, the repro steps are:

o-sdn-o commented 1 year ago

Far+vtm+WT is not affected by this issue.

First tab: Far inside vtm inside WT, Second tab: Far inside WT

https://github.com/microsoft/terminal/assets/11535558/70f81b54-009b-4fb7-b731-03818dc48028

zadjii-msft commented 8 months ago

In #15741, @Zeroes1 mentioned that this was fixed apparently in Canary 1.20.3491.0. Presumably, that would mean that this root issue also got fixed?

(no idea which PR would have done it though)

j4james commented 8 months ago

@zadjii-msft I can still reproduce the issue in my local dev build, which is branched off of 63c3573a13cc96bfa3d655f0f1898ae250e2fe35, so I don't think it's fixed. I suspect it might be timing dependent, so that may explain why it isn't always reproducible.

I briefly looked at this a while back, and if I'm remembering correctly, it looked like the app wasn't receiving a mouse-up event because of the focus change to the launched app. As a result, it then thought you were still holding the mouse down once it received the focus again.

I think it only happens over conpty, though, so it seems like there might be something wrong with the way we're forwarding mouse events, but I'm just guessing here.

Zeroes1 commented 8 months ago

@zadjii-msft fixed only #15533 for me

Zeroes1 commented 3 months ago

Additional info: middle click in Far Manager work as Enter

  if (MouseEvent->dwButtonState & FROM_LEFT_2ND_BUTTON_PRESSED && MouseEvent->dwEventFlags != MOUSE_MOVED) {
    FarKey Key = KEY_ENTER;
    if (MouseEvent->dwControlKeyState & SHIFT_PRESSED) {
      Key|= KEY_SHIFT;
    }
    if (MouseEvent->dwControlKeyState & (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED)) {
      Key|= KEY_CTRL;
    }
    if (MouseEvent->dwControlKeyState & (LEFT_ALT_PRESSED | RIGHT_ALT_PRESSED)) {
      Key|= KEY_ALT;
    }
    ProcessKey(Key);
    return TRUE;
  }

afrter use middle click on PROBLEM EXEs files break functional Rclick/Lclick mouse. Now Rclick/Lclick work as Double-L-Click, need restart Far for fix it.

checked on canary terminal-1.22.1501.0/release terminal-1.20.11271.0 without WT, problem not exist.

Zeroes1 commented 1 month ago

may be interest for someones people how to workaround this trouble... for example if use AutoHotkey v2.x [https://www.autohotkey.com/]

add script (aka Little Magic Spell):

;-------------------- Temporary Workaround for FAR Manager & Windows Terminal ---------------------
; fix LButton double click, fix Mbutton click
; side effect: dont work selecting in grabber by mouse and drag'n'drop selected files

CoordMode "Mouse" , "Window"

#HotIf Check_OpenConsole_and_FAR()

Check_OpenConsole_and_FAR()
{
 Try
    {
     MouseGetPos , &ypos
     if (ypos > 40)
      {
       currentTitle := WinGetTitle("A")
       if (!InStr(currentTitle,"редактирование ") and !InStr(currentTitle,"edit "))
         return winActive("- Far 3.0 ahk_class CASCADIA_HOSTING_WINDOW_CLASS")
      }
    }
}

 LButton::
   {
     Send "{LButton}"
   }

 MButton::
  {
    Send "{MButton}"
  }

#HotIf