Compare commits

...
2 Commits
3 changed files with 25 additions and 8 deletions
+10
View File
@@ -125,6 +125,8 @@ pub struct ConfigFile {
pub body_panels: Option<Vec<f32>>,
#[serde(default)]
pub transfers: Vec<crate::terminal::Transfer>,
#[serde(default)]
pub show_hidden_files: bool,
}
fn default_locale() -> String {
@@ -331,6 +333,14 @@ impl ConfigStore {
self.cache.terminal_font_family = family.to_string();
}
pub fn show_hidden_files(&self) -> bool {
self.cache.show_hidden_files
}
pub fn set_show_hidden_files(&mut self, val: bool) {
self.cache.show_hidden_files = val;
}
pub fn get(&self, id: &str) -> Option<&Session> {
self.cache.sessions.iter().find(|s| s.id == id)
}
+10 -7
View File
@@ -338,7 +338,7 @@ impl Ashell {
sftp_creating_folder: false,
sftp_new_folder_input,
sftp_delete_scroll_handle: gpui::ScrollHandle::new(),
show_hidden_files: false,
show_hidden_files: config.show_hidden_files(),
transfers: config.transfers(),
show_transfers_dialog: false,
system_status: None,
@@ -2792,19 +2792,20 @@ impl Ashell {
&self,
range_utf16: Range<usize>,
element_bounds: Bounds<Pixels>,
window: &Window,
cell_width: f32,
line_height: f32,
) -> Option<Bounds<Pixels>> {
let snapshot = self.active_snapshot()?;
let cursor = snapshot.cursor?;
let x = element_bounds.origin.x
+ px(self.terminal_cell_width(window)) * cursor.col as f32
+ px(self.terminal_cell_width(window)) * range_utf16.start as f32;
let y = element_bounds.origin.y + px(self.terminal_line_height()) * cursor.row as f32;
+ px(cell_width) * cursor.col as f32
+ px(cell_width) * range_utf16.start as f32;
let y = element_bounds.origin.y + px(line_height) * cursor.row as f32;
Some(Bounds::new(
point(x, y),
size(
px(self.terminal_cell_width(window)),
px(self.terminal_line_height()),
px(cell_width),
px(line_height),
),
))
}
@@ -3553,6 +3554,8 @@ impl Ashell {
.tab_stop(false)
.on_click(cx.listener(|this, checked, _, cx| {
this.show_hidden_files = *checked;
this.config.set_show_hidden_files(*checked);
let _ = this.config.save();
cx.notify();
})),
)
+5 -1
View File
@@ -144,6 +144,8 @@ pub struct PrepaintState {
struct TerminalInputHandler {
view: Entity<Ashell>,
element_bounds: Bounds<Pixels>,
cell_width: f32,
line_height: f32,
}
impl InputHandler for TerminalInputHandler {
@@ -219,7 +221,7 @@ impl InputHandler for TerminalInputHandler {
) -> Option<Bounds<Pixels>> {
self.view
.read(cx)
.terminal_ime_bounds_for_range(range_utf16, self.element_bounds, _window)
.terminal_ime_bounds_for_range(range_utf16, self.element_bounds, self.cell_width, self.line_height)
}
fn character_index_for_point(
@@ -492,6 +494,8 @@ impl Element for TerminalElement {
TerminalInputHandler {
view: self.view.clone(),
element_bounds: prepaint.bounds,
cell_width: prepaint.metrics.cell_width.as_f32(),
line_height: prepaint.metrics.line_height.as_f32(),
},
cx,
);