Commit Graph

792 Commits

Author SHA1 Message Date
Alexandre Julliard c1a1f0cfb4 riched20: Make sure we have a valid ITextHost vtable for all platforms. 2009-08-26 21:23:52 +02:00
Francois Gouget 6e80d875d4 riched20: Make ME_SetCursorToEnd() static. 2009-08-26 13:09:27 +02:00
Dylan Smith a8e58307f9 richedit: Fixed check for nOffset at the end of the cursor's run.
For some reason the code previously mixed up a selection cursor with the
result cursor.  The problem seemed to have corrected itself before as a
result of conversion between offsets and cursors, but my recent changes
made this bug more severe.
2009-08-17 13:57:50 +02:00
Dylan Smith 989bdd1579 richedit: Use ME_MoveCursorChars in ME_FindText to find relative offset.
When a previous character needed to be found, it is simpler to move
existing cursor rather than retravese the linked list to find the offset
again.
2009-08-13 15:35:37 +02:00
Dylan Smith 54b53b6018 richedit: Use ME_Cursor instead of offsets for stream out functions. 2009-08-13 15:35:28 +02:00
Dylan Smith bd4704280d richedit: Replace offsets arg with ME_Cursor for ME_InternalDeleteText.
Offsets are still used within the function, but this patch reduces the
use of it at the entry to the function.
2009-08-13 15:35:17 +02:00
Dylan Smith 8f0dfaba30 richedit: Removed ME_InsertRun since it uses character offsets.
The function was used in one place, and was simply a wrapper around a
call to ME_InsertRunAtCursor, so I removed it to avoids it use in other
parts of the code.
2009-08-13 15:35:07 +02:00
Dylan Smith 02228ee176 richedit: Use ME_Cursor instead of offsets for ME_CharFromPos. 2009-08-13 15:35:01 +02:00
Dylan Smith a69ef26599 richedit: Use ME_Cursor instead of offsets for copying text. 2009-08-13 15:34:54 +02:00
Dylan Smith 60a72583f4 richedit: Use ME_Cursor instead of offsets for ME_UpdateLinkAttribute. 2009-08-13 15:34:47 +02:00
Dylan Smith 27c28ab292 richedit: Modified ME_MoveCursorsChars to move multiple chars.
Previously the function was only used to move a single character in
either direction, so I made the function more general so that it could
be used in more places.
2009-08-13 15:34:39 +02:00
Dylan Smith 326f9b3f3f richedit: Fixed regression in ME_SetCharFormat.
Missed an assignment for end_run when the end cursor is provided and the
end position doesn't cause a split.
2009-08-13 11:45:13 +02:00
Dylan Smith c92bb271b7 richedit: Use ME_Cursor instead of offsets for ME_GetTextRange. 2009-08-12 17:35:55 +02:00
Dylan Smith 2da0d8e933 richedit: Use ME_Cursor instead of offsets for ME_SetCharFormat.
The test that succeeded from this change was as a result of allowing the
end of the character format change be specified using NULL as the rest
of the text.  Before, the end paragraph run at the end of the text was
not being set for this case, when all the text was supposed to have its
character format changed.
2009-08-12 17:35:50 +02:00
Dylan Smith ade37203a5 richedit: Use ME_Cursor instead of offsets for ME_GetCharFormat.
Prevent extra conversions from character offset to ME_Cursor.
2009-08-12 17:35:42 +02:00
Dylan Smith 2bc726930f richedit: Add helpers for setting cursor to start/end of text. 2009-08-12 17:35:30 +02:00
Dylan Smith 32dcd3bbe1 richedit: Created functions to move between runs and track paragraphs.
Plenty of places in the code find following or preceding runs, then
afterwards find the paragraph from the run.  This is inefficient because
the same linked list is used for both runs and paragraphs, so changes in
paragraphs can be detected while returning the next or previous run.
2009-08-12 17:35:24 +02:00
Dylan Smith 0362b1b087 richedit: Improve efficiency of ME_IsCandidateAnURL.
The code was previously getting the same text in the loop from the
editor, and it was converting each of the prefixes to compare against
for each URL candidate.
2009-08-12 17:34:44 +02:00
Dylan Smith 82e102107c richedit: ME_GetTextW must use source and destination lengths.
Before a single length was used for the number of characters to retrieve
from the text, and to keep track of the size of the buffer.  These are
not equivalent, since there is a possible end of line conversion.
2009-08-12 17:32:16 +02:00
Dylan Smith 46b84aed4a richedit: Added function to get selection cursors in order.
Previously the only convenient way to get the start and end of the
selection was through offsets, which eventually need to get converted
back into items in the linked list storing the text.  The new function
will help with eliminating these inefficiencies.
2009-08-12 17:29:30 +02:00
Dylan Smith be0fb1ef5d richedit: Make the ME_GetCursorOfs function more flexible.
This function will make it easier to work with ME_Cursor objects, which
should be used in a lot of places instead of character offsets (which
often require seeking through the linked lists to perform operations
with).
2009-08-12 17:29:20 +02:00
Dylan Smith 314bd5ca85 richedit: Update paragraph on saved cursor when inserting table start.
Since the table row start is inserted after the rest of the table is
inserted, the cursor is saved, and temporarily moved to the start of the
row to insert the table row start paragraph.  Unfortunately the
paragraph in saved cursor becomes invalid during this insertion and
needs to be updated, so this code introduced a regression once
paragraphs started to be stored in cursors.
2009-08-11 12:31:18 +02:00
Dylan Smith 114a64ce5d richedit: Added missing style releases.
Style objects are referenced counted in richedit controls, so I tried to
make sure styles were released properly.  This can be checked using with
the all_refs global reference count to see if everything is cleaned up.
2009-08-10 17:10:34 +02:00
Dylan Smith fc618ab041 richedit: Add closing actions for IRichEditOle_fnInsertObject.
Previously inserting the object didn't result in the text being wrapped,
which would cause an assertion error when this is checked for during
repainting the text.  It is also important to invalidate the affected
areas of text, update the scrollbar, and end the creation of undo
transactions for this insertion.
2009-08-10 17:10:24 +02:00
Dylan Smith 71cb069246 richedit: Use richedit class string macros from public headers. 2009-08-10 17:10:14 +02:00
Dylan Smith 832ffe108c richedit: Remove header function declarations with no definition. 2009-08-10 17:09:53 +02:00
Dylan Smith 6782627624 richedit: Implement ME_DITypesEqual using a switch statment. 2009-08-10 17:09:46 +02:00
Dylan Smith e306b91392 richedit: Avoid comparing padding in cursor structures on memcmp. 2009-08-07 14:57:24 +02:00
Dylan Smith 05c730fd4c richedit: Prevent using uninitialized nAvailWidth in initialization. 2009-08-03 16:00:34 +02:00
Dylan Smith c4b023b1b6 richedit: Prevent buffer overflows in WM_GETTEXT.
The application AutoGK was getting the length of the text with
WM_GETTEXTLENGTH to allocate an appropriate buffer size, but then
claimed the buffer was twice the size when sending WM_GETTEXTEX.  This
caused the memcpy call to overflow the actual buffer since the count
is based on the size of the buffer alone, regardless of the amount of
text retrieved.
2009-08-03 16:00:16 +02:00
Dylan Smith 3d89e29155 richedit: Handle NULL buffer or 0 buffer length in ME_GetTextEx.
ME_GetTextEx directly handles EM_GETTEXTEX, and previously a NULL buffer
would be dereferenced, and a 0 buffer length would cause nCount an
underflow in the nCount value which would allow a buffer overflow to
occur.
2009-08-03 15:59:57 +02:00
Dylan Smith 0deb3d04ed richedit: Scrollinfo stored as 16-bit values externally.
The application Blitzin2 was sending WM_VSCROLL messages to the
richedit control directly, when normally this message is supposed to
be a notification sent after the scrollinfo is set.  Native richedit
controls always use the 16-bit value passed to this message to set the
scroll position for SB_THUMBPOSITION, rather than trying to find a
32-bit value through GetScrollInfo like I had previously done.
2009-07-22 11:08:33 +02:00
Dylan Smith e364a4406a richedit: Added missing return to ME_EnsureVisible.
The missing return was to prevent automatic vertically scrolling when
style for it is not set, but is set for the horizontal scrollbar. I
initially missed this by testing with no autoscrolling on either
scrollbar.
2009-07-21 10:47:13 +02:00
Dylan Smith c6cf567706 richedit: Properly restore style after end of rtf group.
Rich text files have groupings of text, where styles are pushed onto
the stack when encountering a start of the group, then popped at the
end of the group.  This was being handled improperly before, because a
single styleChanged flag was being stored to keep track of whether the
style needed to be restored at the end of a group. This fails to work
properly since the single flag isn't keeping track of all the levels
of the stack, so some styles are not restored properly.
2009-07-20 12:18:43 +02:00
Dylan Smith dde41d5c13 richedit: Handle missing colours in rtf colour table.
When a colour table entry is empty, then the default colour is used.
For an incomplete colour table entry 0 is used for the missing colours.

Previously the -1 value used internally for missing colours was being
converted into white, where it should be using the default colour that
is normally black.

This bug could be seen by loading the following rich text into wordpad:
{\rtf{\colortbl;;}\cf1 text}
2009-07-17 15:40:35 +02:00
Dylan Smith f59e41e8d5 richedit: Keep scrollbars hidden without WS_HSCROLL & WS_VSCROLL. 2009-07-17 12:37:17 +02:00
Dylan Smith eddccdd1f2 richedit: Initially disable scrollbars for ES_DISABLENOSCROLL.
Previously after initial window creation of a richedit control with the
ES_DISABLENOSCROLL window style flag the scrollbar would be shown but
not disabled.  This patch fixes this issue by explicitly disabling and
showing the scrollbar.
2009-07-17 12:37:03 +02:00
Dylan Smith 140fee1790 richedit: Prevent autoscrolling without ES_AUTO[VH]SCROLL style.
When the richedit control is created without the ES_AUTOHSCROLL or the
ES_AUTOVSCROLL, then scrolling isn't done automatically when moving the
cursor with the arrow keys, drag selecting with the mouse, or even from
using the EM_SCROLLCARET (based on testing using a modified version of
wordpad).
2009-07-17 11:22:07 +02:00
Dylan Smith e7fd0b46b0 richedit: Add more tests for WM_SETTEXT RTF support. 2009-07-13 10:48:05 +02:00
Dylan Smith 88c2b90aa6 richedit: Support ascii RTF in WM_SETTEXT even for unicode messages.
WM_SETTEXT seems to check for {\rtf or {\urtf to determine if it is an
ascii RTF string, even if it is a unicode message.  So I removed the
check to see if it is a unicode message, and added a check for {\urtf.
2009-07-13 10:48:01 +02:00
Alexandre Julliard eb08df3a90 riched20: Add appropriate stdcall decorations to assembly functions. 2009-06-15 13:42:26 +02:00
Alexandre Julliard 3fe51326cd riched20: Move the textHostVtbl definition to work around Mac OS X breakage with __ASM_GLOBAL_FUNC. 2009-06-13 12:20:10 +02:00
Austin Lund 1643679476 riched20/test: Added a test for TxDraw. 2009-06-03 16:04:49 +02:00
Austin Lund 33534916a3 riched20: If DataObjectImpl_EnumFormatEtc returns E_NOTIMPL then ensure that returned pointers are nulled. 2009-06-02 12:09:12 +02:00
Francois Gouget 19020b9ef5 riched20: Make some functions static. 2009-05-26 14:25:12 +02:00
Francois Gouget e5f5bd1153 riched20: RTFPeekToken(), RTFExpandStyle() and RTFHexToChar() are unused so remove them. 2009-05-26 14:25:06 +02:00
Francois Gouget 1914d256a6 riched20: RTF{G,S}et{In,Out}putName() are unused so remove them as well as the corresponding _RTF_Info fields. 2009-05-26 14:10:46 +02:00
Francois Gouget 3d6c53b972 riched20: Make ME_GetCursorCoordinates() static and remove ME_MustBeWrapped() as it is unused. 2009-05-26 14:10:32 +02:00
Francois Gouget 61a8b94634 riched20: ME_MakeString() is unused so remove it. 2009-05-15 10:28:20 +02:00
Francois Gouget 8a46d0eaf5 Assorted spelling fixes. 2009-05-04 12:53:29 +02:00