add yank functionality in imperative shell
This commit is contained in:
@@ -41,3 +41,8 @@ void swapBuffers(GLFWwindow *window) {
|
||||
glfwSwapBuffers(window);
|
||||
}
|
||||
|
||||
void setClipboardString (GLFWwindow *window, const char *copyString) {
|
||||
glfwSetClipboardString(window, copyString);
|
||||
printf("ddone yanking");
|
||||
}
|
||||
|
||||
|
||||
@@ -22,4 +22,5 @@ struct
|
||||
val windowShouldClose = _import "windowShouldClose" public : window -> bool;
|
||||
val waitEvents = _import "waitEvents" public reentrant : unit -> unit;
|
||||
val swapBuffers = _import "swapBuffers" public : window -> unit;
|
||||
val setClipboardString = _import "setClipboardString" public : window * string -> unit;
|
||||
end
|
||||
|
||||
@@ -3,6 +3,7 @@ sig
|
||||
datatype t =
|
||||
REDRAW_TEXT of Real32.real vector
|
||||
| REDRAW_CURSOR of Real32.real vector
|
||||
| YANK of string
|
||||
end
|
||||
|
||||
structure DrawMsg :> DRAW_MSG =
|
||||
@@ -10,4 +11,5 @@ struct
|
||||
datatype t =
|
||||
REDRAW_TEXT of Real32.real vector
|
||||
| REDRAW_CURSOR of Real32.real vector
|
||||
| YANK of string
|
||||
end
|
||||
|
||||
@@ -164,6 +164,11 @@ struct
|
||||
()
|
||||
end
|
||||
|
||||
fun yank (shellState: t, str) =
|
||||
( Glfw.setClipboardString (#window shellState, str);
|
||||
shellState
|
||||
)
|
||||
|
||||
fun consumeDrawEvent (shellState, msg) =
|
||||
let
|
||||
val
|
||||
@@ -178,6 +183,7 @@ struct
|
||||
case msg of
|
||||
REDRAW_TEXT textVec => uploadText (shellState, textVec)
|
||||
| REDRAW_CURSOR cursorVec => uploadCursor (shellState, cursorVec)
|
||||
| YANK str => yank (shellState, str)
|
||||
end
|
||||
|
||||
fun consumeDrawEvents (shellState as {drawMailbox, ...}: t) =
|
||||
|
||||
Reference in New Issue
Block a user