agent: Optimize render_markdown_block function (#28487)
Co-Authored-by: Agus <agus@zed.dev> Closes #ISSUE Release Notes: - N/A Co-authored-by: Agus <agus@zed.dev>
This commit is contained in:
parent
9dfb907f97
commit
55760295d9
1 changed files with 7 additions and 4 deletions
|
@ -467,12 +467,15 @@ fn render_markdown_code_block(
|
|||
.element_background
|
||||
.blend(cx.theme().colors().editor_foreground.opacity(0.01));
|
||||
|
||||
let line_count = without_fences(&parsed_markdown.source()[codeblock_range.clone()])
|
||||
.lines()
|
||||
.count();
|
||||
|
||||
const CODE_FENCES_LINE_COUNT: usize = 2;
|
||||
const MAX_COLLAPSED_LINES: usize = 5;
|
||||
|
||||
let line_count = parsed_markdown.source()[codeblock_range.clone()]
|
||||
.bytes()
|
||||
.filter(|c| *c == b'\n')
|
||||
.count()
|
||||
.saturating_sub(CODE_FENCES_LINE_COUNT - 1);
|
||||
|
||||
let codeblock_header = h_flex()
|
||||
.group("codeblock_header")
|
||||
.p_1()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue