修复合并编辑时的代码问题
This commit is contained in:
@@ -361,7 +361,6 @@ export function BranchDropdown({
|
|||||||
// Remote has new commits — auto-pull then retry push
|
// Remote has new commits — auto-pull then retry push
|
||||||
updateTask(taskId, {
|
updateTask(taskId, {
|
||||||
status: "running",
|
status: "running",
|
||||||
label: t("tasks.pullCode"),
|
|
||||||
})
|
})
|
||||||
try {
|
try {
|
||||||
const pullResult = await gitPull(folderPath)
|
const pullResult = await gitPull(folderPath)
|
||||||
@@ -371,7 +370,7 @@ export function BranchDropdown({
|
|||||||
setConflictInfo(pullResult.conflict)
|
setConflictInfo(pullResult.conflict)
|
||||||
} else {
|
} else {
|
||||||
// Pull succeeded, retry push
|
// Pull succeeded, retry push
|
||||||
updateTask(taskId, { status: "running", label })
|
updateTask(taskId, { status: "running" })
|
||||||
const pushResult = await gitPush(folderPath)
|
const pushResult = await gitPush(folderPath)
|
||||||
updateTask(taskId, { status: "completed" })
|
updateTask(taskId, { status: "completed" })
|
||||||
onBranchChange()
|
onBranchChange()
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react"
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react"
|
||||||
import dynamic from "next/dynamic"
|
import dynamic from "next/dynamic"
|
||||||
import type { OnMount } from "@monaco-editor/react"
|
import type { OnMount } from "@monaco-editor/react"
|
||||||
import type { editor as MonacoEditorNs } from "monaco-editor"
|
import type { editor as MonacoEditorNs, IRange } from "monaco-editor"
|
||||||
import { ArrowLeft, ArrowRight, CheckCheck } from "lucide-react"
|
import { ArrowLeft, ArrowRight, CheckCheck } from "lucide-react"
|
||||||
import { useTranslations } from "next-intl"
|
import { useTranslations } from "next-intl"
|
||||||
import { defineMonacoThemes, useMonacoThemeSync } from "@/lib/monaco-themes"
|
import { defineMonacoThemes, useMonacoThemeSync } from "@/lib/monaco-themes"
|
||||||
@@ -676,8 +676,6 @@ function ArrowGutter({
|
|||||||
title,
|
title,
|
||||||
}: ArrowGutterProps) {
|
}: ArrowGutterProps) {
|
||||||
const editor = editorRef.current
|
const editor = editorRef.current
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
||||||
const _tick = scrollTick // read to establish dependency
|
|
||||||
|
|
||||||
const positioned = useMemo(() => {
|
const positioned = useMemo(() => {
|
||||||
if (!editor) return []
|
if (!editor) return []
|
||||||
@@ -729,7 +727,7 @@ function hunkToEditorRange(
|
|||||||
hunk: DiffHunk,
|
hunk: DiffHunk,
|
||||||
allHunks: DiffHunk[],
|
allHunks: DiffHunk[],
|
||||||
totalLines: number
|
totalLines: number
|
||||||
): MonacoEditorNs.IRange | null {
|
): IRange | null {
|
||||||
let offset = 0
|
let offset = 0
|
||||||
for (const h of allHunks) {
|
for (const h of allHunks) {
|
||||||
if (h.baseStart >= hunk.baseStart) break
|
if (h.baseStart >= hunk.baseStart) break
|
||||||
|
|||||||
Reference in New Issue
Block a user