Improve the "go to line" modal (#21301)
Just a small, mostly visual refinement to this component. <img width="700" alt="Screenshot 2024-11-28 at 16 30 27" src="https://github.com/user-attachments/assets/d5bbed63-202c-4cd3-b4b0-b7ed23466309"> Release Notes: - N/A
This commit is contained in:
parent
ae85ecba2d
commit
e76589107d
1 changed files with 18 additions and 27 deletions
|
@ -9,7 +9,7 @@ use gpui::{
|
||||||
use settings::Settings;
|
use settings::Settings;
|
||||||
use text::{Bias, Point};
|
use text::{Bias, Point};
|
||||||
use theme::ActiveTheme;
|
use theme::ActiveTheme;
|
||||||
use ui::{h_flex, prelude::*, v_flex, Label};
|
use ui::prelude::*;
|
||||||
use util::paths::FILE_ROW_COLUMN_DELIMITER;
|
use util::paths::FILE_ROW_COLUMN_DELIMITER;
|
||||||
use workspace::ModalView;
|
use workspace::ModalView;
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ impl GoToLine {
|
||||||
let last_line = editor.buffer().read(cx).snapshot(cx).max_point().row;
|
let last_line = editor.buffer().read(cx).snapshot(cx).max_point().row;
|
||||||
let scroll_position = active_editor.update(cx, |editor, cx| editor.scroll_position(cx));
|
let scroll_position = active_editor.update(cx, |editor, cx| editor.scroll_position(cx));
|
||||||
|
|
||||||
let current_text = format!("line {} of {} (column {})", line, last_line + 1, column);
|
let current_text = format!("{} of {} (column {})", line, last_line + 1, column);
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
line_editor,
|
line_editor,
|
||||||
|
@ -186,36 +186,27 @@ impl Render for GoToLine {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
div()
|
v_flex()
|
||||||
|
.w(rems(24.))
|
||||||
.elevation_2(cx)
|
.elevation_2(cx)
|
||||||
.key_context("GoToLine")
|
.key_context("GoToLine")
|
||||||
.on_action(cx.listener(Self::cancel))
|
.on_action(cx.listener(Self::cancel))
|
||||||
.on_action(cx.listener(Self::confirm))
|
.on_action(cx.listener(Self::confirm))
|
||||||
.w_96()
|
|
||||||
.child(
|
.child(
|
||||||
v_flex()
|
div()
|
||||||
.px_1()
|
.border_b_1()
|
||||||
.pt_0p5()
|
.border_color(cx.theme().colors().border_variant)
|
||||||
.gap_px()
|
.px_2()
|
||||||
.child(
|
.py_1()
|
||||||
v_flex()
|
.child(self.line_editor.clone()),
|
||||||
.py_0p5()
|
)
|
||||||
.px_1()
|
.child(
|
||||||
.child(div().px_1().py_0p5().child(self.line_editor.clone())),
|
h_flex()
|
||||||
)
|
.px_2()
|
||||||
.child(
|
.py_1()
|
||||||
div()
|
.gap_1()
|
||||||
.h_px()
|
.child(Label::new("Current Line:").color(Color::Muted))
|
||||||
.w_full()
|
.child(Label::new(help_text).color(Color::Muted)),
|
||||||
.bg(cx.theme().colors().element_background),
|
|
||||||
)
|
|
||||||
.child(
|
|
||||||
h_flex()
|
|
||||||
.justify_between()
|
|
||||||
.px_2()
|
|
||||||
.py_1()
|
|
||||||
.child(Label::new(help_text).color(Color::Muted)),
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue