mirror of https://github.com/lapce/lapce.git
rename completion to completionwidget
This commit is contained in:
parent
5636d16f76
commit
9154fb6caf
|
@ -134,15 +134,19 @@ pub fn update_input(&mut self, ctx: &mut EventCtx, input: String) {
|
|||
}
|
||||
}
|
||||
|
||||
pub struct Completion {
|
||||
pub struct CompletionWidget {
|
||||
window_id: WindowId,
|
||||
tab_id: WidgetId,
|
||||
id: WidgetId,
|
||||
}
|
||||
|
||||
impl Completion {
|
||||
pub fn new(window_id: WindowId, tab_id: WidgetId, id: WidgetId) -> Completion {
|
||||
Completion {
|
||||
impl CompletionWidget {
|
||||
pub fn new(
|
||||
window_id: WindowId,
|
||||
tab_id: WidgetId,
|
||||
id: WidgetId,
|
||||
) -> CompletionWidget {
|
||||
CompletionWidget {
|
||||
window_id,
|
||||
tab_id,
|
||||
id,
|
||||
|
@ -225,7 +229,7 @@ fn paint_raw(&mut self, ctx: &mut PaintCtx, data: &LapceUIState, env: &Env) {
|
|||
}
|
||||
}
|
||||
|
||||
impl Widget<LapceUIState> for Completion {
|
||||
impl Widget<LapceUIState> for CompletionWidget {
|
||||
fn event(
|
||||
&mut self,
|
||||
ctx: &mut EventCtx,
|
||||
|
|
|
@ -2,15 +2,9 @@
|
|||
|
||||
use crate::state::Mode;
|
||||
use crate::{
|
||||
buffer::BufferId,
|
||||
buffer::BufferUIState,
|
||||
command::{LapceCommand, LapceUICommand, LAPCE_COMMAND, LAPCE_UI_COMMAND},
|
||||
completion::Completion,
|
||||
editor::Editor,
|
||||
editor::EditorState,
|
||||
editor::EditorUIState,
|
||||
completion::CompletionWidget,
|
||||
editor::EditorView,
|
||||
state::LapceTabState,
|
||||
state::LapceUIState,
|
||||
state::LAPCE_APP_STATE,
|
||||
theme::LapceTheme,
|
||||
|
@ -18,20 +12,12 @@
|
|||
use crate::{palette::Palette, split::LapceSplit};
|
||||
use crate::{scroll::LapceScroll, state::LapceFocus};
|
||||
use druid::piet::TextAttribute;
|
||||
use druid::FontDescriptor;
|
||||
use druid::FontFamily;
|
||||
use druid::FontWeight;
|
||||
use druid::TextLayout;
|
||||
use druid::{
|
||||
kurbo::{Line, Rect},
|
||||
piet::Text,
|
||||
piet::TextLayoutBuilder,
|
||||
widget::Container,
|
||||
widget::Flex,
|
||||
widget::IdentityWrapper,
|
||||
widget::Label,
|
||||
widget::SizedBox,
|
||||
Color, Command, MouseEvent, Selector, Target, Vec2, WidgetId,
|
||||
Color, Vec2, WidgetId,
|
||||
};
|
||||
use druid::{
|
||||
theme, BoxConstraints, Cursor, Data, Env, Event, EventCtx, LayoutCtx, LifeCycle,
|
||||
|
@ -52,7 +38,7 @@ pub struct LapceContainer {
|
|||
palette_rect: Rect,
|
||||
palette: WidgetPod<LapceUIState, Box<dyn Widget<LapceUIState>>>,
|
||||
editor_split: WidgetPod<LapceUIState, LapceSplit>,
|
||||
completion: WidgetPod<LapceUIState, Completion>,
|
||||
completion: WidgetPod<LapceUIState, CompletionWidget>,
|
||||
}
|
||||
|
||||
impl LapceContainer {
|
||||
|
@ -82,7 +68,7 @@ pub fn new(window_id: WindowId, tab_id: WidgetId) -> Self {
|
|||
.with_flex_child(editor_view, 1.0),
|
||||
);
|
||||
|
||||
let completion = WidgetPod::new(Completion::new(
|
||||
let completion = WidgetPod::new(CompletionWidget::new(
|
||||
window_id.clone(),
|
||||
tab_id.clone(),
|
||||
editor_split_state.completion.widget_id,
|
||||
|
|
|
@ -60,7 +60,8 @@ fn window_removed(
|
|||
|
||||
fn build_app(window_id: WindowId) -> impl Widget<LapceUIState> {
|
||||
let window = LapceWindow::new(window_id);
|
||||
window.env_scope(|env: &mut druid::Env, data: &LapceUIState| {
|
||||
window
|
||||
.env_scope(|env: &mut druid::Env, data: &LapceUIState| {
|
||||
let theme = &LAPCE_APP_STATE.theme;
|
||||
if let Some(line_highlight) = theme.get("line_highlight") {
|
||||
env.set(
|
||||
|
@ -104,7 +105,7 @@ fn build_app(window_id: WindowId) -> impl Widget<LapceUIState> {
|
|||
);
|
||||
env.set(theme::SCROLLBAR_COLOR, hex_to_color("#c4c4c4").unwrap());
|
||||
})
|
||||
// .debug_invalidation()
|
||||
.debug_invalidation()
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
|
|
Loading…
Reference in New Issue