first pass of merging in warp (doesn't build)

This commit is contained in:
Ryan Ward
2026-07-01 16:08:58 -05:00
parent 2f64909469
commit 4770ac06b5
3662 changed files with 414574 additions and 89772 deletions
+13 -9
View File
@@ -1,22 +1,22 @@
//! Module containing the definition of [`ActiveFileModel`],
//! which tracks the currently focused file across an entire PaneGroup.
use std::path::PathBuf;
use galaxyui::{Entity, ModelContext};
use super::buffer_location::LocalOrRemotePath;
/// Events emitted by the ActiveFileModel.
#[derive(Debug, Clone)]
pub enum ActiveFileEvent {
/// A new file became focused.
ActiveFileChanged { file_info: PathBuf },
ActiveFileChanged { location: LocalOrRemotePath },
}
/// Model that tracks the currently focused file.
#[derive(Default)]
pub struct ActiveFileModel {
/// The currently focused file, if any.
active_file: Option<PathBuf>,
active_file: Option<LocalOrRemotePath>,
}
impl Entity for ActiveFileModel {
@@ -29,16 +29,20 @@ impl ActiveFileModel {
}
/// Get the currently active file, if any.
pub fn active_file(&self) -> Option<&PathBuf> {
pub fn active_file(&self) -> Option<&LocalOrRemotePath> {
self.active_file.as_ref()
}
/// Set the currently active file.
pub fn active_file_changed(&mut self, path: PathBuf, ctx: &mut ModelContext<Self>) {
pub fn active_file_changed(
&mut self,
location: LocalOrRemotePath,
ctx: &mut ModelContext<Self>,
) {
// Only emit event if the active file changed.
if self.active_file.as_ref() != Some(&path) {
self.active_file = Some(path.clone());
ctx.emit(ActiveFileEvent::ActiveFileChanged { file_info: path });
if self.active_file.as_ref() != Some(&location) {
self.active_file = Some(location.clone());
ctx.emit(ActiveFileEvent::ActiveFileChanged { location });
ctx.notify();
}
}