Repository navigation
Merge Tool Layouts
The merge tool has two layouts. Columns shows yours, the result and theirs side by side, joined by ribbons, with each side's buttons beside its line numbers. Stacked shows yours and theirs on top and the result across the bottom, with a row of links above each change. The user side is in Merge Tool.
Columns is best for small changes: every version of a line sits on one row. Long lines and narrow windows suit Stacked better, because the result gets the full width. People coming from other editors also expect one or the other, so the tool offers both and remembers the choice.
flowchart TD
S["settings.mergeLayout"] --> E["MergeEditor.svelte"]
E -->|Columns| F["MergeFrame (library)"]
E -->|"Stacked, loaded on demand"| K["MergeStackFrame (library)"]
F --> A["attach(parts)"]
K --> A
A -->|"no editors yet"| B["session.build"]
A -->|"editors exist"| R["session.relayout: move the editors, swap layoutCompartment"]
The editors never change with the layout. MergeEditor shows one frame at a time; when a frame's panes appear, attach builds the editors the first time and later only moves them: moveToLayout (mergeLayout.ts) appends each editor's DOM to the new frame's pane and reconfigures layoutCompartment with that pane's extensions from paneLayout. So the text, the undo history and every applied or ignored change survive a switch, and the work done in one layout shows in the other.
paneLayout gives each pane what its layout needs:
-
Columns: the side gutters (
sideGutters: numbers facing the result, Apply and Ignore beside them), the result's ruler over its lines' ends and one vertical scrollbar. -
Stacked: plain line numbers, rulers at the right, and lenses from the library's
chunkLenses(editor/chunkLens.ts). A side's lenses read its open changes fromgutterChunkField, which the session fills with the same marks it already sends; the result's lenses come from the chunk field (resultLenses).
MergeStackFrame is imported with import() only when Stacked is shown, so a merge in Columns never loads it. Its top row height and the split between its top panes are layout state (mergeStackHeight, mergeStackRatio in state.json); a saved height too tall for the window falls back to half, so the result always shows. The toolbar buttons set settings.mergeLayout, the same setting as Merge tool layout in Settings > Git, like the Ignore whitespace button.
| File | What it does |
|---|---|
src/lib/merge/mergeLayout.ts |
layoutCompartment, paneLayout, moveToLayout, the lenses' links |
src/lib/merge/MergeEditor.svelte |
The layout buttons, one frame at a time, attach
|
src/lib/merge/mergeSession.svelte.ts |
build with a layout, relayout, acceptBoth
|
ui/web/src/lib/components/MergeStackFrame.svelte |
The stacked frame: two panes over one, titles, resize lines |
ui/web/src/lib/editor/chunkLens.ts |
Lens rows above changes, as block widgets from a StateField |
Move the editors, do not rebuild them. Rebuilding would lose the undo history and cost a new set of editors on every click.
Lenses instead of ribbons when stacked. Ribbons need the panes side by side with the result between them; links above each change work in any arrangement.
Accept both takes yours first. It is two applies, so Undo can take back theirs alone.
Our own names. Columns and Stacked say what you see.
-
src/lib/merge/mergeLayout.test.ts: the result's notes for open conflicts. -
ui/web/src/lib/editor/chunkLens.test.ts: lens rows, their bars and their clicks. -
src/lib/stores/settingsData.test.ts:mergeLayoutdefaults to Columns and refuses unknown values; the saved stack sizes are read and kept in range. - The look and the switch need a visual check:
merge-tool-stackedinscripts/screenshots.tsopens in Columns, applies the easy changes and switches.
Update it when a layout gets new extensions, or when the switch stops moving the editors.
These pages are generated from docs/wiki. To correct something, open a pull request against the source file; edits made here are overwritten.
Using Nibtree
- Getting Started
- Welcome Screen
- Workspaces
- Files Panel
- File Operations
- File Icons
- Rounded Panels
- Editor and Tabs
- Pin Reorder and Wrap Tabs
- Single Tab Title
- Split Editor
- New File and Unsaved Changes
- Unload Hidden Tabs
- Editing Code
- Code Appearance
- Markdown Editor
- Image and PDF Preview
- Search Everywhere
- Recent Files
- Navigation Bar
- Find and Replace
- Changes and Commits
- Sign In Prompts
- Commit Box Layout
- Repository Actions
- Commit Options
- Ignoring Files
- Diffs
- Inline Diffs
- Staging View
- Revert a Change
- Resolving Conflicts
- Merge Tool
- Blame
- History and Log
- Merge Commits
- Branches and Tags
- Branches Popup
- Remotes
- Stashes
- Shelf
- Git Menu
- Git Dialogs
- Interactive Rebase
- Worktrees
- AI Agents
- AI Tasks
- AI Usage
- Keep Computer Awake
- Submodules
- Git LFS
- GitHub
- Git Console
- Terminal
- Terminal Features
- Scripts
- Navigation
- Menus
- Settings
- Settings Search
- Color Themes
- Settings Terminal and Automation
- Settings Files
- Updates
- Status Bar and Help
- Notifications
- Memory Use
- Clear Cache
- MCP and CLI
- Git Mergetool
- Keyboard Shortcuts
- Keyboard Shortcuts Editor
- Troubleshooting
- Troubleshooting Git
Developers
- Developer Guide
- Architecture
- Project Layout
- Backend
- How Folder Watching Works
- Folder Watching Bugs We Fixed
- How Workspace Files Work
- How the Preview Scheme Works
- Backend Services
- How Terminal Features Work
- Terminal Bugs We Fixed
- Frontend
- How the Rich Markdown Editor Works
- Rich Markdown Bugs We Fixed
- Git Menu Links
- Menu Keys and Routing
- Frontend Modules
- Blame Bugs We Fixed
- Project Color And Title Bar
- One Diff View
- Diff Bugs We Fixed
- Merge Tool Layouts
- Merge Tool Bugs We Fixed
- Color Theme Bugs We Fixed
- How the Connected Diff Works
- Rounded Panels Bugs We Fixed
- Update Bugs We Fixed
- Status Bar Bugs We Fixed
- MCP and CLI Bugs We Fixed
- Repository Actions Bugs We Fixed
- How the Changes Tab Works
- CodeMirror Patterns
- How the Cursor Works
- How Editor Features Work
- How the Path Bar Works
- Commands and Events
- Settings Reference
- Commands Workspace and Changes
- Commands Branches and Remotes
- Commands History and Extras
- Commands App and Tools
- Testing
- Test Suites
- Debugging
- Debugging with MCP
- Measuring Setting Memory
- How Terminal Memory Is Measured
- How Markdown Diagrams Work
- Releases and CI
- Publishing the Wiki
- Versioning and Changelog
- Browser Version Packages
- Browser Release Checks
- Docker Image
- Platforms and Signing
- Windows Support
- Windows Bugs We Fixed
- Windows MCP and CLI
- Docs and Screenshots
- UI Library
- UI Library MCP
- UI Library Bugs
- UI Library Migration
- Contributing
How features work
- Welcome screen
- Workspaces and folders
- Files panel
- File operations
- File icons
- Editor and tabs
- Pin, reorder and wrap tabs
- Single tab title
- Split editor
- New File and unsaved changes
- Unload hidden tabs
- Editing code
- Code appearance
- Markdown editor
- Image and PDF preview
- Search Everywhere
- Recent Files
- Navigation Bar
- Find and replace
- Changes and commits
- Sign-in prompts
- Commit box layout
- Repository actions
- Commit options
- Ignoring files
- Diffs
- Inline diffs
- Staging view
- Revert a change
- Resolving conflicts
- Merge tool
- Blame
- History and log
- Merge commits
- Commit tabs
- Branches and tags
- Branches popup
- Remotes
- Stashes
- Shelf
- Git menu
- Git dialogs
- Interactive rebase
- Worktrees
- AI agents
- AI usage
- Keep computer awake
- AI tasks
- Submodules
- Git LFS
- GitHub account
- Git Console
- Back and Forward
- Integrated terminal
- Scripts tool window
- Menu bar
- Settings
- Search in Settings
- Color themes
- Rounded panels
- Updates and release channels
- Status bar and help links
- Notifications
- Memory readout and memory log
- Clear Cache
- MCP server and command line tool
- git mergetool mode