edit control fix
Andreas Mohr
andi at rhlx01.fht-esslingen.de
Sat Nov 10 18:29:29 CST 2001
Hi all,
I thought that it's time to fix Matlab again.
And I realized that I had to fix EDIT_EM_LineLength *again*.
- fix stupid thinko: EDIT_EM_LineLength called from within EDIT_EM_LineLength
needs starting line *char* index, *not* line index (== line number).
This fixed both horrible mess when inserting line breaks into the buffer
and a severe redraw problem, too (even without having to find a second bug
for that problem :))
- cleaned up variable namespace to comply to other, much more sensible
namespace use in other parts of edit.c
- added some traces, spelling fixes
--
Andreas Mohr Stauferstr. 6, D-71272 Renningen, Germany
Tel. +49 7159 800604 http://home.nexgo.de/andi.mohr/
-------------- next part --------------
Determining best CVS host...
Using CVSROOT :pserver:cvs at rhlx01.fht-esslingen.de:/home/wine
Index: controls/edit.c
===================================================================
RCS file: /home/wine/wine/controls/edit.c,v
retrieving revision 1.87
diff -u -r1.87 edit.c
--- controls/edit.c 8 Oct 2001 20:33:08 -0000 1.87
+++ controls/edit.c 10 Nov 2001 20:31:53 -0000
@@ -1274,7 +1274,7 @@
if (current_line->index == nstart_index && istart > current_line->index + prev)
istart = current_line->index + prev;
/* else if we are updating the previous line before the first line we
- * are re-caulculating and it expanded */
+ * are re-calculating and it expanded */
else if (current_line == start_line &&
current_line->index != nstart_index && orig_net_length < prev)
{
@@ -1312,7 +1312,7 @@
line_index++;
} while (previous_line->ending != END_0);
- /* Finish adjusting line index's by delta or remove hanging lines */
+ /* Finish adjusting line indexes by delta or remove hanging lines */
if (previous_line->ending == END_0)
{
LINEDEF *pnext = NULL;
@@ -1376,6 +1376,13 @@
SelectObject(dc, old_font);
ReleaseDC(hwnd, dc);
+
+#ifdef DBG_LINELENGTH
+ current_line = es->first_line_def;
+ do {
+ TRACE("llen: %d\n", current_line->length);
+ } while (current_line = current_line->next);
+#endif
}
/*********************************************************************
@@ -1394,7 +1401,7 @@
*
* Call appropriate WordBreakProc (internal or external).
*
- * Note: The "start" argument should always be an index refering
+ * Note: The "start" argument should always be an index referring
* to es->text. The actual wordbreak proc might be
* 16 bit, so we can't always pass any 32 bit LPSTR.
* Hence we assume that es->text is the buffer that holds
@@ -1408,7 +1415,7 @@
{
INT ret, iWndsLocks;
- /* To avoid any deadlocks, all the locks on the windows structures
+ /* To avoid any deadlocks, all the locks on the window structures
must be suspended before the control is passed to the application */
iWndsLocks = WIN_SuspendWndsLock();
@@ -2820,15 +2827,16 @@
if (index == -1) {
/* get the number of remaining non-selected chars of selected lines */
- INT32 li;
+ INT32 l; /* line number */
+ INT32 li; /* index of first char in line */
INT32 count;
- li = EDIT_EM_LineFromChar(es, es->selection_start);
+ l = EDIT_EM_LineFromChar(es, es->selection_start);
/* # chars before start of selection area */
- count = es->selection_start - EDIT_EM_LineIndex(es, li);
- li = EDIT_EM_LineFromChar(es, es->selection_end);
+ count = es->selection_start - EDIT_EM_LineIndex(es, l);
+ l = EDIT_EM_LineFromChar(es, es->selection_end);
/* # chars after end of selection */
- count += EDIT_EM_LineIndex(es, li) +
- EDIT_EM_LineLength(es, li) - es->selection_end;
+ li = EDIT_EM_LineIndex(es, l);
+ count += li + EDIT_EM_LineLength(es, li) - es->selection_end;
return count;
}
line_def = es->first_line_def;
@@ -3011,6 +3019,7 @@
if (e != s) {
/* there is something to be deleted */
+ TRACE("deleting stuff.\n");
if (can_undo) {
utl = strlenW(es->undo_text);
if (!es->undo_insert_count && (*es->undo_text && (s == es->undo_position))) {
@@ -3064,6 +3073,7 @@
/* now insert */
tl = strlenW(es->text);
+ TRACE("inserting stuff (tl %d, strl %d, selstart %d ('%s'), text '%s')\n", tl, strl, s, debugstr_w(es->text + s), debugstr_w(es->text));
for (p = es->text + tl ; p >= es->text + s ; p--)
p[strl] = p[0];
for (i = 0 , p = es->text + s ; i < strl ; i++)
More information about the wine-patches
mailing list