Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- **The Pulls screen is redrawn, and its list is sorted by what each pull request needs.** Open ones are grouped into Ready to merge, Needs work, In review and Drafts, in place of the All, Ready, Drafts and Failing filters and the Approved state. Inside a pull request, its facts stand beside the description, and Copy link and Copy Markdown are in the `⋯` menu.
- **The Git panel shows one thing at a time.** Changes and History are now two tabs, and a commit opens beside the log when you click it. The branches open from the branch's name in the panel's header: click one to check it out, type a new name to create it, and find the rest in its `⋯`.
- **The dock's tabs are at its top, and the open one says what it holds.** Review shows its changed files and lines beside its name, Artifacts its count, and the row of icons at the foot is gone. Comments waiting to be sent are one bar with Send: click the count to read, edit or remove them, and to add a note.
- **A finished turn in the chat is your message, the answer and the files it changed.** The calls, thoughts and texts on the way fold under one line with the time they took, like Worked for 4m 6s; click it to read them in order. Each changed file is listed once under the answer, and a click opens all its edits.
- **A permission the agent asks for in the chat now waits over the message box.** It says what the agent wants to do and shows the whole command, or each file with its diff, with the answers always in view. Once you answer, only the call is left in the conversation, or a Denied line.
- **A command you run with `!` in the chat is one message with its output.** The command and what it printed stand together on your side of the conversation, with the time it took when it is a second or more, and in red when it fails. On Claude Code, Codex and opencode, the agents whose chat runs commands.
Expand Down
5 changes: 3 additions & 2 deletions docs/ceilings.md
Original file line number Diff line number Diff line change
Expand Up @@ -2435,8 +2435,9 @@ work when nobody knows it and that the call site never shows. The mechanism and
goes when the extension fails, is removed, or the window restarts. A tree drawn for another checkout than the
active one shows a placeholder, and an extension that never draws one for the new checkout leaves it there.
- **The dock is never narrower than its tabs** (`native/cmd/lich-native/dock.go`, `fitTabs`): each extension with a
dock surface adds an icon button, 28px and a 2px gap, to the pill at the dock's foot, so with enough of them the
dock cannot be dragged narrow and the terminal beside it loses the columns. The title is only in the tooltip.
dock surface adds an icon button, 28px and a 2px gap, to the dock's header, so from the third extension on the
dock cannot be dragged down to its narrowest and the terminal beside it loses the columns. The title is in the
tooltip, and beside the icon while the tab is open.
- **`render` is coalesced, at 30 a second per surface** (`internal/extensions/throttle.go`): the first goes out at
once, and while the interval has not passed only the newest is kept and sent when it ends, so a loop of renders
costs the window a frame rate and the newest tree always arrives. The older ones in between never reach the
Expand Down
6 changes: 3 additions & 3 deletions docs/extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ A `dock` or `panel` surface opens from an item of the window's footer, the ballo
way Review opens the dock and the branch opens the Git panel. lich puts each new item at the end of the footer's
left side; the person can move
it or hide it in Settings › Appearance › Footer, and a hidden one stays hidden across updates. A dock surface is a
tab after lich's own, an icon button in the row at the dock's foot with the title in its tooltip, and the dock is
never narrower than that row. A panel surface takes the Git panel's place at the stage's foot, one panel at a time,
each with the height the person dragged it to.
tab after lich's own, an icon button in the dock's header with the title in its tooltip, spelled out beside the icon
while the tab is open, and the dock is never narrower than its tabs. A panel surface takes the Git panel's place at
the stage's foot, one panel at a time, each with the height the person dragged it to.

Both follow the session the window has active. lich sends `context` to an extension with such a surface when the
active session changes, when the extension starts and when a window attaches, whether the surface is open or not:
Expand Down
33 changes: 23 additions & 10 deletions native/DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Elements are defined by space, hover and islands, not by enclosure.

Inside an island, a change that adds a border, a rule, a pill, a second line or a nested surface is probably wrong. Reach for spacing,
a hover state or the tooltip first. The folder tray is the one nested surface, and the reason is written
under it; the dock's tab pill reuses its fill, for the same reason. The footer's balloons are the pills on `Sidebar`:
under it; the bar of comments to send at a panel's foot is the other, set apart from the code it lies under. The footer's balloons are the pills on `Sidebar`:
they float over the terminal and need a ground of their own to read on it, standing on `ui.ElevationLow`. The extension and theme
catalogs, their Installed tabs included, are the screens of cards, and the reason is written under them.

Expand Down Expand Up @@ -353,14 +353,27 @@ Space closes the header off from the body, never a rule.

### The dock's tabs

The dock's tabs (Code, Review, Artifacts and an extension's surfaces) are a pill of icon-only `BarIconButton`s
floating at its foot, centred, with the tab's name in a tooltip. The pill is `RadiusLG` on a faint `Accent` tray
(`folderTrayAlpha`; a `Sidebar` pill would vanish on the dock, which is `Sidebar` itself), `Space(1)` of padding, `Space(2)` off the dock's edges; the tab on screen is the
`Accent` fill, the others light on hover. The body stops above the strip, so nothing is covered. The header keeps
only actions at its right (Review's, collapse, full screen). A tab that holds something (Review with
changes, Artifacts with files) wears a 5px dot on its icon, never a count or a pill: `Foreground`, or `ToneWait`
on Review over a checkout with conflicts. The dock is never narrower
than the pill.
The dock's tabs (Code, Review, Artifacts and an extension's surfaces) stand at the left of its header, on the line
of its actions. The tab on screen is spelled out on an `Accent` fill at `RadiusMD`, 28px tall: its icon, its name in
medium, and what it holds, the count muted in `TextXS` and, on Review, the `DiffStat`. The others are icon-only
`BarIconButton`s with their name in a tooltip, and one that holds something (Review with changes, Artifacts with
files) wears a 5px dot on its icon, never a count: `Foreground`, or `ToneWait` on Review over a checkout with
conflicts. In a narrow dock the `DiffStat` goes first, then the count, and then the name is cut; the dock is never
narrower than its actions, the icons and 96px of the open tab. No line under the header repeats what the tab says.

A tab with nothing to show says why in the middle of its body, muted in `TextSM` under a muted 20px glyph
(`dockEmpty`). Loading and a search with no match stay a `Notice` at the top, where the rows will be.

### Review's file header and the comments to send

A file's header is its chevron, its file icon, its name, its folder muted and its `DiffStat`. The paperclip and
discard show only while the pointer is on the header, before the `DiffStat`, so nothing there at rest moves. What the
state asks for stays: a conflict's actions, a Markdown file's preview. On the Pulls screen the paperclip stays too.

The comments waiting to go to the session are one bar at the panel's foot (`commentBatch`), on `Accent` at
`RadiusLG`, `Space(2)` off the edges: a chevron and the count, then Clear and Send, the panel's `Primary`. A click on
the count unfolds the comments and the note about the whole change over the bar (`ui.Collapse`), so Send never moves.
A comment is one line, its pencil and × only under the pointer.

### The Code tab's tree

Expand Down Expand Up @@ -1728,6 +1741,6 @@ at once, whatever its row is still doing.
- **Pinned project tabs** stay at the left of the top strip, grouped before unpinned tabs with a wider gap
between the groups (`tabGroupMargin`), never a rule; they carry a pin glyph and close from their context menu
only.
- **Semantic color and the diff language badges**: they carry meaning.
- **Semantic color**: it carries meaning.
- **Buttons do not move when pressed**; only their color changes.
- **A sidebar row is one line.** Pull request and changes stay on it; a name too long is cut, not wrapped.
83 changes: 45 additions & 38 deletions native/cmd/lich-native/dock.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ package main
// or its Artifacts tab, and the tab it was last on when the window opens. It
// never closes: it stands beside the terminal or, collapsed, comes out from
// the window's edge. It owns the chrome around the bodies: the drag-resizable
// width (one, persisted, for every tab), full screen, collapse and the pill of
// icon tabs at its foot.
// width (one, persisted, for every tab) and the header: the tabs at its left,
// collapse and full screen at its right.
//
// The Review tab is a body the dock hands the frame to, through reviewTab:
//
Expand Down Expand Up @@ -68,7 +68,7 @@ const (
dockMinRem = 20
dockMaxRem = 60
dockDefaultRem = 28
// dockHeaderHeight is the strip the actions sit in, 8dp from the top and
// dockHeaderHeight is the strip the tabs and the actions sit in, 8dp from the top and
// from the Separator under it, the inset the sidebar's header keeps.
dockHeaderHeight = unit.Dp(44)
)
Expand All @@ -89,22 +89,27 @@ const (
// dockBuiltinTabs is how many tabs lich's own are, before the extensions'.
const dockBuiltinTabs = int(dockArtifacts)

// dockHeaderSpare is what the header needs past its actions: its two insets
// and gaps, and a gap's room to their left.
// dockHeaderSpare is what the header needs past its tabs and actions: its two
// insets and gaps, and a gap's room between the two.
var dockHeaderSpare = ui.Space(8)

// dockEmptyIcon is an empty tab's glyph, dockEmptyPad what keeps its line off
// the dock's edges.
var (
dockEmptyIcon = ui.Space(5)
dockEmptyPad = ui.Space(8)
)

// dockInput is what the dock reads of the active session each frame. checkout
// is where the session works now (useActiveSession's path), which is what both
// tabs browse and review; git is its status, isGit false outside a repository.
// light is the palette on screen, for what draws with its own theme.
type dockInput struct {
sessionID string
inject func(string) bool
submit func(api.RequestOptions, func(error)) bool
checkout string
git backend.DiffStats
isGit bool
light bool
code godemirror.Theme
// placed is the extensions' dock surfaces, a tab each after lich's.
placed []placedSurface
Expand Down Expand Up @@ -147,15 +152,12 @@ type dock struct {
ext extensionKey
extensions *extensionScreen
extAct extensionAction
// tabButtons are the pill's buttons, one per tab; placed the extension
// tabButtons are the tabs' buttons, one per tab; placed the extension
// tabs they were drawn for, which actTabs picks from.
tabButtons []*dockTabButton
placed []placedSurface
// actionsWidth and tabBarWidth are the header's actions and the pill with
// its insets, which fitTabs reads once both are laid out.
actionsWidth, tabBarWidth int
// minRem is the width the header's actions and the pill need, measured on
// the last frame: the dock is never narrower, so every tab stays in reach.
// minRem is the width the header's tabs and actions need, as of the last
// frame: the dock is never narrower, so every tab stays in reach.
minRem float64
}

Expand Down Expand Up @@ -248,9 +250,8 @@ func (d *dock) layout(gtx C, th *ui.Theme, root *ui.Root, in dockInput) (saveWid
return D{Size: gtx.Constraints.Max}
})
}),
layout.Rigid(func(gtx C) D { return d.tabBar(gtx, on, root, in) }),
)
d.fitTabs(gtx, max(d.actionsWidth+gtx.Dp(dockHeaderSpare), d.tabBarWidth))
d.fitTabs(gtx, tabsNeed(gtx, len(d.tabButtons)))
return saveWidth, err
}

Expand All @@ -269,35 +270,47 @@ func (d *dock) body(gtx C, th *ui.Theme, root *ui.Root, in dockInput) error {
return nil
}

// header is the h-10 strip: at its right the Review tab's actions or the Code
// tab's search, collapse and full screen. The tabs are the pill at the dock's foot.
// dockEmpty is a tab with nothing to show: why, under a quiet glyph, in the
// middle of the body.
func dockEmpty(gtx C, th *ui.Theme, glyph *icons.Icon, why string) D {
return layout.Center.Layout(gtx, func(gtx C) D {
return layout.UniformInset(dockEmptyPad).Layout(gtx, func(gtx C) D {
return layout.Flex{Axis: layout.Vertical, Alignment: layout.Middle}.Layout(gtx,
layout.Rigid(func(gtx C) D { return glyph.Layout(gtx, dockEmptyIcon, th.MutedForeground) }),
ui.VGap(2.5),
layout.Rigid(th.Text(ui.TextSM, why).Muted().Wrapped().Centered().Layout),
)
})
})
}

// header is the strip over the body: the tabs at its left, and at its right
// the Review tab's actions or the Code tab's search, collapse and full screen.
func (d *dock) header(gtx C, th *ui.Theme, root *ui.Root, in dockInput) D {
changed := in.isGit && in.git.Files > 0
actions := 0
fullIcon, fullLabel := icDockMaximize, i18n.T("dock.rightDock.fullScreen")
if d.fullscreen {
fullIcon, fullLabel = icDockMinimize, i18n.T("dock.rightDock.exitFullScreen")
}
gtx.Constraints = layout.Exact(image.Pt(gtx.Constraints.Max.X, gtx.Dp(dockHeaderHeight)))
dims := layout.Inset{Left: ui.Space(2), Right: ui.Space(2)}.Layout(gtx, func(gtx C) D {
return layout.Inset{Left: ui.Space(2), Right: ui.Space(2)}.Layout(gtx, func(gtx C) D {
return layout.Flex{Alignment: layout.Middle}.Layout(gtx,
layout.Flexed(1, func(gtx C) D { return D{Size: image.Pt(gtx.Constraints.Min.X, 0)} }),
layout.Flexed(1, func(gtx C) D {
width := gtx.Constraints.Max.X
return D{Size: image.Pt(width, d.tabs(gtx, th, root, in).Size.Y)}
}),
layout.Rigid(func(gtx C) D {
if d.tab != dockReview || !changed {
return D{}
}
dims := d.review.layoutActions(gtx, th)
actions += dims.Size.X
return dims
return d.review.layoutActions(gtx, th)
}),
ui.Gap(1),
layout.Rigid(func(gtx C) D {
if d.tab != dockCode {
return D{}
}
dims := th.IconAction(root, &d.search, icSearch, i18n.T("dock.filesPanel.search"), d.code.searching).Layout(gtx)
actions += dims.Size.X
return dims
return th.IconAction(root, &d.search, icSearch, i18n.T("dock.filesPanel.search"), d.code.searching).Layout(gtx)
}),
ui.Gap(1),
layout.Rigid(func(gtx C) D {
Expand All @@ -308,24 +321,18 @@ func (d *dock) header(gtx C, th *ui.Theme, root *ui.Root, in dockInput) D {
if d.collapsed {
icon, label = icDockExpand, i18n.T("dock.rightDock.expandPanel")
}
dims := th.IconAction(root, &d.collapse, icon, label, false).Layout(gtx)
actions += dims.Size.X
return dims
return th.IconAction(root, &d.collapse, icon, label, false).Layout(gtx)
}),
ui.Gap(1),
layout.Rigid(func(gtx C) D {
dims := th.IconAction(root, &d.full, fullIcon, fullLabel, false).Layout(gtx)
actions += dims.Size.X
return dims
return th.IconAction(root, &d.full, fullIcon, fullLabel, false).Layout(gtx)
}),
)
})
d.actionsWidth = actions
return dims
}

// fitTabs keeps the dock at least as wide as its header's actions and the
// pill of tabs need, px wide, and redraws when that changes.
// fitTabs keeps the dock at least as wide as its header needs, px, and redraws
// when that changes.
func (d *dock) fitTabs(gtx C, px int) {
need := max(dockMinRem, float64(gtx.Metric.PxToDp(px))/remDp)
if need != d.minRem {
Expand Down Expand Up @@ -359,8 +366,8 @@ func (d *dock) pickTab(index int, placed []placedSurface) {
}
}

// act runs the header's and the pill's clicks before the stage row reads whether the dock
// is open and how wide, so the frame shows their outcome.
// act runs the header's clicks before the stage row reads whether the dock is
// open and how wide, so the frame shows their outcome.
func (d *dock) act(gtx C) {
d.actTabs(gtx)
for d.search.Click.Clicked(gtx) {
Expand Down
2 changes: 1 addition & 1 deletion native/cmd/lich-native/dock_artifacts.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func (t *artifactsTab) motion(owner string) *ui.Presence {
func (t *artifactsTab) layout(gtx C, th *ui.Theme, root *ui.Root, active string) D {
own, others := t.groups(active)
if len(own) == 0 && len(others) == 0 {
return th.Notice(i18n.T("dock.artifacts.empty")).Layout(gtx)
return dockEmpty(gtx, th, icDockArtifacts, i18n.T("dock.artifacts.empty"))
}
var items []layout.Widget
add := func(w layout.Widget) { items = append(items, w) }
Expand Down
Loading
Loading