open in diff or in updated mode
Some checks failed
CI / check (push) Has been cancelled

This commit is contained in:
2026-06-16 09:36:44 +02:00
parent 8fc6478bb1
commit 87fcf9bf93

View File

@@ -274,7 +274,10 @@ export function App(): React.ReactElement {
setHistory((h) => [path, ...h.filter((p) => p !== path)].slice(0, 100))
actions.ensureFile(path)
setActive(path)
setTabMode((m) => ({ ...m, [path]: opts.diff && changed ? defaultMode : (m[path] || (changed ? defaultMode : 'code')) }))
// Git rows open the diff; explorer / recent-files open the updated view.
// Unchanged files only have the plain editable "code" view.
const openMode: Mode = changed ? (opts.diff ? 'diff' : 'updated') : 'code'
setTabMode((m) => ({ ...m, [path]: openMode }))
reveal(path)
if (opts.line) {
// show the current/updated file so line numbers map to search hits
@@ -418,7 +421,7 @@ export function App(): React.ReactElement {
<GitPanel branch={proj.branch} changes={proj.changes} staged={proj.staged} committed={NO_COMMITTED}
commitMsg={commitMsg} setCommitMsg={setCommitMsg}
onStage={stageGuarded} onUnstage={unstageGuarded} onStageAll={actions.stageAll} onUnstageAll={actions.unstageAll} onCommit={commit}
onOpen={openFile} onContext={openMenu} activePath={active} />
onOpen={openFile} onContext={openMenu} activePath={active} showDir={gitW > 300} />
</div>
<Splitter onDelta={(dx) => { setAutoResize(false); setGitW((w) => clamp(w + dx, 160, 460)) }} />