aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2021-02-09 17:35:41 +0100
committerGitHub <noreply@github.com>2021-02-09 17:35:41 +0100
commit167b891b0f87544c1ff95fd88a3685d78027a5e5 (patch)
treeb2e55a467d36f168c961220b8ba4cf5edd6881d2 /src
parentMerge pull request #1 from mosaic-org/max-height (diff)
parentfeat(api): set invisible borders (diff)
downloadsl0ppij-167b891b0f87544c1ff95fd88a3685d78027a5e5.tar.gz
sl0ppij-167b891b0f87544c1ff95fd88a3685d78027a5e5.tar.xz
sl0ppij-167b891b0f87544c1ff95fd88a3685d78027a5e5.zip
feat(api): set invisible borders
Diffstat (limited to 'src')
-rw-r--r--src/shim.rs35
1 files changed, 34 insertions, 1 deletions
diff --git a/src/shim.rs b/src/shim.rs
index 452d69a9..5de8f393 100644
--- a/src/shim.rs
+++ b/src/shim.rs
@@ -23,6 +23,33 @@ pub enum Key {
Esc,
}
+// TODO: use same struct from main crate?
+#[derive(Default, Debug, Clone, Serialize, Deserialize)]
+pub struct Help {
+ pub mode: InputMode,
+ pub mode_is_persistent: bool,
+ pub keybinds: Vec<(String, String)>,
+}
+
+// TODO: use same struct from main crate?
+#[derive(Debug, Clone, Deserialize, Serialize)]
+pub enum InputMode {
+ Normal,
+ Command,
+ CommandPersistent,
+ Resize,
+ Pane,
+ Tab,
+ Scroll,
+ Exiting,
+}
+
+impl Default for InputMode {
+ fn default() -> InputMode {
+ InputMode::Normal
+ }
+}
+
pub fn get_key() -> Key {
deserialize_from_stdin().unwrap()
}
@@ -36,12 +63,17 @@ pub fn set_max_height(max_height: i32) {
unsafe { host_set_max_height(max_height) };
}
+pub fn set_invisible_borders(invisible_borders: bool) {
+ let invisible_borders = if invisible_borders { 1 } else { 0 };
+ unsafe { host_set_invisible_borders(invisible_borders) };
+}
+
pub fn set_selectable(selectable: bool) {
let selectable = if selectable { 1 } else { 0 };
unsafe { host_set_selectable(selectable) };
}
-pub fn get_help() -> Vec<String> {
+pub fn get_help() -> Help {
unsafe { host_get_help() };
deserialize_from_stdin().unwrap_or_default()
}
@@ -57,5 +89,6 @@ extern "C" {
fn host_open_file();
fn host_set_max_height(max_height: i32);
fn host_set_selectable(selectable: i32);
+ fn host_set_invisible_borders(invisible_borders: i32);
fn host_get_help();
}