mirror of
https://github.com/wez/wezterm.git
synced 2024-11-22 22:42:48 +03:00
add window
object to debug overlay
refs: https://github.com/wez/wezterm/issues/641
This commit is contained in:
parent
57ab9e36f5
commit
a594298947
@ -1,3 +1,4 @@
|
||||
use crate::scripting::guiwin::GuiWin;
|
||||
use chrono::prelude::*;
|
||||
use log::Level;
|
||||
use luahelper::ValueWrapper;
|
||||
@ -64,13 +65,14 @@ impl LineEditorHost for LuaReplHost {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn show_debug_overlay(mut term: TermWizTerminal) -> anyhow::Result<()> {
|
||||
pub fn show_debug_overlay(mut term: TermWizTerminal, gui_win: GuiWin) -> anyhow::Result<()> {
|
||||
term.no_grab_mouse_in_raw_mode();
|
||||
|
||||
let lua = config::Config::load()?
|
||||
.lua
|
||||
.ok_or_else(|| anyhow::anyhow!("failed to setup lua context"))?;
|
||||
lua.load("wezterm = require 'wezterm'").exec()?;
|
||||
lua.globals().set("window", gui_win)?;
|
||||
|
||||
let mut latest_log_entry = None;
|
||||
let mut host = LuaReplHost {
|
||||
|
@ -1287,8 +1287,10 @@ impl TermWindow {
|
||||
None => return,
|
||||
};
|
||||
|
||||
let gui_win = GuiWin::new(self);
|
||||
|
||||
let (overlay, future) = start_overlay(self, &tab, move |_tab_id, term| {
|
||||
crate::overlay::show_debug_overlay(term)
|
||||
crate::overlay::show_debug_overlay(term, gui_win)
|
||||
});
|
||||
self.assign_overlay(tab.tab_id(), overlay);
|
||||
promise::spawn::spawn(future).detach();
|
||||
|
Loading…
Reference in New Issue
Block a user