Skip to content

Commit

Permalink
FindMode: not hook selection color if focused on a transparent textbox
Browse files Browse the repository at this point in the history
for #1144
  • Loading branch information
gdh1995 committed Jun 13, 2024
1 parent 58b8e1a commit 68d37ec
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions content/mode_find.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
getSelection_, isSelected_, docSelectable_, isHTML_, createElement_, CLK, MDW, removeEl_s, appendNode_s, isNode_,
setDisplaying_s, findAnchor_, isSafeEl_, textContent_s, modifySel, parentNode_unsafe_s, selOffset_, blur_unsafe,
getAccessibleSelectedNode, INP, BU, PGH, contains_s, setOrRemoveAttr_s, singleSelectionElement_unsafe, getNodeChild_,
getDirectionOfNormalSelection
getDirectionOfNormalSelection, getComputedStyle_
} from "../lib/dom_utils"
import {
wdZoom_, prepareCrop_, view_, dimSize_, selRange_, getZoom_, isSelARange, getViewBox_, scrollWndBy_, cropRectS_,
Expand Down Expand Up @@ -905,9 +905,15 @@ export const executeFind = (query: string | null, options: Readonly<ExecuteOptio
}
}
if (found! && !highlight && (par = par || getSelectionParent_unsafe(curSel = getSelected()))) {
newAnchor = oldAnchor && getAccessibleSelectedNode(curSel!)
posChange = newAnchor && compareDocumentPosition(oldAnchor as Node, newAnchor)
newAnchor = (!noColor && styleSelColorOut || oldAnchor) && getAccessibleSelectedNode(curSel!)
posChange = oldAnchor && newAnchor && compareDocumentPosition(oldAnchor, newAnchor)
newAnchor = newAnchor && getNodeChild_(newAnchor, curSel!)
const specialFixForTransparent = !noColor && styleSelColorOut
&& newAnchor && isNode_(newAnchor, kNode.ELEMENT_NODE)
&& getEditableType_<0>(newAnchor) > EditableType.MaxNotTextBox
&& getComputedStyle_((newAnchor as TextElement)).color!.includes("(0, 0, 0")
isSafeEl_(par) && view_(par, 1)
specialFixForTransparent && (styleSelColorOut!.disabled = !0)
if (posChange && /** go back */ !!(posChange & kNode.DOCUMENT_POSITION_PRECEDING) !== back) {
hudTip(kTip.wrapWhenFind, 1, VTr(back ? kTip.atStart : kTip.atEnd))
}
Expand Down

0 comments on commit 68d37ec

Please sign in to comment.