1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-23 15:04:36 +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:
Wez Furlong 2022-01-09 10:06:50 -07:00
parent 3000223585
commit 31f16375ed
4 changed files with 1346 additions and 1322 deletions

1333
config/src/config.rs Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
use crate::{KeyAssignment, MouseEventTrigger};
use crate::keyassignment::{KeyAssignment, MouseEventTrigger};
use luahelper::impl_lua_conversion;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use std::collections::HashMap;

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,4 @@
use crate::keyassignment::KeyAssignment;
use crate::Gradient;
use crate::{FontAttributes, FontStretch, FontWeight, FreeTypeLoadTarget, TextStyle};
use anyhow::anyhow;
@ -598,22 +599,16 @@ fn font_with_fallback<'lua>(
/// }
/// }
/// ```
fn action<'lua>(
_lua: &'lua Lua,
action: Table<'lua>,
) -> mlua::Result<crate::keyassignment::KeyAssignment> {
fn action<'lua>(_lua: &'lua Lua, action: Table<'lua>) -> mlua::Result<KeyAssignment> {
Ok(from_lua_value(Value::Table(action))?)
}
fn action_callback<'lua>(
lua: &'lua Lua,
callback: mlua::Function,
) -> mlua::Result<crate::keyassignment::KeyAssignment> {
fn action_callback<'lua>(lua: &'lua Lua, callback: mlua::Function) -> mlua::Result<KeyAssignment> {
let callback_count: i32 = lua.named_registry_value(LUA_REGISTRY_USER_CALLBACK_COUNT)?;
let user_event_id = format!("user-defined-{}", callback_count);
lua.set_named_registry_value(LUA_REGISTRY_USER_CALLBACK_COUNT, callback_count + 1)?;
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>> {