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