Skip to content

Commit

Permalink
fix found bugs
Browse files Browse the repository at this point in the history
include #1097
  • Loading branch information
gdh1995 committed Mar 4, 2024
1 parent 831e002 commit 8ab666c
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions content/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,16 +243,15 @@ set_contentCommands_([
const S = "IH IHS"
const act = options.act || options.action, selAction = options.select
const checkOrView = act === "last-visible" ? isNotInViewport : view_
const first_last = derefInDoc_(insert_last_), second_last = derefInDoc_(insert_last2_)
const known_last = first_last || second_last
const second_last = derefInDoc_(insert_last2_), known_last = derefInDoc_(insert_last_) || second_last
const selectOrClick = (el: SafeHTMLElement, rect?: Rect | null, onlyOnce?: true): Promise<void> => {
return getEditableType_(el) ? select_(el, rect, onlyOnce, selAction, onlyOnce)
: click_async(el, rect, 1).then((): void => { onlyOnce && flash_(el) })
}
let actRet: kTip | 0 | -1 = 0
OnFirefox && insert_Lock_()
if (OnEdge || OnFirefox || OnChrome && Build.MinCVer < BrowserVer.MinEnsured$WeakRef) {
first_last || set_insert_last_(null)
known_last !== second_last || set_insert_last_(null)
second_last || set_insert_last2_(null)
}
if (act && (act[0] !== "l" || known_last && !raw_insert_lock)) { /*#__ENABLE_SCOPED__*/
Expand Down Expand Up @@ -344,7 +343,8 @@ set_contentCommands_([
if (abs_(count) > 2 * sel) {
sel = count < 0 ? 0 : sel - 1
} else {
for (ind = 0; ind < sel && hints[ind].d !== known_last && hints[ind].d !== second_last; ) { ind++ }
for (ind = 0; ind < sel && hints[ind].d !== known_last; ) { ind++ }
if (ind >= sel) { for (ind = 0; ind < sel && hints[ind].d !== second_last; ) { ind++ } }
if (preferredSelector.endsWith("!") ? (preferredSelector = preferredSelector.slice(0, -1)) : ind >= sel) {
for (ind = preferredSelector && safeCall(testMatch, preferredSelector, visibleInputs[0]) === false ? 0 : sel;
ind < sel && !testMatch(preferredSelector, visibleInputs[ind]); ind++) { /* empty */ }
Expand Down
6 changes: 3 additions & 3 deletions content/marks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ export const dispatchMark = ((mark?: MarksNS.ScrollInfo | 0 | undefined, global?
(mark?: 0, global?: boolean): MarksNS.ScrollInfo // create: return `Writable<MarksNS.ScrollInfo>`
}

export const setPreviousMarkPosition = (idx?: number): void => {
export const setPreviousMarkPosition = (idx: number): void => {
const arr = dispatchMark()
arr.length === 2 && (arr as Writable<MarksNS.ScrollInfo>).push(loc_.hash)
previous[idx! | 0] = arr
previous[idx] = arr
}

export const activate = (options: CmdOptions[kFgCmd.marks], count: number): void => {
Expand Down Expand Up @@ -83,7 +83,7 @@ export const scrollToMark = (scroll: MarksNS.ScrollInfo | null | undefined): voi

export const goToMark_ = (options: CmdOptions[kFgCmd.goToMark]): void => {
const cb = (): void => {
options.t && setPreviousMarkPosition()
options.t && setPreviousMarkPosition(1)
scrollToMark(dispatchMark(options.s, options.g))
hudTip(kTip.raw, (options.g satisfies boolean as boolean | number as number + 1) as 1 | 2, options.t)
runFallbackKey(options.f, 0)
Expand Down
2 changes: 1 addition & 1 deletion content/mode_find.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ export const activate = (options: CmdOptions[kFgCmd.findMode]): void => {
(initial_query.length > 99 || initial_query.includes("\n")) && (initial_query = "")
isQueryRichText_ = !initial_query
initial_query || (initial_query = options.q)
isActive || initial_query === query_ && options.l || setPreviousMarkPosition()
isActive || initial_query === query_ && options.l || setPreviousMarkPosition(1)
checkDocSelectable();
ensureBorder()

Expand Down
2 changes: 1 addition & 1 deletion content/scroller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ export const executeScroll: VApiTy["c"] = function (di: ScrollByY, amount0: numb
amount = toDoInSelf = 0
}
if (toFlags && elementIsTop && amount) {
di && setPreviousMarkPosition()
di && setPreviousMarkPosition(1)
if (!joined && options && (options as Extract<typeof options, {dest: string}>).sel === "clear") {
resetSelectionToDocStart()
}
Expand Down
2 changes: 1 addition & 1 deletion pages/options_base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const showI18n_ = (): void => {
t = pageTrans_(isTitle ? i.slice(0, -2) : i)
t != null && (isTitle ? el.title = t : el.textContent = t)
}
(document.documentElement as HTMLHtmlElement).lang = lang1 === "zh" ? "zh-CN" as "" : lang1 as ""
(document.documentElement as HTMLHtmlElement).lang = lang1 === "zh" ? "zh-CN" as "" : lang1.replace("_", "-") as ""
}

(window as unknown as any).__extends = function<Child, Super, Base> (
Expand Down

0 comments on commit 8ab666c

Please sign in to comment.