From 0cc6e71ca6bc806b09902bf30775c1b90d3d8bb5 Mon Sep 17 00:00:00 2001 From: Spoike Date: Sat, 18 Jul 2009 20:24:23 +0000 Subject: [PATCH] Code so I can copy from the console again. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3310 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/keys.c | 72 ++++---------------------------------------- 1 file changed, 6 insertions(+), 66 deletions(-) diff --git a/engine/client/keys.c b/engine/client/keys.c index 8dc772428..4530d37df 100644 --- a/engine/client/keys.c +++ b/engine/client/keys.c @@ -457,75 +457,15 @@ void Key_ConsoleRelease(int key) con_mousedown[2] = false; if (key == K_MOUSE2 && con_mousedown[2]) { -#if 0 - extern cvar_t vid_conwidth, vid_conheight; extern int mousecursor_x, mousecursor_y; - int xpos, ypos, temp; - char *buf, *bufhead; - int x, y; - + char *buffer; con_mousedown[2] = false; + buffer = Con_CopyConsole(); + if (!buffer) + return; + Sys_SaveClipboard(buffer); + Z_Free(buffer); - xpos = (int)((mousecursor_x*vid_conwidth.value)/(vid.width*8)); - ypos = (int)((mousecursor_y*vid_conheight.value)/(vid.height*8)); - - if (con_mousedown[0] < 1) - con_mousedown[0] = 1; - if (xpos < 1) - xpos = 1; - if (con_mousedown[0] > con_current->linewidth) - con_mousedown[0] = con_current->linewidth; - if (xpos > con_current->linewidth) - xpos = con_current->linewidth; - if (con_mousedown[0] > xpos) - { - temp = xpos; - xpos = con_mousedown[0]; - con_mousedown[0] = temp; - } - xpos++; - if (con_mousedown[1] > ypos) - { - temp = ypos; - ypos = con_mousedown[1]; - con_mousedown[1] = temp; - } - ypos++; - - ypos += con_current->display-((con_current->vislines-22)/8)+1; - con_mousedown[1] += con_current->display-((con_current->vislines-22)/8)+1; - if (con_current->display != con_current->current) - { - ypos++; - con_mousedown[1]++; - } - - con_mousedown[0]--; - xpos--; - - temp = (ypos - con_mousedown[1]) * (xpos - con_mousedown[0] + 2) + 1; - - bufhead = buf = Z_Malloc(temp); - for (y = con_mousedown[1]; y < ypos; y++) - { - if (y != con_mousedown[1]) - { - while(buf > bufhead && buf[-1] == ' ') - buf--; - *buf++ = '\r'; - *buf++ = '\n'; - } - - for (x = con_mousedown[0]; x < xpos; x++) - *buf++ = con_current->text[x + ((y%con_current->totallines)*con_current->linewidth)]&127; - } - while(buf > bufhead && buf[-1] == ' ') - buf--; - *buf++ = '\0'; - - Sys_SaveClipboard(bufhead); - Z_Free(bufhead); -#endif } }