scaffolding for backspace functionality
This commit is contained in:
BIN
.temp.txt.swp
BIN
.temp.txt.swp
Binary file not shown.
@@ -272,4 +272,5 @@ struct
|
||||
| WITH_SEARCH_LIST searchList =>
|
||||
NormalFinish.withSearchList (app, searchList)
|
||||
| KEY_ENTER => app
|
||||
| KEY_BACKSPACE => app
|
||||
end
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user