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

fix: Selecting too long causes the search dialog too wide for the screen to display #572

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

VEXLife
Copy link

@VEXLife VEXLife commented Jan 22, 2025

Hi! Thanks for providing so excellent an IDE! I'm finding it extremely useful for me, especially the Competitive Companion integration.
If you select a lot of code, then press Ctrl+R/F, or select Search -> Replace.../Find..., the selected text will be filled into the new window, but wrongly expanding the window to be VERY VERY wide, and making subsequent callings for this function have the same problem. The only solution seems to be restarting the application.
I set a maximize limit to the dialog widget, and finding it works well. The width limit is currently 2x of the original size 609, and maybe a better limit should be adjusted properly? More discussions are welcome.

您好!感谢您提供了如此优秀的IDE!它对我非常有用,特别是 Competitive Companion 的集成功能。

如果我选中大量代码,然后按下 Ctrl+R/F 或选择 查找 -> 替换.../查找...,被选中的文本将会填入新窗口中。但此时窗口会错误地扩展得非常非常宽,并且导致后续调用此功能时也出现同样的问题。目前看来,唯一的解决办法似乎是重启应用程序。

我为对话框的Widget设置了一个最大宽度限制,发现这样做效果很好。我目前的宽度限制设置是原始尺寸609的两倍,或许应该适当调整以找到更合适的限制?欢迎更多的讨论。

@royqh1979
Copy link
Owner

看你的邮箱是163的,所以直接用中文回复了。首先感谢你的bug报告和PR。

关于你所说的问题,我的想法是这样的:

  1. 除了searchdialog外,searchinfilesdialog可能也存在类似的问题
  2. 替换操作可能也存在类似的问题
  3. 简单限制对话框的最大宽度(像素)可能不是个好的解决方案。因为需要考虑高分辨率显示器的支持。
  4. 可以试试在SearchDialog的search和replace方法里,先show()对话框(这样对话框就是以默认的尺寸显示),然后再setComboTextAndHistory(设置搜索框的文字内容)?

@VEXLife
Copy link
Author

VEXLife commented Jan 23, 2025

您说的第4点的确可以在不额外设置对话框的最大宽度的情况下解决问题,不过我注意到您的代码风格多是在最后UI准备完毕后编写show()和activeWindow()代码,也更符合大多数人直觉逻辑,为了这个BUG更改顺序似乎不太合适?
我仔细研究了一下,认为BUG可能来源于SizeAdjustPolicy属性,该属性默认值是AdjustToContentsOnFirstShow,即首次显示时根据内容拉伸。将其改为AdjustToMinimumContentsLengthWithIcon也能解决问题,不知这个方案怎么样?

for the screen to display or use. Change SizeAdjustPolicy from AdjustToContentsOnFirstShow to AdjustToMinimumContentsLengthWithIcon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants