Commit a8edb3e4 authored by Andreas Mohr's avatar Andreas Mohr Committed by Alexandre Julliard

Some part of EDIT_EM_LineLength code was commented (broken). Restored

the capability to calculate the remaining non-selected chars of a selection area.
parent 75f98cfc
...@@ -808,9 +808,9 @@ LRESULT WINAPI EditWndProc( HWND hwnd, UINT msg, ...@@ -808,9 +808,9 @@ LRESULT WINAPI EditWndProc( HWND hwnd, UINT msg,
case WM_MOUSEACTIVATE: case WM_MOUSEACTIVATE:
/* /*
* FIXME: maybe DefWindowProc() screws up, but it seems that * FIXME: maybe DefWindowProc() screws up, but it seems that
* modalless dialog boxes need this. If we don't do this, the focus * modeless dialog boxes need this. If we don't do this, the focus
* will _not_ be set by DefWindowProc() for edit controls in a * will _not_ be set by DefWindowProc() for edit controls in a
* modalless dialog box ??? * modeless dialog box ???
*/ */
DPRINTF_EDIT_MSG32("WM_MOUSEACTIVATE"); DPRINTF_EDIT_MSG32("WM_MOUSEACTIVATE");
SetFocus(wnd->hwndSelf); SetFocus(wnd->hwndSelf);
...@@ -2236,14 +2236,17 @@ static INT EDIT_EM_LineLength(WND *wnd, EDITSTATE *es, INT index) ...@@ -2236,14 +2236,17 @@ static INT EDIT_EM_LineLength(WND *wnd, EDITSTATE *es, INT index)
return lstrlenA(es->text); return lstrlenA(es->text);
if (index == -1) { if (index == -1) {
/* FIXME: broken /* get the number of remaining non-selected chars of selected lines */
INT32 sl = EDIT_EM_LineFromChar(wnd, es, es->selection_start); INT32 li;
INT32 el = EDIT_EM_LineFromChar(wnd, es, es->selection_end); INT32 count;
return es->selection_start - es->line_defs[sl].offset + li = EDIT_EM_LineFromChar(wnd, es, es->selection_start);
es->line_defs[el].offset + /* # chars before start of selection area */
es->line_defs[el].length - es->selection_end; count = es->selection_start - EDIT_EM_LineIndex(wnd, es, li);
*/ li = EDIT_EM_LineFromChar(wnd, es, es->selection_end);
return 0; /* # chars after end of selection */
count += EDIT_EM_LineIndex(wnd, es, li) +
EDIT_EM_LineLength(wnd, es, li) - es->selection_end;
return count;
} }
line_def = es->first_line_def; line_def = es->first_line_def;
index -= line_def->length; index -= line_def->length;
...@@ -2769,7 +2772,7 @@ static void EDIT_EM_SetSel(WND *wnd, EDITSTATE *es, UINT start, UINT end, BOOL a ...@@ -2769,7 +2772,7 @@ static void EDIT_EM_SetSel(WND *wnd, EDITSTATE *es, UINT start, UINT end, BOOL a
es->flags &= ~EF_AFTER_WRAP; es->flags &= ~EF_AFTER_WRAP;
if (es->flags & EF_FOCUSED) if (es->flags & EF_FOCUSED)
EDIT_SetCaretPos(wnd, es, end, after_wrap); EDIT_SetCaretPos(wnd, es, end, after_wrap);
/* This is little bit more efficient than before, not sure if it can be improved. FIXME? */ /* This is a little bit more efficient than before, not sure if it can be improved. FIXME? */
ORDER_UINT(start, end); ORDER_UINT(start, end);
ORDER_UINT(end, old_end); ORDER_UINT(end, old_end);
ORDER_UINT(start, old_start); ORDER_UINT(start, old_start);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment