ReactOS 0.4.15-dev-6068-g8061a6f
edit.c File Reference
#include "config.h"
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "imm.h"
#include "usp10.h"
#include "commctrl.h"
#include "uxtheme.h"
#include "vsstyle.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "wine/heap.h"
Include dependency graph for edit.c:

Go to the source code of this file.

Classes

struct  tagLINEDEF
 
struct  EDITSTATE
 

Macros

#define BUFLIMIT_INITIAL   30000 /* initial buffer size */
 
#define GROWLENGTH   32 /* buffers granularity in bytes: must be power of 2 */
 
#define ROUND_TO_GROW(size)   (((size) + (GROWLENGTH - 1)) & ~(GROWLENGTH - 1))
 
#define HSCROLL_FRACTION   3 /* scroll window by 1/3 width */
 
#define EF_MODIFIED   0x0001 /* text has been modified */
 
#define EF_FOCUSED   0x0002 /* we have input focus */
 
#define EF_UPDATE   0x0004 /* notify parent of changed state */
 
#define EF_VSCROLL_TRACK   0x0008 /* don't SetScrollPos() since we are tracking the thumb */
 
#define EF_HSCROLL_TRACK   0x0010 /* don't SetScrollPos() since we are tracking the thumb */
 
#define EF_AFTER_WRAP
 
#define EF_USE_SOFTBRK   0x0100 /* Enable soft breaks in text. */
 
#define EF_DIALOGMODE   0x0200 /* Indicates that we are inside a dialog window */
 
#define ID_CB_LISTBOX   1000
 
#define SWAP_UINT32(x, y)   do { UINT temp = (UINT)(x); (x) = (UINT)(y); (y) = temp; } while(0)
 
#define ORDER_UINT(x, y)   do { if ((UINT)(y) < (UINT)(x)) SWAP_UINT32((x),(y)); } while(0)
 

Typedefs

typedef struct tagLINEDEF LINEDEF
 

Enumerations

enum  LINE_END {
  END_0 = 0 , END_WRAP , END_HARD , END_SOFT ,
  END_RICH , END_0 = 0 , END_WRAP , END_HARD ,
  END_SOFT , END_RICH
}
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (edit)
 
static BOOL notify_parent (const EDITSTATE *es, INT code)
 
static LRESULT EDIT_EM_PosFromChar (EDITSTATE *es, INT index, BOOL after_wrap)
 
static BOOL EDIT_EM_CanUndo (const EDITSTATE *es)
 
static void EDIT_EM_EmptyUndoBuffer (EDITSTATE *es)
 
static HBRUSH EDIT_NotifyCtlColor (EDITSTATE *es, HDC hdc)
 
static UINT get_text_length (EDITSTATE *es)
 
static INT EDIT_WordBreakProc (EDITSTATE *es, LPWSTR s, INT index, INT count, INT action)
 
static INT EDIT_CallWordBreakProc (EDITSTATE *es, INT start, INT index, INT count, INT action)
 
static void EDIT_InvalidateUniscribeData_linedef (LINEDEF *line_def)
 
static void EDIT_InvalidateUniscribeData (EDITSTATE *es)
 
static SCRIPT_STRING_ANALYSIS EDIT_UpdateUniscribeData_linedef (EDITSTATE *es, HDC dc, LINEDEF *line_def)
 
static SCRIPT_STRING_ANALYSIS EDIT_UpdateUniscribeData (EDITSTATE *es, HDC dc, INT line)
 
static INT get_vertical_line_count (EDITSTATE *es)
 
static void EDIT_BuildLineDefs_ML (EDITSTATE *es, INT istart, INT iend, INT delta, HRGN hrgn)
 
static void EDIT_CalcLineWidth_SL (EDITSTATE *es)
 
static INT EDIT_CharFromPos (EDITSTATE *es, INT x, INT y, LPBOOL after_wrap)
 
static void EDIT_ConfinePoint (const EDITSTATE *es, LPINT x, LPINT y)
 
static INT EDIT_EM_LineFromChar (EDITSTATE *es, INT index)
 
static INT EDIT_EM_LineIndex (const EDITSTATE *es, INT line)
 
static INT EDIT_EM_LineLength (EDITSTATE *es, INT index)
 
static void EDIT_GetLineRect (EDITSTATE *es, INT line, INT scol, INT ecol, LPRECT rc)
 
static void text_buffer_changed (EDITSTATE *es)
 
static void EDIT_LockBuffer (EDITSTATE *es)
 
static void EDIT_UnlockBuffer (EDITSTATE *es, BOOL force)
 
static BOOL EDIT_MakeFit (EDITSTATE *es, UINT size)
 
static BOOL EDIT_MakeUndoFit (EDITSTATE *es, UINT size)
 
static void EDIT_UpdateTextRegion (EDITSTATE *es, HRGN hrgn, BOOL bErase)
 
static void EDIT_UpdateText (EDITSTATE *es, const RECT *rc, BOOL bErase)
 
static void EDIT_SL_InvalidateText (EDITSTATE *es, INT start, INT end)
 
static void EDIT_ML_InvalidateText (EDITSTATE *es, INT start, INT end)
 
static void EDIT_InvalidateText (EDITSTATE *es, INT start, INT end)
 
static BOOL EDIT_EM_SetSel (EDITSTATE *es, UINT start, UINT end, BOOL after_wrap)
 
static void EDIT_UpdateScrollInfo (EDITSTATE *es)
 
static BOOL EDIT_EM_LineScroll_internal (EDITSTATE *es, INT dx, INT dy)
 
static BOOL EDIT_EM_LineScroll (EDITSTATE *es, INT dx, INT dy)
 
static LRESULT EDIT_EM_Scroll (EDITSTATE *es, INT action)
 
static void EDIT_SetCaretPos (EDITSTATE *es, INT pos, BOOL after_wrap)
 
static void EDIT_EM_ScrollCaret (EDITSTATE *es)
 
static void EDIT_MoveBackward (EDITSTATE *es, BOOL extend)
 
static void EDIT_MoveDown_ML (EDITSTATE *es, BOOL extend)
 
static void EDIT_MoveEnd (EDITSTATE *es, BOOL extend, BOOL ctrl)
 
static void EDIT_MoveForward (EDITSTATE *es, BOOL extend)
 
static void EDIT_MoveHome (EDITSTATE *es, BOOL extend, BOOL ctrl)
 
static void EDIT_MovePageDown_ML (EDITSTATE *es, BOOL extend)
 
static void EDIT_MovePageUp_ML (EDITSTATE *es, BOOL extend)
 
static void EDIT_MoveUp_ML (EDITSTATE *es, BOOL extend)
 
static void EDIT_MoveWordBackward (EDITSTATE *es, BOOL extend)
 
static void EDIT_MoveWordForward (EDITSTATE *es, BOOL extend)
 
static INT EDIT_PaintText (EDITSTATE *es, HDC dc, INT x, INT y, INT line, INT col, INT count, BOOL rev)
 
static void EDIT_PaintLine (EDITSTATE *es, HDC dc, INT line, BOOL rev)
 
static void EDIT_AdjustFormatRect (EDITSTATE *es)
 
static void EDIT_SetRectNP (EDITSTATE *es, const RECT *rc)
 
static LRESULT EDIT_EM_CharFromPos (EDITSTATE *es, INT x, INT y)
 
static BOOL EDIT_EM_FmtLines (EDITSTATE *es, BOOL add_eol)
 
static HLOCAL EDIT_EM_GetHandle (EDITSTATE *es)
 
static INT EDIT_EM_GetLine (EDITSTATE *es, INT line, LPWSTR dst)
 
static LRESULT EDIT_EM_GetSel (const EDITSTATE *es, PUINT start, PUINT end)
 
static void EDIT_EM_ReplaceSel (EDITSTATE *es, BOOL can_undo, const WCHAR *lpsz_replace, UINT strl, BOOL send_update, BOOL honor_limit)
 
static void EDIT_EM_SetHandle (EDITSTATE *es, HLOCAL hloc)
 
static void EDIT_EM_SetLimitText (EDITSTATE *es, UINT limit)
 
static BOOL is_cjk (UINT charset)
 
static void EDIT_EM_SetMargins (EDITSTATE *es, INT action, WORD left, WORD right, BOOL repaint)
 
static void EDIT_EM_SetPasswordChar (EDITSTATE *es, WCHAR c)
 
static BOOL EDIT_EM_SetTabStops (EDITSTATE *es, INT count, const INT *tabs)
 
static void EDIT_EM_SetWordBreakProc (EDITSTATE *es, EDITWORDBREAKPROCW wbp)
 
static BOOL EDIT_EM_Undo (EDITSTATE *es)
 
static BOOL EDIT_IsInsideDialog (EDITSTATE *es)
 
static void EDIT_WM_Paste (EDITSTATE *es)
 
static void EDIT_WM_Copy (EDITSTATE *es)
 
static void EDIT_WM_Clear (EDITSTATE *es)
 
static void EDIT_WM_Cut (EDITSTATE *es)
 
static LRESULT EDIT_WM_Char (EDITSTATE *es, WCHAR c)
 
static void EDIT_ContextMenuCommand (EDITSTATE *es, UINT id)
 
static void EDIT_WM_ContextMenu (EDITSTATE *es, INT x, INT y)
 
static INT EDIT_WM_GetText (const EDITSTATE *es, INT count, LPWSTR dst)
 
static BOOL EDIT_CheckCombo (EDITSTATE *es, UINT msg, INT key)
 
static LRESULT EDIT_WM_KeyDown (EDITSTATE *es, INT key)
 
static LRESULT EDIT_WM_KillFocus (HTHEME theme, EDITSTATE *es)
 
static LRESULT EDIT_WM_LButtonDblClk (EDITSTATE *es)
 
static LRESULT EDIT_WM_LButtonDown (EDITSTATE *es, DWORD keys, INT x, INT y)
 
static LRESULT EDIT_WM_LButtonUp (EDITSTATE *es)
 
static LRESULT EDIT_WM_MButtonDown (EDITSTATE *es)
 
static LRESULT EDIT_WM_MouseMove (EDITSTATE *es, INT x, INT y)
 
static void EDIT_WM_Paint (EDITSTATE *es, HDC hdc)
 
static void EDIT_WM_NCPaint (HWND hwnd, HRGN region)
 
static void EDIT_WM_SetFocus (HTHEME theme, EDITSTATE *es)
 
static void EDIT_WM_SetFont (EDITSTATE *es, HFONT font, BOOL redraw)
 
static void EDIT_WM_SetText (EDITSTATE *es, LPCWSTR text)
 
static void EDIT_WM_Size (EDITSTATE *es, UINT action)
 
static LRESULT EDIT_WM_StyleChanged (EDITSTATE *es, WPARAM which, const STYLESTRUCT *style)
 
static LRESULT EDIT_WM_SysKeyDown (EDITSTATE *es, INT key, DWORD key_data)
 
static void EDIT_WM_Timer (EDITSTATE *es)
 
static LRESULT EDIT_WM_HScroll (EDITSTATE *es, INT action, INT pos)
 
static LRESULT EDIT_WM_VScroll (EDITSTATE *es, INT action, INT pos)
 
static LRESULT EDIT_EM_GetThumb (EDITSTATE *es)
 
static void EDIT_GetCompositionStr (HIMC hIMC, LPARAM CompFlag, EDITSTATE *es)
 
static void EDIT_GetResultStr (HIMC hIMC, EDITSTATE *es)
 
static void EDIT_ImeComposition (HWND hwnd, LPARAM CompFlag, EDITSTATE *es)
 
static LRESULT EDIT_WM_NCCreate (HWND hwnd, LPCREATESTRUCTW lpcs)
 
static LRESULT EDIT_WM_Create (EDITSTATE *es, const WCHAR *name)
 
static LRESULT EDIT_WM_NCDestroy (EDITSTATE *es)
 
static LRESULT CALLBACK EDIT_WindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
void EDIT_Register (void)
 

Macro Definition Documentation

◆ BUFLIMIT_INITIAL

#define BUFLIMIT_INITIAL   30000 /* initial buffer size */

Definition at line 61 of file edit.c.

◆ EF_AFTER_WRAP

#define EF_AFTER_WRAP
Value:
0x0080 /* the caret is displayed after the last character of a
wrapped line, instead of in front of the next character */

Definition at line 74 of file edit.c.

◆ EF_DIALOGMODE

#define EF_DIALOGMODE   0x0200 /* Indicates that we are inside a dialog window */

Definition at line 76 of file edit.c.

◆ EF_FOCUSED

#define EF_FOCUSED   0x0002 /* we have input focus */

Definition at line 70 of file edit.c.

◆ EF_HSCROLL_TRACK

#define EF_HSCROLL_TRACK   0x0010 /* don't SetScrollPos() since we are tracking the thumb */

Definition at line 73 of file edit.c.

◆ EF_MODIFIED

#define EF_MODIFIED   0x0001 /* text has been modified */

Definition at line 69 of file edit.c.

◆ EF_UPDATE

#define EF_UPDATE   0x0004 /* notify parent of changed state */

Definition at line 71 of file edit.c.

◆ EF_USE_SOFTBRK

#define EF_USE_SOFTBRK   0x0100 /* Enable soft breaks in text. */

Definition at line 75 of file edit.c.

◆ EF_VSCROLL_TRACK

#define EF_VSCROLL_TRACK   0x0008 /* don't SetScrollPos() since we are tracking the thumb */

Definition at line 72 of file edit.c.

◆ GROWLENGTH

#define GROWLENGTH   32 /* buffers granularity in bytes: must be power of 2 */

Definition at line 62 of file edit.c.

◆ HSCROLL_FRACTION

#define HSCROLL_FRACTION   3 /* scroll window by 1/3 width */

Definition at line 64 of file edit.c.

◆ ID_CB_LISTBOX

#define ID_CB_LISTBOX   1000

Definition at line 78 of file edit.c.

◆ ORDER_UINT

#define ORDER_UINT (   x,
  y 
)    do { if ((UINT)(y) < (UINT)(x)) SWAP_UINT32((x),(y)); } while(0)

Definition at line 165 of file edit.c.

◆ ROUND_TO_GROW

#define ROUND_TO_GROW (   size)    (((size) + (GROWLENGTH - 1)) & ~(GROWLENGTH - 1))

Definition at line 63 of file edit.c.

◆ SWAP_UINT32

#define SWAP_UINT32 (   x,
  y 
)    do { UINT temp = (UINT)(x); (x) = (UINT)(y); (y) = temp; } while(0)

Definition at line 164 of file edit.c.

Typedef Documentation

◆ LINEDEF

Enumeration Type Documentation

◆ LINE_END

Enumerator
END_0 
END_WRAP 
END_HARD 
END_SOFT 
END_RICH 
END_0 
END_WRAP 
END_HARD 
END_SOFT 
END_RICH 

Definition at line 80 of file edit.c.

82{
83 END_0 = 0, /* line ends with terminating '\0' character */
84 END_WRAP, /* line is wrapped */
85 END_HARD, /* line ends with a hard return '\r\n' */
86 END_SOFT, /* line ends with a soft return '\r\r\n' */
87 END_RICH /* line ends with a single '\n' */
@ END_SOFT
Definition: edit.c:85
@ END_RICH
Definition: edit.c:86
@ END_HARD
Definition: edit.c:84
@ END_0
Definition: edit.c:82
@ END_WRAP
Definition: edit.c:83

Function Documentation

◆ EDIT_AdjustFormatRect()

static void EDIT_AdjustFormatRect ( EDITSTATE es)
static

Definition at line 2255 of file edit.c.

2257{
2258 RECT ClientRect;
2259
2260 es->format_rect.right = max(es->format_rect.right, es->format_rect.left + es->char_width);
2261 if (es->style & ES_MULTILINE)
2262 {
2263 INT fw, vlc, max_x_offset, max_y_offset;
2264
2266 es->format_rect.bottom = es->format_rect.top + vlc * es->line_height;
2267
2268 /* correct es->x_offset */
2269 fw = es->format_rect.right - es->format_rect.left;
2270 max_x_offset = es->text_width - fw;
2271 if(max_x_offset < 0) max_x_offset = 0;
2272 if(es->x_offset > max_x_offset)
2273 es->x_offset = max_x_offset;
2274
2275 /* correct es->y_offset */
2276 max_y_offset = es->line_count - vlc;
2277 if(max_y_offset < 0) max_y_offset = 0;
2278 if(es->y_offset > max_y_offset)
2279 es->y_offset = max_y_offset;
2280
2281 /* force scroll info update */
2283 }
2284 else
2285 /* Windows doesn't care to fix text placement for SL controls */
2286 es->format_rect.bottom = es->format_rect.top + es->line_height;
2287
2288 /* Always stay within the client area */
2289 GetClientRect(es->hwndSelf, &ClientRect);
2290 es->format_rect.bottom = min(es->format_rect.bottom, ClientRect.bottom);
2291
2292 if ((es->style & ES_MULTILINE) && !(es->style & ES_AUTOHSCROLL))
2294
2295 EDIT_SetCaretPos(es, es->selection_end, es->flags & EF_AFTER_WRAP);
#define NULL
Definition: types.h:112
static INT get_vertical_line_count(EDITSTATE *es)
Definition: edit.c:415
#define EF_AFTER_WRAP
Definition: edit.c:74
static void EDIT_SetCaretPos(EDITSTATE *es, INT pos, BOOL after_wrap)
Definition: edit.c:1747
static void EDIT_BuildLineDefs_ML(EDITSTATE *es, INT istart, INT iend, INT delta, HRGN hrgn)
Definition: edit.c:430
static UINT get_text_length(EDITSTATE *es)
Definition: edit.c:217
static void EDIT_UpdateScrollInfo(EDITSTATE *es)
Definition: edit.c:1557
#define es
Definition: i386-dis.c:440
#define min(a, b)
Definition: monoChain.cc:55
#define ES_AUTOHSCROLL
Definition: pedump.c:672
#define ES_MULTILINE
Definition: pedump.c:667
LONG bottom
Definition: windef.h:309
#define max(a, b)
Definition: svc.c:63
int32_t INT
Definition: typedefs.h:58
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)

Referenced by EDIT_EM_SetMargins(), and EDIT_SetRectNP().

◆ EDIT_BuildLineDefs_ML()

static void EDIT_BuildLineDefs_ML ( EDITSTATE es,
INT  istart,
INT  iend,
INT  delta,
HRGN  hrgn 
)
static

Definition at line 430 of file edit.c.

432{
433 LPWSTR current_position, cp;
434 INT fw;
435 LINEDEF *current_line;
436 LINEDEF *previous_line;
437 LINEDEF *start_line;
438 INT line_index = 0, nstart_line, nstart_index;
439 INT line_count = es->line_count;
440 INT orig_net_length;
441 RECT rc;
442 INT vlc;
443
444 if (istart == iend && delta == 0)
445 return;
446
447 previous_line = NULL;
448 current_line = es->first_line_def;
449
450 /* Find starting line. istart must lie inside an existing line or
451 * at the end of buffer */
452 do {
453 if (istart < current_line->index + current_line->length ||
454 current_line->ending == END_0)
455 break;
456
457 previous_line = current_line;
458 current_line = current_line->next;
459 line_index++;
460 } while (current_line);
461
462 if (!current_line) /* Error occurred start is not inside previous buffer */
463 {
464 FIXME(" modification occurred outside buffer\n");
465 return;
466 }
467
468 /* Remember start of modifications in order to calculate update region */
469 nstart_line = line_index;
470 nstart_index = current_line->index;
471
472 /* We must start to reformat from the previous line since the modifications
473 * may have caused the line to wrap upwards. */
474 if (!(es->style & ES_AUTOHSCROLL) && line_index > 0)
475 {
476 line_index--;
477 current_line = previous_line;
478 }
479 start_line = current_line;
480
481 fw = es->format_rect.right - es->format_rect.left;
482 current_position = es->text + current_line->index;
484 do {
485 if (current_line != start_line)
486 {
487 if (!current_line || current_line->index + delta > current_position - es->text)
488 {
489 /* The buffer has been expanded, create a new line and
490 insert it into the link list */
491 LINEDEF *new_line = heap_alloc_zero(sizeof(*new_line));
492 new_line->next = previous_line->next;
493 previous_line->next = new_line;
494 current_line = new_line;
495 es->line_count++;
496 }
497 else if (current_line->index + delta < current_position - es->text)
498 {
499 /* The previous line merged with this line so we delete this extra entry */
500 previous_line->next = current_line->next;
501 heap_free(current_line);
502 current_line = previous_line->next;
503 es->line_count--;
504 continue;
505 }
506 else /* current_line->index + delta == current_position */
507 {
508 if (current_position - es->text > iend)
509 break; /* We reached end of line modifications */
510 /* else recalculate this line */
511 }
512 }
513
514 current_line->index = current_position - es->text;
515 orig_net_length = current_line->net_length;
516
517 /* Find end of line */
518 cp = current_position;
519 while (*cp) {
520 if (*cp == '\n') break;
521 if ((*cp == '\r') && (*(cp + 1) == '\n'))
522 break;
523 cp++;
524 }
525
526 /* Mark type of line termination */
527 if (!(*cp)) {
528 current_line->ending = END_0;
529 current_line->net_length = strlenW(current_position);
530 } else if ((cp > current_position) && (*(cp - 1) == '\r')) {
531 current_line->ending = END_SOFT;
532 current_line->net_length = cp - current_position - 1;
533 } else if (*cp == '\n') {
534 current_line->ending = END_RICH;
535 current_line->net_length = cp - current_position;
536 } else {
537 current_line->ending = END_HARD;
538 current_line->net_length = cp - current_position;
539 }
540
541 if (current_line->net_length)
542 {
543 const SIZE *sz;
546 if (current_line->ssa)
547 {
548 sz = ScriptString_pSize(current_line->ssa);
549 /* Calculate line width */
550 current_line->width = sz->cx;
551 }
552 else current_line->width = es->char_width * current_line->net_length;
553 }
554 else current_line->width = 0;
555
556 /* FIXME: check here for lines that are too wide even in AUTOHSCROLL (> 32767 ???) */
557
558/* Line breaks just look back from the end and find the next break and try that. */
559
560 if (!(es->style & ES_AUTOHSCROLL)) {
561 if (current_line->width > fw && fw > es->char_width) {
562
563 INT prev, next;
564 int w;
565 const SIZE *sz;
566 float d;
567
568 prev = current_line->net_length - 1;
569 w = current_line->net_length;
570 d = (float)current_line->width/(float)fw;
571 if (d > 1.2f) d -= 0.2f;
572 next = prev/d;
573 if (next >= prev) next = prev-1;
574 do {
575 prev = EDIT_CallWordBreakProc(es, current_position - es->text,
576 next, current_line->net_length, WB_LEFT);
577 current_line->net_length = prev;
580 if (current_line->ssa)
581 sz = ScriptString_pSize(current_line->ssa);
582 else sz = 0;
583 if (sz)
584 current_line->width = sz->cx;
585 else
586 prev = 0;
587 next = prev - 1;
588 } while (prev && current_line->width > fw);
589 current_line->net_length = w;
590
591 if (prev == 0) { /* Didn't find a line break so force a break */
592 INT *piDx;
593 const INT *count;
594
597
598 if (current_line->ssa)
599 {
600 count = ScriptString_pcOutChars(current_line->ssa);
601 piDx = heap_alloc(sizeof(INT) * (*count));
602 ScriptStringGetLogicalWidths(current_line->ssa,piDx);
603
604 prev = current_line->net_length-1;
605 do {
606 current_line->width -= piDx[prev];
607 prev--;
608 } while ( prev > 0 && current_line->width > fw);
609 if (prev<=0)
610 prev = 1;
611 heap_free(piDx);
612 }
613 else
614 prev = (fw / es->char_width);
615 }
616
617 /* If the first line we are calculating, wrapped before istart, we must
618 * adjust istart in order for this to be reflected in the update region. */
619 if (current_line->index == nstart_index && istart > current_line->index + prev)
620 istart = current_line->index + prev;
621 /* else if we are updating the previous line before the first line we
622 * are re-calculating and it expanded */
623 else if (current_line == start_line &&
624 current_line->index != nstart_index && orig_net_length < prev)
625 {
626 /* Line expanded due to an upwards line wrap so we must partially include
627 * previous line in update region */
628 nstart_line = line_index;
629 nstart_index = current_line->index;
630 istart = current_line->index + orig_net_length;
631 }
632
633 current_line->net_length = prev;
634 current_line->ending = END_WRAP;
635
636 if (current_line->net_length > 0)
637 {
639 if (current_line->ssa)
640 {
641 sz = ScriptString_pSize(current_line->ssa);
642 current_line->width = sz->cx;
643 }
644 else
645 current_line->width = 0;
646 }
647 else current_line->width = 0;
648 }
649 else if (current_line == start_line &&
650 current_line->index != nstart_index &&
651 orig_net_length < current_line->net_length) {
652 /* The previous line expanded but it's still not as wide as the client rect */
653 /* The expansion is due to an upwards line wrap so we must partially include
654 it in the update region */
655 nstart_line = line_index;
656 nstart_index = current_line->index;
657 istart = current_line->index + orig_net_length;
658 }
659 }
660
661
662 /* Adjust length to include line termination */
663 switch (current_line->ending) {
664 case END_SOFT:
665 current_line->length = current_line->net_length + 3;
666 break;
667 case END_RICH:
668 current_line->length = current_line->net_length + 1;
669 break;
670 case END_HARD:
671 current_line->length = current_line->net_length + 2;
672 break;
673 case END_WRAP:
674 case END_0:
675 current_line->length = current_line->net_length;
676 break;
677 }
678 es->text_width = max(es->text_width, current_line->width);
679 current_position += current_line->length;
680 previous_line = current_line;
681
682 /* Discard data for non-visible lines. It will be calculated as needed */
683 if ((line_index < es->y_offset) || (line_index > es->y_offset + vlc))
685
686 current_line = current_line->next;
687 line_index++;
688 } while (previous_line->ending != END_0);
689
690 /* Finish adjusting line indexes by delta or remove hanging lines */
691 if (previous_line->ending == END_0)
692 {
693 LINEDEF *pnext = NULL;
694
695 previous_line->next = NULL;
696 while (current_line)
697 {
698 pnext = current_line->next;
700 heap_free(current_line);
701 current_line = pnext;
702 es->line_count--;
703 }
704 }
705 else if (delta != 0)
706 {
707 while (current_line)
708 {
709 current_line->index += delta;
710 current_line = current_line->next;
711 }
712 }
713
714 /* Calculate rest of modification rectangle */
715 if (hrgn)
716 {
717 HRGN tmphrgn;
718 /*
719 * We calculate two rectangles. One for the first line which may have
720 * an indent with respect to the format rect. The other is a format-width
721 * rectangle that spans the rest of the lines that changed or moved.
722 */
723 rc.top = es->format_rect.top + nstart_line * es->line_height -
724 (es->y_offset * es->line_height); /* Adjust for vertical scrollbar */
725 rc.bottom = rc.top + es->line_height;
726 if ((es->style & ES_CENTER) || (es->style & ES_RIGHT))
727 rc.left = es->format_rect.left;
728 else
729#ifdef __REACTOS__ /* CORE-11475 */
730 rc.left = (short)LOWORD(EDIT_EM_PosFromChar(es, nstart_index, FALSE));
731#else
732 rc.left = LOWORD(EDIT_EM_PosFromChar(es, nstart_index, FALSE));
733#endif
734 rc.right = es->format_rect.right;
735 SetRectRgn(hrgn, rc.left, rc.top, rc.right, rc.bottom);
736
737 rc.top = rc.bottom;
738 rc.left = es->format_rect.left;
739 rc.right = es->format_rect.right;
740 /*
741 * If lines were added or removed we must re-paint the remainder of the
742 * lines since the remaining lines were either shifted up or down.
743 */
744 if (line_count < es->line_count) /* We added lines */
745 rc.bottom = es->line_count * es->line_height;
746 else if (line_count > es->line_count) /* We removed lines */
747 rc.bottom = line_count * es->line_height;
748 else
749 rc.bottom = line_index * es->line_height;
750 rc.bottom += es->format_rect.top;
751 rc.bottom -= (es->y_offset * es->line_height); /* Adjust for vertical scrollbar */
752 tmphrgn = CreateRectRgn(rc.left, rc.top, rc.right, rc.bottom);
753 CombineRgn(hrgn, hrgn, tmphrgn, RGN_OR);
754 DeleteObject(tmphrgn);
755 }
static HRGN hrgn
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
#define FIXME(fmt,...)
Definition: debug.h:111
#define FALSE
Definition: types.h:117
static void EDIT_InvalidateUniscribeData_linedef(LINEDEF *line_def)
Definition: edit.c:307
static SCRIPT_STRING_ANALYSIS EDIT_UpdateUniscribeData_linedef(EDITSTATE *es, HDC dc, LINEDEF *line_def)
Definition: edit.c:331
static LRESULT EDIT_EM_PosFromChar(EDITSTATE *es, INT index, BOOL after_wrap)
Definition: edit.c:1014
static INT EDIT_CallWordBreakProc(EDITSTATE *es, INT start, INT index, INT count, INT action)
Definition: edit.c:295
const WCHAR * text
Definition: package.c:1799
HRESULT WINAPI ScriptStringGetLogicalWidths(SCRIPT_STRING_ANALYSIS ssa, int *piDx)
Definition: usp10.c:3804
const SIZE *WINAPI ScriptString_pSize(SCRIPT_STRING_ANALYSIS ssa)
Definition: usp10.c:3876
const int *WINAPI ScriptString_pcOutChars(SCRIPT_STRING_ANALYSIS ssa)
Definition: usp10.c:3938
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
pKey DeleteObject()
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint index
Definition: glext.h:6031
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
#define d
Definition: ke_i.h:81
POINT cp
Definition: magnifier.c:59
static float(__cdecl *square_half_float)(float x
#define LOWORD(l)
Definition: pedump.c:82
#define ES_CENTER
Definition: pedump.c:665
#define ES_RIGHT
Definition: pedump.c:666
static unsigned __int64 next
Definition: rand_nt.c:6
#define strlenW(s)
Definition: unicode.h:28
LONG cx
Definition: kdterminal.h:27
INT width
Definition: edit.c:93
struct tagLINEDEF * next
Definition: edit.c:96
INT length
Definition: edit.c:90
SCRIPT_STRING_ANALYSIS ssa
Definition: edit.c:95
INT index
Definition: edit.c:94
INT net_length
Definition: edit.c:91
LINE_END ending
Definition: edit.c:92
LONG right
Definition: windef.h:308
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
HRGN WINAPI CreateRectRgn(_In_ int, _In_ int, _In_ int, _In_ int)
int WINAPI CombineRgn(_In_opt_ HRGN hrgnDest, _In_opt_ HRGN hrgnSrc1, _In_opt_ HRGN hrgnSrc2, _In_ int fnCombineMode)
#define RGN_OR
Definition: wingdi.h:359
BOOL WINAPI SetRectRgn(_In_ HRGN, _In_ int, _In_ int, _In_ int, _In_ int)
#define WB_LEFT
Definition: winuser.h:550
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by EDIT_AdjustFormatRect(), EDIT_EM_ReplaceSel(), EDIT_EM_SetHandle(), EDIT_EM_SetWordBreakProc(), and EDIT_WM_SetFont().

◆ EDIT_CalcLineWidth_SL()

static void EDIT_CalcLineWidth_SL ( EDITSTATE es)
static

Definition at line 762 of file edit.c.

764{
766 if (es->ssa)
767 {
768 const SIZE *size;
769 size = ScriptString_pSize(es->ssa);
770 es->text_width = size->cx;
771 }
772 else
773 es->text_width = 0;
static SCRIPT_STRING_ANALYSIS EDIT_UpdateUniscribeData(EDITSTATE *es, HDC dc, INT line)
Definition: edit.c:373
GLsizeiptr size
Definition: glext.h:5919

Referenced by EDIT_EM_ReplaceSel(), and EDIT_WM_SetFont().

◆ EDIT_CallWordBreakProc()

static INT EDIT_CallWordBreakProc ( EDITSTATE es,
INT  start,
INT  index,
INT  count,
INT  action 
)
static

Definition at line 295 of file edit.c.

297{
298 INT ret;
299
300 if (es->word_break_proc)
301 ret = es->word_break_proc(es->text + start, index, count, action);
302 else
304
305 return ret;
static INT EDIT_WordBreakProc(EDITSTATE *es, LPWSTR s, INT index, INT count, INT action)
Definition: edit.c:237
const WCHAR * action
Definition: action.c:7479
GLuint start
Definition: gl.h:1545
int ret

Referenced by EDIT_BuildLineDefs_ML(), EDIT_MoveWordBackward(), EDIT_MoveWordForward(), and EDIT_WM_LButtonDblClk().

◆ EDIT_CharFromPos()

static INT EDIT_CharFromPos ( EDITSTATE es,
INT  x,
INT  y,
LPBOOL  after_wrap 
)
static

Definition at line 785 of file edit.c.

787{
788 INT index;
789
790 if (es->style & ES_MULTILINE) {
791 int trailing;
792 INT line = (y - es->format_rect.top) / es->line_height + es->y_offset;
793 INT line_index = 0;
794 LINEDEF *line_def = es->first_line_def;
796 while ((line > 0) && line_def->next) {
797 line_index += line_def->length;
798 line_def = line_def->next;
799 line--;
800 }
801
802 x += es->x_offset - es->format_rect.left;
803 if (es->style & ES_RIGHT)
804 x -= (es->format_rect.right - es->format_rect.left) - line_def->width;
805 else if (es->style & ES_CENTER)
806 x -= ((es->format_rect.right - es->format_rect.left) - line_def->width) / 2;
807 if (x >= line_def->width) {
808 if (after_wrap)
809 *after_wrap = (line_def->ending == END_WRAP);
810 return line_index + line_def->net_length;
811 }
812 if (x <= 0 || !line_def->ssa) {
813 if (after_wrap)
814 *after_wrap = FALSE;
815 return line_index;
816 }
817
818 ScriptStringXtoCP(line_def->ssa, x , &index, &trailing);
819 if (trailing) index++;
820 index += line_index;
821 if (after_wrap)
822 *after_wrap = ((index == line_index + line_def->net_length) &&
823 (line_def->ending == END_WRAP));
824 } else {
825 INT xoff = 0;
826 INT trailing;
827 if (after_wrap)
828 *after_wrap = FALSE;
829 x -= es->format_rect.left;
830 if (!x)
831 return es->x_offset;
832
833 if (!es->x_offset)
834 {
835 INT indent = (es->format_rect.right - es->format_rect.left) - es->text_width;
836 if (es->style & ES_RIGHT)
837 x -= indent;
838 else if (es->style & ES_CENTER)
839 x -= indent / 2;
840 }
841
843 if (es->x_offset)
844 {
845 if (es->ssa)
846 {
847 if (es->x_offset>= get_text_length(es))
848 {
849 const SIZE *size;
850 size = ScriptString_pSize(es->ssa);
851 xoff = size->cx;
852 }
853 ScriptStringCPtoX(es->ssa, es->x_offset, FALSE, &xoff);
854 }
855 else
856 xoff = 0;
857 }
858 if (x < 0)
859 {
860 if (x + xoff > 0 || !es->ssa)
861 {
862 ScriptStringXtoCP(es->ssa, x+xoff, &index, &trailing);
863 if (trailing) index++;
864 }
865 else
866 index = 0;
867 }
868 else
869 {
870 if (x)
871 {
872 const SIZE *size = NULL;
873 if (es->ssa)
874 size = ScriptString_pSize(es->ssa);
875 if (!size)
876 index = 0;
877 else if (x > size->cx)
879 else if (es->ssa)
880 {
881 ScriptStringXtoCP(es->ssa, x+xoff, &index, &trailing);
882 if (trailing) index++;
883 }
884 else
885 index = 0;
886 }
887 else
888 index = es->x_offset;
889 }
890 }
891 return index;
#define index(s, c)
Definition: various.h:29
static const WCHAR indent[]
Definition: object.c:1156
HRESULT WINAPI ScriptStringXtoCP(SCRIPT_STRING_ANALYSIS ssa, int iX, int *piCh, int *piTrailing)
Definition: usp10.c:2474
HRESULT WINAPI ScriptStringCPtoX(SCRIPT_STRING_ANALYSIS ssa, int icp, BOOL fTrailing, int *pX)
Definition: usp10.c:2411
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
if(dx< 0)
Definition: linetemp.h:194
Definition: parser.c:49

Referenced by EDIT_EM_CharFromPos(), EDIT_MoveDown_ML(), EDIT_MoveEnd(), EDIT_MoveHome(), EDIT_MovePageDown_ML(), EDIT_MovePageUp_ML(), EDIT_MoveUp_ML(), EDIT_WM_LButtonDown(), and EDIT_WM_MouseMove().

◆ EDIT_CheckCombo()

static BOOL EDIT_CheckCombo ( EDITSTATE es,
UINT  msg,
INT  key 
)
static

Definition at line 3245 of file edit.c.

3247{
3248 HWND hLBox = es->hwndListBox;
3249 HWND hCombo;
3250 BOOL bDropped;
3251 int nEUI;
3252
3253 if (!hLBox)
3254 return FALSE;
3255
3256 hCombo = GetParent(es->hwndSelf);
3257 bDropped = TRUE;
3258 nEUI = 0;
3259
3260 TRACE("[%p]: handling msg %x (%x)\n", es->hwndSelf, msg, key);
3261
3262 if (key == VK_UP || key == VK_DOWN)
3263 {
3264 if (SendMessageW(hCombo, CB_GETEXTENDEDUI, 0, 0))
3265 nEUI = 1;
3266
3267 if (msg == WM_KEYDOWN || nEUI)
3268 bDropped = (BOOL)SendMessageW(hCombo, CB_GETDROPPEDSTATE, 0, 0);
3269 }
3270
3271 switch (msg)
3272 {
3273 case WM_KEYDOWN:
3274 if (!bDropped && nEUI && (key == VK_UP || key == VK_DOWN))
3275 {
3276 /* make sure ComboLBox pops up */
3277 SendMessageW(hCombo, CB_SETEXTENDEDUI, FALSE, 0);
3278 key = VK_F4;
3279 nEUI = 2;
3280 }
3281
3282 SendMessageW(hLBox, WM_KEYDOWN, key, 0);
3283 break;
3284
3285 case WM_SYSKEYDOWN: /* Handle Alt+up/down arrows */
3286 if (nEUI)
3287 SendMessageW(hCombo, CB_SHOWDROPDOWN, !bDropped, 0);
3288 else
3289 SendMessageW(hLBox, WM_KEYDOWN, VK_F4, 0);
3290 break;
3291 }
3292
3293 if (nEUI == 2)
3294 SendMessageW(hCombo, CB_SETEXTENDEDUI, TRUE, 0);
3295
3296 return TRUE;
#define msg(x)
Definition: auth_time.c:54
#define TRUE
Definition: types.h:120
unsigned int BOOL
Definition: ntddk_ex.h:94
#define BOOL
Definition: nt_native.h:43
#define TRACE(s)
Definition: solgame.cpp:4
Definition: copy.c:22
#define CB_SHOWDROPDOWN
Definition: winuser.h:1960
#define VK_UP
Definition: winuser.h:2215
#define VK_F4
Definition: winuser.h:2248
#define CB_GETDROPPEDSTATE
Definition: winuser.h:1935
HWND WINAPI GetParent(_In_ HWND)
#define CB_GETEXTENDEDUI
Definition: winuser.h:1938
#define VK_DOWN
Definition: winuser.h:2217
#define WM_KEYDOWN
Definition: winuser.h:1705
#define CB_SETEXTENDEDUI
Definition: winuser.h:1954
#define WM_SYSKEYDOWN
Definition: winuser.h:1709
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by EDIT_WM_KeyDown(), and EDIT_WM_SysKeyDown().

◆ EDIT_ConfinePoint()

static void EDIT_ConfinePoint ( const EDITSTATE es,
LPINT  x,
LPINT  y 
)
static

Definition at line 902 of file edit.c.

904{
905 *x = min(max(*x, es->format_rect.left), es->format_rect.right - 1);
906 *y = min(max(*y, es->format_rect.top), es->format_rect.bottom - 1);

Referenced by EDIT_WM_LButtonDown(), and EDIT_WM_MouseMove().

◆ EDIT_ContextMenuCommand()

static void EDIT_ContextMenuCommand ( EDITSTATE es,
UINT  id 
)
static

Definition at line 3131 of file edit.c.

3133{
3134 switch (id) {
3135 case EM_UNDO:
3136 SendMessageW(es->hwndSelf, WM_UNDO, 0, 0);
3137 break;
3138 case WM_CUT:
3139 SendMessageW(es->hwndSelf, WM_CUT, 0, 0);
3140 break;
3141 case WM_COPY:
3142 SendMessageW(es->hwndSelf, WM_COPY, 0, 0);
3143 break;
3144 case WM_PASTE:
3145 SendMessageW(es->hwndSelf, WM_PASTE, 0, 0);
3146 break;
3147 case WM_CLEAR:
3148 SendMessageW(es->hwndSelf, WM_CLEAR, 0, 0);
3149 break;
3150 case EM_SETSEL:
3151 SendMessageW(es->hwndSelf, EM_SETSEL, 0, -1);
3152 break;
3153 default:
3154 ERR("unknown menu item, please report\n");
3155 break;
3156 }
#define ERR(fmt,...)
Definition: debug.h:110
#define WM_PASTE
Definition: winuser.h:1853
#define WM_CUT
Definition: winuser.h:1851
#define WM_UNDO
Definition: winuser.h:1855
#define EM_UNDO
Definition: winuser.h:2011
#define EM_SETSEL
Definition: winuser.h:2008
#define WM_COPY
Definition: winuser.h:1852
#define WM_CLEAR
Definition: winuser.h:1854

Referenced by EDIT_WM_ContextMenu().

◆ EDIT_EM_CanUndo()

static BOOL EDIT_EM_CanUndo ( const EDITSTATE es)
inlinestatic

Definition at line 182 of file edit.c.

184{
185 return (es->undo_insert_count || strlenW(es->undo_text));

Referenced by EDIT_WindowProc(), EDIT_WM_ContextMenu(), EDIT_WM_SysKeyDown(), and EditWndProc_common().

◆ EDIT_EM_CharFromPos()

static LRESULT EDIT_EM_CharFromPos ( EDITSTATE es,
INT  x,
INT  y 
)
static

Definition at line 2350 of file edit.c.

2352{
2353 POINT pt;
2354 RECT rc;
2355 INT index;
2356
2357 pt.x = x;
2358 pt.y = y;
2359 GetClientRect(es->hwndSelf, &rc);
2360 if (!PtInRect(&rc, pt))
2361 return -1;
2362
static INT EDIT_CharFromPos(EDITSTATE *es, INT x, INT y, LPBOOL after_wrap)
Definition: edit.c:785
static INT EDIT_EM_LineFromChar(EDITSTATE *es, INT index)
Definition: edit.c:914
#define pt(x, y)
Definition: drawing.c:79
#define MAKELONG(a, b)
Definition: typedefs.h:249
BOOL WINAPI PtInRect(_In_ LPCRECT, _In_ POINT)

Referenced by EDIT_WindowProc().

◆ EDIT_EM_EmptyUndoBuffer()

static void EDIT_EM_EmptyUndoBuffer ( EDITSTATE es)
inlinestatic

Definition at line 193 of file edit.c.

195{
196 es->undo_insert_count = 0;
197 *es->undo_text = '\0';

Referenced by EDIT_EM_ReplaceSel(), EDIT_EM_SetHandle(), EDIT_EM_Undo(), EDIT_WindowProc(), EDIT_WM_Create(), and EditWndProc_common().

◆ EDIT_EM_FmtLines()

static BOOL EDIT_EM_FmtLines ( EDITSTATE es,
BOOL  add_eol 
)
static

Definition at line 2378 of file edit.c.

2380{
2381 es->flags &= ~EF_USE_SOFTBRK;
2382 if (add_eol) {
2383 es->flags |= EF_USE_SOFTBRK;
2384 FIXME("soft break enabled, not implemented\n");
2385 }
2386 return add_eol;
#define EF_USE_SOFTBRK
Definition: edit.c:75

Referenced by EDIT_WindowProc(), and EditWndProc_common().

◆ EDIT_EM_GetHandle()

static HLOCAL EDIT_EM_GetHandle ( EDITSTATE es)
static

Definition at line 2400 of file edit.c.

2402{
2403 if (!(es->style & ES_MULTILINE))
2404 return 0;
2405
2407
2408 /* The text buffer handle belongs to the app */
2409 es->hlocapp = es->hloc32W;
2410
2411 TRACE("Returning %p, LocalSize() = %ld\n", es->hlocapp, LocalSize(es->hlocapp));
2412 return es->hlocapp;
static void EDIT_UnlockBuffer(EDITSTATE *es, BOOL force)
Definition: edit.c:1227
SIZE_T NTAPI LocalSize(HLOCAL hMem)
Definition: heapmem.c:1794

Referenced by EDIT_WindowProc(), and EditWndProc_common().

◆ EDIT_EM_GetLine()

static INT EDIT_EM_GetLine ( EDITSTATE es,
INT  line,
LPWSTR  dst 
)
static

Definition at line 2420 of file edit.c.

2422{
2423 INT line_len, dst_len;
2424 LPWSTR src;
2425 INT i;
2426
2427 if (es->style & ES_MULTILINE)
2428 {
2429 if (line >= es->line_count)
2430 return 0;
2431 }
2432 else
2433 line = 0;
2434
2436 src = es->text + i;
2437 line_len = EDIT_EM_LineLength(es, i);
2438 dst_len = *(WORD *)dst;
2439
2440 if (dst_len <= line_len)
2441 {
2442 memcpy(dst, src, dst_len * sizeof(WCHAR));
2443 return dst_len;
2444 }
2445 else /* Append 0 if enough space */
2446 {
2447 memcpy(dst, src, line_len * sizeof(WCHAR));
2448 dst[line_len] = 0;
2449 return line_len;
2450 }
static INT EDIT_EM_LineIndex(const EDITSTATE *es, INT line)
Definition: edit.c:943
static INT EDIT_EM_LineLength(EDITSTATE *es, INT index)
Definition: edit.c:978
unsigned short WORD
Definition: ntddk_ex.h:93
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by EDIT_WindowProc(), and EditWndProc_common().

◆ EDIT_EM_GetSel()

static LRESULT EDIT_EM_GetSel ( const EDITSTATE es,
PUINT  start,
PUINT  end 
)
static

Definition at line 2458 of file edit.c.

2460{
2461 UINT s = es->selection_start;
2462 UINT e = es->selection_end;
2463
2464 ORDER_UINT(s, e);
2465 if (start)
2466 *start = s;
2467 if (end)
2468 *end = e;
2469 return MAKELONG(s, e);
#define ORDER_UINT(x, y)
Definition: edit.c:165
GLdouble s
Definition: gl.h:2039
GLuint GLuint end
Definition: gl.h:1545
#define e
Definition: ke_i.h:82
unsigned int UINT
Definition: ndis.h:50

Referenced by EDIT_WindowProc(), and EditWndProc_common().

◆ EDIT_EM_GetThumb()

static LRESULT EDIT_EM_GetThumb ( EDITSTATE es)
static

Definition at line 4247 of file edit.c.

4249{
static LRESULT EDIT_WM_HScroll(EDITSTATE *es, INT action, INT pos)
Definition: edit.c:3995
static LRESULT EDIT_WM_VScroll(EDITSTATE *es, INT action, INT pos)
Definition: edit.c:4127
#define EM_GETTHUMB
Definition: winuser.h:1988

Referenced by EDIT_WindowProc(), and EditWndProc_common().

◆ EDIT_EM_LineFromChar()

static INT EDIT_EM_LineFromChar ( EDITSTATE es,
INT  index 
)
static

Definition at line 914 of file edit.c.

916{
917 INT line;
918 LINEDEF *line_def;
919
920 if (!(es->style & ES_MULTILINE))
921 return 0;
922 if (index > (INT)get_text_length(es))
923 return es->line_count - 1;
924 if (index == -1)
925 index = min(es->selection_start, es->selection_end);
926
927 line = 0;
928 line_def = es->first_line_def;
929 index -= line_def->length;
930 while ((index >= 0) && line_def->next) {
931 line++;
932 line_def = line_def->next;
933 index -= line_def->length;
934 }
935 return line;

Referenced by EDIT_EM_CharFromPos(), EDIT_EM_LineLength(), EDIT_EM_PosFromChar(), EDIT_EM_ScrollCaret(), EDIT_ML_InvalidateText(), EDIT_MoveWordBackward(), EDIT_MoveWordForward(), EDIT_WindowProc(), EDIT_WM_LButtonDblClk(), and EditWndProc_common().

◆ EDIT_EM_LineIndex()

static INT EDIT_EM_LineIndex ( const EDITSTATE es,
INT  line 
)
static

Definition at line 943 of file edit.c.

945{
946 INT line_index;
947 const LINEDEF *line_def;
948
949 if (!(es->style & ES_MULTILINE))
950 return 0;
951 if (line >= es->line_count)
952 return -1;
953
954 line_index = 0;
955 line_def = es->first_line_def;
956 if (line == -1) {
957 INT index = es->selection_end - line_def->length;
958 while ((index >= 0) && line_def->next) {
959 line_index += line_def->length;
960 line_def = line_def->next;
961 index -= line_def->length;
962 }
963 } else {
964 while (line > 0) {
965 line_index += line_def->length;
966 line_def = line_def->next;
967 line--;
968 }
969 }
970 return line_index;

Referenced by EDIT_EM_GetLine(), EDIT_EM_LineLength(), EDIT_EM_PosFromChar(), EDIT_ML_InvalidateText(), EDIT_MoveWordBackward(), EDIT_MoveWordForward(), EDIT_PaintLine(), EDIT_PaintText(), EDIT_WindowProc(), EDIT_WM_LButtonDblClk(), and EditWndProc_common().

◆ EDIT_EM_LineLength()

static INT EDIT_EM_LineLength ( EDITSTATE es,
INT  index 
)
static

Definition at line 978 of file edit.c.

980{
981 LINEDEF *line_def;
982
983 if (!(es->style & ES_MULTILINE))
984 return get_text_length(es);
985
986 if (index == -1) {
987 /* get the number of remaining non-selected chars of selected lines */
988 INT32 l; /* line number */
989 INT32 li; /* index of first char in line */
990 INT32 count;
991 l = EDIT_EM_LineFromChar(es, es->selection_start);
992 /* # chars before start of selection area */
993 count = es->selection_start - EDIT_EM_LineIndex(es, l);
994 l = EDIT_EM_LineFromChar(es, es->selection_end);
995 /* # chars after end of selection */
997 count += li + EDIT_EM_LineLength(es, li) - es->selection_end;
998 return count;
999 }
1000 line_def = es->first_line_def;
1001 index -= line_def->length;
1002 while ((index >= 0) && line_def->next) {
1003 line_def = line_def->next;
1004 index -= line_def->length;
1005 }
1006 return line_def->net_length;
signed int INT32
r l[0]
Definition: byte_order.h:168
LARGE_INTEGER li
Definition: fxtimerapi.cpp:235

Referenced by EDIT_EM_GetLine(), EDIT_EM_LineLength(), EDIT_ML_InvalidateText(), EDIT_MoveWordBackward(), EDIT_MoveWordForward(), EDIT_PaintLine(), EDIT_WindowProc(), EDIT_WM_LButtonDblClk(), and EditWndProc_common().

◆ EDIT_EM_LineScroll()

static BOOL EDIT_EM_LineScroll ( EDITSTATE es,
INT  dx,
INT  dy 
)
static

Definition at line 1654 of file edit.c.

1656{
1657 if (!(es->style & ES_MULTILINE))
1658 return FALSE;
1659
1660 dx *= es->char_width;
static BOOL EDIT_EM_LineScroll_internal(EDITSTATE *es, INT dx, INT dy)
Definition: edit.c:1598
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97

Referenced by EDIT_EM_Scroll(), EDIT_WindowProc(), EDIT_WM_VScroll(), and EditWndProc_common().

◆ EDIT_EM_LineScroll_internal()

static BOOL EDIT_EM_LineScroll_internal ( EDITSTATE es,
INT  dx,
INT  dy 
)
static

Definition at line 1598 of file edit.c.

1600{
1601 INT nyoff;
1602 INT x_offset_in_pixels;
1603 INT lines_per_page = (es->format_rect.bottom - es->format_rect.top) /
1604 es->line_height;
1605
1606 if (es->style & ES_MULTILINE)
1607 {
1608 x_offset_in_pixels = es->x_offset;
1609 }
1610 else
1611 {
1612 dy = 0;
1613 x_offset_in_pixels = (short)LOWORD(EDIT_EM_PosFromChar(es, es->x_offset, FALSE));
1614 }
1615
1616 if (-dx > x_offset_in_pixels)
1617 dx = -x_offset_in_pixels;
1618 if (dx > es->text_width - x_offset_in_pixels)
1619 dx = es->text_width - x_offset_in_pixels;
1620 nyoff = max(0, es->y_offset + dy);
1621 if (nyoff >= es->line_count - lines_per_page)
1622 nyoff = max(0, es->line_count - lines_per_page);
1623 dy = (es->y_offset - nyoff) * es->line_height;
1624 if (dx || dy) {
1625 RECT rc1;
1626 RECT rc;
1627
1628 es->y_offset = nyoff;
1629 if(es->style & ES_MULTILINE)
1630 es->x_offset += dx;
1631 else
1632 es->x_offset += dx / es->char_width;
1633
1634 GetClientRect(es->hwndSelf, &rc1);
1635 IntersectRect(&rc, &rc1, &es->format_rect);
1636 ScrollWindowEx(es->hwndSelf, -dx, dy,
1637 NULL, &rc, NULL, NULL, SW_INVALIDATE);
1638 /* force scroll info update */
1640 }
1641 if (dx && !(es->flags & EF_HSCROLL_TRACK))
1643 if (dy && !(es->flags & EF_VSCROLL_TRACK))
1645 return TRUE;
static BOOL notify_parent(const EDITSTATE *es, INT code)
Definition: edit.c:167
#define EF_HSCROLL_TRACK
Definition: edit.c:73
#define EF_VSCROLL_TRACK
Definition: edit.c:72
#define SW_INVALIDATE
Definition: winuser.h:2569
#define EN_HSCROLL
Definition: winuser.h:2014
BOOL WINAPI IntersectRect(_Out_ LPRECT, _In_ LPCRECT, _In_ LPCRECT)
#define EN_VSCROLL
Definition: winuser.h:2019
int WINAPI ScrollWindowEx(_In_ HWND, _In_ int, _In_ int, _In_opt_ LPCRECT, _In_opt_ LPCRECT, _In_opt_ HRGN, _Out_opt_ LPRECT, _In_ UINT)

Referenced by EDIT_EM_LineScroll(), EDIT_EM_ScrollCaret(), and EDIT_WM_HScroll().

◆ EDIT_EM_PosFromChar()

static LRESULT EDIT_EM_PosFromChar ( EDITSTATE es,
INT  index,
BOOL  after_wrap 
)
static

Definition at line 1014 of file edit.c.

1016{
1018 INT l;
1019 INT li;
1020 INT x = 0;
1021 INT y = 0;
1022 INT w;
1023 INT lw;
1024 LINEDEF *line_def;
1025
1026 index = min(index, len);
1027 if (es->style & ES_MULTILINE) {
1030
1031 y = (l - es->y_offset) * es->line_height;
1033 if (after_wrap && (li == index) && l) {
1034 INT l2 = l - 1;
1035 line_def = es->first_line_def;
1036 while (l2) {
1037 line_def = line_def->next;
1038 l2--;
1039 }
1040 if (line_def->ending == END_WRAP) {
1041 l--;
1042 y -= es->line_height;
1044 }
1045 }
1046
1047 line_def = es->first_line_def;
1048 while (line_def->index != li)
1049 line_def = line_def->next;
1050
1051 lw = line_def->width;
1052 w = es->format_rect.right - es->format_rect.left;
1053 if (line_def->ssa)
1054 {
1055 ScriptStringCPtoX(line_def->ssa, (index - 1) - li, TRUE, &x);
1056 x -= es->x_offset;
1057 }
1058 else
1059#ifdef __REACTOS__ /* CORE-15780 */
1060 x = (lw > 0 ? es->x_offset : x - es->x_offset);
1061#else
1062 x = es->x_offset;
1063#endif
1064
1065 if (es->style & ES_RIGHT)
1066 x = w - (lw - x);
1067 else if (es->style & ES_CENTER)
1068 x += (w - lw) / 2;
1069 } else {
1070 INT xoff = 0;
1071 INT xi = 0;
1073 if (es->x_offset)
1074 {
1075 if (es->ssa)
1076 {
1077 if (es->x_offset >= get_text_length(es))
1078 {
1079 int leftover = es->x_offset - get_text_length(es);
1080 if (es->ssa)
1081 {
1082 const SIZE *size;
1083 size = ScriptString_pSize(es->ssa);
1084 xoff = size->cx;
1085 }
1086 else
1087 xoff = 0;
1088 xoff += es->char_width * leftover;
1089 }
1090 else
1091 ScriptStringCPtoX(es->ssa, es->x_offset, FALSE, &xoff);
1092 }
1093 else
1094 xoff = 0;
1095 }
1096 if (index)
1097 {
1098 if (index >= get_text_length(es))
1099 {
1100 if (es->ssa)
1101 {
1102 const SIZE *size;
1103 size = ScriptString_pSize(es->ssa);
1104 xi = size->cx;
1105 }
1106 else
1107 xi = 0;
1108 }
1109 else if (es->ssa)
1110 ScriptStringCPtoX(es->ssa, index, FALSE, &xi);
1111 else
1112 xi = 0;
1113 }
1114 x = xi - xoff;
1115
1116 if (index >= es->x_offset) {
1117 if (!es->x_offset && (es->style & (ES_RIGHT | ES_CENTER)))
1118 {
1119 w = es->format_rect.right - es->format_rect.left;
1120 if (w > es->text_width)
1121 {
1122 if (es->style & ES_RIGHT)
1123 x += w - es->text_width;
1124 else if (es->style & ES_CENTER)
1125 x += (w - es->text_width) / 2;
1126 }
1127 }
1128 }
1129 y = 0;
1130 }
1131 x += es->format_rect.left;
1132 y += es->format_rect.top;
1133 return MAKELONG((INT16)x, (INT16)y);
signed short INT16
GLenum GLsizei len
Definition: glext.h:6722

Referenced by EDIT_BuildLineDefs_ML(), EDIT_EM_LineScroll_internal(), EDIT_EM_ScrollCaret(), EDIT_GetLineRect(), EDIT_MoveDown_ML(), EDIT_MoveEnd(), EDIT_MoveHome(), EDIT_MovePageDown_ML(), EDIT_MovePageUp_ML(), EDIT_MoveUp_ML(), EDIT_PaintLine(), EDIT_SetCaretPos(), and EDIT_WindowProc().

◆ EDIT_EM_ReplaceSel()

static void EDIT_EM_ReplaceSel ( EDITSTATE es,
BOOL  can_undo,
const WCHAR lpsz_replace,
UINT  strl,
BOOL  send_update,
BOOL  honor_limit 
)
static

Definition at line 2479 of file edit.c.

2482{
2483 UINT tl = get_text_length(es);
2484 UINT utl;
2485 UINT s;
2486 UINT e;
2487 UINT i;
2488 UINT size;
2489 LPWSTR p;
2490 HRGN hrgn = 0;
2491 LPWSTR buf = NULL;
2492 UINT bufl;
2493
2494 TRACE("%s, can_undo %d, send_update %d\n",
2495 debugstr_wn(lpsz_replace, strl), can_undo, send_update);
2496
2497 s = es->selection_start;
2498 e = es->selection_end;
2499
2501 if ((s == e) && !strl)
2502 return;
2503
2504 ORDER_UINT(s, e);
2505
2506 size = tl - (e - s) + strl;
2507 if (!size)
2508 es->text_width = 0;
2509
2510 /* Issue the EN_MAXTEXT notification and continue with replacing text
2511 * so that buffer limit is honored. */
2512 if ((honor_limit) && (size > es->buffer_limit))
2513 {
2514 if (!notify_parent(es, EN_MAXTEXT)) return;
2515 /* Buffer limit can be smaller than the actual length of text in combobox */
2516 if (es->buffer_limit < (tl - (e-s)))
2517 strl = 0;
2518 else
2519 strl = min(strl, es->buffer_limit - (tl - (e-s)));
2520 }
2521
2522 if (!EDIT_MakeFit(es, tl - (e - s) + strl))
2523 return;
2524
2525 if (e != s) {
2526 /* there is something to be deleted */
2527 TRACE("deleting stuff.\n");
2528 bufl = e - s;
2529 buf = heap_alloc((bufl + 1) * sizeof(WCHAR));
2530 if (!buf) return;
2531 memcpy(buf, es->text + s, bufl * sizeof(WCHAR));
2532 buf[bufl] = 0; /* ensure 0 termination */
2533 /* now delete */
2534 strcpyW(es->text + s, es->text + e);
2536 }
2537 if (strl) {
2538 /* there is an insertion */
2539 tl = get_text_length(es);
2540 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));
2541 for (p = es->text + tl ; p >= es->text + s ; p--)
2542 p[strl] = p[0];
2543 for (i = 0 , p = es->text + s ; i < strl ; i++)
2544 p[i] = lpsz_replace[i];
2545 if(es->style & ES_UPPERCASE)
2546 CharUpperBuffW(p, strl);
2547 else if(es->style & ES_LOWERCASE)
2548 CharLowerBuffW(p, strl);
2550 }
2551 if (es->style & ES_MULTILINE)
2552 {
2553 INT st = min(es->selection_start, es->selection_end);
2555
2556 hrgn = CreateRectRgn(0, 0, 0, 0);
2557 EDIT_BuildLineDefs_ML(es, st, st + strl,
2558 strl - abs(es->selection_end - es->selection_start), hrgn);
2559 /* if text is too long undo all changes */
2560 if (honor_limit && !(es->style & ES_AUTOVSCROLL) && (es->line_count > vlc)) {
2561 if (strl)
2562 strcpyW(es->text + e, es->text + e + strl);
2563 if (e != s)
2564 for (i = 0 , p = es->text ; i < e - s ; i++)
2565 p[i + s] = buf[i];
2568 abs(es->selection_end - es->selection_start) - strl, hrgn);
2569 strl = 0;
2570 e = s;
2571 hrgn = CreateRectRgn(0, 0, 0, 0);
2572 if (!notify_parent(es, EN_MAXTEXT)) return;
2573 }
2574 }
2575 else {
2576 INT fw = es->format_rect.right - es->format_rect.left;
2579 /* remove chars that don't fit */
2580 if (honor_limit && !(es->style & ES_AUTOHSCROLL) && (es->text_width > fw)) {
2581 while ((es->text_width > fw) && s + strl >= s) {
2582 strcpyW(es->text + s + strl - 1, es->text + s + strl);
2583 strl--;
2584 es->text_length = -1;
2587 }
2589 if (!notify_parent(es, EN_MAXTEXT)) return;
2590 }
2591 }
2592
2593 if (e != s) {
2594 if (can_undo) {
2595 utl = strlenW(es->undo_text);
2596 if (!es->undo_insert_count && (*es->undo_text && (s == es->undo_position))) {
2597 /* undo-buffer is extended to the right */
2598 EDIT_MakeUndoFit(es, utl + e - s);
2599 memcpy(es->undo_text + utl, buf, (e - s)*sizeof(WCHAR));
2600 (es->undo_text + utl)[e - s] = 0; /* ensure 0 termination */
2601 } else if (!es->undo_insert_count && (*es->undo_text && (e == es->undo_position))) {
2602 /* undo-buffer is extended to the left */
2603 EDIT_MakeUndoFit(es, utl + e - s);
2604 for (p = es->undo_text + utl ; p >= es->undo_text ; p--)
2605 p[e - s] = p[0];
2606 for (i = 0 , p = es->undo_text ; i < e - s ; i++)
2607 p[i] = buf[i];
2608 es->undo_position = s;
2609 } else {
2610 /* new undo-buffer */
2611 EDIT_MakeUndoFit(es, e - s);
2612 memcpy(es->undo_text, buf, (e - s)*sizeof(WCHAR));
2613 es->undo_text[e - s] = 0; /* ensure 0 termination */
2614 es->undo_position = s;
2615 }
2616 /* any deletion makes the old insertion-undo invalid */
2617 es->undo_insert_count = 0;
2618 } else
2620 }
2621 if (strl) {
2622 if (can_undo) {
2623 if ((s == es->undo_position) ||
2624 ((es->undo_insert_count) &&
2625 (s == es->undo_position + es->undo_insert_count)))
2626 /*
2627 * insertion is new and at delete position or
2628 * an extension to either left or right
2629 */
2630 es->undo_insert_count += strl;
2631 else {
2632 /* new insertion undo */
2633 es->undo_position = s;
2634 es->undo_insert_count = strl;
2635 /* new insertion makes old delete-buffer invalid */
2636 *es->undo_text = '\0';
2637 }
2638 } else
2640 }
2641
2642 heap_free(buf);
2643
2644 s += strl;
2645
2646 /* If text has been deleted and we're right or center aligned then scroll rightward */
2647 if (es->style & (ES_RIGHT | ES_CENTER))
2648 {
2649 INT delta = strl - abs(es->selection_end - es->selection_start);
2650
2651 if (delta < 0 && es->x_offset)
2652 {
2653 if (abs(delta) > es->x_offset)
2654 es->x_offset = 0;
2655 else
2656 es->x_offset += delta;
2657 }
2658 }
2659
2661 es->flags |= EF_MODIFIED;
2662 if (send_update) es->flags |= EF_UPDATE;
2663 if (hrgn)
2664 {
2667 }
2668 else
2670
2672
2673 /* force scroll info update */
2675
2676
2677 if(send_update || (es->flags & EF_UPDATE))
2678 {
2679 es->flags &= ~EF_UPDATE;
2680 if (!notify_parent(es, EN_CHANGE)) return;
2681 }
#define EF_MODIFIED
Definition: edit.c:69
static void EDIT_CalcLineWidth_SL(EDITSTATE *es)
Definition: edit.c:762
static void EDIT_EM_ScrollCaret(EDITSTATE *es)
Definition: edit.c:1772
#define EF_UPDATE
Definition: edit.c:71
static void EDIT_InvalidateUniscribeData(EDITSTATE *es)
Definition: edit.c:316
static void EDIT_EM_EmptyUndoBuffer(EDITSTATE *es)
Definition: edit.c:193
static void text_buffer_changed(EDITSTATE *es)
Definition: edit.c:1195
static BOOL EDIT_MakeFit(EDITSTATE *es, UINT size)
Definition: edit.c:1273
static BOOL EDIT_MakeUndoFit(EDITSTATE *es, UINT size)
Definition: edit.c:1314
static void EDIT_UpdateTextRegion(EDITSTATE *es, HRGN hrgn, BOOL bErase)
Definition: edit.c:1341
static void EDIT_UpdateText(EDITSTATE *es, const RECT *rc, BOOL bErase)
Definition: edit.c:1356
static BOOL EDIT_EM_SetSel(EDITSTATE *es, UINT start, UINT end, BOOL after_wrap)
Definition: edit.c:1486
#define abs(i)
Definition: fconv.c:206
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLfloat GLfloat p
Definition: glext.h:8902
#define debugstr_wn
Definition: kernel32.h:33
#define debugstr_w
Definition: kernel32.h:32
#define ES_LOWERCASE
Definition: pedump.c:669
#define ES_AUTOVSCROLL
Definition: pedump.c:671
#define ES_UPPERCASE
Definition: pedump.c:668
#define strcpyW(d, s)
Definition: unicode.h:29
#define EN_MAXTEXT
Definition: winuser.h:2016
DWORD WINAPI CharUpperBuffW(_Inout_updates_(cchLength) LPWSTR lpsz, _In_ DWORD cchLength)
#define EN_CHANGE
Definition: winuser.h:2012
DWORD WINAPI CharLowerBuffW(_Inout_updates_(cchLength) LPWSTR lpsz, _In_ DWORD cchLength)

Referenced by EDIT_EM_Undo(), EDIT_GetCompositionStr(), EDIT_GetResultStr(), EDIT_ImeComposition(), EDIT_WindowProc(), EDIT_WM_Char(), EDIT_WM_Clear(), EDIT_WM_Create(), EDIT_WM_Paste(), EDIT_WM_SetText(), and EditWndProc_common().

◆ EDIT_EM_Scroll()

static LRESULT EDIT_EM_Scroll ( EDITSTATE es,
INT  action 
)
static

Definition at line 1669 of file edit.c.

1671{
1672 INT dy;
1673
1674 if (!(es->style & ES_MULTILINE))
1675 return (LRESULT)FALSE;
1676
1677 dy = 0;
1678
1679 switch (action) {
1680 case SB_LINEUP:
1681 if (es->y_offset)
1682 dy = -1;
1683 break;
1684 case SB_LINEDOWN:
1685 if (es->y_offset < es->line_count - 1)
1686 dy = 1;
1687 break;
1688 case SB_PAGEUP:
1689 if (es->y_offset)
1690 dy = -(es->format_rect.bottom - es->format_rect.top) / es->line_height;
1691 break;
1692 case SB_PAGEDOWN:
1693 if (es->y_offset < es->line_count - 1)
1694 dy = (es->format_rect.bottom - es->format_rect.top) / es->line_height;
1695 break;
1696 default:
1698 }
1699 if (dy) {
1701 /* check if we are going to move too far */
1702 if(es->y_offset + dy > es->line_count - vlc)
1703 dy = max(es->line_count - vlc, 0) - es->y_offset;
1704
1705 /* Notification is done in EDIT_EM_LineScroll */
1706 if(dy) {
1708 return MAKELONG(dy, TRUE);
1709 }
1710
1711 }
1712 return (LRESULT)FALSE;
return
Definition: dirsup.c:529
static BOOL EDIT_EM_LineScroll(EDITSTATE *es, INT dx, INT dy)
Definition: edit.c:1654
LONG_PTR LRESULT
Definition: windef.h:209
#define SB_LINEUP
Definition: winuser.h:564
#define SB_PAGEDOWN
Definition: winuser.h:569
#define SB_LINEDOWN
Definition: winuser.h:565
#define SB_PAGEUP
Definition: winuser.h:568

Referenced by EDIT_WindowProc(), EDIT_WM_VScroll(), and EditWndProc_common().

◆ EDIT_EM_ScrollCaret()

static void EDIT_EM_ScrollCaret ( EDITSTATE es)
static

Definition at line 1772 of file edit.c.

1774{
1775 if (es->style & ES_MULTILINE) {
1776 INT l;
1777 INT vlc;
1778 INT ww;
1779 INT cw = es->char_width;
1780 INT x;
1781 INT dy = 0;
1782 INT dx = 0;
1783
1784 l = EDIT_EM_LineFromChar(es, es->selection_end);
1785 x = (short)LOWORD(EDIT_EM_PosFromChar(es, es->selection_end, es->flags & EF_AFTER_WRAP));
1787 if (l >= es->y_offset + vlc)
1788 dy = l - vlc + 1 - es->y_offset;
1789 if (l < es->y_offset)
1790 dy = l - es->y_offset;
1791 ww = es->format_rect.right - es->format_rect.left;
1792 if (x < es->format_rect.left)
1793 dx = x - es->format_rect.left - ww / HSCROLL_FRACTION / cw * cw;
1794 if (x > es->format_rect.right)
1795 dx = x - es->format_rect.left - (HSCROLL_FRACTION - 1) * ww / HSCROLL_FRACTION / cw * cw;
1796 if (dy || dx || (es->y_offset && (es->line_count - es->y_offset < vlc)))
1797 {
1798 /* check if we are going to move too far */
1799 if(es->x_offset + dx + ww > es->text_width)
1800 dx = es->text_width - ww - es->x_offset;
1801 if(dx || dy || (es->y_offset && (es->line_count - es->y_offset < vlc)))
1803 }
1804 } else {
1805 INT x;
1806 INT goal;
1807 INT format_width;
1808
1809 x = (short)LOWORD(EDIT_EM_PosFromChar(es, es->selection_end, FALSE));
1810 format_width = es->format_rect.right - es->format_rect.left;
1811 if (x < es->format_rect.left) {
1812 goal = es->format_rect.left + format_width / HSCROLL_FRACTION;
1813 do {
1814 es->x_offset--;
1815 x = (short)LOWORD(EDIT_EM_PosFromChar(es, es->selection_end, FALSE));
1816 } while ((x < goal) && es->x_offset);
1817 /* FIXME: use ScrollWindow() somehow to improve performance */
1819 } else if (x > es->format_rect.right) {
1820 INT x_last;
1822 goal = es->format_rect.right - format_width / HSCROLL_FRACTION;
1823 do {
1824 es->x_offset++;
1825 x = (short)LOWORD(EDIT_EM_PosFromChar(es, es->selection_end, FALSE));
1827 } while ((x > goal) && (x_last > es->format_rect.right));
1828 /* FIXME: use ScrollWindow() somehow to improve performance */
1830 }
1831 }
1832
1833 if(es->flags & EF_FOCUSED)
1834 EDIT_SetCaretPos(es, es->selection_end, es->flags & EF_AFTER_WRAP);
#define EF_FOCUSED
Definition: edit.c:70
#define HSCROLL_FRACTION
Definition: edit.c:64

Referenced by EDIT_EM_ReplaceSel(), EDIT_EM_SetHandle(), EDIT_EM_Undo(), EDIT_MoveBackward(), EDIT_MoveDown_ML(), EDIT_MoveEnd(), EDIT_MoveForward(), EDIT_MoveHome(), EDIT_MovePageDown_ML(), EDIT_MovePageUp_ML(), EDIT_MoveUp_ML(), EDIT_MoveWordBackward(), EDIT_MoveWordForward(), EDIT_WindowProc(), EDIT_WM_Create(), EDIT_WM_LButtonDblClk(), EDIT_WM_LButtonDown(), EDIT_WM_SetText(), and EditWndProc_common().

◆ EDIT_EM_SetHandle()

static void EDIT_EM_SetHandle ( EDITSTATE es,
HLOCAL  hloc 
)
static

Definition at line 2692 of file edit.c.

2694{
2695 if (!(es->style & ES_MULTILINE))
2696 return;
2697
2698 if (!hloc)
2699 return;
2700
2702
2703 es->hloc32W = hloc;
2704 es->buffer_size = LocalSize(es->hloc32W)/sizeof(WCHAR) - 1;
2705
2706 /* The text buffer handle belongs to the control */
2707 es->hlocapp = NULL;
2708
2711
2712 es->x_offset = es->y_offset = 0;
2713 es->selection_start = es->selection_end = 0;
2715 es->flags &= ~EF_MODIFIED;
2716 es->flags &= ~EF_UPDATE;
2720 /* force scroll info update */
static void EDIT_LockBuffer(EDITSTATE *es)
Definition: edit.c:1208

Referenced by EDIT_WindowProc(), and EditWndProc_common().

◆ EDIT_EM_SetLimitText()

static void EDIT_EM_SetLimitText ( EDITSTATE es,
UINT  limit 
)
static

Definition at line 2731 of file edit.c.

2733{
2734 if (!limit) limit = ~0u;
2735 if (!(es->style & ES_MULTILINE)) limit = min(limit, 0x7ffffffe);
2736 es->buffer_limit = limit;
GLint limit
Definition: glext.h:10326
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240

Referenced by EDIT_WindowProc(), and EditWndProc_common().

◆ EDIT_EM_SetMargins()

static void EDIT_EM_SetMargins ( EDITSTATE es,
INT  action,
WORD  left,
WORD  right,
BOOL  repaint 
)
static

Definition at line 2767 of file edit.c.

2770{
2772 INT default_left_margin = 0; /* in pixels */
2773 INT default_right_margin = 0; /* in pixels */
2774
2775 /* Set the default margins depending on the font */
2776 if (es->font && (left == EC_USEFONTINFO || right == EC_USEFONTINFO)) {
2777 HDC dc = GetDC(es->hwndSelf);
2778 HFONT old_font = SelectObject(dc, es->font);
2780 RECT rc;
2781
2782 /* The default margins are only non zero for TrueType or Vector fonts */
2783 if (tm.tmPitchAndFamily & ( TMPF_VECTOR | TMPF_TRUETYPE )) {
2784 if (!is_cjk(tm.tmCharSet)) {
2785 default_left_margin = width / 2;
2786 default_right_margin = width / 2;
2787
2788 GetClientRect(es->hwndSelf, &rc);
2789 if (rc.right - rc.left < (width / 2 + width) * 2 &&
2790 (width >= 28 || !IsRectEmpty(&rc)) ) {
2791 default_left_margin = es->left_margin;
2792 default_right_margin = es->right_margin;
2793 }
2794 } else {
2795 /* FIXME: figure out the CJK values. They are not affected by the client rect. */
2796 default_left_margin = width / 2;
2797 default_right_margin = width / 2;
2798 }
2799 }
2800 SelectObject(dc, old_font);
2801 ReleaseDC(es->hwndSelf, dc);
2802 }
2803
2804 if (action & EC_LEFTMARGIN) {
2805 es->format_rect.left -= es->left_margin;
2806 if (left != EC_USEFONTINFO)
2807 es->left_margin = left;
2808 else
2809 es->left_margin = default_left_margin;
2810 es->format_rect.left += es->left_margin;
2811 }
2812
2813 if (action & EC_RIGHTMARGIN) {
2814 es->format_rect.right += es->right_margin;
2815 if (right != EC_USEFONTINFO)
2816 es->right_margin = right;
2817 else
2818 es->right_margin = default_right_margin;
2819 es->format_rect.right -= es->right_margin;
2820 }
2821
2824 if (repaint) EDIT_UpdateText(es, NULL, TRUE);
2825 }
2826
2827 TRACE("left=%d, right=%d\n", es->left_margin, es->right_margin);
static void EDIT_AdjustFormatRect(EDITSTATE *es)
Definition: edit.c:2255
GLint GLint GLsizei width
Definition: gl.h:1546
GLdouble GLdouble right
Definition: glext.h:10859
GLint left
Definition: glext.h:7726
static const WCHAR dc[]
static HDC
Definition: imagelist.c:92
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
static BOOL is_cjk(void)
Definition: dde.c:46
long LONG
Definition: pedump.c:60
Definition: time.h:68
LONG WINAPI GdiGetCharDimensions(HDC, LPTEXTMETRICW, LONG *)
Definition: font.c:2145
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
#define TMPF_TRUETYPE
Definition: wingdi.h:1313
#define TMPF_VECTOR
Definition: wingdi.h:1312
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define EC_RIGHTMARGIN
Definition: winuser.h:2597
#define EC_USEFONTINFO
Definition: winuser.h:2598
BOOL WINAPI IsRectEmpty(_In_ LPCRECT)
HDC WINAPI GetDC(_In_opt_ HWND)
#define EC_LEFTMARGIN
Definition: winuser.h:2596

Referenced by EDIT_WindowProc(), and EDIT_WM_SetFont().

◆ EDIT_EM_SetPasswordChar()

static void EDIT_EM_SetPasswordChar ( EDITSTATE es,
WCHAR  c 
)
static

Definition at line 2835 of file edit.c.

2837{
2838 LONG style;
2839
2840 if (es->style & ES_MULTILINE)
2841 return;
2842
2843 if (es->password_char == c)
2844 return;
2845
2846 style = GetWindowLongW( es->hwndSelf, GWL_STYLE );
2847 es->password_char = c;
2848 if (c) {
2849 SetWindowLongW( es->hwndSelf, GWL_STYLE, style | ES_PASSWORD );
2850 es->style |= ES_PASSWORD;
2851 } else {
2852 SetWindowLongW( es->hwndSelf, GWL_STYLE, style & ~ES_PASSWORD );
2853 es->style &= ~ES_PASSWORD;
2854 }
Arabic default style
Definition: afstyles.h:94
const GLubyte * c
Definition: glext.h:8905
#define c
Definition: ke_i.h:80
#define ES_PASSWORD
Definition: pedump.c:670
LONG WINAPI SetWindowLongW(_In_ HWND, _In_ int, _In_ LONG)
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
#define GWL_STYLE
Definition: winuser.h:846

Referenced by EDIT_WindowProc(), and EditWndProc_common().

◆ EDIT_EM_SetSel()

static BOOL EDIT_EM_SetSel ( EDITSTATE es,
UINT  start,
UINT  end,
BOOL  after_wrap 
)
static

Definition at line 1486 of file edit.c.

1488{
1489 UINT old_start = es->selection_start;
1490 UINT old_end = es->selection_end;
1492
1493 if (start == old_start && end == old_end)
1494 return FALSE;
1495
1496 if (start == (UINT)-1) {
1497 start = es->selection_end;
1498 end = es->selection_end;
1499 } else {
1500 start = min(start, len);
1501 end = min(end, len);
1502 }
1503 es->selection_start = start;
1504 es->selection_end = end;
1505 if (after_wrap)
1506 es->flags |= EF_AFTER_WRAP;
1507 else
1508 es->flags &= ~EF_AFTER_WRAP;
1509 /* Compute the necessary invalidation region. */
1510 /* Note that we don't need to invalidate regions which have
1511 * "never" been selected, or those which are "still" selected.
1512 * In fact, every time we hit a selection boundary, we can
1513 * *toggle* whether we need to invalidate. Thus we can optimize by
1514 * *sorting* the interval endpoints. Let's assume that we sort them
1515 * in this order:
1516 * start <= end <= old_start <= old_end
1517 * Knuth 5.3.1 (p 183) assures us that this can be done optimally
1518 * in 5 comparisons; i.e. it is impossible to do better than the
1519 * following: */
1520 ORDER_UINT(end, old_end);
1521 ORDER_UINT(start, old_start);
1522 ORDER_UINT(old_start, old_end);
1524 /* Note that at this point 'end' and 'old_start' are not in order, but
1525 * start is definitely the min. and old_end is definitely the max. */
1526 if (end != old_start)
1527 {
1528/*
1529 * One can also do
1530 * ORDER_UINT32(end, old_start);
1531 * EDIT_InvalidateText(es, start, end);
1532 * EDIT_InvalidateText(es, old_start, old_end);
1533 * in place of the following if statement.
1534 * (That would complete the optimal five-comparison four-element sort.)
1535 */
1536 if (old_start > end )
1537 {
1539 EDIT_InvalidateText(es, old_start, old_end);
1540 }
1541 else
1542 {
1543 EDIT_InvalidateText(es, start, old_start);
1544 EDIT_InvalidateText(es, end, old_end);
1545 }
1546 }
1547 else EDIT_InvalidateText(es, start, old_end);
1548
1549 return TRUE;
static void EDIT_InvalidateText(EDITSTATE *es, INT start, INT end)
Definition: edit.c:1456

Referenced by EDIT_EM_ReplaceSel(), EDIT_EM_Undo(), EDIT_MoveBackward(), EDIT_MoveDown_ML(), EDIT_MoveEnd(), EDIT_MoveForward(), EDIT_MoveHome(), EDIT_MovePageDown_ML(), EDIT_MovePageUp_ML(), EDIT_MoveUp_ML(), EDIT_MoveWordBackward(), EDIT_MoveWordForward(), EDIT_WindowProc(), EDIT_WM_Char(), EDIT_WM_KeyDown(), EDIT_WM_LButtonDblClk(), EDIT_WM_LButtonDown(), EDIT_WM_MouseMove(), EDIT_WM_SetText(), and EditWndProc_common().

◆ EDIT_EM_SetTabStops()

static BOOL EDIT_EM_SetTabStops ( EDITSTATE es,
INT  count,
const INT tabs 
)
static

Definition at line 2864 of file edit.c.

2866{
2867 if (!(es->style & ES_MULTILINE))
2868 return FALSE;
2869 heap_free(es->tabs);
2870 es->tabs_count = count;
2871 if (!count)
2872 es->tabs = NULL;
2873 else {
2874 es->tabs = heap_alloc(count * sizeof(INT));
2875 memcpy(es->tabs, tabs, count * sizeof(INT));
2876 }
2878 return TRUE;

Referenced by EDIT_WindowProc(), and EditWndProc_common().

◆ EDIT_EM_SetWordBreakProc()

static void EDIT_EM_SetWordBreakProc ( EDITSTATE es,
EDITWORDBREAKPROCW  wbp 
)
static

Definition at line 2886 of file edit.c.

2888{
2889 if (es->word_break_proc == wbp)
2890 return;
2891
2892 es->word_break_proc = wbp;
2893
2894 if ((es->style & ES_MULTILINE) && !(es->style & ES_AUTOHSCROLL)) {
2897 }

Referenced by EDIT_WindowProc(), and EditWndProc_common().

◆ EDIT_EM_Undo()

static BOOL EDIT_EM_Undo ( EDITSTATE es)
static

Definition at line 2905 of file edit.c.

2907{
2908 INT ulength;
2909 LPWSTR utext;
2910
2911 /* As per MSDN spec, for a single-line edit control,
2912 the return value is always TRUE */
2913 if( es->style & ES_READONLY )
2914 return !(es->style & ES_MULTILINE);
2915
2916 ulength = strlenW(es->undo_text);
2917
2918 utext = heap_alloc((ulength + 1) * sizeof(WCHAR));
2919
2920 strcpyW(utext, es->undo_text);
2921
2922 TRACE("before UNDO:insertion length = %d, deletion buffer = %s\n",
2923 es->undo_insert_count, debugstr_w(utext));
2924
2925 EDIT_EM_SetSel(es, es->undo_position, es->undo_position + es->undo_insert_count, FALSE);
2927 EDIT_EM_ReplaceSel(es, TRUE, utext, ulength, TRUE, TRUE);
2928 EDIT_EM_SetSel(es, es->undo_position, es->undo_position + es->undo_insert_count, FALSE);
2929 /* send the notification after the selection start and end are set */
2930 if (!notify_parent(es, EN_CHANGE)) return TRUE;
2932 heap_free(utext);
2933
2934 TRACE("after UNDO:insertion length = %d, deletion buffer = %s\n",
2935 es->undo_insert_count, debugstr_w(es->undo_text));
2936 return TRUE;
static void EDIT_EM_ReplaceSel(EDITSTATE *es, BOOL can_undo, const WCHAR *lpsz_replace, UINT strl, BOOL send_update, BOOL honor_limit)
Definition: edit.c:2479
#define ES_READONLY
Definition: pedump.c:675

Referenced by EDIT_WindowProc(), EDIT_WM_SysKeyDown(), and EditWndProc_common().

◆ EDIT_GetCompositionStr()

static void EDIT_GetCompositionStr ( HIMC  hIMC,
LPARAM  CompFlag,
EDITSTATE es 
)
static

Definition at line 4259 of file edit.c.

4261{
4262 LONG buflen;
4263 LPWSTR lpCompStr;
4264 LPSTR lpCompStrAttr = NULL;
4265 DWORD dwBufLenAttr;
4266
4267 buflen = ImmGetCompositionStringW(hIMC, GCS_COMPSTR, NULL, 0);
4268
4269 if (buflen < 0)
4270 {
4271 return;
4272 }
4273
4274 lpCompStr = heap_alloc(buflen);
4275 if (!lpCompStr)
4276 {
4277 ERR("Unable to allocate IME CompositionString\n");
4278 return;
4279 }
4280
4281 if (buflen)
4282 ImmGetCompositionStringW(hIMC, GCS_COMPSTR, lpCompStr, buflen);
4283
4284 if (CompFlag & GCS_COMPATTR)
4285 {
4286 /*
4287 * We do not use the attributes yet. it would tell us what characters
4288 * are in transition and which are converted or decided upon
4289 */
4290 dwBufLenAttr = ImmGetCompositionStringW(hIMC, GCS_COMPATTR, NULL, 0);
4291 if (dwBufLenAttr)
4292 {
4293 dwBufLenAttr ++;
4294 lpCompStrAttr = heap_alloc(dwBufLenAttr + 1);
4295 if (!lpCompStrAttr)
4296 {
4297 ERR("Unable to allocate IME Attribute String\n");
4298 heap_free(lpCompStr);
4299 return;
4300 }
4301 ImmGetCompositionStringW(hIMC,GCS_COMPATTR, lpCompStrAttr,
4302 dwBufLenAttr);
4303 lpCompStrAttr[dwBufLenAttr] = 0;
4304 }
4305 }
4306
4307#ifndef __REACTOS__ /* We don't use internal composition string. Rely on the composition window */
4308 /* check for change in composition start */
4309 if (es->selection_end < es->composition_start)
4310 es->composition_start = es->selection_end;
4311
4312 /* replace existing selection string */
4313 es->selection_start = es->composition_start;
4314
4315 if (es->composition_len > 0)
4316 es->selection_end = es->composition_start + es->composition_len;
4317 else
4318 es->selection_end = es->selection_start;
4319
4320 EDIT_EM_ReplaceSel(es, FALSE, lpCompStr, buflen / sizeof(WCHAR), TRUE, TRUE);
4321 es->composition_len = abs(es->composition_start - es->selection_end);
4322
4323 es->selection_start = es->composition_start;
4324 es->selection_end = es->selection_start + es->composition_len;
4325#endif
4326
4327 heap_free(lpCompStrAttr);
4328 heap_free(lpCompStr);
LONG WINAPI ImmGetCompositionStringW(HIMC hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen)
Definition: compstr.c:899
unsigned long DWORD
Definition: ntddk_ex.h:95
#define GCS_COMPATTR
Definition: imm.h:368
#define GCS_COMPSTR
Definition: imm.h:367
char * LPSTR
Definition: xmlstorage.h:182

Referenced by EDIT_ImeComposition().

◆ EDIT_GetLineRect()

static void EDIT_GetLineRect ( EDITSTATE es,
INT  line,
INT  scol,
INT  ecol,
LPRECT  rc 
)
static

Definition at line 1144 of file edit.c.

1146{
1148 INT line_index = 0;
1149 INT pt1, pt2, pt3;
1150
1151 if (es->style & ES_MULTILINE)
1152 {
1153 const LINEDEF *line_def = NULL;
1154 rc->top = es->format_rect.top + (line - es->y_offset) * es->line_height;
1155 if (line >= es->line_count)
1156 return;
1157
1158 line_def = es->first_line_def;
1159 if (line == -1) {
1160 INT index = es->selection_end - line_def->length;
1161 while ((index >= 0) && line_def->next) {
1162 line_index += line_def->length;
1163 line_def = line_def->next;
1164 index -= line_def->length;
1165 }
1166 } else {
1167 while (line > 0) {
1168 line_index += line_def->length;
1169 line_def = line_def->next;
1170 line--;
1171 }
1172 }
1173 ssa = line_def->ssa;
1174 }
1175 else
1176 {
1177 line_index = 0;
1178 rc->top = es->format_rect.top;
1179 ssa = es->ssa;
1180 }
1181
1182 rc->bottom = rc->top + es->line_height;
1183 pt1 = (scol == 0) ? es->format_rect.left : (short)LOWORD(EDIT_EM_PosFromChar(es, line_index + scol, TRUE));
1184 pt2 = (ecol == -1) ? es->format_rect.right : (short)LOWORD(EDIT_EM_PosFromChar(es, line_index + ecol, TRUE));
1185 if (ssa)
1186 {
1187 ScriptStringCPtoX(ssa, scol, FALSE, &pt3);
1188 pt3+=es->format_rect.left;
1189 }
1190 else pt3 = pt1;
1191 rc->right = max(max(pt1 , pt2),pt3);
1192 rc->left = min(min(pt1, pt2),pt3);

Referenced by EDIT_ML_InvalidateText(), EDIT_SL_InvalidateText(), and EDIT_WM_Paint().

◆ EDIT_GetResultStr()

static void EDIT_GetResultStr ( HIMC  hIMC,
EDITSTATE es 
)
static

Definition at line 4330 of file edit.c.

4332{
4333 LONG buflen;
4334 LPWSTR lpResultStr;
4335
4336 buflen = ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, NULL, 0);
4337 if (buflen <= 0)
4338 {
4339 return;
4340 }
4341
4342 lpResultStr = heap_alloc(buflen);
4343 if (!lpResultStr)
4344 {
4345 ERR("Unable to alloc buffer for IME string\n");
4346 return;
4347 }
4348
4349 ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, lpResultStr, buflen);
4350
4351#ifndef __REACTOS__
4352 /* check for change in composition start */
4353 if (es->selection_end < es->composition_start)
4354 es->composition_start = es->selection_end;
4355
4356 es->selection_start = es->composition_start;
4357 es->selection_end = es->composition_start + es->composition_len;
4358 EDIT_EM_ReplaceSel(es, TRUE, lpResultStr, buflen / sizeof(WCHAR), TRUE, TRUE);
4359 es->composition_start = es->selection_end;
4360 es->composition_len = 0;
4361#endif
4362
4363 heap_free(lpResultStr);
#define GCS_RESULTSTR
Definition: imm.h:374

Referenced by EDIT_ImeComposition().

◆ EDIT_ImeComposition()

static void EDIT_ImeComposition ( HWND  hwnd,
LPARAM  CompFlag,
EDITSTATE es 
)
static

Definition at line 4365 of file edit.c.

4367{
4368 HIMC hIMC;
4369 int cursor;
4370
4371#ifdef __REACTOS__
4372 if (es->selection_start != es->selection_end)
4374#else
4375 if (es->composition_len == 0 && es->selection_start != es->selection_end)
4376 {
4378 es->composition_start = es->selection_end;
4379 }
4380#endif
4381
4382 hIMC = ImmGetContext(hwnd);
4383 if (!hIMC)
4384 return;
4385
4386 if (CompFlag & GCS_RESULTSTR)
4387 {
4388 EDIT_GetResultStr(hIMC, es);
4389 cursor = 0;
4390 }
4391 else
4392 {
4393 if (CompFlag & GCS_COMPSTR)
4394 EDIT_GetCompositionStr(hIMC, CompFlag, es);
4395#ifdef __REACTOS__
4396 cursor = 0;
4397#else
4399#endif
4400 }
4401 ImmReleaseContext(hwnd, hIMC);
4402 EDIT_SetCaretPos(es, es->selection_start + cursor, es->flags & EF_AFTER_WRAP);
DWORD HIMC
Definition: dimm.idl:75
static void EDIT_GetResultStr(HIMC hIMC, EDITSTATE *es)
Definition: edit.c:4330
static void EDIT_GetCompositionStr(HIMC hIMC, LPARAM CompFlag, EDITSTATE *es)
Definition: edit.c:4259
HIMC WINAPI ImmGetContext(HWND hWnd)
Definition: imm.c:1057
BOOL WINAPI ImmReleaseContext(HWND hWnd, HIMC hIMC)
Definition: imm.c:1098
const char cursor[]
Definition: icontest.c:13
#define GCS_CURSORPOS
Definition: imm.h:370
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023

Referenced by EDIT_WindowProc().

◆ EDIT_InvalidateText()

static void EDIT_InvalidateText ( EDITSTATE es,
INT  start,
INT  end 
)
static

Definition at line 1456 of file edit.c.

1458{
1459 if (end == start)
1460 return;
1461
1462 if (end == -1)
1464
1465 if (end < start) {
1466 INT tmp = start;
1467 start = end;
1468 end = tmp;
1469 }
1470
1471 if (es->style & ES_MULTILINE)
1473 else
static void EDIT_ML_InvalidateText(EDITSTATE *es, INT start, INT end)
Definition: edit.c:1391
static void EDIT_SL_InvalidateText(EDITSTATE *es, INT start, INT end)
Definition: edit.c:1373

Referenced by EDIT_EM_SetSel(), EDIT_WM_KillFocus(), and EDIT_WM_SetFocus().

◆ EDIT_InvalidateUniscribeData()

static void EDIT_InvalidateUniscribeData ( EDITSTATE es)
inlinestatic

Definition at line 316 of file edit.c.

318{
319 LINEDEF *line_def = es->first_line_def;
320 while (line_def)
321 {
323 line_def = line_def->next;
324 }
325 if (es->ssa)
326 {
327 ScriptStringFree(&es->ssa);
328 es->ssa = NULL;
329 }
HRESULT WINAPI ScriptStringFree(SCRIPT_STRING_ANALYSIS *pssa)
Definition: usp10.c:2556

Referenced by EDIT_EM_ReplaceSel(), EDIT_EM_SetPasswordChar(), EDIT_EM_SetTabStops(), EDIT_WM_NCCreate(), EDIT_WM_NCDestroy(), EDIT_WM_Paint(), EDIT_WM_SetFont(), EDIT_WM_SetText(), and text_buffer_changed().

◆ EDIT_InvalidateUniscribeData_linedef()

static void EDIT_InvalidateUniscribeData_linedef ( LINEDEF line_def)
inlinestatic

Definition at line 307 of file edit.c.

309{
310 if (line_def->ssa)
311 {
312 ScriptStringFree(&line_def->ssa);
313 line_def->ssa = NULL;
314 }

Referenced by EDIT_BuildLineDefs_ML(), and EDIT_InvalidateUniscribeData().

◆ EDIT_IsInsideDialog()

static BOOL EDIT_IsInsideDialog ( EDITSTATE es)
inlinestatic

Definition at line 2946 of file edit.c.

2948{
2949 return (es->flags & EF_DIALOGMODE);
#define EF_DIALOGMODE
Definition: edit.c:76

Referenced by EDIT_WM_Char(), and EDIT_WM_KeyDown().

◆ EDIT_LockBuffer()

static void EDIT_LockBuffer ( EDITSTATE es)
static

Definition at line 1208 of file edit.c.

1210{
1211 if (!es->text)
1212 {
1213 if (!es->hloc32W)
1214 return;
1215
1216 es->text = LocalLock(es->hloc32W);
1217 }
1218
1219 es->lock_count++;
LPVOID NTAPI LocalLock(HLOCAL hMem)
Definition: heapmem.c:1616

Referenced by EDIT_EM_SetHandle(), EDIT_MakeFit(), EDIT_WindowProc(), and EditWndProc_common().

◆ EDIT_MakeFit()

static BOOL EDIT_MakeFit ( EDITSTATE es,
UINT  size 
)
static

Definition at line 1273 of file edit.c.

1275{
1276 HLOCAL hNew32W;
1277
1278 if (size <= es->buffer_size)
1279 return TRUE;
1280
1281 TRACE("trying to ReAlloc to %d+1 characters\n", size);
1282
1283 /* Force edit to unlock its buffer. es->text now NULL */
1285
1286 if (es->hloc32W) {
1287 UINT alloc_size = ROUND_TO_GROW((size + 1) * sizeof(WCHAR));
1288 if ((hNew32W = LocalReAlloc(es->hloc32W, alloc_size, LMEM_MOVEABLE | LMEM_ZEROINIT))) {
1289 TRACE("Old 32 bit handle %p, new handle %p\n", es->hloc32W, hNew32W);
1290 es->hloc32W = hNew32W;
1291 es->buffer_size = LocalSize(hNew32W)/sizeof(WCHAR) - 1;
1292 }
1293 }
1294
1296
1297 if (es->buffer_size < size) {
1298 WARN("FAILED ! We now have %d+1\n", es->buffer_size);
1300 return FALSE;
1301 } else {
1302 TRACE("We now have %d+1\n", es->buffer_size);
1303 return TRUE;
1304 }
#define WARN(fmt,...)
Definition: debug.h:112
#define ROUND_TO_GROW(size)
Definition: edit.c:63
HLOCAL NTAPI LocalReAlloc(HLOCAL hMem, SIZE_T dwBytes, UINT uFlags)
Definition: heapmem.c:1625
static void buffer_size(GLcontext *ctx, GLuint *width, GLuint *height)
Definition: swimpl.c:888
#define LMEM_MOVEABLE
Definition: winbase.h:369
#define LMEM_ZEROINIT
Definition: winbase.h:375
#define EN_ERRSPACE
Definition: winuser.h:2013

Referenced by EDIT_EM_ReplaceSel().

◆ EDIT_MakeUndoFit()

static BOOL EDIT_MakeUndoFit ( EDITSTATE es,
UINT  size 
)
static

Definition at line 1314 of file edit.c.

1316{
1317 UINT alloc_size;
1318
1319 if (size <= es->undo_buffer_size)
1320 return TRUE;
1321
1322 TRACE("trying to ReAlloc to %d+1\n", size);
1323
1324 alloc_size = ROUND_TO_GROW((size + 1) * sizeof(WCHAR));
1325 if ((es->undo_text = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, es->undo_text, alloc_size))) {
1326 es->undo_buffer_size = alloc_size/sizeof(WCHAR) - 1;
1327 return TRUE;
1328 }
1329 else
1330 {
1331 WARN("FAILED ! We now have %d+1\n", es->undo_buffer_size);
1332 return FALSE;
1333 }
#define GetProcessHeap()
Definition: compat.h:736
#define HeapReAlloc
Definition: compat.h:734
#define HEAP_ZERO_MEMORY
Definition: compat.h:134

Referenced by EDIT_EM_ReplaceSel().

◆ EDIT_ML_InvalidateText()

static void EDIT_ML_InvalidateText ( EDITSTATE es,
INT  start,
INT  end 
)
static

Definition at line 1391 of file edit.c.

1393{
1397 INT sc;
1398 INT ec;
1399 RECT rc1;
1400 RECT rcWnd;
1401 RECT rcLine;
1402 RECT rcUpdate;
1403 INT l;
1404
1405 if ((el < es->y_offset) || (sl > es->y_offset + vlc))
1406 return;
1407
1408 sc = start - EDIT_EM_LineIndex(es, sl);
1409 ec = end - EDIT_EM_LineIndex(es, el);
1410 if (sl < es->y_offset) {
1411 sl = es->y_offset;
1412 sc = 0;
1413 }
1414 if (el > es->y_offset + vlc) {
1415 el = es->y_offset + vlc;
1417 }
1418 GetClientRect(es->hwndSelf, &rc1);
1419 IntersectRect(&rcWnd, &rc1, &es->format_rect);
1420 if (sl == el) {
1421 EDIT_GetLineRect(es, sl, sc, ec, &rcLine);
1422 if (IntersectRect(&rcUpdate, &rcWnd, &rcLine))
1423 EDIT_UpdateText(es, &rcUpdate, TRUE);
1424 } else {
1425 EDIT_GetLineRect(es, sl, sc,
1427 EDIT_EM_LineIndex(es, sl)),
1428 &rcLine);
1429 if (IntersectRect(&rcUpdate, &rcWnd, &rcLine))
1430 EDIT_UpdateText(es, &rcUpdate, TRUE);
1431 for (l = sl + 1 ; l < el ; l++) {
1432 EDIT_GetLineRect(es, l, 0,
1435 &rcLine);
1436 if (IntersectRect(&rcUpdate, &rcWnd, &rcLine))
1437 EDIT_UpdateText(es, &rcUpdate, TRUE);
1438 }
1439 EDIT_GetLineRect(es, el, 0, ec, &rcLine);
1440 if (IntersectRect(&rcUpdate, &rcWnd, &rcLine))
1441 EDIT_UpdateText(es, &rcUpdate, TRUE);
1442 }
static void EDIT_GetLineRect(EDITSTATE *es, INT line, INT scol, INT ecol, LPRECT rc)
Definition: edit.c:1144

Referenced by EDIT_InvalidateText().

◆ EDIT_MoveBackward()

static void EDIT_MoveBackward ( EDITSTATE es,
BOOL  extend 
)
static

Definition at line 1842 of file edit.c.

1844{
1845 INT e = es->selection_end;
1846
1847 if (e) {
1848 e--;
1849 if ((es->style & ES_MULTILINE) && e &&
1850 (es->text[e - 1] == '\r') && (es->text[e] == '\n')) {
1851 e--;
1852 if (e && (es->text[e - 1] == '\r'))
1853 e--;
1854 }
1855 }
1856 EDIT_EM_SetSel(es, extend ? es->selection_start : e, e, FALSE);

Referenced by EDIT_WM_Char(), EDIT_WM_KeyDown(), and EDIT_WM_Timer().

◆ EDIT_MoveDown_ML()

static void EDIT_MoveDown_ML ( EDITSTATE es,
BOOL  extend 
)
static

Definition at line 1869 of file edit.c.

1871{
1872 INT s = es->selection_start;
1873 INT e = es->selection_end;
1874 BOOL after_wrap = (es->flags & EF_AFTER_WRAP);
1875 LRESULT pos = EDIT_EM_PosFromChar(es, e, after_wrap);
1876 INT x = (short)LOWORD(pos);
1877 INT y = (short)HIWORD(pos);
1878
1879 e = EDIT_CharFromPos(es, x, y + es->line_height, &after_wrap);
1880 if (!extend)
1881 s = e;
1882 EDIT_EM_SetSel(es, s, e, after_wrap);
#define HIWORD(l)
Definition: typedefs.h:247

Referenced by EDIT_WM_Char(), and EDIT_WM_KeyDown().

◆ EDIT_MoveEnd()

static void EDIT_MoveEnd ( EDITSTATE es,
BOOL  extend,
BOOL  ctrl 
)
static

Definition at line 1891 of file edit.c.

1893{
1894 BOOL after_wrap = FALSE;
1895 INT e;
1896
1897 /* Pass a high value in x to make sure of receiving the end of the line */
1898 if (!ctrl && (es->style & ES_MULTILINE))
1899 e = EDIT_CharFromPos(es, 0x3fffffff,
1900 HIWORD(EDIT_EM_PosFromChar(es, es->selection_end, es->flags & EF_AFTER_WRAP)), &after_wrap);
1901 else
1902 e = get_text_length(es);
1903 EDIT_EM_SetSel(es, extend ? es->selection_start : e, e, after_wrap);
#define ctrl
Definition: input.c:1756

Referenced by EDIT_WM_KeyDown().

◆ EDIT_MoveForward()

static void EDIT_MoveForward ( EDITSTATE es,
BOOL  extend 
)
static

Definition at line 1912 of file edit.c.

1914{
1915 INT e = es->selection_end;
1916
1917 if (es->text[e]) {
1918 e++;
1919 if ((es->style & ES_MULTILINE) && (es->text[e - 1] == '\r')) {
1920 if (es->text[e] == '\n')
1921 e++;
1922 else if ((es->text[e] == '\r') && (es->text[e + 1] == '\n'))
1923 e += 2;
1924 }
1925 }
1926 EDIT_EM_SetSel(es, extend ? es->selection_start : e, e, FALSE);

Referenced by EDIT_WM_KeyDown(), and EDIT_WM_Timer().

◆ EDIT_MoveHome()

static void EDIT_MoveHome ( EDITSTATE es,
BOOL  extend,
BOOL  ctrl 
)
static

Definition at line 1937 of file edit.c.

1939{
1940 INT e;
1941
1942 /* Pass the x_offset in x to make sure of receiving the first position of the line */
1943 if (!ctrl && (es->style & ES_MULTILINE))
1944 e = EDIT_CharFromPos(es, -es->x_offset,
1945 HIWORD(EDIT_EM_PosFromChar(es, es->selection_end, es->flags & EF_AFTER_WRAP)), NULL);
1946 else
1947 e = 0;
1948 EDIT_EM_SetSel(es, extend ? es->selection_start : e, e, FALSE);

Referenced by EDIT_WM_Char(), and EDIT_WM_KeyDown().

◆ EDIT_MovePageDown_ML()

static void EDIT_MovePageDown_ML ( EDITSTATE es,
BOOL  extend 
)
static

Definition at line 1961 of file edit.c.

1963{
1964 INT s = es->selection_start;
1965 INT e = es->selection_end;
1966 BOOL after_wrap = (es->flags & EF_AFTER_WRAP);
1967 LRESULT pos = EDIT_EM_PosFromChar(es, e, after_wrap);
1968 INT x = (short)LOWORD(pos);
1969 INT y = (short)HIWORD(pos);
1970
1972 y + (es->format_rect.bottom - es->format_rect.top),
1973 &after_wrap);
1974 if (!extend)
1975 s = e;
1976 EDIT_EM_SetSel(es, s, e, after_wrap);

Referenced by EDIT_WM_KeyDown().

◆ EDIT_MovePageUp_ML()

static void EDIT_MovePageUp_ML ( EDITSTATE es,
BOOL  extend 
)
static

Definition at line 1989 of file edit.c.

1991{
1992 INT s = es->selection_start;
1993 INT e = es->selection_end;
1994 BOOL after_wrap = (es->flags & EF_AFTER_WRAP);
1995 LRESULT pos = EDIT_EM_PosFromChar(es, e, after_wrap);
1996 INT x = (short)LOWORD(pos);
1997 INT y = (short)HIWORD(pos);
1998
2000 y - (es->format_rect.bottom - es->format_rect.top),
2001 &after_wrap);
2002 if (!extend)
2003 s = e;
2004 EDIT_EM_SetSel(es, s, e, after_wrap);

Referenced by EDIT_WM_KeyDown().

◆ EDIT_MoveUp_ML()

static void EDIT_MoveUp_ML ( EDITSTATE es,
BOOL  extend 
)
static

Definition at line 2017 of file edit.c.

2019{
2020 INT s = es->selection_start;
2021 INT e = es->selection_end;
2022 BOOL after_wrap = (es->flags & EF_AFTER_WRAP);
2023 LRESULT pos = EDIT_EM_PosFromChar(es, e, after_wrap);
2024 INT x = (short)LOWORD(pos);
2025 INT y = (short)HIWORD(pos);
2026
2027 e = EDIT_CharFromPos(es, x, y - es->line_height, &after_wrap);
2028 if (!extend)
2029 s = e;
2030 EDIT_EM_SetSel(es, s, e, after_wrap);

Referenced by EDIT_WM_KeyDown().

◆ EDIT_MoveWordBackward()

static void EDIT_MoveWordBackward ( EDITSTATE es,
BOOL  extend 
)
static

Definition at line 2039 of file edit.c.

2041{
2042 INT s = es->selection_start;
2043 INT e = es->selection_end;
2044 INT l;
2045 INT ll;
2046 INT li;
2047
2051 if (e - li == 0) {
2052 if (l) {
2053 li = EDIT_EM_LineIndex(es, l - 1);
2054 e = li + EDIT_EM_LineLength(es, li);
2055 }
2056 } else {
2058 }
2059 if (!extend)
2060 s = e;
w ll
Definition: byte_order.h:167

Referenced by EDIT_WM_KeyDown().

◆ EDIT_MoveWordForward()

static void EDIT_MoveWordForward ( EDITSTATE es,
BOOL  extend 
)
static

Definition at line 2070 of file edit.c.

2072{
2073 INT s = es->selection_start;
2074 INT e = es->selection_end;
2075 INT l;
2076 INT ll;
2077 INT li;
2078
2082 if (e - li == ll) {
2083 if ((es->style & ES_MULTILINE) && (l != es->line_count - 1))
2084 e = EDIT_EM_LineIndex(es, l + 1);
2085 } else {
2087 li, e - li + 1, ll, WB_RIGHT);
2088 }
2089 if (!extend)
2090 s = e;
#define WB_RIGHT
Definition: winuser.h:551

Referenced by EDIT_WM_KeyDown().

◆ EDIT_NotifyCtlColor()

static HBRUSH EDIT_NotifyCtlColor ( EDITSTATE es,
HDC  hdc 
)
static

Definition at line 199 of file edit.c.

201{
202 HBRUSH hbrush;
203 UINT msg;
204
205 if ((!es->bEnableState || (es->style & ES_READONLY)))
207 else
209
210 /* Why do we notify to es->hwndParent, and we send this one to GetParent()? */
211 hbrush = (HBRUSH)SendMessageW(GetParent(es->hwndSelf), msg, (WPARAM)hdc, (LPARAM)es->hwndSelf);
212 if (!hbrush)
213 hbrush = (HBRUSH)DefWindowProcW(GetParent(es->hwndSelf), msg, (WPARAM)hdc, (LPARAM)es->hwndSelf);
214 return hbrush;
static HBRUSH hbrush
HDC hdc
Definition: main.c:9
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1762
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_CTLCOLOREDIT
Definition: winuser.h:1757

Referenced by EDIT_WM_Paint().

◆ EDIT_PaintLine()

static void EDIT_PaintLine ( EDITSTATE es,
HDC  dc,
INT  line,
BOOL  rev 
)
static

Definition at line 2174 of file edit.c.

2176{
2177 INT s = 0;
2178 INT e = 0;
2179 INT li = 0;
2180 INT ll = 0;
2181 INT x;
2182 INT y;
2183 LRESULT pos;
2185
2186 if (es->style & ES_MULTILINE) {
2188
2189 if ((line < es->y_offset) || (line > es->y_offset + vlc) || (line >= es->line_count))
2190 return;
2191 } else if (line)
2192 return;
2193
2194 TRACE("line=%d\n", line);
2195
2198 x = (short)LOWORD(pos);
2199 y = (short)HIWORD(pos);
2200
2201 if (es->style & ES_MULTILINE)
2202 {
2203 int line_idx = line;
2204 x = -es->x_offset;
2205 if (es->style & ES_RIGHT || es->style & ES_CENTER)
2206 {
2207 LINEDEF *line_def = es->first_line_def;
2208 int w, lw;
2209
2210 while (line_def && line_idx)
2211 {
2212 line_def = line_def->next;
2213 line_idx--;
2214 }
2215 w = es->format_rect.right - es->format_rect.left;
2216 lw = line_def->width;
2217
2218 if (es->style & ES_RIGHT)
2219 x = w - (lw - x);
2220 else if (es->style & ES_CENTER)
2221 x += (w - lw) / 2;
2222 }
2223 x += es->format_rect.left;
2224 }
2225
2226 if (rev)
2227 {
2230 s = min(es->selection_start, es->selection_end);
2231 e = max(es->selection_start, es->selection_end);
2232 s = min(li + ll, max(li, s));
2233 e = min(li + ll, max(li, e));
2234 }
2235
2236 if (ssa)
2237 ScriptStringOut(ssa, x, y, 0, &es->format_rect, s - li, e - li, FALSE);
2238 else if (rev && (s != e) &&
2239 ((es->flags & EF_FOCUSED) || (es->style & ES_NOHIDESEL))) {
2240 x += EDIT_PaintText(es, dc, x, y, line, 0, s - li, FALSE);
2241 x += EDIT_PaintText(es, dc, x, y, line, s - li, e - s, TRUE);
2242 x += EDIT_PaintText(es, dc, x, y, line, e - li, li + ll - e, FALSE);
2243 } else
2244 x += EDIT_PaintText(es, dc, x, y, line, 0, ll, FALSE);
int rev
Definition: sort.c:17
static INT EDIT_PaintText(EDITSTATE *es, HDC dc, INT x, INT y, INT line, INT col, INT count, BOOL rev)
Definition: edit.c:2100
HRESULT WINAPI ScriptStringOut(SCRIPT_STRING_ANALYSIS ssa, int iX, int iY, UINT uOptions, const RECT *prc, int iMinSel, int iMaxSel, BOOL fDisabled)
Definition: usp10.c:2366
#define ES_NOHIDESEL
Definition: pedump.c:673

Referenced by EDIT_WM_Paint().

◆ EDIT_PaintText()

static INT EDIT_PaintText ( EDITSTATE es,
HDC  dc,
INT  x,
INT  y,
INT  line,
INT  col,
INT  count,
BOOL  rev 
)
static

Definition at line 2100 of file edit.c.

2102{
2103 COLORREF BkColor;
2104 COLORREF TextColor;
2105 LOGFONTW underline_font;
2106 HFONT hUnderline = 0;
2107 HFONT old_font = 0;
2108 INT ret;
2109 INT li;
2110 INT BkMode;
2111 SIZE size;
2112
2113 if (!count)
2114 return 0;
2115 BkMode = GetBkMode(dc);
2116 BkColor = GetBkColor(dc);
2117 TextColor = GetTextColor(dc);
2118 if (rev) {
2119#ifdef __REACTOS__
2120 if (TRUE)
2121#else
2122 if (es->composition_len == 0)
2123#endif
2124 {
2127 SetBkMode( dc, OPAQUE);
2128 }
2129 else
2130 {
2132 GetObjectW(current,sizeof(LOGFONTW),&underline_font);
2133 underline_font.lfUnderline = TRUE;
2134 hUnderline = CreateFontIndirectW(&underline_font);
2135 old_font = SelectObject(dc,hUnderline);
2136 }
2137 }
2139 if (es->style & ES_MULTILINE) {
2140 ret = (INT)LOWORD(TabbedTextOutW(dc, x, y, es->text + li + col, count,
2141 es->tabs_count, es->tabs, es->format_rect.left - es->x_offset));
2142 } else {
2143 TextOutW(dc, x, y, es->text + li + col, count);
2144 GetTextExtentPoint32W(dc, es->text + li + col, count, &size);
2145 ret = size.cx;
2146 }
2147 if (rev) {
2148#ifdef __REACTOS__
2149 if (TRUE)
2150#else
2151 if (es->composition_len == 0)
2152#endif
2153 {
2154 SetBkColor(dc, BkColor);
2155 SetTextColor(dc, TextColor);
2156 SetBkMode( dc, BkMode);
2157 }
2158 else
2159 {
2160 if (old_font)
2161 SelectObject(dc,old_font);
2162 if (hUnderline)
2163 DeleteObject(hUnderline);
2164 }
2165 }
2166 return ret;
struct task_struct * current
Definition: linux.c:32
#define OBJ_FONT
Definition: objidl.idl:1414
#define INT
Definition: polytest.cpp:20
BYTE lfUnderline
Definition: dimm.idl:65
DWORD COLORREF
Definition: windef.h:300
int WINAPI GetBkMode(_In_ HDC)
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:999
COLORREF WINAPI GetTextColor(_In_ HDC)
Definition: text.c:861
HGDIOBJ WINAPI GetCurrentObject(_In_ HDC, _In_ UINT)
Definition: dc.c:428
COLORREF WINAPI GetBkColor(_In_ HDC)
Definition: dc.c:978
#define OPAQUE
Definition: wingdi.h:949
BOOL WINAPI TextOutW(_In_ HDC hdc, _In_ int x, _In_ int y, _In_reads_(c) LPCWSTR lpString, _In_ int c)
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1056
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:918
BOOL WINAPI GetTextExtentPoint32W(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE psizl)
DWORD WINAPI GetSysColor(_In_ int)
#define COLOR_HIGHLIGHT
Definition: winuser.h:920
#define COLOR_HIGHLIGHTTEXT
Definition: winuser.h:921
LONG WINAPI TabbedTextOutW(_In_ HDC hdc, _In_ int x, _In_ int y, _In_reads_(chCount) LPCWSTR lpString, _In_ int chCount, _In_ int nTabPositions, _In_reads_opt_(nTabPositions) CONST INT *lpnTabStopPositions, _In_ int nTabOrigin)

Referenced by EDIT_PaintLine().

◆ EDIT_Register()

void EDIT_Register ( void  )

Definition at line 5162 of file edit.c.

5164{
5165 WNDCLASSW wndClass;
5166
5167 memset(&wndClass, 0, sizeof(wndClass));
5169 wndClass.lpfnWndProc = EDIT_WindowProc;
5170 wndClass.cbClsExtra = 0;
5171#ifdef __i386__
5172 wndClass.cbWndExtra = sizeof(EDITSTATE *) + sizeof(WORD);
5173#else
5174 wndClass.cbWndExtra = sizeof(EDITSTATE *);
5175#endif
5176 wndClass.hCursor = LoadCursorW(0, (LPWSTR)IDC_IBEAM);
5177 wndClass.hbrBackground = NULL;
5178 wndClass.lpszClassName = WC_EDITW;
5179 RegisterClassW(&wndClass);
static LRESULT CALLBACK EDIT_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: edit.c:4608
#define WC_EDITW
Definition: commctrl.h:4687
#define memset(x, y, z)
Definition: compat.h:39
LPCWSTR lpszClassName
Definition: winuser.h:3175
HBRUSH hbrBackground
Definition: winuser.h:3173
int cbClsExtra
Definition: winuser.h:3168
UINT style
Definition: winuser.h:3166
WNDPROC lpfnWndProc
Definition: winuser.h:3167
int cbWndExtra
Definition: winuser.h:3169
HCURSOR hCursor
Definition: winuser.h:3172
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
#define CS_DBLCLKS
Definition: winuser.h:646
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2074
#define IDC_IBEAM
Definition: winuser.h:683
#define CS_GLOBALCLASS
Definition: winuser.h:647
#define CS_PARENTDC
Definition: winuser.h:651

Referenced by DllMain().

◆ EDIT_SetCaretPos()

static void EDIT_SetCaretPos ( EDITSTATE es,
INT  pos,
BOOL  after_wrap 
)
static

Definition at line 1747 of file edit.c.

1750{
1751 LRESULT res = EDIT_EM_PosFromChar(es, pos, after_wrap);
1752#ifdef __REACTOS__
1753 HKL hKL = GetKeyboardLayout(0);
1754 POINT pt = { (short)LOWORD(res), (short)HIWORD(res) };
1755 SetCaretPos(pt.x, pt.y);
1756
1757 if (!ImmIsIME(hKL))
1758 return;
1759
1760 EDIT_ImmSetCompositionWindow(es, pt);
1761#else
1762 TRACE("%d - %dx%d\n", pos, (short)LOWORD(res), (short)HIWORD(res));
1763 SetCaretPos((short)LOWORD(res), (short)HIWORD(res));
1764#endif
BOOL WINAPI ImmIsIME(HKL hKL)
Definition: ime.c:880
GLuint res
Definition: glext.h:9613
UINT_PTR HKL
Definition: msctf.idl:104
HKL WINAPI GetKeyboardLayout(_In_ DWORD)
BOOL WINAPI SetCaretPos(_In_ int, _In_ int)

Referenced by EDIT_AdjustFormatRect(), EDIT_EM_ScrollCaret(), EDIT_ImeComposition(), EDIT_WM_MouseMove(), EDIT_WM_SetFocus(), and EDIT_WM_SetFont().

◆ EDIT_SetRectNP()

static void EDIT_SetRectNP ( EDITSTATE es,
const RECT rc 
)
static

Definition at line 2306 of file edit.c.

2308{
2310 INT bw, bh;
2312
2313 CopyRect(&es->format_rect, rc);
2314
2315 if (ExStyle & WS_EX_CLIENTEDGE) {
2316 es->format_rect.left++;
2317 es->format_rect.right--;
2318
2319 if (es->format_rect.bottom - es->format_rect.top
2320 >= es->line_height + 2)
2321 {
2322 es->format_rect.top++;
2323 es->format_rect.bottom--;
2324 }
2325 }
2326 else if (es->style & WS_BORDER) {
2328 bh = GetSystemMetrics(SM_CYBORDER) + 1;
2329 InflateRect(&es->format_rect, -bw, 0);
2330 if (es->format_rect.bottom - es->format_rect.top >= es->line_height + 2 * bh)
2331 InflateRect(&es->format_rect, 0, -bh);
2332 }
2333
2334 es->format_rect.left += es->left_margin;
2335 es->format_rect.right -= es->right_margin;
static int bw
Definition: maze.c:120
const DWORD ExStyle
Definition: appswitch.c:72
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define WS_BORDER
Definition: pedump.c:625
BOOL WINAPI CopyRect(_Out_ LPRECT, _In_ LPCRECT)
#define GetWindowLongPtrW
Definition: winuser.h:4819
#define SM_CYBORDER
Definition: winuser.h:959
#define SM_CXBORDER
Definition: winuser.h:958
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
int WINAPI GetSystemMetrics(_In_ int)
#define GWL_EXSTYLE
Definition: winuser.h:845

Referenced by EDIT_WindowProc(), EDIT_WM_Create(), EDIT_WM_SetFont(), EDIT_WM_Size(), and EditWndProc_common().

◆ EDIT_SL_InvalidateText()

static void EDIT_SL_InvalidateText ( EDITSTATE es,
INT  start,
INT  end 
)
static

Definition at line 1373 of file edit.c.

1375{
1376 RECT line_rect;
1377 RECT rc;
1378
1379 EDIT_GetLineRect(es, 0, start, end, &line_rect);
1380 if (IntersectRect(&rc, &line_rect, &es->format_rect))
1381 EDIT_UpdateText(es, &rc, TRUE);

Referenced by EDIT_InvalidateText().

◆ EDIT_UnlockBuffer()

static void EDIT_UnlockBuffer ( EDITSTATE es,
BOOL  force 
)
static

Definition at line 1227 of file edit.c.

1229{
1230 /* Edit window might be already destroyed */
1231 if (!IsWindow(es->hwndSelf))
1232 {
1233 WARN("edit hwnd %p already destroyed\n", es->hwndSelf);
1234 return;
1235 }
1236
1237 if (!es->lock_count)
1238 {
1239 ERR("lock_count == 0 ... please report\n");
1240 return;
1241 }
1242
1243 if (!es->text)
1244 {
1245 ERR("es->text == 0 ... please report\n");
1246 return;
1247 }
1248
1249 if (force || (es->lock_count == 1))
1250 {
1251 if (es->hloc32W)
1252 {
1253 LocalUnlock(es->hloc32W);
1254 es->text = NULL;
1255 }
1256 else
1257 {
1258 ERR("no buffer ... please report\n");
1259 return;
1260 }
1261
1262 }
1263
1264 es->lock_count--;
BOOL NTAPI LocalUnlock(HLOCAL hMem)
Definition: heapmem.c:1805
BOOL WINAPI IsWindow(_In_opt_ HWND)

Referenced by EDIT_EM_GetHandle(), EDIT_EM_SetHandle(), and EDIT_MakeFit().

◆ EDIT_UpdateScrollInfo()

static void EDIT_UpdateScrollInfo ( EDITSTATE es)
static

Definition at line 1557 of file edit.c.

1559{
1560 if ((es->style & WS_VSCROLL) && !(es->flags & EF_VSCROLL_TRACK))
1561 {
1562 SCROLLINFO si;
1563 si.cbSize = sizeof(SCROLLINFO);
1565 si.nMin = 0;
1566 si.nMax = es->line_count - 1;
1567 si.nPage = (es->format_rect.bottom - es->format_rect.top) / es->line_height;
1568 si.nPos = es->y_offset;
1569 TRACE("SB_VERT, nMin=%d, nMax=%d, nPage=%d, nPos=%d\n",
1570 si.nMin, si.nMax, si.nPage, si.nPos);
1571 SetScrollInfo(es->hwndSelf, SB_VERT, &si, TRUE);
1572 }
1573
1574 if ((es->style & WS_HSCROLL) && !(es->flags & EF_HSCROLL_TRACK))
1575 {
1576 SCROLLINFO si;
1577 si.cbSize = sizeof(SCROLLINFO);
1579 si.nMin = 0;
1580 si.nMax = es->text_width - 1;
1581 si.nPage = es->format_rect.right - es->format_rect.left;
1582 si.nPos = es->x_offset;
1583 TRACE("SB_HORZ, nMin=%d, nMax=%d, nPage=%d, nPos=%d\n",
1584 si.nMin, si.nMax, si.nPage, si.nPos);
1585 SetScrollInfo(es->hwndSelf, SB_HORZ, &si, TRUE);
1586 }
#define WS_VSCROLL
Definition: pedump.c:627
#define WS_HSCROLL
Definition: pedump.c:628
struct tagSCROLLINFO SCROLLINFO
#define SIF_RANGE
Definition: winuser.h:1225
#define SB_VERT
Definition: winuser.h:553
#define SIF_PAGE
Definition: winuser.h:1223
#define SIF_DISABLENOSCROLL
Definition: winuser.h:1226
#define SIF_POS
Definition: winuser.h:1224
int WINAPI SetScrollInfo(_In_ HWND, _In_ int, _In_ LPCSCROLLINFO, _In_ BOOL)
#define SB_HORZ
Definition: winuser.h:552

Referenced by EDIT_AdjustFormatRect(), EDIT_EM_LineScroll_internal(), EDIT_EM_ReplaceSel(), EDIT_EM_SetHandle(), EDIT_WM_Create(), EDIT_WM_HScroll(), EDIT_WM_SetText(), and EDIT_WM_VScroll().

◆ EDIT_UpdateText()

static void EDIT_UpdateText ( EDITSTATE es,
const RECT rc,
BOOL  bErase 
)
static

Definition at line 1356 of file edit.c.

1358{
1359 if (es->flags & EF_UPDATE) {
1360 es->flags &= ~EF_UPDATE;
1361 if (!notify_parent(es, EN_UPDATE)) return;
1362 }
1363 InvalidateRect(es->hwndSelf, rc, bErase);
#define EN_UPDATE
Definition: winuser.h:2018
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)

Referenced by EDIT_EM_ReplaceSel(), EDIT_EM_ScrollCaret(), EDIT_EM_SetHandle(), EDIT_EM_SetMargins(), EDIT_EM_SetPasswordChar(), EDIT_EM_SetWordBreakProc(), EDIT_ML_InvalidateText(), EDIT_SL_InvalidateText(), EDIT_WindowProc(), EDIT_WM_SetFont(), EDIT_WM_Size(), and EditWndProc_common().

◆ EDIT_UpdateTextRegion()

static void EDIT_UpdateTextRegion ( EDITSTATE es,
HRGN  hrgn,
BOOL  bErase 
)
static

Definition at line 1341 of file edit.c.

1343{
1344 if (es->flags & EF_UPDATE) {
1345 es->flags &= ~EF_UPDATE;
1346 if (!notify_parent(es, EN_UPDATE)) return;
1347 }
1348 InvalidateRgn(es->hwndSelf, hrgn, bErase);
BOOL WINAPI InvalidateRgn(_In_ HWND, _In_opt_ HRGN, _In_ BOOL)

Referenced by EDIT_EM_ReplaceSel().

◆ EDIT_UpdateUniscribeData()

static SCRIPT_STRING_ANALYSIS EDIT_UpdateUniscribeData ( EDITSTATE es,
HDC  dc,
INT  line 
)
static

Definition at line 373 of file edit.c.

375{
376 LINEDEF *line_def;
377
378 if (!(es->style & ES_MULTILINE))
379 {
380 if (!es->ssa)
381 {
383 HFONT old_font = NULL;
384 HDC udc = dc;
385
386 if (!udc)
387 udc = GetDC(es->hwndSelf);
388 if (es->font)
389 old_font = SelectObject(udc, es->font);
390
391 if (es->style & ES_PASSWORD)
392 ScriptStringAnalyse(udc, &es->password_char, length, (1.5*length+16), -1, SSA_LINK|SSA_FALLBACK|SSA_GLYPHS|SSA_PASSWORD, -1, NULL, NULL, NULL, NULL, NULL, &es->ssa);
393 else
394 ScriptStringAnalyse(udc, es->text, length, (1.5*length+16), -1, SSA_LINK|SSA_FALLBACK|SSA_GLYPHS, -1, NULL, NULL, NULL, NULL, NULL, &es->ssa);
395
396 if (es->font)
397 SelectObject(udc, old_font);
398 if (udc != dc)
399 ReleaseDC(es->hwndSelf, udc);
400 }
401 return es->ssa;
402 }
403 else
404 {
405 line_def = es->first_line_def;
406 while (line_def && line)
407 {
408 line_def = line_def->next;
409 line--;
410 }
411
412 return EDIT_UpdateUniscribeData_linedef(es,dc,line_def);
413 }
HRESULT WINAPI ScriptStringAnalyse(HDC hdc, const void *pString, int cString, int cGlyphs, int iCharset, DWORD dwFlags, int iReqWidth, SCRIPT_CONTROL *psControl, SCRIPT_STATE *psState, const int *piDx, SCRIPT_TABDEF *pTabdef, const BYTE *pbInClass, SCRIPT_STRING_ANALYSIS *pssa)
Definition: usp10.c:1985
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
#define SSA_FALLBACK
Definition: usp10.h:38
#define SSA_LINK
Definition: usp10.h:45
#define SSA_PASSWORD
Definition: usp10.h:33
#define SSA_GLYPHS
Definition: usp10.h:40

Referenced by EDIT_CalcLineWidth_SL(), EDIT_CharFromPos(), EDIT_EM_PosFromChar(), EDIT_PaintLine(), and EDIT_WM_Paint().

◆ EDIT_UpdateUniscribeData_linedef()

static SCRIPT_STRING_ANALYSIS EDIT_UpdateUniscribeData_linedef ( EDITSTATE es,
HDC  dc,
LINEDEF line_def 
)
static

Definition at line 331 of file edit.c.

333{
334 if (!line_def)
335 return NULL;
336
337 if (line_def->net_length && !line_def->ssa)
338 {
339 int index = line_def->index;
340 HFONT old_font = NULL;
341 HDC udc = dc;
342 SCRIPT_TABDEF tabdef;
343 HRESULT hr;
344
345 if (!udc)
346 udc = GetDC(es->hwndSelf);
347 if (es->font)
348 old_font = SelectObject(udc, es->font);
349
350 tabdef.cTabStops = es->tabs_count;
351 tabdef.iScale = GdiGetCharDimensions(udc, NULL, NULL);
352 tabdef.pTabStops = es->tabs;
353 tabdef.iTabOrigin = 0;
354
355 hr = ScriptStringAnalyse(udc, &es->text[index], line_def->net_length,
356 (1.5*line_def->net_length+16), -1,
358 NULL, NULL, NULL, &tabdef, NULL, &line_def->ssa);
359 if (FAILED(hr))
360 {
361 WARN("ScriptStringAnalyse failed (%x)\n",hr);
362 line_def->ssa = NULL;
363 }
364
365 if (es->font)
366 SelectObject(udc, old_font);
367 if (udc != dc)
368 ReleaseDC(es->hwndSelf, udc);
369 }
370
371 return line_def->ssa;
#define FAILED(hr)
Definition: intsafe.h:51
HRESULT hr
Definition: shlfolder.c:183
int * pTabStops
Definition: usp10.h:173
#define SSA_TAB
Definition: usp10.h:34

Referenced by EDIT_BuildLineDefs_ML(), and EDIT_UpdateUniscribeData().

◆ EDIT_WindowProc()

static LRESULT CALLBACK EDIT_WindowProc ( HWND  hwnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 4608 of file edit.c.

4610{
4612 HTHEME theme = GetWindowTheme(hwnd);
4613 LRESULT result = 0;
4614 RECT *rect;
4615
4616 TRACE("hwnd=%p msg=%#x wparam=%lx lparam=%lx\n", hwnd, msg, wParam, lParam);
4617
4618 if (!es && msg != WM_NCCREATE)
4619 return DefWindowProcW(hwnd, msg, wParam, lParam);
4620
4621 if (es && (msg != WM_NCDESTROY))
4623
4624 switch (msg)
4625 {
4626 case EM_GETSEL:
4628 break;
4629
4630 case EM_SETSEL:
4633 result = 1;
4634 break;
4635
4636 case EM_GETRECT:
4637 rect = (RECT *)lParam;
4638 if (rect)
4639 *rect = es->format_rect;
4640 break;
4641
4642 case EM_SETRECT:
4643 if ((es->style & ES_MULTILINE) && lParam)
4644 {
4647 }
4648 break;
4649
4650 case EM_SETRECTNP:
4651 if ((es->style & ES_MULTILINE) && lParam)
4653 break;
4654
4655 case EM_SCROLL:
4657 break;
4658
4659 case EM_LINESCROLL:
4661 break;
4662
4663 case EM_SCROLLCARET:
4665 result = 1;
4666 break;
4667
4668 case EM_GETMODIFY:
4669 result = ((es->flags & EF_MODIFIED) != 0);
4670 break;
4671
4672 case EM_SETMODIFY:
4673 if (wParam)
4674 es->flags |= EF_MODIFIED;
4675 else
4676 es->flags &= ~(EF_MODIFIED | EF_UPDATE); /* reset pending updates */
4677 break;
4678
4679 case EM_GETLINECOUNT:
4680 result = (es->style & ES_MULTILINE) ? es->line_count : 1;
4681 break;
4682
4683 case EM_LINEINDEX:
4685 break;
4686
4687 case EM_SETHANDLE:
4689 break;
4690
4691 case EM_GETHANDLE:
4693 break;
4694
4695 case EM_GETTHUMB:
4697 break;
4698
4699 /* these messages missing from specs */
4700 case 0x00bf:
4701 case 0x00c0:
4702 case 0x00c3:
4703 case 0x00ca:
4704 FIXME("undocumented message 0x%x, please report\n", msg);
4706 break;
4707
4708 case EM_LINELENGTH:
4710 break;
4711
4712 case EM_REPLACESEL:
4713 {
4714 const WCHAR *textW = (const WCHAR *)lParam;
4715
4717 result = 1;
4718 break;
4719 }
4720
4721 case EM_GETLINE:
4723 break;
4724
4725 case EM_SETLIMITTEXT:
4727 break;
4728
4729 case EM_CANUNDO:
4731 break;
4732
4733 case EM_UNDO:
4734 case WM_UNDO:
4736 break;
4737
4738 case EM_FMTLINES:
4740 break;
4741
4742 case EM_LINEFROMCHAR:
4744 break;
4745
4746 case EM_SETTABSTOPS:
4748 break;
4749
4750 case EM_SETPASSWORDCHAR:
4752 break;
4753
4754 case EM_EMPTYUNDOBUFFER:
4756 break;
4757
4759 result = (es->style & ES_MULTILINE) ? es->y_offset : es->x_offset;
4760 break;
4761
4762 case EM_SETREADONLY:
4763 {
4764 DWORD old_style = es->style;
4765
4766 if (wParam)
4767 {
4769 es->style |= ES_READONLY;
4770 }
4771 else
4772 {
4774 es->style &= ~ES_READONLY;
4775 }
4776
4777 if (old_style ^ es->style)
4778 InvalidateRect(es->hwndSelf, NULL, TRUE);
4779
4780 result = 1;
4781 break;
4782 }
4783
4786 result = 1;
4787 break;
4788
4790 result = (LRESULT)es->word_break_proc;
4791 break;
4792
4793 case EM_GETPASSWORDCHAR:
4794 result = es->password_char;
4795 break;
4796
4797 case EM_SETMARGINS:
4799 break;
4800
4801 case EM_GETMARGINS:
4802 result = MAKELONG(es->left_margin, es->right_margin);
4803 break;
4804
4805 case EM_GETLIMITTEXT:
4806 result = es->buffer_limit;
4807 break;
4808
4809 case EM_POSFROMCHAR:
4810 if ((INT)wParam >= get_text_length(es)) result = -1;
4812 break;
4813
4814 case EM_CHARFROMPOS:
4815 result = EDIT_EM_CharFromPos(es, (short)LOWORD(lParam), (short)HIWORD(lParam));
4816 break;
4817
4818 /* End of the EM_ messages which were in numerical order; what order
4819 * are these in? vaguely alphabetical?
4820 */
4821
4822 case WM_NCCREATE:
4824 break;
4825
4826 case WM_NCDESTROY:
4828 es = NULL;
4829 break;
4830
4831 case WM_GETDLGCODE:
4833
4834 if (es->style & ES_MULTILINE)
4836
4837 if (lParam)
4838 {
4839 MSG *msg = (MSG *)lParam;
4840 es->flags |= EF_DIALOGMODE;
4841
4842 if (msg->message == WM_KEYDOWN)
4843 {
4844 int vk = (int)msg->wParam;
4845
4846 if (es->hwndListBox)
4847 {
4848 if (vk == VK_RETURN || vk == VK_ESCAPE)
4851 }
4852 }
4853 }
4854 break;
4855
4856 case WM_IME_CHAR:
4857#ifdef __REACTOS__
4859 break;
4860#endif
4861 case WM_CHAR:
4862 {
4863 WCHAR charW = wParam;
4864
4865 if (es->hwndListBox)
4866 {
4867 if (charW == VK_RETURN || charW == VK_ESCAPE)
4868 {
4871 break;
4872 }
4873 }
4874 result = EDIT_WM_Char(es, charW);
4875 break;
4876 }
4877
4878