Merge pull request #258 from exoticus/master

Neovide can now open files... with drag/drop
macos-click-through
Keith Simmons 5 years ago committed by GitHub
commit 8c89ffb92b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -21,6 +21,7 @@ pub enum UiCommand {
position: (u32, u32), position: (u32, u32),
}, },
Drag(u32, u32), Drag(u32, u32),
FileDrop(String),
FocusLost, FocusLost,
FocusGained, FocusGained,
Quit, Quit,
@ -74,6 +75,9 @@ impl UiCommand {
.expect("Focus Gained Failed"), .expect("Focus Gained Failed"),
UiCommand::Quit => { UiCommand::Quit => {
nvim.command("qa!").await.ok(); // Ignoring result as it won't succeed since the app closed. nvim.command("qa!").await.ok(); // Ignoring result as it won't succeed since the app closed.
},
UiCommand::FileDrop(path) => {
nvim.command(format!("e {}", path).as_str()).await.ok();
} }
} }
} }

@ -437,6 +437,9 @@ pub fn ui_loop() {
for event in event_pump.poll_iter() { for event in event_pump.poll_iter() {
match event { match event {
Event::Quit { .. } => window.handle_quit(), Event::Quit { .. } => window.handle_quit(),
Event::DropFile { filename, ..} => {
BRIDGE.queue_command(UiCommand::FileDrop(filename));
}
Event::KeyDown { Event::KeyDown {
keycode: received_keycode, keycode: received_keycode,
.. ..

Loading…
Cancel
Save