diff --git a/.temp.txt.swp b/.temp.txt.swp deleted file mode 100644 index 8b2ed04..0000000 Binary files a/.temp.txt.swp and /dev/null differ diff --git a/fcore/normal-mode/normal-mode.sml b/fcore/normal-mode/normal-mode.sml index e8a7b9c..2812729 100644 --- a/fcore/normal-mode/normal-mode.sml +++ b/fcore/normal-mode/normal-mode.sml @@ -272,4 +272,5 @@ struct | WITH_SEARCH_LIST searchList => NormalFinish.withSearchList (app, searchList) | KEY_ENTER => app + | KEY_BACKSPACE => app end diff --git a/fcore/normal-mode/normal-search-mode.sml b/fcore/normal-mode/normal-search-mode.sml index ce78dae..2ce1f13 100644 --- a/fcore/normal-mode/normal-search-mode.sml +++ b/fcore/normal-mode/normal-search-mode.sml @@ -110,9 +110,14 @@ struct (app, buffer, searchString, tempSearchList, startLine, mode, msgs) end + (* todo: implement *) + fun backspace (app: app_type, searchString, tempSearchList) = + raise Fail "normal-search-mode: KEY_BACKSPACE unimplemented" + fun update (app, {searchString, tempSearchList}, msg, time) = case msg of CHAR_EVENT chr => addChr (app, searchString, chr) + | KEY_BACKSPACE => backspace (app, searchString, tempSearchList) | KEY_ESC => exitToNormalMode app | KEY_ENTER => saveSearch (app, searchString, tempSearchList) | RESIZE_EVENT (width, height) => app diff --git a/ffi/glfw-input.c b/ffi/glfw-input.c index 57a49dd..64d0759 100644 --- a/ffi/glfw-input.c +++ b/ffi/glfw-input.c @@ -8,6 +8,7 @@ int REPEAT = GLFW_REPEAT; int RELEASE = GLFW_RELEASE; int KEY_ESC = GLFW_KEY_ESCAPE; int KEY_ENTER = GLFW_KEY_ENTER; +int KEY_BACKSPACE = GLFW_KEY_BACKSPACE; void framebufferSizeCallback(GLFWwindow* window, int width, int height) { glViewport(0, 0, width, height); diff --git a/ffi/glfw-input.sml b/ffi/glfw-input.sml index 91ad2ec..15dd143 100644 --- a/ffi/glfw-input.sml +++ b/ffi/glfw-input.sml @@ -36,4 +36,7 @@ struct val (KEY_ENTER, _) = _symbol "KEY_ENTER" public : ( unit -> int ) * ( int -> unit ); val KEY_ENTER = KEY_ENTER () + val (KEY_BACKSPACE, _) = + _symbol "KEY_BACKSPACE" public : ( unit -> int ) * ( int -> unit ); + val KEY_BACKSPACE = KEY_BACKSPACE () end diff --git a/message-types/input-msg.sml b/message-types/input-msg.sml index 661da51..ce26639 100644 --- a/message-types/input-msg.sml +++ b/message-types/input-msg.sml @@ -4,6 +4,7 @@ struct CHAR_EVENT of char | KEY_ESC | KEY_ENTER + | KEY_BACKSPACE | RESIZE_EVENT of int * int | WITH_SEARCH_LIST of int vector end diff --git a/shell/shell.sml b/shell/shell.sml index 36f11b1..b59d634 100644 --- a/shell/shell.sml +++ b/shell/shell.sml @@ -27,6 +27,8 @@ struct Mailbox.send (inputMailbox, InputMsg.KEY_ESC) else if key = KEY_ENTER andalso action = PRESS andalso mods = 0 then Mailbox.send (inputMailbox, InputMsg.KEY_ENTER) + else if key = KEY_BACKSPACE andalso action <> RELEASE andalso mods = 0 then + Mailbox.send (inputMailbox, InputMsg.KEY_BACKSPACE) else () end