Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find window is opened as a "top level" window #5496

Open
AndyM48 opened this issue Apr 28, 2024 · 58 comments
Open

Find window is opened as a "top level" window #5496

AndyM48 opened this issue Apr 28, 2024 · 58 comments

Comments

@AndyM48
Copy link

AndyM48 commented Apr 28, 2024

I have two issues with the Find dialogue:

If I have immediate search (Im) selected then the search starts immediately when I start typing. While this is strictly in accordance with the requested action it s somewhat distracting. For example if I enter "Search" then firstly the next "S" is found, then the next "Se" and so on. I would suggest starting "immediate" after a minimum of three characters is entered to avoid this. This may also be a partial fix for #5473 :)

The find widow is opened as a "top level" window, by which I mean that the window will appear over other unconnected windows.
image
Can it be opened as a 'sibling' of the Cudatext 'parent' window?

@Alexey-T
Copy link
Owner

Do you suggest to ignore the typed text when len<=2? bad! identifiers of len=1 also exist. so I cannot change it.
To avoid search for 'S' and 'Se' (in 'Search') you can decrease the option "find_hi_max_lines". when option is e.g. "100" all documents with line_count > 100 will be searched by timer (typing 'www' fast will search only for 'www').

@Alexey-T
Copy link
Owner

Can it be opened as a 'sibling' of the Cudatext 'parent' window?

Form style should be "stay on top of ALL windows" if Cud's main window has 'View / Toggle always on top" checked. do you have it checked?

@AndyM48
Copy link
Author

AndyM48 commented Apr 28, 2024

Do you suggest to ignore the typed text when len<=2?

Yes, exactly, I do not want to search for a single letter, ever, ( and if I should want to I can press Enter :)
This applies to any document, even short ones.

Form style should be "stay on top of ALL windows" if Cud's main window has 'View / Toggle always on top"

Not necessary in linux, I can simply toggle "Always on top". Don't know about windows.
In either case it should be sufficient to keep the Find window always on top of the Cuda window and not on top any others (see screenshot above)
PS: I do not have View>Always on top selected

@Alexey-T
Copy link
Owner

Alexey-T commented Apr 28, 2024

Yes, exactly, I do not want to search for a single letter, ever, ( and if I should want to I can press Enter

Ok example is SublimeText, it searches for single char. VSCode too. they do not have an option for this, I guess.

@Alexey-T
Copy link
Owner

Not necessary in linux, I can simply toggle "Always on top". Don't know about windows.
In either case it should be sufficient to keep the Find window always on top of the Cuda window and not on top any others (see screenshot above)
PS: I do not have View>Always on top selected

I guess it is the Lazarus Qt5-version bug, that on-top works like system-on-top. I will study it.

@AndyM48
Copy link
Author

AndyM48 commented Apr 28, 2024

Ok example is SublimeText, it searches for single char. VSCode too. they do not have an option for this, I guess.

May be, I don't use either. There are plenty of examples where find works after the third character is entered. :)

on-top works like system-on-top.

Yes, I see that the find window is set as "Always on Top" in the window manager, and I can reset it to "Normal". But that will put the window below Cuda, which is no use at all. Don't know about Lazarus :(

@pintassilgo
Copy link

From what I can remember, every app with find-as-you-type I know process from the first char and I think that's right. Including web browsers, the most universally popular software class with find-as-you-type.

I'm not against providing an option for those who don't like it, the more customizing options the better, but surely current behavior should remain as default.

@Alexey-T
Copy link
Owner

Alexey-T commented Apr 30, 2024

2 issues were reported:

  • wish to only search (by 'Im' option) from input len = 3 chars. declined, sorry. I don't think we need an option, too many opts already.
  • report about incorrect work of 'stay on top' style of the Find window. it is the Lazarus issue so I put the lebel 'Lazarus/FPC issue'. will report it to Lazarus team.

@AndyM48
Copy link
Author

AndyM48 commented Apr 30, 2024

OK, thank you

@MiroslavMatas
Copy link

@AndyM48 - please try to use on this cases cmd Find in Lines (part of CudaExt), here I have minimum 3 characters… works fine for me the years… some options available…
(on my case - dedicated Ctrl+Q for start to search… floating dialog, vs standard Find/Search is docked for me)

@AndyM48
Copy link
Author

AndyM48 commented May 1, 2024

Cannot find 'Find in Lines'?

I prefer floating find dialogue to docked, hence my issue.

@Alexey-T
Copy link
Owner

Alexey-T commented May 1, 2024

'Find in lines' - can be found in the Command Palette when plugin CudaExt is installed.

Screenshot from 2024-05-01 10-26-54

This 'find in lines' dlg can be DOCKED into the top or bottom of the main Cud window. Press '=' button in 'find in lines', you will see that option.

Screenshot from 2024-05-01 10-29-06

@AndyM48
Copy link
Author

AndyM48 commented May 1, 2024

Sounds promising, I will take a look

Thank you

@Alexey-T Alexey-T changed the title Issues with Find Issues with Find, find widow is opened as a "top level" window May 3, 2024
@Alexey-T Alexey-T changed the title Issues with Find, find widow is opened as a "top level" window Issues with Find, find window is opened as a "top level" window May 3, 2024
@Alexey-T Alexey-T changed the title Issues with Find, find window is opened as a "top level" window minimal chars for 'Im' option; find window is opened as a "top level" window May 3, 2024
@AndyM48
Copy link
Author

AndyM48 commented May 23, 2024

I don't know pascal I'm afarid, but is this not an issue with FindWindow.Parent:= Self or similar, instead of FindWindow.Parent:= MainWindow or similar?

I see that this occurs with all the sibling windows opened by CudaText.

@Alexey-T
Copy link
Owner

No, it is not the problem with FindWindow.Parent. It is problem of the 'top most' window style, how it works.

@AndyM48
Copy link
Author

AndyM48 commented Jun 6, 2024

report about incorrect work of 'stay on top' style of the Find window. it is the Lazarus issue so I put the lebel 'Lazarus/FPC issue'. will report it to Lazarus team.

Is there any progress from the Lazarus team on this issue? If it is not possible to make the 'find' window a sibling of the main Cuda window then I might suggest an alternative approach.

@AndyM48 AndyM48 changed the title minimal chars for 'Im' option; find window is opened as a "top level" window Find window is opened as a "top level" window Jun 6, 2024
@Alexey-T
Copy link
Owner

Alexey-T commented Jun 6, 2024

Is there any progress from the Lazarus team on this issue?

not yet. I just posted additional demo to the same Lazarus bugreport:
https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/40933

@AndyM48
Copy link
Author

AndyM48 commented Jul 19, 2024

The Pascal/Lazarus report does not seem to have offered any solutions to this problem:

2024-07-19_10-32

Would you consider this solution?
Simply close the Find window when both Cudatext and the Find window lose focus. It is simple enough to reopen the Find window, with exactly the same contents, if it is needed, by either clicking on the Find button or Ctrl-F.
Note that it is necessary to close the Find window since minimising it and the using Ctrl-F or the Find button to raise it has unexpected consequences.

@Alexey-T
Copy link
Owner

Alexey-T commented Jul 19, 2024

on opening the Find dlg, rules for "find_suggest_" options apply / options are changed too for current document (it can be picture or binary viewer or too big text file). so sometimes it's not easy to reopen Find dlg with the same text and options (options change too).

@AndyM48
Copy link
Author

AndyM48 commented Jul 19, 2024

But that is an option, which can be selected/changed.
Not that I am only referring to the Find window.

@Alexey-T
Copy link
Owner

If you test it on Windows you Will see the topmode works ok? So its much better to fix it in the gtk2 and-or qt5 widgetset.

@AndyM48
Copy link
Author

AndyM48 commented Jul 19, 2024

Honestly, I doubt that it is a problem with gtk or qt, since, apparently/as far as I know, it does not affect any other programmes. I would imagine it is a problem with how Pascal/Lazarus interacts with gtk/qt. Either way, since I will not be going back to windows, and there is a possible fix for the problem, I would prefer that Cudatext worked on Linux.

Please read this knowing that I really like Cudatext and appreciate all your hard work.

May be add what I suggested as an option??

@Alexey-T
Copy link
Owner

Alexey-T commented Jul 19, 2024

You misread this. I mean "problem in gtk-qt widgetset (ie wrapper) in lazarus". Lazarus issue.

@AndyM48
Copy link
Author

AndyM48 commented Jul 19, 2024

OK, so back to my comment would you consider implementing this work-around?

Alexey-T added a commit that referenced this issue Jul 19, 2024
@AndyM48
Copy link
Author

AndyM48 commented Jul 25, 2024

No

The problem seems to be that when the main window receives the focus again, then the Find window is shown again without any user intervention. Presumably some side effect of if FPrevFindDlgVisible then fmFind.Hide;

May be this should be fmFind,Close or equivalent?

@Alexey-T
Copy link
Owner

Alexey-T commented Jul 25, 2024

i guess fmFind.Close will work the same as fmFind.Hide.

@AndyM48
Copy link
Author

AndyM48 commented Jul 25, 2024

Well it should not restore after a close

@Alexey-T
Copy link
Owner

Can you compile the app? Please try it then.

@AndyM48
Copy link
Author

AndyM48 commented Jul 25, 2024

Sorry, I don't have the time to work out how to compile it at the moment.
I suggest removing the code

{$if defined(LCLQt5) or defined(LCLQt6)}
  //workaround for issue https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/40933
  if FPrevFindDlgVisible and Assigned(fmFind) and not fmFind.Visible then
    fmFind.Show;
  {$ifend}

and changing

 {$if defined(LCLQt5) or defined(LCLQt6)}
  //workaround for issue https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/40933
  FPrevFindDlgVisible:= Assigned(fmFind) and (fmFind.Parent=nil) and fmFind.Visible;
  if FPrevFindDlgVisible then
   // fmFind.Hide;
     fmFind.Close;
  {$ifend}

Alexey-T added a commit that referenced this issue Jul 25, 2024
@Alexey-T
Copy link
Owner

made it. beta qt5:
cudatext.zip

@AndyM48
Copy link
Author

AndyM48 commented Jul 25, 2024

fmFind.Close seems to work fine now. Find windw closes when parent loses focus and reappears when Ctrl-F or button pressed.
Moving the Find window still does not work though. You did not remove the code

{$if defined(LCLQt5) or defined(LCLQt6)}
  //workaround for issue https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/40933
  if FPrevFindDlgVisible and Assigned(fmFind) and not fmFind.Visible then
    fmFind.Show;
  {$ifend}

I don't know why this would cause the problem, but since it is the only other change that you made in this fix I suppose it may be the cause.

@Alexey-T
Copy link
Owner

You did not remove the code

i commented it out! with pascal comment chars (* ...*). IDE shows block as comment

@AndyM48
Copy link
Author

AndyM48 commented Jul 25, 2024

Sorry, I did not know that.

So the problem must be with the code

{$if defined(LCLQt5) or defined(LCLQt6)}
  //workaround for issue https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/40933
  FPrevFindDlgVisible:= Assigned(fmFind) and (fmFind.Parent=nil) and fmFind.Visible;
  if FPrevFindDlgVisible then
    fmFind.Close;
  {$ifend}

{$if defined(LCLQt5) or defined(LCLQt6)} ... {$ifend} : only apply to Qt5 and Qt6 versions
FPrevFindDlgVisible:= : set a variable, if the following are true then close Find
Assigned(fmFind) : Find window has been called?
(fmFind.Parent=nil) : main window does not have focus?
fmFind.Visible : Find window exists?

If this might, in any way, be an approximation of the sense of the code, then DND will close the Find window since the window will not exist as it is being dragged.

@Alexey-T
Copy link
Owner

FPrevFindDlgVisible:= : set a variable, if the following are true then close Find

yes

Assigned(fmFind) : Find window has been called?

has been created in memory

(fmFind.Parent=nil) : main window does not have focus?

find-dlg is not docked to main dlg

fmFind.Visible : Find window exists?

find-dlg is shown

@AndyM48
Copy link
Author

AndyM48 commented Jul 25, 2024

So if fmFind is not docked and is shown, close it.

In essence this will close the fmFind window whenever it is called.

It is called by the procedure TfmMain.AppPropsDeactivate which in turn, I am assuming, is called when the programme is deactivated. So why is the fmFind window closed by DND?

If DND is an external application, then may be Cudatext is deactivated when DND is called?

@Alexey-T
Copy link
Owner

Yes, its possible.

@AndyM48
Copy link
Author

AndyM48 commented Jul 25, 2024

Can you establish when DND is called, and the omit it from the deactivate procedure.

How is DND called?

@Alexey-T
Copy link
Owner

what DND? what do you drag, file from OS file manager? text inside editor?

@AndyM48
Copy link
Author

AndyM48 commented Jul 25, 2024

DND = Drag aNd Drop the fmFind window in the main window.

@Alexey-T
Copy link
Owner

DND of the find dlg is not supported. What are trying to do? Add it? I dont like the idea.

@AndyM48
Copy link
Author

AndyM48 commented Jul 25, 2024

Fair enough. So where is the fmFind widow opened?

@Alexey-T
Copy link
Owner

Wait, i mean that dropping of find dlg to dock it into main dlg, is not supported. Usual mouse dragging of the find dlg must work. You have problems with the mouse dragging of the find dlg?

Does it work on Windows?

@AndyM48
Copy link
Author

AndyM48 commented Jul 25, 2024

At present DND of the find window, within the main window, does not work for me. I don't use windows.
Checked in all versions available to me.

I think I may need to wipe out my all the Cudatext from my system and restart from clean. Or do you have a debgug method?

@Alexey-T
Copy link
Owner

So its DND into main Window. Its not supported.

No, you dont need to wipe the app.

@AndyM48
Copy link
Author

AndyM48 commented Jul 25, 2024

No, it is DND within the main window which is not working for me.

I do not need or want DND into the main window

@Alexey-T
Copy link
Owner

Its not supported too.

@AndyM48
Copy link
Author

AndyM48 commented Jul 25, 2024

I have no idea where you are going?

Usual mouse dragging of the find dlg must work. You have problems with the mouse dragging of the find dlg?

Now you say it is not supported.

Never mind. I don't think that anyone else is interested so I will move on.

@Alexey-T
Copy link
Owner

sual mouse dragging of the find dlg must work. You have problems with the mouse dragging of the find dlg?

Now you say it is not supported.

DND of dlg is not supported (within main window). the quote is about usual dragging of UNDOCKED find-dlg by mouse - ie reposition of dlg. so we used different terms - usual dragging is not DND.

@AndyM48
Copy link
Author

AndyM48 commented Jul 25, 2024

OK, same difference, usual mouse dragging of the find dlg does not work for me.

@Alexey-T Alexey-T reopened this Jul 27, 2024
@Alexey-T
Copy link
Owner

@Alexey-T
Copy link
Owner

Alexey-T commented Jul 30, 2024

i disabled new workaroud which hides find-dlg on deactivate. because of lazarus qt5 bug this workaround makes things worse. i will update 1.216.0 linux-qt5 release files today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants