1use ratatui::{
2 layout::{Constraint, Direction, Layout, Rect},
3 style::{Color, Modifier, Style},
4 text::{Line, Span},
5 widgets::{Block, BorderType, Borders, Clear, List, ListItem, Paragraph, Wrap},
6 Frame,
7};
8
9use crate::app::{App, DeleteTarget, Modal};
10use crate::format::format_bytes;
11use crate::input::{InputMode, TextInput};
12use crate::ui::theme;
13
14fn render_text_input(input: &TextInput, is_active: bool) -> Vec<Span<'static>> {
15 let base_style = if is_active {
16 Style::default().fg(theme::FG_TEXT).bg(theme::BG_HIGHLIGHT)
17 } else {
18 Style::default().fg(theme::FG_MUTED)
19 };
20
21 if !is_active {
22 return vec![Span::styled(input.value.clone(), base_style)];
23 }
24
25 let chars: Vec<char> = input.value.chars().collect();
26 let cursor = input.cursor.min(chars.len());
27 let before: String = chars[..cursor].iter().collect();
28 let cursor_ch = chars.get(cursor).copied().unwrap_or(' ');
29 let after: String = if cursor < chars.len() {
30 chars[cursor + 1..].iter().collect()
31 } else {
32 String::new()
33 };
34
35 let cursor_style = match input.mode {
36 InputMode::Insert => Style::default()
37 .fg(theme::BG_DARK)
38 .bg(theme::ACCENT_GREEN)
39 .add_modifier(Modifier::BOLD),
40 InputMode::Normal => Style::default()
41 .fg(theme::BG_DARK)
42 .bg(theme::ACCENT_BLUE)
43 .add_modifier(Modifier::BOLD),
44 };
45
46 let mut spans = Vec::new();
47 if !before.is_empty() {
48 spans.push(Span::styled(before, base_style));
49 }
50 spans.push(Span::styled(cursor_ch.to_string(), cursor_style));
51 if !after.is_empty() {
52 spans.push(Span::styled(after, base_style));
53 }
54 spans
55}
56
57pub fn render(f: &mut Frame, app: &App) {
58 let modal = match &app.modal {
59 Some(m) => m,
60 None => return,
61 };
62
63 match modal {
64 Modal::HostSwitcher {
65 cursor,
66 custom_input,
67 entering_custom,
68 } => render_host_switcher(f, app, *cursor, custom_input, *entering_custom),
69 Modal::Search { input } => render_search(f, input),
70 Modal::QuickAppendPrompt {
71 content_input,
72 section_input,
73 as_task,
74 focus_field,
75 } => render_quick_append(f, content_input, section_input, *as_task, *focus_field),
76 Modal::ProjectForm {
77 id,
78 name_input,
79 desc_input,
80 focus_desc,
81 } => render_project_form(f, id.is_some(), name_input, desc_input, *focus_desc),
82 Modal::PromptForm {
83 id,
84 title_input,
85 project_choice_idx,
86 pinned,
87 focus_field,
88 } => render_prompt_form(
89 f,
90 app,
91 id.is_some(),
92 title_input,
93 *project_choice_idx,
94 *pinned,
95 *focus_field,
96 ),
97 Modal::ConfirmDelete { target } => render_confirm_delete(f, target),
98 Modal::Attachments {
99 cursor,
100 upload_input,
101 dest_input,
102 } => render_attachments(
103 f,
104 app,
105 *cursor,
106 upload_input.as_ref(),
107 dest_input.as_ref(),
108 ),
109 Modal::Help => render_help(f, app.config.allow_host_switcher),
110 }
111}
112
113fn centered_rect(percent_x: u16, percent_y: u16, r: Rect) -> Rect {
114 let popup_layout = Layout::default()
115 .direction(Direction::Vertical)
116 .constraints([
117 Constraint::Percentage((100 - percent_y) / 2),
118 Constraint::Percentage(percent_y),
119 Constraint::Percentage((100 - percent_y) / 2),
120 ])
121 .split(r);
122
123 Layout::default()
124 .direction(Direction::Horizontal)
125 .constraints([
126 Constraint::Percentage((100 - percent_x) / 2),
127 Constraint::Percentage(percent_x),
128 Constraint::Percentage((100 - percent_x) / 2),
129 ])
130 .split(popup_layout[1])[1]
131}
132
133fn render_host_switcher(
134 f: &mut Frame,
135 app: &App,
136 cursor: usize,
137 custom_input: &TextInput,
138 entering_custom: bool,
139) {
140 let area = centered_rect(60, 45, f.area());
141 f.render_widget(Clear, area);
142
143 let block = Block::default()
144 .title(" Switch Devbook Host URL ")
145 .borders(Borders::ALL)
146 .border_type(BorderType::Thick)
147 .border_style(Style::default().fg(theme::ACCENT_BLUE))
148 .style(Style::default().bg(theme::BG_DARK));
149
150 let inner = block.inner(area);
151 f.render_widget(block, area);
152
153 let mut lines = Vec::new();
154 lines.push(Line::from(Span::styled(
155 format!("Current Active Host: {}", app.config.base_url),
156 Style::default()
157 .fg(Color::LightCyan)
158 .add_modifier(Modifier::BOLD),
159 )));
160 lines.push(Line::from(""));
161 lines.push(Line::from(Span::styled(
162 "Preset Hosts:",
163 Style::default().fg(Color::Gray),
164 )));
165
166 for (i, preset) in app.preset_hosts.iter().enumerate() {
167 let is_sel = !entering_custom && cursor == i;
168 let prefix = if is_sel { " ▶ " } else { " " };
169 let style = if is_sel {
170 Style::default()
171 .fg(Color::Cyan)
172 .add_modifier(Modifier::BOLD)
173 } else if *preset == app.config.base_url {
174 Style::default().fg(Color::Green)
175 } else {
176 Style::default().fg(Color::White)
177 };
178 let active_mark = if *preset == app.config.base_url {
179 " (active)"
180 } else {
181 ""
182 };
183 lines.push(Line::from(vec![
184 Span::styled(prefix, style),
185 Span::styled(preset.as_str(), style),
186 Span::styled(active_mark, Style::default().fg(Color::Green)),
187 ]));
188 }
189
190 lines.push(Line::from(""));
191 let custom_sel = entering_custom || cursor == app.preset_hosts.len();
192 let custom_prefix = if custom_sel {
193 " ▶ Custom URL: "
194 } else {
195 " Custom URL: "
196 };
197 let custom_style = if custom_sel {
198 Style::default()
199 .fg(Color::Cyan)
200 .add_modifier(Modifier::BOLD)
201 } else {
202 Style::default().fg(Color::Gray)
203 };
204
205 let mut custom_line = vec![Span::styled(custom_prefix, custom_style)];
206 if custom_input.value.is_empty() && !entering_custom {
207 custom_line.push(Span::styled(
208 "(type or press c to enter)",
209 Style::default().fg(theme::FG_MUTED),
210 ));
211 } else {
212 custom_line.extend(render_text_input(custom_input, entering_custom));
213 }
214 lines.push(Line::from(custom_line));
215
216 lines.push(Line::from(""));
217 lines.push(Line::from(Span::styled(
218 "Keys: j/k: select preset | Enter: switch | c: custom input | Esc: cancel",
219 Style::default().fg(Color::DarkGray),
220 )));
221
222 f.render_widget(Paragraph::new(lines).wrap(Wrap { trim: false }), inner);
223}
224
225fn render_search(f: &mut Frame, input: &TextInput) {
226 let area = centered_rect(60, 20, f.area());
227 f.render_widget(Clear, area);
228
229 let block = Block::default()
230 .title(" Search Prompts ")
231 .borders(Borders::ALL)
232 .border_type(BorderType::Thick)
233 .border_style(Style::default().fg(theme::ACCENT_BLUE))
234 .style(Style::default().bg(theme::BG_DARK));
235
236 let inner = block.inner(area);
237 f.render_widget(block, area);
238
239 let mut query_line = vec![Span::styled(
240 " Query: ",
241 Style::default().fg(theme::ACCENT_CYAN),
242 )];
243 query_line.extend(render_text_input(input, true));
244
245 let lines = vec![
246 Line::from(Span::styled(
247 "Type search query (matches title or prompt body):",
248 Style::default().fg(theme::FG_MUTED),
249 )),
250 Line::from(""),
251 Line::from(query_line),
252 Line::from(""),
253 Line::from(Span::styled(
254 "Press Enter to apply filter, Esc to cancel / clear",
255 Style::default().fg(theme::FG_MUTED),
256 )),
257 ];
258
259 f.render_widget(Paragraph::new(lines), inner);
260}
261
262fn render_quick_append(
263 f: &mut Frame,
264 content_input: &TextInput,
265 section_input: &TextInput,
266 as_task: bool,
267 focus_field: usize,
268) {
269 let area = centered_rect(65, 45, f.area());
270 f.render_widget(Clear, area);
271
272 let block = Block::default()
273 .title(" Quick Append to Prompt ")
274 .borders(Borders::ALL)
275 .border_type(BorderType::Thick)
276 .border_style(Style::default().fg(theme::ACCENT_BLUE))
277 .style(Style::default().bg(theme::BG_DARK));
278
279 let inner = block.inner(area);
280 f.render_widget(block, area);
281
282 let task_mode_str = if as_task {
283 "[x] Append as checklist task (- [ ] ...)"
284 } else {
285 "[ ] Append as normal Markdown prose"
286 };
287
288 let task_style = if as_task {
289 Style::default()
290 .fg(theme::ACCENT_GREEN)
291 .add_modifier(Modifier::BOLD)
292 } else {
293 Style::default().fg(theme::FG_MUTED)
294 };
295
296 let mut sec_line = vec![Span::styled(
297 " Section: ## ",
298 Style::default().fg(theme::ACCENT_BLUE),
299 )];
300 sec_line.extend(render_text_input(section_input, focus_field == 0));
301
302 let mut content_line = vec![Span::styled(
303 " Text: ",
304 Style::default().fg(theme::ACCENT_BLUE),
305 )];
306 content_line.extend(render_text_input(content_input, focus_field == 1));
307
308 let lines = vec![
309 Line::from(Span::styled(
310 "Optional Section Heading (e.g. 'Instructions' or 'Examples'):",
311 Style::default().fg(theme::ACCENT_CYAN),
312 )),
313 Line::from(sec_line),
314 Line::from(""),
315 Line::from(Span::styled(
316 "Content to append:",
317 Style::default().fg(theme::ACCENT_CYAN),
318 )),
319 Line::from(content_line),
320 Line::from(""),
321 Line::from(Span::styled(task_mode_str, task_style)),
322 Line::from(""),
323 Line::from(Span::styled(
324 "Keys: Tab: switch field | Space: toggle task | Enter: append | Esc: cancel",
325 Style::default().fg(theme::FG_MUTED),
326 )),
327 ];
328
329 f.render_widget(Paragraph::new(lines).wrap(Wrap { trim: false }), inner);
330}
331
332fn render_project_form(
333 f: &mut Frame,
334 is_edit: bool,
335 name_input: &TextInput,
336 desc_input: &TextInput,
337 focus_desc: bool,
338) {
339 let area = centered_rect(55, 35, f.area());
340 f.render_widget(Clear, area);
341
342 let title = if is_edit {
343 " Edit Project "
344 } else {
345 " Create New Project "
346 };
347
348 let block = Block::default()
349 .title(title)
350 .borders(Borders::ALL)
351 .border_type(BorderType::Thick)
352 .border_style(Style::default().fg(theme::ACCENT_BLUE))
353 .style(Style::default().bg(theme::BG_DARK));
354
355 let inner = block.inner(area);
356 f.render_widget(block, area);
357
358 let mut name_line = vec![Span::styled(
359 " Name: ",
360 Style::default().fg(theme::ACCENT_BLUE),
361 )];
362 name_line.extend(render_text_input(name_input, !focus_desc));
363
364 let mut desc_line = vec![Span::styled(
365 " Desc: ",
366 Style::default().fg(theme::ACCENT_BLUE),
367 )];
368 desc_line.extend(render_text_input(desc_input, focus_desc));
369
370 let lines = vec![
371 Line::from(Span::styled(
372 "Project Name (required):",
373 Style::default().fg(theme::ACCENT_CYAN),
374 )),
375 Line::from(name_line),
376 Line::from(""),
377 Line::from(Span::styled(
378 "Description (optional):",
379 Style::default().fg(theme::ACCENT_CYAN),
380 )),
381 Line::from(desc_line),
382 Line::from(""),
383 Line::from(Span::styled(
384 "Keys: Tab: switch field | Enter: save | Esc: cancel",
385 Style::default().fg(theme::FG_MUTED),
386 )),
387 ];
388
389 f.render_widget(Paragraph::new(lines).wrap(Wrap { trim: false }), inner);
390}
391
392fn render_prompt_form(
393 f: &mut Frame,
394 app: &App,
395 is_edit: bool,
396 title_input: &TextInput,
397 project_choice_idx: usize,
398 pinned: bool,
399 focus_field: usize,
400) {
401 let area = centered_rect(65, 45, f.area());
402 f.render_widget(Clear, area);
403
404 let modal_title = if is_edit {
405 " Edit Prompt Metadata "
406 } else {
407 " Create New Prompt "
408 };
409
410 let block = Block::default()
411 .title(modal_title)
412 .borders(Borders::ALL)
413 .border_type(BorderType::Thick)
414 .border_style(Style::default().fg(theme::ACCENT_BLUE))
415 .style(Style::default().bg(theme::BG_DARK));
416
417 let inner = block.inner(area);
418 f.render_widget(block, area);
419
420 let proj_label = if project_choice_idx == 0 {
421 "(None — Standalone scratchpad)".to_string()
422 } else if let Some(p) = app.projects.get(project_choice_idx - 1) {
423 format!("{} (ID: {})", p.name, p.id)
424 } else {
425 "(None)".to_string()
426 };
427
428 let proj_style = if focus_field == 1 {
429 Style::default()
430 .fg(Color::Cyan)
431 .add_modifier(Modifier::BOLD)
432 } else {
433 Style::default().fg(Color::Gray)
434 };
435
436 let pin_str = if pinned {
437 "[x] Pinned (★)"
438 } else {
439 "[ ] Not Pinned"
440 };
441
442 let pin_style = if focus_field == 2 {
443 Style::default()
444 .fg(Color::LightCyan)
445 .add_modifier(Modifier::BOLD)
446 } else {
447 Style::default().fg(Color::Gray)
448 };
449
450 let mut title_line = vec![Span::styled(
451 " Title: ",
452 Style::default().fg(theme::ACCENT_BLUE),
453 )];
454 title_line.extend(render_text_input(title_input, focus_field == 0));
455
456 let lines = vec![
457 Line::from(Span::styled(
458 "Prompt Title (required):",
459 Style::default().fg(theme::ACCENT_CYAN),
460 )),
461 Line::from(title_line),
462 Line::from(""),
463 Line::from(Span::styled(
464 "Assigned Project (Left/Right to choose):",
465 Style::default().fg(Color::LightCyan),
466 )),
467 Line::from(vec![
468 Span::styled(" Project: ", Style::default().fg(Color::Cyan)),
469 Span::styled(format!("◀ {} ▶", proj_label), proj_style),
470 ]),
471 Line::from(""),
472 Line::from(vec![
473 Span::styled(" Pinned: ", Style::default().fg(Color::Cyan)),
474 Span::styled(pin_str, pin_style),
475 ]),
476 Line::from(""),
477 Line::from(Span::styled(
478 "Keys: Tab/Shift-Tab: navigate | h/l: select project | Space: toggle pin | Enter: save | Esc: cancel",
479 Style::default().fg(Color::DarkGray),
480 )),
481 ];
482
483 f.render_widget(Paragraph::new(lines).wrap(Wrap { trim: false }), inner);
484}
485
486fn render_confirm_delete(f: &mut Frame, target: &DeleteTarget) {
487 let area = centered_rect(50, 25, f.area());
488 f.render_widget(Clear, area);
489
490 let (type_name, obj_name) = match target {
491 DeleteTarget::Project(p) => ("Project", p.name.as_str()),
492 DeleteTarget::Prompt(p) => ("Prompt", p.title.as_str()),
493 DeleteTarget::Attachment { filename, .. } => ("Attachment", filename.as_str()),
494 };
495
496 let block = Block::default()
497 .title(format!(" Confirm Delete {} ", type_name))
498 .borders(Borders::ALL)
499 .border_type(BorderType::Rounded)
500 .border_style(Style::default().fg(Color::Red));
501
502 let inner = block.inner(area);
503 f.render_widget(block, area);
504
505 let lines = vec![
506 Line::from(Span::styled(
507 format!("Are you sure you want to delete this {}?", type_name),
508 Style::default().fg(Color::White),
509 )),
510 Line::from(""),
511 Line::from(Span::styled(
512 format!(" ▶ \"{}\"", obj_name),
513 Style::default()
514 .fg(Color::Red)
515 .add_modifier(Modifier::BOLD),
516 )),
517 Line::from(""),
518 Line::from(Span::styled(
519 "Press 'y' to confirm delete, 'n' or Esc to cancel",
520 Style::default().fg(Color::DarkGray),
521 )),
522 ];
523
524 f.render_widget(Paragraph::new(lines).wrap(Wrap { trim: false }), inner);
525}
526
527fn render_attachments(
528 f: &mut Frame,
529 app: &App,
530 cursor: usize,
531 upload_input: Option<&TextInput>,
532 dest_input: Option<&TextInput>,
533) {
534 let area = centered_rect(75, 65, f.area());
535 f.render_widget(Clear, area);
536
537 let prompt_title = app
538 .current_prompt
539 .as_ref()
540 .map(|p| p.title.as_str())
541 .unwrap_or("Prompt");
542
543 let block = Block::default()
544 .title(format!(" Attachments Manager — \"{}\" ", prompt_title))
545 .borders(Borders::ALL)
546 .border_type(BorderType::Rounded)
547 .border_style(Style::default().fg(Color::Cyan));
548
549 let inner = block.inner(area);
550 f.render_widget(block, area);
551
552 if let Some(input) = upload_input {
554 let input_lines = vec![
555 Line::from(Span::styled(
556 "Upload File to Prompt Attachments",
557 Style::default()
558 .fg(Color::Cyan)
559 .add_modifier(Modifier::BOLD),
560 )),
561 Line::from(""),
562 Line::from(Span::styled(
563 "Enter absolute or relative path to file:",
564 Style::default().fg(Color::Gray),
565 )),
566 Line::from({
567 let mut line = vec![Span::styled(" Path: ", Style::default().fg(theme::ACCENT_CYAN))];
568 line.extend(render_text_input(input, true));
569 line
570 }),
571 Line::from(""),
572 Line::from(Span::styled(
573 "Press Enter to upload, Esc to cancel",
574 Style::default().fg(Color::DarkGray),
575 )),
576 ];
577 f.render_widget(Paragraph::new(input_lines), inner);
578 return;
579 }
580
581 if let Some(input) = dest_input {
582 let input_lines = vec![
583 Line::from(Span::styled(
584 "Save Attachment to Local Disk",
585 Style::default()
586 .fg(Color::Cyan)
587 .add_modifier(Modifier::BOLD),
588 )),
589 Line::from(""),
590 Line::from(Span::styled(
591 "Enter destination file path:",
592 Style::default().fg(Color::Gray),
593 )),
594 Line::from({
595 let mut line = vec![Span::styled(" Dest: ", Style::default().fg(theme::ACCENT_CYAN))];
596 line.extend(render_text_input(input, true));
597 line
598 }),
599 Line::from(""),
600 Line::from(Span::styled(
601 "Press Enter to download, Esc to cancel",
602 Style::default().fg(Color::DarkGray),
603 )),
604 ];
605 f.render_widget(Paragraph::new(input_lines), inner);
606 return;
607 }
608
609 let mut items = Vec::new();
610 let attachments = app
611 .current_prompt
612 .as_ref()
613 .map(|p| &p.attachments)
614 .cloned()
615 .unwrap_or_default();
616
617 if attachments.is_empty() {
618 items.push(ListItem::new(Line::from(Span::styled(
619 " (no attachments on this prompt — press 'u' to upload a file)",
620 Style::default().fg(Color::DarkGray),
621 ))));
622 } else {
623 for (i, att) in attachments.iter().enumerate() {
624 let is_sel = cursor == i;
625 let prefix = if is_sel { "▶ " } else { " " };
626 let style = if is_sel {
627 Style::default()
628 .fg(Color::Cyan)
629 .add_modifier(Modifier::BOLD)
630 } else {
631 Style::default().fg(Color::White)
632 };
633
634 let size_str = format_bytes(att.byte_size.unwrap_or(0));
635 let line = Line::from(vec![
636 Span::styled(prefix, style),
637 Span::styled(format!("{:<30} ", att.filename), style),
638 Span::styled(
639 format!("{:>10} ", size_str),
640 Style::default().fg(Color::LightCyan),
641 ),
642 Span::styled(
643 att.content_type.as_deref().unwrap_or("unknown"),
644 Style::default().fg(Color::DarkGray),
645 ),
646 ]);
647 items.push(ListItem::new(line));
648 }
649 }
650
651 let layout = Layout::default()
652 .direction(Direction::Vertical)
653 .constraints([Constraint::Min(0), Constraint::Length(2)])
654 .split(inner);
655
656 f.render_widget(List::new(items), layout[0]);
657
658 let footer = Paragraph::new(Line::from(Span::styled(
659 "Keys: j/k: select | u: upload file | s: save to disk | y: copy URL | d: delete | Esc: close",
660 Style::default().fg(Color::DarkGray),
661 )));
662 f.render_widget(footer, layout[1]);
663}
664
665fn render_help(f: &mut Frame, allow_switch: bool) {
666 let area = centered_rect(76, 78, f.area());
667 f.render_widget(Clear, area);
668
669 let block = Block::default()
670 .title(" Devbook-TUI Keyboard Shortcuts & Help ")
671 .borders(Borders::ALL)
672 .border_type(BorderType::Rounded)
673 .border_style(Style::default().fg(Color::Cyan));
674
675 let inner = block.inner(area);
676 f.render_widget(block, area);
677
678 let host_line = if allow_switch {
679 Line::from(" H / u Switch Host URL presets or enter custom URL")
680 } else {
681 Line::from(
682 " H / u [Locked by DEVBOOK_REMOTE_URL] (pass --allow-switch to enable)",
683 )
684 };
685
686 let lines = vec![
687 Line::from(Span::styled(
688 "Navigation & Focus",
689 Style::default()
690 .fg(Color::Cyan)
691 .add_modifier(Modifier::BOLD),
692 )),
693 Line::from(" 1, 2, 3 Direct focus to pane 1 (Sidebar), 2 (Prompts), 3 (Detail)"),
694 Line::from(" Tab / BackTab Cycle focus forward / backward between panes"),
695 Line::from(" h / l Move focus left / right"),
696 Line::from(" j / k Move selection down / up in focused pane"),
697 Line::from(" Enter Enter pane 2 from sidebar, or pane 3 from prompts list"),
698 Line::from(""),
699 Line::from(Span::styled(
700 "Prompt Detail, Markdown & Checklists (Pane 3)",
701 Style::default()
702 .fg(Color::Cyan)
703 .add_modifier(Modifier::BOLD),
704 )),
705 Line::from(" v / m Toggle between Styled Preview and Raw Markdown (line numbers)"),
706 Line::from(" j / k Scroll prompt (or navigate checklist items when present)"),
707 Line::from(" Space / Enter Toggle active checklist item [ ] ⇄ [x] (if prompt has tasks)"),
708 Line::from(" a Quick-append Markdown section, log entry, or task to prompt"),
709 Line::from(" E Open prompt Markdown body in external $EDITOR (nvim/vim/nano)"),
710 Line::from(" J / K Scroll detail document view down / up by 3 lines"),
711 Line::from(" g / G Jump to top / bottom of prompt document"),
712 Line::from(" c / Y Copy entire Markdown body to system clipboard"),
713 Line::from(" y Yank active task text (or prompt title) to system clipboard"),
714 Line::from(""),
715 Line::from(Span::styled(
716 "Workspace Management & Modals",
717 Style::default()
718 .fg(Color::Cyan)
719 .add_modifier(Modifier::BOLD),
720 )),
721 host_line,
722 Line::from(" / Search & filter prompts by title or body in real-time"),
723 Line::from(" n Create New Project (in pane 1) or Prompt (in pane 2/3)"),
724 Line::from(" e Edit metadata of selected Project or Prompt"),
725 Line::from(" d Delete selected Project, Prompt, or Attachment"),
726 Line::from(" p Toggle pinned status of selected Prompt"),
727 Line::from(" K / J Reorder pinned prompts up / down (in Pinned scope)"),
728 Line::from(" A Open attachments manager modal (upload, download, delete)"),
729 Line::from(" r Refresh all data from Devbook server"),
730 Line::from(" ? Open this help dialog"),
731 Line::from(" q Quit application (or Esc to close dialogs)"),
732 ];
733
734 f.render_widget(Paragraph::new(lines).wrap(Wrap { trim: false }), inner);
735}