Monster commit: native version
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
use crate::theme::editor_widget;
|
||||
use ratatui::{
|
||||
layout::Rect,
|
||||
style::{Color, Modifier, Style},
|
||||
style::{Modifier, Style},
|
||||
text::{Line, Span},
|
||||
widgets::{Clear, Paragraph},
|
||||
Frame,
|
||||
@@ -333,8 +334,8 @@ impl Editor {
|
||||
|
||||
pub fn render(&self, frame: &mut Frame, area: Rect, highlighter: Highlighter) {
|
||||
let (cursor_row, cursor_col) = self.text.cursor();
|
||||
let cursor_style = Style::default().bg(Color::White).fg(Color::Black);
|
||||
let selection_style = Style::default().bg(Color::Rgb(60, 80, 120));
|
||||
let cursor_style = Style::default().bg(editor_widget::CURSOR_BG).fg(editor_widget::CURSOR_FG);
|
||||
let selection_style = Style::default().bg(editor_widget::SELECTION_BG);
|
||||
|
||||
let selection = self.text.selection_range();
|
||||
|
||||
@@ -412,9 +413,9 @@ impl Editor {
|
||||
let list_area = Rect::new(popup_x, popup_y, list_width, total_height);
|
||||
frame.render_widget(Clear, list_area);
|
||||
|
||||
let highlight_style = Style::default().fg(Color::Yellow).add_modifier(Modifier::BOLD);
|
||||
let normal_style = Style::default().fg(Color::White);
|
||||
let bg_style = Style::default().bg(Color::Rgb(30, 30, 40));
|
||||
let highlight_style = Style::default().fg(editor_widget::COMPLETION_SELECTED).add_modifier(Modifier::BOLD);
|
||||
let normal_style = Style::default().fg(editor_widget::COMPLETION_FG);
|
||||
let bg_style = Style::default().bg(editor_widget::COMPLETION_BG);
|
||||
|
||||
let list_lines: Vec<Line> = (scroll_offset..scroll_offset + visible_count)
|
||||
.map(|i| {
|
||||
@@ -427,7 +428,7 @@ impl Editor {
|
||||
};
|
||||
let prefix = if i == self.completion.cursor { "> " } else { " " };
|
||||
let display = format!("{prefix}{name:<width$}", width = list_width as usize - 2);
|
||||
Line::from(Span::styled(display, style.bg(Color::Rgb(30, 30, 40))))
|
||||
Line::from(Span::styled(display, style.bg(editor_widget::COMPLETION_BG)))
|
||||
})
|
||||
.collect();
|
||||
|
||||
@@ -450,15 +451,15 @@ impl Editor {
|
||||
let candidate = &self.completion.candidates[selected_idx];
|
||||
|
||||
let name_style = Style::default()
|
||||
.fg(Color::Yellow)
|
||||
.fg(editor_widget::COMPLETION_SELECTED)
|
||||
.add_modifier(Modifier::BOLD)
|
||||
.bg(Color::Rgb(30, 30, 40));
|
||||
.bg(editor_widget::COMPLETION_BG);
|
||||
let desc_style = Style::default()
|
||||
.fg(Color::White)
|
||||
.bg(Color::Rgb(30, 30, 40));
|
||||
.fg(editor_widget::COMPLETION_FG)
|
||||
.bg(editor_widget::COMPLETION_BG);
|
||||
let example_style = Style::default()
|
||||
.fg(Color::Rgb(120, 200, 160))
|
||||
.bg(Color::Rgb(30, 30, 40));
|
||||
.fg(editor_widget::COMPLETION_EXAMPLE)
|
||||
.bg(editor_widget::COMPLETION_BG);
|
||||
|
||||
let w = doc_width as usize;
|
||||
let mut doc_lines: Vec<Line> = Vec::new();
|
||||
|
||||
Reference in New Issue
Block a user