mirror of
https://github.com/wez/wezterm.git
synced 2024-11-23 23:21:08 +03:00
refactor: move Config into own module
That top level config/src/lib.rs has been too big for too long. Break it up a little. (I recommend running `cargo clean` if you're updating across this change to avoid a rust ICE with it cached on-disk state)
This commit is contained in:
parent
3000223585
commit
31f16375ed
1333
config/src/config.rs
Normal file
1333
config/src/config.rs
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
|||||||
use crate::{KeyAssignment, MouseEventTrigger};
|
use crate::keyassignment::{KeyAssignment, MouseEventTrigger};
|
||||||
use luahelper::impl_lua_conversion;
|
use luahelper::impl_lua_conversion;
|
||||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
1320
config/src/lib.rs
1320
config/src/lib.rs
File diff suppressed because it is too large
Load Diff
@ -1,3 +1,4 @@
|
|||||||
|
use crate::keyassignment::KeyAssignment;
|
||||||
use crate::Gradient;
|
use crate::Gradient;
|
||||||
use crate::{FontAttributes, FontStretch, FontWeight, FreeTypeLoadTarget, TextStyle};
|
use crate::{FontAttributes, FontStretch, FontWeight, FreeTypeLoadTarget, TextStyle};
|
||||||
use anyhow::anyhow;
|
use anyhow::anyhow;
|
||||||
@ -598,22 +599,16 @@ fn font_with_fallback<'lua>(
|
|||||||
/// }
|
/// }
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
fn action<'lua>(
|
fn action<'lua>(_lua: &'lua Lua, action: Table<'lua>) -> mlua::Result<KeyAssignment> {
|
||||||
_lua: &'lua Lua,
|
|
||||||
action: Table<'lua>,
|
|
||||||
) -> mlua::Result<crate::keyassignment::KeyAssignment> {
|
|
||||||
Ok(from_lua_value(Value::Table(action))?)
|
Ok(from_lua_value(Value::Table(action))?)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn action_callback<'lua>(
|
fn action_callback<'lua>(lua: &'lua Lua, callback: mlua::Function) -> mlua::Result<KeyAssignment> {
|
||||||
lua: &'lua Lua,
|
|
||||||
callback: mlua::Function,
|
|
||||||
) -> mlua::Result<crate::keyassignment::KeyAssignment> {
|
|
||||||
let callback_count: i32 = lua.named_registry_value(LUA_REGISTRY_USER_CALLBACK_COUNT)?;
|
let callback_count: i32 = lua.named_registry_value(LUA_REGISTRY_USER_CALLBACK_COUNT)?;
|
||||||
let user_event_id = format!("user-defined-{}", callback_count);
|
let user_event_id = format!("user-defined-{}", callback_count);
|
||||||
lua.set_named_registry_value(LUA_REGISTRY_USER_CALLBACK_COUNT, callback_count + 1)?;
|
lua.set_named_registry_value(LUA_REGISTRY_USER_CALLBACK_COUNT, callback_count + 1)?;
|
||||||
register_event(lua, (user_event_id.clone(), callback))?;
|
register_event(lua, (user_event_id.clone(), callback))?;
|
||||||
return Ok(crate::KeyAssignment::EmitEvent(user_event_id));
|
return Ok(KeyAssignment::EmitEvent(user_event_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn read_dir<'lua>(_: &'lua Lua, path: String) -> mlua::Result<Vec<String>> {
|
async fn read_dir<'lua>(_: &'lua Lua, path: String) -> mlua::Result<Vec<String>> {
|
||||||
|
Loading…
Reference in New Issue
Block a user