0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-02-24 06:13:00 +01:00

3 Commits

Author SHA1 Message Date
silverwind
dbb8312ff3
DRY blob excerpt: unified single/batch path, single-pass highlighting
- Merge ExcerptBlob and excerptBlobBatch into a single unified flow
  that handles both single and batch requests without duplicated code
- Extract parseBatchBlobExcerptOptions to DRY the repetitive splitInts calls
- Refactor BuildBlobExcerptDiffSection to separate section building from
  highlighting, enabling BuildBlobExcerptDiffSections (plural) to highlight
  the file content only once for all sections instead of N times
- Add blob size limit check (MaxDisplayFileSize) before io.ReadAll to
  prevent OOM on large files

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 13:08:24 +01:00
wxiaoguang
0d8bd7720d
Refactor highlight and diff (#36599)
1. fix a performance regression when using line-by-line highlighting
* the root cause is that chroma's `lexers.Get` is slow and a lexer cache
is missing during recent changes
2. clarify the chroma lexer detection behavior
* now we fully manage our logic to detect lexer, and handle overriding
problems, everything is fully under control
3. clarify "code analyze" behavior, now only 2 usages:
* only use file name and language to detect lexer (very fast), mainly
for "diff" page which contains a lot of files
* if no lexer is detected by file name and language, use code content to
detect again (slow), mainly for "view file" or "blame" page, which can
get best result
4. fix git diff bug, it caused "broken pipe" error for large diff files
2026-02-13 00:15:46 +00:00
wxiaoguang
8cc8150922
Use full-file highlighting for diff sections (#36561)
* Fix #35252
* Fix #35999
* Improve diff rendering, don't add unnecessary "added"/"removed" tags for a full-line change
* Also fix a "space trimming" bug in #36539 and add tests
* Use chroma "SQL" lexer instead of "MySQL" to workaround a bug (35999)
2026-02-10 03:29:28 +00:00