diff options
-rw-r--r-- | ROADMAP.md | 2 | ||||
-rw-r--r-- | src/c_defs.go | 3 | ||||
-rw-r--r-- | src/e_events.go | 4 | ||||
-rw-r--r-- | src/e_keys.go | 6 | ||||
-rw-r--r-- | src/i_help.go | 68 | ||||
-rw-r--r-- | src/i_insert.go | 2 | ||||
-rw-r--r-- | src/i_ui.go | 3 |
7 files changed, 81 insertions, 7 deletions
@@ -41,6 +41,7 @@ - [x] scroll insert - [ ] help +- [ ] rename dirs - [ ] better readline ## v0.8 @@ -57,7 +58,6 @@ ## v1.1 - 360 hard - [ ] fuzz -- [ ] rename dirs - [ ] undo maybe ## v1.2 - ghetto bird diff --git a/src/c_defs.go b/src/c_defs.go index 3aa1884..a905897 100644 --- a/src/c_defs.go +++ b/src/c_defs.go @@ -78,7 +78,8 @@ const ( MKDIR_MODE INSERT_MODE RENAME_MODE - MODE_MAX = RENAME_MODE + HELP_MODE + MODE_MAX = HELP_MODE ) const ( diff --git a/src/e_events.go b/src/e_events.go index c30946d..783e707 100644 --- a/src/e_events.go +++ b/src/e_events.go @@ -400,10 +400,6 @@ func e_deep_copy_host(base *HostNode) HostNode { return new_host } -// func e_paste_item(litems *ItemsList, item ItemsNode) { -// curr := litems.curr -// } - // screen events such as keypresses func e_events(data *HardData, fp [MODE_MAX + 1]key_event_mode_func) { ui := &data.ui diff --git a/src/e_keys.go b/src/e_keys.go index 667ba3d..28cc628 100644 --- a/src/e_keys.go +++ b/src/e_keys.go @@ -246,6 +246,8 @@ func e_normal_events(data *HardData, ui *HardUI, event tcell.EventKey) bool { data.litems.curr.is_dir() == false { ui.mode = RENAME_MODE ui.buff = data.litems.curr.Host.Name + } else if event.Rune() == '?' { + ui.mode = HELP_MODE } return false } @@ -829,3 +831,7 @@ func e_rename_events(data *HardData, ui *HardUI, event tcell.EventKey) bool { ui.buff = "" return false } + +func e_help_events(data *HardData, ui *HardUI, event tcell.EventKey) bool { + return false +} diff --git a/src/i_help.go b/src/i_help.go new file mode 100644 index 0000000..5c179fe --- /dev/null +++ b/src/i_help.go @@ -0,0 +1,68 @@ +/* + * ======================== + * ===== =============== + * ====== ================ + * ====== ================ + * ====== ==== ==== == + * ====== === == = = + * ====== === = == = + * = === === = == ==== + * = === === = == = = + * == ===== ==== == + * ======================== + * + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright (c) 2023-2024, Joe + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the organization nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ''AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * hardflip: src/i_help.go + * Fri May 10 15:40:13 2024 + * Joe + * + * helping the user + */ + +package main + +func i_draw_help(ui HardUI) { + if ui.dim[W] < 8 || ui.dim[H] < 4 { + return + } + win := Quad{ + 4, + 4, + ui.dim[W] - 4, + ui.dim[H] - 4, + } + i_draw_box(ui.s, + win.L, win.T, win.R, win.B, + ui.style[BOX_STYLE], ui.style[HEAD_STYLE], + " Keys ", true) +} diff --git a/src/i_insert.go b/src/i_insert.go index 27c150a..08efdb4 100644 --- a/src/i_insert.go +++ b/src/i_insert.go @@ -43,7 +43,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * hardflip: src/i_insert.go - * Tue May 07 10:23:23 2024 + * Fri May 10 15:40:07 2024 * Joe * * insert a new host diff --git a/src/i_ui.go b/src/i_ui.go index 09a1d65..327eb4c 100644 --- a/src/i_ui.go +++ b/src/i_ui.go @@ -713,6 +713,7 @@ func i_ui(data_dir string) { MKDIR_MODE: e_mkdir_events, INSERT_MODE: e_insert_events, RENAME_MODE: e_rename_events, + HELP_MODE: e_help_events, } for { data.ui.s.Clear() @@ -751,6 +752,8 @@ func i_ui(data_dir string) { } case RENAME_MODE: i_prompt_insert(data.ui, data.litems.curr) + case HELP_MODE: + i_draw_help(data.ui) } data.ui.s.Show() e_events(&data, fp) |