Merge the pending changes from #429

pull/432/head
Arijit Basu 2 years ago committed by Arijit Basu
parent 729b51d674
commit 24bd6d9f00

@ -45,6 +45,7 @@ of [modes][4] and the key mappings for each mode.
| ctrl-c | | terminate |
| enter | | open logs in editor |
| esc | | escape |
| q | | quit |
### recover

@ -3,11 +3,12 @@
This configuration is exposed via the `xplr.config.general` API. It contains
the following fields:
## debug_on_error
## disable_debug_error_mode
Type: boolean
Set it to `true` to debug errors if they occur during startup.
Set it to `true` if you want to ignore the startup errors. You can still see
the errors in the logs.
## enable_mouse

@ -1429,8 +1429,8 @@ impl App {
app = app.log_error(err)?
}
if has_errs && app.config.general.debug_on_error {
app = app.switch_mode_builtin("debug")?;
if has_errs && !app.config.general.disable_debug_error_mode {
app = app.switch_mode_builtin("debug_error")?;
}
Ok(app)
@ -2677,7 +2677,7 @@ impl App {
[
&builtin.default,
&builtin.debug,
&builtin.debug_error,
&builtin.recover,
&builtin.filter,
&builtin.number,

@ -216,7 +216,7 @@ pub struct PanelUi {
#[serde(deny_unknown_fields)]
pub struct GeneralConfig {
#[serde(default)]
pub debug_on_error: bool,
pub disable_debug_error_mode: bool,
#[serde(default)]
pub enable_mouse: bool,
@ -524,7 +524,7 @@ pub struct BuiltinModesConfig {
pub default: Mode,
#[serde(default)]
pub debug: Mode,
pub debug_error: Mode,
#[serde(default)]
pub recover: Mode,
@ -582,7 +582,7 @@ impl BuiltinModesConfig {
pub fn get(&self, name: &str) -> Option<&Mode> {
match name {
"default" => Some(&self.default),
"debug" => Some(&self.debug),
"debug_error" => Some(&self.debug_error),
"recover" => Some(&self.recover),
"selection ops" => Some(&self.selection_ops),
"selection_ops" => Some(&self.selection_ops),

@ -7,8 +7,8 @@ local xplr = xplr
-- Config
---- General
------ Debug on error
xplr.config.general.debug_on_error = true
------ Debug error
xplr.config.general.disable_debug_error_mode = false
------ Show hidden
xplr.config.general.show_hidden = false
@ -976,44 +976,52 @@ xplr.config.modes.builtin.default.key_bindings.on_key["k"] =
xplr.config.modes.builtin.default.key_bindings.on_key["l"] =
xplr.config.modes.builtin.default.key_bindings.on_key.right
xplr.config.modes.builtin.debug = {
name = "debug",
xplr.config.modes.builtin.debug_error = {
name = "debug error",
help = nil,
extra_help = nil,
layout = {
Vertical = {
config = {
constraints = {
{ Min = 9 },
{ MinLessThanScreenHeight = 9 },
}
{ Min = 14 },
{ MinLessThanScreenHeight = 14 },
},
},
splits = {
{
CustomContent = {
title = "debug mode",
title = "debug error",
body = {
StaticParagraph = {
render = [[Startup errors have occured. Check your init.lua for errors.
If you think this is a bug, report your error at:
render = [[
Some errors occurred during startup.
If you think this is a bug, please report it at:
https://github.com/sayanarijit/xplr/issues/new
https://github.com/sayanarijit/xplr/issues/new
To open the logs in your editor, press `enter`.
To ignore the errors continue in the default config, press `escape`.]]
}
Press `enter` to open the logs in your $EDITOR.
Press `escape` to ignore the errors and continue with the default config.
To disable this mode, set `xplr.config.general.disable_debug_error_mode`
to `true` in your config file.
]],
},
},
},
},
"InputAndLogs",
}
}
},
},
},
key_bindings = {
on_key = {
["ctrl-c"] = {
help = "terminate",
messages = {"Terminate"}
messages = {
"Terminate",
},
},
enter = {
help = "open logs in editor",
@ -1027,17 +1035,22 @@ To ignore the errors continue in the default config, press `escape`.]]
},
esc = {
help = "escape",
messages = {"PopMode"}
}
messages = {
"PopMode",
},
},
q = {
help = "quit",
messages = {
"Quit",
},
},
},
on_alphabet = nil,
on_number = nil,
on_special_character = nil,
default = {
help = nil,
messages = {}
}
}
messages = {},
},
},
}
------ Recover
@ -1054,6 +1067,9 @@ xplr.config.modes.builtin.recover = {
This mode saves you from performing unwanted actions.
Let's calm down, press `escape`, and try again.
To disable this mode, set `xplr.config.general.enable_recover_mode`
to `false` in your config file.
]],
},
},
@ -1308,7 +1324,9 @@ xplr.config.modes.builtin.number = {
on_key = {
["ctrl-c"] = {
help = "terminate",
messages = { "Terminate" },
messages = {
"Terminate",
},
},
down = {
help = "to down",

Loading…
Cancel
Save