summaryrefslogtreecommitdiff
path: root/console.c
diff options
context:
space:
mode:
Diffstat (limited to 'console.c')
-rw-r--r--console.c42
1 files changed, 38 insertions, 4 deletions
diff --git a/console.c b/console.c
index 06d59059a..d867bdf3b 100644
--- a/console.c
+++ b/console.c
@@ -7,7 +7,11 @@
#include "variables.h"
#include "hal.h"
#include <stdarg.h>
-#include "console.h"
+#include "console.h"
+
+#ifdef WIN32
+#include <windows.h>
+#endif
// ** main console ** //
static bool _iconsole_inited;
@@ -46,9 +50,34 @@ static const WindowDesc _iconsole_window_desc = {
/* *************** */
/* end of header */
-/* *************** */
+/* *************** */
+
+static void IConsoleAppendClipboard()
+{
+#ifdef WIN32
+ if (IsClipboardFormatAvailable(CF_TEXT)) {
+ byte * data;
+ HGLOBAL cbuf;
+ int i;
+
+ OpenClipboard(NULL);
+ cbuf = GetClipboardData(CF_TEXT);
+ data = (byte *) GlobalLock(cbuf);
+
+ i=0;
+ while (IS_INT_INSIDE(data[i], 32, 256)) {
+ _iconsole_cmdline[_iconsole_cmdpos]=data[i];
+ i++;
+ _iconsole_cmdpos++;
+ }
+
+ GlobalUnlock(cbuf);
+ CloseClipboard();
+ }
+#endif
+}
-void IConsoleClearCommand()
+static void IConsoleClearCommand()
{
int i;
for (i=0; i<255; i++) _iconsole_cmdline[i]=0;
@@ -103,7 +132,12 @@ static void IConsoleWndProc(Window *w, WindowEvent *e)
break;
case WE_KEYPRESS:
- e->keypress.cont=false;
+ e->keypress.cont=false;
+ if (e->keypress.keycode == (WKC_CTRL | 'V'))
+ {
+ IConsoleAppendClipboard();
+ SetWindowDirty(w);
+ } else
if (e->keypress.keycode == (WKC_UP))
{
IConsoleCmdBufferNavigate(+1);