MCPcopy Create free account
hub / github.com/Eeive/Evcode-ide / draw_tabs

Function draw_tabs

src/ui/tabs.rs:11–40  ·  view source on GitHub ↗
(f: &mut Frame, area: Rect, app: &App, colors: &Colors)

Source from the content-addressed store, hash-verified

9};
10
11pub fn draw_tabs(f: &mut Frame, area: Rect, app: &App, colors: &Colors) {
12 let titles: Vec<Line> = app
13 .editor
14 .files
15 .iter()
16 .enumerate()
17 .map(|(i, file)| {
18 let num = format!("[{}] ", i + 1);
19 let name = file.title();
20 Line::from(vec![
21 Span::styled(num, Style::default().fg(colors.muted)),
22 Span::styled(name, Style::default().fg(colors.text)),
23 ])
24 })
25 .collect();
26
27 let tabs = Tabs::new(titles)
28 .block(Block::default())
29 .select(app.editor.current_file)
30 .style(Style::default().fg(colors.muted).bg(colors.bg))
31 .highlight_style(
32 Style::default()
33 .fg(colors.accent)
34 .bg(colors.bg)
35 .add_modifier(Modifier::BOLD),
36 )
37 .divider(Span::styled(" │ ", Style::default().fg(colors.border)));
38
39 f.render_widget(tabs, area);
40}

Callers 1

drawFunction · 0.85

Calls 1

titleMethod · 0.80

Tested by

no test coverage detected