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

ツールバーの検索ボックスにフォーカスを当てていないにも関わらず文字列が選択状態として表示される現象が起きないように対策 #1724

Merged

Conversation

beru
Copy link
Contributor

@beru beru commented Sep 7, 2021

PR の目的

件名の通りです。#1717 で報告された問題です。

カテゴリ

  • 不具合修正

PR の背景

61c5cf8 で、ツールバー上のコンボボックスを作成後に垂直位置を調整する処理が変更されて、位置と横幅を調整する処理に変更されました。この変更が加えられた後に問題の現象が発生するようになりました。

メカニズムは分かりませんがウィンドウ作成後に横幅を変えると問題が起きる事が分かった(そうしないと問題が起きない)ので、代わりにウィンドウ作成のAPIの引数の値を調整して横幅を目的の値にしました。

PR の影響範囲

ツールバー上のコンボボックス作成直後の位置や幅の調整処理

テスト内容

テスト1

手順

  • サクラエディタ起動
  • ツールバー上の検索ボックスのテキストが選択状態になっていない事を確認

テスト2

  • ツールバー上の検索ボックスの検索機能が正常に動作する事を確認
  • 検索ダイアログを表示して検索を行った際に、ツールバー上の検索ボックスに検索キーワードが入る事を確認

テスト3

関連 issue, PR

#1717
#1343, #1345

キーボードフォーカスが当たっていないにもかかわらず,文字列が選択状態として表示される現象が起きないようにする為の対策
@beru beru added the 🐛bug🦋 ■バグ修正(Something isn't working) label Sep 7, 2021
@sonarcloud
Copy link

sonarcloud bot commented Sep 7, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@AppVeyorBot
Copy link

Build sakura 1.0.3906 completed (commit fb82948363 by @beru)

Copy link
Contributor

@berryzplus berryzplus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

動作確認はしていませんが、原因に対する対策として適切だと思います。

@@ -293,6 +293,9 @@ void CMainToolBar::CreateToolBar( void )
//位置とサイズを取得する
rc.right = rc.left = rc.top = rc.bottom = 0;
Toolbar_GetItemRect( m_hwndToolBar, count-1, &rc );
// Social Distance
rc.left += cxBorder;
rc.right -= cxBorder;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Social Distance

時事用語ですね。beforeコロナ時代にあった「不適切な密着状態」を戒めるコトバですな。
ツールバーのボタン同士に人間社会が形成されているとは考えづらいので誤用と考えられます。
まぁ、まともな理解力を持った人にはニュアンス伝わると思うのでこのままでよいと思いますが。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここは意図的にこの言葉を使いました。記念として…。

SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOSENDCHANGING );
0, //rcCombo.Width()のまま変えない
0, //rcCombo.Height()のまま変えない
SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOSENDCHANGING );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SWP_NOSIZE |

ここが変更のキモでしょうか。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

そうですね、何故かウィンドウ作成後にサイズを変えるとテキスト選択状態の見た目になってしまうという。。
他にも色々と条件がありそうですが、まぁあんまり考えたくないです。。

@beru
Copy link
Contributor Author

beru commented Sep 8, 2021

レビューありがとうございました。Mergeします。
もし問題が見つかったら別のPRで修正します。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛bug🦋 ■バグ修正(Something isn't working)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants