38 cursor->nOffset = final_eop ?
cursor->pRun->member.run.len : 0;
63 if (from_ofs == to_ofs)
116 FIXME(
"GTL_PRECISE flag unsupported. Using GTL_CLOSE\n");
134 int selectionEnd = 0;
144 if (
from == 0 && to == -1)
153 if ((
from == to) && (to < 0 || to >
len))
256 pSizeRun = run = tmp;
316 int nChars,
BOOL bForce)
321 int totalChars = nChars;
326 nChars =
min(nChars, text_len - nOfs);
327 if (nChars == text_len) delete_all =
TRUE;
328 start_para =
c.pPara;
342 nOfs+nChars == (
c.pRun->member.run.nCharOfs
343 +
c.pPara->member.para.nCharOfs))
348 c.nOffset =
c.pRun->member.run.len;
350 run = &
c.pRun->member.run;
352 int eollen =
c.pRun->member.run.
len;
353 BOOL keepFirstParaFormat;
359 keepFirstParaFormat = (totalChars == nChars && nChars <= eollen &&
368 if (this_para == start_para &&
377 nChars -= (eollen < nChars) ? eollen : nChars;
380 keepFirstParaFormat =
TRUE;
386 nChars -= (eollen < nChars) ? eollen : nChars;
392 int nCharsToDelete =
min(nChars,
c.nOffset);
395 c.nOffset -= nCharsToDelete;
403 nChars -= nCharsToDelete;
404 shift -= nCharsToDelete;
405 TRACE(
"Deleting %d (remaining %d) chars at %d in %s (%d)\n",
406 nCharsToDelete, nChars,
c.nOffset,
414 run->
len -= nCharsToDelete;
421 if (
i == -1) pThisCur = &
c;
427 pThisCur->
nOffset -= nCharsToDelete;
447 if (!
cursor.pRun->member.run.len)
449 TRACE(
"Removing empty run\n");
467 assert(nCursor>=0 && nCursor<editor->nCursors);
494 WARN(
"Fail to allocate re_object.\n");
570 assert(nCursor>=0 && nCursor<editor->nCursors);
588 }
else if (*
pos ==
'\t') {
603 if (
len > 1 &&
pos[1] ==
'\n')
605 else if (
len > 2 &&
pos[1] ==
'\r' &&
pos[2] ==
'\n')
621 const WCHAR cr =
'\r', *eol_str =
str;
631 if (
p->nOffset ==
p->pRun->member.run.len)
634 if (!run) run =
p->pRun;
677 cursor->nOffset += nRelOfs;
686 }
while (
cursor->nOffset <
cursor->pRun->member.run.nCharOfs);
695 nRelOfs -=
cursor->nOffset;
703 }
while (
cursor->nOffset <
cursor->pPara->member.para.nCharOfs);
707 while (
cursor->nOffset <
cursor->pRun->member.run.nCharOfs) {
711 }
else if (
cursor->nOffset >=
cursor->pRun->member.run.len) {
716 next_para =
cursor->pPara->member.para.next_para;
717 if (new_offset < next_para->
member.para.nCharOfs)
723 }
while (
cursor->nOffset >=
cursor->pRun->member.run.len);
737 cursor->pPara = next_para;
741 cursor->nOffset = new_offset -
cursor->pPara->member.para.nCharOfs;
758 int nOffset =
cursor->nOffset;
770 if (pOtherRun->type ==
diRun)
773 pOtherRun->member.run.len,
774 pOtherRun->member.run.len - 1,
816 if (nOffset < pRun->
member.run.len)
819 if (pOtherRun->type ==
diRun)
830 if (
cursor->pRun == pRun) {
848 cursor->nOffset = nOffset;
863 switch(selectionType)
914 return cursor->pPara->member.para.nCharOfs
971 if (pbCaretAtEnd) *pbCaretAtEnd =
FALSE;
977 if (
x >= run_x &&
x < run_x+
width)
991 if (pbCaretAtEnd) *pbCaretAtEnd =
TRUE;
1030 y -=
p->member.para.pt.y;
1085 if (isExact) *isExact =
FALSE;
1091 if (isExact) *isExact = bResult;
1110 int curOfs, anchorStartOfs, anchorEndOfs;
1120 if (curOfs < anchorStartOfs)
1137 else if (curOfs >= anchorEndOfs)
1185 }
else if (clickNum % 2 == 0) {
1196 else if (!is_selection)
1210 }
else if (clickNum % 2 == 0 || is_shift) {
1389 y = yp +
p->member.row.pt.y;
1401 if (
p->member.para.prev_para ==
NULL)
1403 yp =
p->member.para.prev_para->member.para.pt.y;
1406 y = yp +
p->member.row.pt.y;
1446 y = yp +
p->member.row.pt.y;
1461 yp =
p->member.para.pt.y;
1464 y = yp +
p->member.row.pt.y;
1488 pCursor->
pRun = pRun;
1514 pCursor->
pRun = pRun;
1543 int nEndCursor = nStartCursor ^ 1;
1575 TRACE(
"cpMin=%d cpMax=%d seltyp=%d (%s %s)\n",
ME_DisplayItem * ME_GetTableRowStart(ME_DisplayItem *para) DECLSPEC_HIDDEN
void ME_SetDefaultParaFormat(ME_TextEditor *editor, PARAFORMAT2 *pFmt) DECLSPEC_HIDDEN
void ME_InvalidateSelection(ME_TextEditor *editor) DECLSPEC_HIDDEN
BOOL WINAPI GetCPInfo(UINT CodePage, LPCPINFO CodePageInfo)
GLint GLint GLsizei width
static void ME_ArrowCtrlEnd(ME_TextEditor *editor, ME_Cursor *pCursor)
void ME_CheckCharOffsets(ME_TextEditor *editor) DECLSPEC_HIDDEN
ME_Style * ME_GetInsertStyle(ME_TextEditor *editor, int nCursor) DECLSPEC_HIDDEN
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
void ME_CursorFromCharOfs(ME_TextEditor *editor, int nCharOfs, ME_Cursor *pCursor) DECLSPEC_HIDDEN
RECO_DRAG struct _reobject REOBJECT
void ME_ScrollDown(ME_TextEditor *editor, int cy) DECLSPEC_HIDDEN
static void ME_ArrowHome(ME_TextEditor *editor, ME_Cursor *pCursor)
#define ITextHost_TxCreateCaret(This, a, b, c)
__WINE_SERVER_LIST_INLINE void list_add_after(struct list *elem, struct list *to_add)
struct tagME_DisplayItem * pCell
int ME_CallWordBreakProc(ME_TextEditor *editor, WCHAR *str, INT len, INT start, INT code) DECLSPEC_HIDDEN
__WINE_SERVER_LIST_INLINE void list_add_head(struct list *list, struct list *elem)
void ME_ScrollUp(ME_TextEditor *editor, int cy) DECLSPEC_HIDDEN
void ME_InsertTextFromCursor(ME_TextEditor *editor, int nCursor, const WCHAR *str, int len, ME_Style *style)
void ME_StrDeleteV(ME_String *s, int nVChar, int nChars) DECLSPEC_HIDDEN
struct tagME_Paragraph * para
ME_Style * ME_GetSelectionInsertStyle(ME_TextEditor *editor)
GLint GLint GLint GLint GLint x
static int ME_GetXForArrow(ME_TextEditor *editor, ME_Cursor *pCursor)
ME_DisplayItem * ME_SplitRunSimple(ME_TextEditor *editor, ME_Cursor *cursor) DECLSPEC_HIDDEN
int ME_GetSelectionOfs(ME_TextEditor *editor, int *from, int *to)
struct tagME_DisplayItem * prev_para
ME_DisplayItem * ME_GetTableRowEnd(ME_DisplayItem *para) DECLSPEC_HIDDEN
#define ITextHost_TxGetClientRect(This, a)
void ME_CopyReObject(REOBJECT *dst, const REOBJECT *src, DWORD flags) DECLSPEC_HIDDEN
static void ME_MoveCursorLines(ME_TextEditor *editor, ME_Cursor *pCursor, int nRelOfs, BOOL extend)
int ME_PointFromChar(ME_TextEditor *editor, ME_Run *pRun, int nOffset, BOOL visual_order) DECLSPEC_HIDDEN
int set_selection_cursors(ME_TextEditor *editor, int from, int to)
void ME_ClearTempStyle(ME_TextEditor *editor) DECLSPEC_HIDDEN
void ME_ProtectPartialTableDeletion(ME_TextEditor *editor, ME_Cursor *c, int *nChars) DECLSPEC_HIDDEN
void ME_LButtonDown(ME_TextEditor *editor, int x, int y, int clickNum)
ME_DisplayItem * ME_SplitParagraph(ME_TextEditor *editor, ME_DisplayItem *rp, ME_Style *style, const WCHAR *eol_str, int eol_len, int paraFlags) DECLSPEC_HIDDEN
void ME_InsertEndRowFromCursor(ME_TextEditor *editor, int nCursor)
#define ITextHost_TxNotify(This, a, b)
static void * heap_alloc(size_t len)
#define PFM_TABLEROWDELIMITER
static const char * debugstr_run(const ME_Run *run)
static struct re_object * create_re_object(const REOBJECT *reo)
GLenum GLuint GLenum GLsizei length
void ME_DestroyDisplayItem(ME_DisplayItem *item) DECLSPEC_HIDDEN
#define ITextHost_TxShowCaret(This, a)
void ME_GetCursorCoordinates(ME_TextEditor *editor, ME_Cursor *pCursor, int *x, int *y, int *height)
void ME_Repaint(ME_TextEditor *editor) DECLSPEC_HIDDEN
int ME_GetSelection(ME_TextEditor *editor, ME_Cursor **from, ME_Cursor **to)
static void ME_ArrowEnd(ME_TextEditor *editor, ME_Cursor *pCursor)
static void ME_ArrowPageDown(ME_TextEditor *editor, ME_Cursor *pCursor)
void ME_InitContext(ME_Context *c, ME_TextEditor *editor, HDC hDC)
void ME_SkipAndPropagateCharOffset(ME_DisplayItem *p, int shift) DECLSPEC_HIDDEN
int ME_CharFromPoint(ME_TextEditor *editor, int cx, ME_Run *run, BOOL closest, BOOL visual_order) DECLSPEC_HIDDEN
#define ITextHost_TxGetDC(This)
BOOL ME_DeleteTextAtCursor(ME_TextEditor *editor, int nCursor, int nChars)
void ME_PropagateCharOffset(ME_DisplayItem *p, int shift) DECLSPEC_HIDDEN
SHORT WINAPI GetKeyState(_In_ int)
_In_ uint64_t _In_ uint64_t _In_ uint64_t _In_opt_ traverse_ptr * tp
void ME_SetCursorToStart(ME_TextEditor *editor, ME_Cursor *cursor)
BOOL ME_PrevRun(ME_DisplayItem **para, ME_DisplayItem **run, BOOL all_para) DECLSPEC_HIDDEN
ME_SelectionType nSelectionType
BOOL ME_MoveCursorWords(ME_TextEditor *editor, ME_Cursor *cursor, int nRelOfs)
void ME_MouseMove(ME_TextEditor *editor, int x, int y)
void show_caret(ME_TextEditor *editor)
BOOL ME_InternalDeleteText(ME_TextEditor *editor, ME_Cursor *start, int nChars, BOOL bForce)
int ME_GetTextLengthEx(ME_TextEditor *editor, const GETTEXTLENGTHEX *how)
BOOL ME_CharFromPos(ME_TextEditor *editor, int x, int y, ME_Cursor *cursor, BOOL *isExact)
void ME_SendSelChange(ME_TextEditor *editor)
static void ME_ArrowPageUp(ME_TextEditor *editor, ME_Cursor *pCursor)
static BOOL ME_FindPixelPos(ME_TextEditor *editor, int x, int y, ME_Cursor *result, BOOL *is_eol, BOOL final_eop)
void ME_ReleaseStyle(ME_Style *item) DECLSPEC_HIDDEN
void ME_DeleteSelection(ME_TextEditor *editor)
void create_caret(ME_TextEditor *editor)
#define success(from, fromstr, to, tostr)
union tagME_DisplayItem::@526 member
void ME_Remove(ME_DisplayItem *diWhere) DECLSPEC_HIDDEN
void ME_DestroyContext(ME_Context *c)
ME_DisplayItem * ME_GetParagraph(ME_DisplayItem *run) DECLSPEC_HIDDEN
static void ME_SetCursorToEnd(ME_TextEditor *editor, ME_Cursor *cursor, BOOL final_eop)
static __inline int is_eol(struct parser *parser, const CHAR *ptr)
#define PFE_TABLEROWDELIMITER
static WCHAR * get_text(const ME_Run *run, int offset)
static ME_DisplayItem * ME_InternalInsertTextFromCursor(ME_TextEditor *editor, int nCursor, const WCHAR *str, int len, ME_Style *style, int flags)
GLint GLint GLsizei GLsizei height
int ME_GetCursorOfs(const ME_Cursor *cursor)
#define ITextHost_TxSetCaretPos(This, a, b)
void ME_InsertOLEFromCursor(ME_TextEditor *editor, const REOBJECT *reo, int nCursor)
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
ME_DisplayItem * ME_JoinParagraphs(ME_TextEditor *editor, ME_DisplayItem *tp, BOOL keepFirstParaFormat) DECLSPEC_HIDDEN
struct tagME_DisplayItem * next_para
void ME_EnsureVisible(ME_TextEditor *editor, ME_Cursor *pCursor) DECLSPEC_HIDDEN
int ME_MoveCursorChars(ME_TextEditor *editor, ME_Cursor *cursor, int nRelOfs, BOOL final_eop)
GLint GLint GLint GLint GLint GLint y
BOOL ME_IsSelection(ME_TextEditor *editor)
BOOL ME_ArrowKey(ME_TextEditor *editor, int nVKey, BOOL extend, BOOL ctrl)
static void ME_ExtendAnchorSelection(ME_TextEditor *editor)
struct tagME_DisplayItem * next_cell
static ME_DisplayItem * ME_FindPixelPosInTableRow(int x, int y, ME_DisplayItem *para)
ME_DisplayItem * ME_FindItemFwd(ME_DisplayItem *di, ME_DIType nTypeOrClass) DECLSPEC_HIDDEN
int ME_PointFromCharContext(ME_Context *c, ME_Run *pRun, int nOffset, BOOL visual_order) DECLSPEC_HIDDEN
void update_caret(ME_TextEditor *editor)
static void ME_ArrowCtrlHome(ME_TextEditor *editor, ME_Cursor *pCursor)
ME_DisplayItem * ME_InsertRunAtCursor(ME_TextEditor *editor, ME_Cursor *cursor, ME_Style *style, const WCHAR *str, int len, int flags) DECLSPEC_HIDDEN
void mark_para_rewrap(ME_TextEditor *editor, ME_DisplayItem *para) DECLSPEC_HIDDEN
static BOOL ME_FindRunInRow(ME_TextEditor *editor, ME_DisplayItem *pRow, int x, ME_Cursor *cursor, BOOL *pbCaretAtEnd)
static void ME_SelectByType(ME_TextEditor *editor, ME_SelectionType selectionType)
int ME_GetTextLength(ME_TextEditor *editor)
ME_DisplayItem * ME_FindItemBack(ME_DisplayItem *di, ME_DIType nTypeOrClass) DECLSPEC_HIDDEN
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
void hide_caret(ME_TextEditor *editor)
WINE_DEFAULT_DEBUG_CHANNEL(richedit)
BOOL add_undo_insert_run(ME_TextEditor *, int pos, const WCHAR *str, int len, int flags, ME_Style *style) DECLSPEC_HIDDEN
struct tagME_DisplayItem * prev_cell