selection fixes in wineconsole
Eric Pouech
eric.pouech at wanadoo.fr
Sat Jun 1 14:27:31 CDT 2002
title says it all
A+
-------------- next part --------------
Name: con_sel
ChangeLog: fixed some selection bugs
License: X11
GenDate: 2002/06/01 19:24:59 UTC
ModifiedFiles: programs/wineconsole/user.c
AddedFiles:
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/wineconsole/user.c,v
retrieving revision 1.11
diff -u -u -r1.11 user.c
--- programs/wineconsole/user.c 31 May 2002 23:40:59 -0000 1.11
+++ programs/wineconsole/user.c 1 Jun 2002 19:00:52 -0000
@@ -450,12 +451,11 @@
}
}
}
-
SelectObject(hDC, hOldFont);
ReleaseDC(hWnd, hDC);
config->cell_width = w;
- config->cell_height = tm.tmHeight;
+ config->cell_height = tm.tmHeight + tm.tmExternalLeading;
config->font_weight = tm.tmWeight;
lstrcpy(config->face_name, lf->lfFaceName);
@@ -578,10 +578,10 @@
*/
static void WCUSER_GetSelectionRect(const struct inner_data* data, LPRECT r)
{
- r->left = (min(PRIVATE(data)->selectPt1.X, PRIVATE(data)->selectPt2.X) ) * data->curcfg.cell_width;
- r->top = (min(PRIVATE(data)->selectPt1.Y, PRIVATE(data)->selectPt2.Y) ) * data->curcfg.cell_height;
- r->right = (max(PRIVATE(data)->selectPt1.X, PRIVATE(data)->selectPt2.X) + 1) * data->curcfg.cell_width;
- r->bottom = (max(PRIVATE(data)->selectPt1.Y, PRIVATE(data)->selectPt2.Y) + 1) * data->curcfg.cell_height;
+ r->left = (min(PRIVATE(data)->selectPt1.X, PRIVATE(data)->selectPt2.X) - data->curcfg.win_pos.X) * data->curcfg.cell_width;
+ r->top = (min(PRIVATE(data)->selectPt1.Y, PRIVATE(data)->selectPt2.Y) - data->curcfg.win_pos.Y) * data->curcfg.cell_height;
+ r->right = (max(PRIVATE(data)->selectPt1.X, PRIVATE(data)->selectPt2.X) + 1 - data->curcfg.win_pos.X) * data->curcfg.cell_width;
+ r->bottom = (max(PRIVATE(data)->selectPt1.Y, PRIVATE(data)->selectPt2.Y) + 1 - data->curcfg.win_pos.Y) * data->curcfg.cell_height;
}
/******************************************************************
@@ -660,19 +660,19 @@
if (!OpenClipboard(PRIVATE(data)->hWnd)) return;
EmptyClipboard();
- hMem = GlobalAlloc(GMEM_MOVEABLE, (w * h - 1) * sizeof(WCHAR));
+ hMem = GlobalAlloc(GMEM_MOVEABLE, (w * h) * sizeof(WCHAR));
if (hMem && (p = GlobalLock(hMem)))
{
COORD c;
int y;
- c.X = data->curcfg.win_pos.X + min(PRIVATE(data)->selectPt1.X, PRIVATE(data)->selectPt2.X);
- c.Y = data->curcfg.win_pos.Y + min(PRIVATE(data)->selectPt1.Y, PRIVATE(data)->selectPt2.Y);
+ c.X = min(PRIVATE(data)->selectPt1.X, PRIVATE(data)->selectPt2.X);
+ c.Y = min(PRIVATE(data)->selectPt1.Y, PRIVATE(data)->selectPt2.Y);
for (y = 0; y < h; y++, c.Y++)
{
ReadConsoleOutputCharacter(data->hConOut, &p[y * w], w - 1, c, NULL);
- if (y < h - 1) p[y * w + w - 1] = '\n';
+ p[y * w + w - 1] = (y < h - 1) ? '\n' : '\0';
}
GlobalUnlock(hMem);
SetClipboardData(CF_UNICODETEXT, hMem);
More information about the wine-patches
mailing list