Revert "fix: Skip case insensitive"#449
Conversation
This reverts commit be1805a.
|
CLA Assistant Lite bot: You can retrigger this bot by commenting recheck in this Pull Request |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideReverts the previous case-sensitivity-aware search highlighting behavior, simplifying keyword highlighting to always use the stored "search all" keyword without tracking or propagating a case-sensitivity flag, and inlining some window access instead of using temporaries. Sequence diagram for reverted find bar search highlighting flowsequenceDiagram
actor User
participant Window
participant EditWrapper
participant TextEdit
User->>Window: popupFindBar()
activate Window
Window->>EditWrapper: currentWrapper()
activate EditWrapper
EditWrapper-->>Window: wrapper
deactivate EditWrapper
Window->>TextEdit: textEditor()
activate TextEdit
TextEdit-->>Window: editor
deactivate TextEdit
Window->>Window: compute text, tabPath, row, column, scrollOffset
Window->>FindBar: activeInput(text, tabPath, row, column, scrollOffset)
Note over Window,TextEdit: Reverted behavior: no case flag is set on Window
Window->>TextEdit: highlightKeywordInView(text)
activate TextEdit
TextEdit-->>Window: highlighted
deactivate TextEdit
Window->>Window: m_keywordForSearchAll = text
Window->>Window: m_keywordForSearch = text
deactivate Window
Sequence diagram for reverted scroll-triggered highlighting via EditWrappersequenceDiagram
participant Window
participant EditWrapper
participant TextEdit
EditWrapper->>EditWrapper: connect(verticalScrollBar valueChanged)
TextEdit->>EditWrapper: verticalScrollBar valueChanged
activate EditWrapper
EditWrapper->>Window: getKeywordForSearchAll()
Window-->>EditWrapper: m_keywordForSearchAll
EditWrapper->>Window: getKeywordForSearch()
Window-->>EditWrapper: m_keywordForSearch
EditWrapper->>EditWrapper: compare keywords (Qt::CaseInsensitive)
alt bars visible and keywords equal
EditWrapper->>Window: findBarIsVisiable(), replaceBarIsVisiable()
Window-->>EditWrapper: visibility flags
EditWrapper->>TextEdit: highlightKeywordInView(m_keywordForSearchAll)
activate TextEdit
TextEdit-->>EditWrapper: highlighted
deactivate TextEdit
end
EditWrapper->>TextEdit: markAllKeywordInView()
TextEdit-->>EditWrapper: all_marked
deactivate EditWrapper
Class diagram for reverted search highlighting state managementclassDiagram
class Window {
+Window(DMainWindow* parent)
+void popupFindBar()
+void popupReplaceBar()
+void handleFindKeyword(const QString& keyword, bool state)
+void handleReplaceNext(const QString& file, const QString& replaceText, const QString& withText)
+void handleUpdateSearchKeyword(QWidget* widget, const QString& file, const QString& keyword, Qt::CaseSensitivity caseFlag)
+bool findBarIsVisiable()
+bool replaceBarIsVisiable()
+QString getKeywordForSearchAll()
+QString getKeywordForSearch()
+void resizeEvent(QResizeEvent* e)
+void closeEvent(QCloseEvent* e)
+void setPrintEnabled(bool enabled)
+QStackedWidget* getStackedWgt()
-- search state --
QString m_keywordForSearch
QString m_keywordForSearchAll
}
class EditWrapper {
+EditWrapper(Window* window, QWidget* parent)
+Window* window()
+TextEdit* textEditor()
-Window* m_pWindow
-TextEdit* m_pTextEdit
}
class TextEdit {
+void nextLine()
+void prevLine()
+void scrollUp()
+void scrollDown()
+void highlightKeywordInView(const QString& keyword)
+void markAllKeywordInView()
+void clearFindMatchSelections()
+bool highlightKeyword(const QString& keyword, int position, Qt::CaseSensitivity caseFlag)
+int getScrollOffset()
+int getPosition()
}
Window "1" o-- "many" EditWrapper : owns
EditWrapper "1" o-- "1" TextEdit : wraps
%% Key reverted change:
%% - Window no longer stores m_searchCaseFlag or getSearchCaseFlag
%% - highlightKeywordInView is now called without a case flag everywhere
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review代码审查意见这份 1. 语法逻辑
2. 代码质量
3. 代码性能
4. 代码安全
总结建议
|
|
Note
详情{
"src/widgets/window.cpp": [
{
"line": " QString key = \"base/enable\";",
"line_number": 389,
"rule": "S106",
"reason": "Var naming | 64f28539d9"
}
]
} |
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In the lambda connected to
ReplaceBar::updateSearchKeyword,handleUpdateSearchKeywordis now called without theQt::CaseSensitivityargument, so either the slot signature should be updated (e.g., default parameter/overload) or the lambda should still pass a case flag to keep the call consistent and compilable. - The repeated
m_wrapper->window()calls insidenextLine,prevLine,scrollUp, andscrollDownwere previously factored into a localWindow *win; consider reintroducing a local variable to avoid repeated calls and improve readability. - With
m_searchCaseFlagremoved andhighlightKeywordInViewno longer taking a case flag, ensure that the different default behaviors for find vs. replace (case-insensitive vs. case-sensitive) are still expressible in the design, or consider introducing an explicit way to distinguish these modes if needed.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In the lambda connected to `ReplaceBar::updateSearchKeyword`, `handleUpdateSearchKeyword` is now called without the `Qt::CaseSensitivity` argument, so either the slot signature should be updated (e.g., default parameter/overload) or the lambda should still pass a case flag to keep the call consistent and compilable.
- The repeated `m_wrapper->window()` calls inside `nextLine`, `prevLine`, `scrollUp`, and `scrollDown` were previously factored into a local `Window *win`; consider reintroducing a local variable to avoid repeated calls and improve readability.
- With `m_searchCaseFlag` removed and `highlightKeywordInView` no longer taking a case flag, ensure that the different default behaviors for find vs. replace (case-insensitive vs. case-sensitive) are still expressible in the design, or consider introducing an explicit way to distinguish these modes if needed.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: JWWTSL, lzwind The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Reverts #448
Summary by Sourcery
Revert the previous change that introduced explicit case-sensitivity handling for search highlighting and restore the prior default behavior.
Bug Fixes:
Enhancements: