Repository navigation
web: add a command palette - #8551
Merged
Merged
Conversation
unknwon
added a commit
that referenced
this pull request
Nov 14, 2026
unknwon
added a commit
that referenced
this pull request
Nov 14, 2026
unknwon
force-pushed
the
command-palette-flamego
branch
2 times, most recently
from
November 14, 2026 07:09
c7c0265 to
777ab12
Compare
unknwon
added a commit
that referenced
this pull request
Nov 14, 2026
unknwon
added a commit
that referenced
this pull request
Nov 14, 2026
unknwon
force-pushed
the
command-palette-flamego
branch
from
November 14, 2026 07:11
777ab12 to
3bde71b
Compare
unknwon
added a commit
that referenced
this pull request
Nov 14, 2026
unknwon
force-pushed
the
command-palette-flamego
branch
from
November 14, 2026 13:23
3bde71b to
3e5fbd1
Compare
unknwon
added a commit
that referenced
this pull request
Nov 14, 2026
unknwon
force-pushed
the
command-palette-flamego
branch
from
November 14, 2026 16:03
3e5fbd1 to
ef31f9b
Compare
unknwon
added a commit
that referenced
this pull request
Nov 14, 2026
unknwon
force-pushed
the
command-palette-flamego
branch
from
November 14, 2026 16:47
ef31f9b to
35e556f
Compare
unknwon
added a commit
that referenced
this pull request
Nov 14, 2026
unknwon
force-pushed
the
command-palette-flamego
branch
from
November 14, 2026 17:11
35e556f to
bf3074c
Compare
unknwon
added a commit
that referenced
this pull request
Nov 14, 2026
unknwon
force-pushed
the
command-palette-flamego
branch
from
November 14, 2026 18:49
bf3074c to
217d878
Compare
4 tasks done
unknwon
added a commit
that referenced
this pull request
Nov 14, 2026
unknwon
force-pushed
the
command-palette-flamego
branch
from
November 14, 2026 19:00
217d878 to
88de163
Compare
unknwon
added a commit
that referenced
this pull request
Nov 14, 2026
unknwon
force-pushed
the
command-palette-flamego
branch
from
November 14, 2026 19:23
88de163 to
cf31880
Compare
unknwon
added a commit
that referenced
this pull request
Nov 14, 2026
unknwon
force-pushed
the
command-palette-flamego
branch
from
November 15, 2026 01:22
e14b3a6 to
83d119e
Compare
unknwon
added a commit
that referenced
this pull request
Nov 15, 2026
unknwon
force-pushed
the
command-palette-flamego
branch
2 times, most recently
from
November 15, 2026 02:17
b382768 to
fe105df
Compare
unknwon
added a commit
that referenced
this pull request
Nov 15, 2026
unknwon
added a commit
that referenced
this pull request
Nov 15, 2026
unknwon
force-pushed
the
command-palette-flamego
branch
from
November 15, 2026 04:06
b382768 to
8cf033f
Compare
unknwon
added a commit
that referenced
this pull request
Nov 15, 2026
unknwon
force-pushed
the
command-palette-flamego
branch
from
November 15, 2026 04:21
8cf033f to
8dc26d1
Compare
unknwon
added a commit
that referenced
this pull request
Nov 15, 2026
unknwon
force-pushed
the
command-palette-flamego
branch
from
November 15, 2026 04:36
8dc26d1 to
17c0e7d
Compare
unknwon
added a commit
that referenced
this pull request
Nov 15, 2026
unknwon
force-pushed
the
command-palette-flamego
branch
from
November 15, 2026 05:02
17c0e7d to
6a8bc55
Compare
unknwon
added a commit
that referenced
this pull request
Nov 15, 2026
unknwon
force-pushed
the
command-palette-flamego
branch
from
November 15, 2026 05:34
6a8bc55 to
e26db76
Compare
unknwon
added a commit
that referenced
this pull request
Nov 15, 2026
3 of 4 tasks
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
unknwon
commented
Nov 17, 2026
Comment on lines
+187
to
+190
| limit := c.QueryInt("limit") | ||
| if limit <= 0 || limit > codeSearchMaxResults { | ||
| limit = codeSearchMaxResults | ||
| } |
Member
Author
There was a problem hiding this comment.
Done in 2b1cf22: limit := max(1, min(c.QueryInt("limit", codeSearchMaxResults), codeSearchMaxResults)). A missing limit still means 200. A limit of 0 or one that isn't a number now means 1 rather than 200.
unknwon
commented
Nov 17, 2026
| file_too_big = File size ({{filesize}} MB) exceeds maximum size ({{maxFilesize}} MB). | ||
| remove_file = Remove file | ||
|
|
||
| [palette] |
Member
Author
There was a problem hiding this comment.
Suggested change
| [palette] | |
| [command_palette] |
Member
Author
There was a problem hiding this comment.
Done in 2b1cf22: the section is [command_palette] and every key in the frontend uses command_palette..
Ctrl K or ⌘K opens a palette that jumps to issues and pull requests,
files, repositories, people, pages and settings, and runs actions such as
switching the theme, starring a repository or copying its clone URL. Inside
a repository it also lists matching lines of code as you type. The >, #, @
and / prefixes limit the results to commands, issues, people or code. Its
navbar button replaces the code search box.
The palette finds issues and pull requests by title or number with
GET /api/web/search/issues, and lists the files of a repository with
GET /api/web/{owner}/{repo}/paths.
Since the glass look, the file tree of the code browser was as tall as the file view, so a long tree beside a short file was squashed, and a short tree stretched the file view. Now the file view is as tall as its content, and the tree as tall as its rows, up to the height of the window, scrolling inside beyond that.
READMEs that center content with <div align="center"> or size images with width and height now render as they do on GitHub.
Body text is 16px, headings 2em down to 0.85em, code 85%, keyboard keys 11px and footnotes 12px, with GitHub's line heights.
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe the pull request
Adds a command palette that opens with Ctrl K or ⌘K on any page, or from the "Search or jump to…" button in the navbar, which replaces the code search box from #8549. It builds all three directions of the mock together: jump-first results, matching lines of code as you type inside a repository, and the
>,#,@and/prefixes.New endpoints:
GET /api/web/search/issues?q=&repo=: issues and pull requests by number (12or#12, matched first) or by words in the title, ignoring case, open ones first, then the most recently updated, at most 10. Withoutrepoit searches every repository the viewer can see, like code search. Issues follow the same access as the issue list (readers, or anyone when guests can view issues, and not with an external tracker), and pull requests need read access and pulls enabled. Backed bydatabase.SearchIssues.GET /api/web/{owner}/{repo}/paths, which is already on main. The browser keeps the list for five minutes per repository.GET /api/web/{owner}/{repo}/searchtakes alimit, so the palette asks for five lines and the search stops early.viewerCanWrite, anddefaultBranchandcloneLinksfor viewers who can read the code. The palette uses them to decide which rows to show.Details:
owner/repochip. Its × button, or Backspace in an empty box, searches everywhere instead. Each opening starts scoped again.>lists every matching command,#issues and pull requests only,@people and organizations, and/code in the repository (path:works) plus the code search row.viewerCanWriteandviewerCanAdminister. Signed-out viewers get sign in and register instead of account pages.aria-activedescendant, andaria-keyshortcutson both navbar buttons. The palette is a Radix dialog, so focus stays inside and goes back to the button on close.useDebouncedtolib/use-debounced.tsandsignOuttolib/sign-out.tsto share them. Removed thecompactprop ofCodeSearchInput, which only the navbar box used. Added the[palette]locale keys andrepo.unstar.File tree and file view heights
Also fixes the code browser, where since the glass look (#8647) the file tree was as tall as the file view, so a long tree beside a short file was squashed, and a short tree stretched the file view. Now each takes its own height: the file view is as tall as its content, and the tree as tall as its rows, up to the height of the window, scrolling inside beyond that.
ResizableSidebarlets its content shrink, so the tree scrolls rather than being cut off.README alignment and image sizes
Markdown keeps
align(left, center, right or justify) ondiv,pand headings, andwidth,heightandalignon images with a relative path, as GitHub does. Image sizes may end inpx, e.g., thewidth="201px"of the DigitalOcean logo, which browsers read as pixels. The gogs README's centered logo and badges now render centered. Before, the sanitizer droppedalignon blocks, and wrapping an image in a link to itself rebuilt theimgwith onlysrcandalt. An image withalign="left"oralign="right"floats so text flows around it.Rendered Markdown, e.g., READMEs, issues and wiki pages, uses GitHub's font sizes and line heights: body text 16px (was 14px), headings 2em, 1.5em, 1.25em, 1em, 0.875em and 0.85em, inline and fenced code 85%, keyboard keys 11px and footnotes 12px.
File card header
The header of a file no longer repeats its name and icon, which the breadcrumb above already shows. It starts with the Preview and Code switch, or with the line count for files without a preview. The name stays as a heading for screen readers, which labels the card. The
isReadmefield of the file response is removed, since only that icon read it.Behavior changes from legacy
/search, reachable from the palette and the mobile menu.Screenshots
In a repository: files, repository commands and code as you type
Empty box in a repository: prefixes, recent repositories, repository commands
Issues and pull requests come first
/code in the repository#issues and pull requests, dark glass>commands>commands, dark glassGlass look
Glass look, light
At 375px: the navbar search icon, the empty box, results, and dark glass
File tree and file view at their own heights
README alignment and image sizes
Markdown at GitHub's font sizes
Theme toggle
File card header without the repeated name
Checklist
Test plan
go test ./internal/git/ ./internal/database/ ./cmd/gogs/internal/web/passes.golangci-lint run ./...reports 0 issues. Inweb/,tsc -b,pnpm run lint, Prettier andpnpm run buildpass.The integration suite passes against PostgreSQL with
-shuffle=on, and every route has a test.TestIssueSearchcoversGET /api/web/search/issues:12and#12find that number.repo=or search its number. The owner finds them.The test fails when the read check on issues is removed, when pull requests ignore whether they are turned on, when the order is only by update time, without the number match, and with case-sensitive titles.
Built with
-tags prodand checked in the browser as alice on alice/alpha and acme/api (the gogs source): the empty box,readme(pull requests, thenREADME.md),webhook(files, a settings command and lines of code),/ ErrNotExist(eight lines of code),# crash,> set(15 settings rows),> glassturning glass mode on and then off, and> 简体and> englishswitching the language and back. Checked in light, dark, light glass and dark glass at 1280px and at 375px. With the glass look the page behind the palette is blurred. Nothing scrolls sideways at 375px.File tree and file view: measured both panels at 1280×900. The
alice/alphatree is 318px, its rows, beside a 723px README card. The gogs source tree stops at the window (795px) and scrolls inside, beside a 487px.gitignorecard and a 54,387pxinternal/database/repo.gocard. Each card is as tall as its content. Checked in light and dark glass.README alignment:
TestSanitizerkeepsalignondiv,pandh1and drops it onspanand for other values.TestMarkdown_SpecialLinksrenders a centereddivwhose relative image keepswidth,heightandaltafter being wrapped in a link, and apwithalign="middle"that loses it.TestSanitizerkeepswidth="201px"and drops20emand1px;color:red. Each test fails with its fix reverted.FuzzRenderran for 45 seconds without a difference between the fast path and the sanitizer. In the browser, the DigitalOcean logo in the acme/api README is 201px wide at 1280px and at 375px, and the README's three centered blocks havetext-align: center, and the logo is centered in the card. A demo file shows images at 120px and 240px, a right-aligned paragraph and a floated image, at 1280px and 375px with nothing scrolling sideways.Markdown sizes: on a file with every element, the computed sizes match GitHub's
github-markdown-css: body 16/24px, h1 to h6 32, 24, 20, 16, 14 and 13.6px with line height 1.25, inline code 13.6px,kbd11px, footnotes 12px, and fenced code 13.6px with 19.72px lines. A pull request description is 16px. Checked in light and dark glass at 1280px and at 375px, where nothing scrolls sideways.File card header: opened
.agents/skills/ghsa/SKILL.mdandgo.modin acme/api. The header has no file name or icon, and the card is still labelled by a visually hidden heading with the file name. Checked in light and dark glass at 1280px and at 375px, where nothing scrolls sideways.Theme toggle: in the palette, with the system theme on a light OS, "Switch to dark theme" turns the page dark and stores
dark, then reads "Switch to light theme" and turns it back. With the system theme on a dark OS it offers light.> togglelists it first and Enter runs it. Checked at 1280px and at 375px in glass.