Commit Graph

684 Commits

Author SHA1 Message Date
Dylan Smith 61308257f2 richedit: Removed redundant ME_FindItemAtOffset using ME_RunOfsFromCharOfs.
The two functions ME_FindItemAtOffset and ME_RunOfsFromCharOfs were almost
identically used, since ME_FindItemAtOffset was always used to find a run.
The only difference was how they returned the offset within the run for an
end of paragraph run.

For ME_FindItemAtOffset it would return the next run if it was in between \r
and \n. ME_RunOfsFromCharOfs would instead return an nOffset of 0 for end
paragraph runs.  This subtle difference introduced bugs, so I decided to
avoid having special case in this function when creating this patch, and
instead let the caller handle this case.
2009-01-27 11:21:33 +01:00
Dylan Smith 61f189cec8 richedit: Handle starting in EOL sequence in EM_GETTEXTRANGE.
EM_GETTEXTRANGE allows the start character offset and end characters
offset to be used to specify the range of text to retrieve.  If the
start offset is in the middle of an end of paragraph run (i.e. \r\n),
then it should only retrieve the characters after the specified
character offset.
2009-01-27 11:21:16 +01:00
Dylan Smith c94e78a572 richedit: Handle case for EM_LINELENGTH when offset is between \r\n.
I found that ME_FindItemAtOffset and ME_CursorFromCharOfs are used
almost identically, except for how they handle a character offset that
is between a carriage return and line feed.  In this case
ME_CursorFromCharOfs sets the cursor's run offset to 0, but
ME_FindItemAtOffset instead returns the next run which is what was
causing ME_LINELENGTH to incorrectly return the length of the next
line.
2009-01-27 11:20:59 +01:00
Dylan Smith 0832737427 richedit: End of line sequence limited to 2 carriage returns.
riched32.dll does preserve the carriage returns and line feeds unlike
later versions of the richedit control, however the tests previously
missed the fact that a sequence of carriage returns followed by a line
feed (e.g. \r\r\r\n) can actually cause multiple paragraph breaks.
2009-01-27 11:20:37 +01:00
Nikolay Sivov e49cb3bfcb richedit: Update EM_GETOLEINTERFACE documentation status. 2009-01-22 15:28:22 +01:00
Dylan Smith 8f7a99fb96 richedit: Implemented ITextServices_TxGetVScroll & TxGetHScroll. 2009-01-22 15:28:22 +01:00
Dylan Smith 94146a72ad richedit: Removed some unused invalidation code.
The ME_InvalidateFromOfs and ME_QueueInvalidateFromCursor functions are
never called, and the nInvalidOfs variable had its value set but never
used.
2009-01-22 15:28:22 +01:00
Dylan Smith a6c7b6fdb2 richedit: Typing is ignored while mouse is captured.
I noticed a while ago that on Windows XP richedit controls ignored
characters typed while the mouse is captured (e.g. from holding the left
or middle button down).  Arrow keys, delete, and backspace, copying,
cutting, pasting, and everything else handled on WM_CHAR and WM_KEYDOWN
messages are also ignored.
2009-01-22 15:28:22 +01:00
Dylan Smith 9b7825f6f6 richedit: Added test for scroll position after EM_SETTEXTEX. 2009-01-22 15:28:22 +01:00
Francois Gouget 30ad4c9eb0 riched20/tests: Make test_TxGetNaturalSize() static. 2009-01-22 12:04:04 +01:00
Alistair Leslie-Hughes 689675273b riched20: Return a long in fnGetObjectCount. 2009-01-22 12:03:17 +01:00
Dylan Smith 20d6bc8ac7 richedit: Implemented ITextServices TxGetText and TxSetText. 2009-01-21 11:55:36 +01:00
Dylan Smith e7b68a20fd richedit: Implemented ITextServices_TxSendMessage. 2009-01-21 11:55:22 +01:00
Dylan Smith 902afbc65b richedit: Prevented using NULL hwnd for certain operations.
Certain operations will simply not be done for windowless richedit
controls, such as WM_PAINT which isn't done for windowless richedit
controls since ITextServices provides a TxDraw method.
2009-01-21 11:55:03 +01:00
Dylan Smith 05c788ac6f richedit: Used ITextHost methods to avoid using window handle directly.
The methods in ITextHost are mostly thin wrappers around functions that
take a handle to a window as their first parameter.  This patch just
uses the wrapper functions provided by ITextHost instead of using the
functions that require a handle to a window that the editor might now
have (for windowless richedit controls).
2009-01-21 11:54:43 +01:00
Dylan Smith 6c4dda009e richedit: Implemented ITextHost for windowed richedit controls. 2009-01-21 11:54:26 +01:00
Paul Vriens bd607b64fd riched20/tests: Fix a test failure on Win9x. 2009-01-20 12:23:20 +01:00
Austin Lund 80e71e63f2 riched20/tests: Added ITextServices::TxGetNaturalSize test. 2009-01-19 14:36:06 +01:00
Andrew Talbot b53d7d3295 riched20: Declare some functions static. 2009-01-19 13:36:26 +01:00
Dylan Smith d29a301ccd richedit: Prevent sending Ctrl-C to console and ending tests. 2009-01-19 12:46:41 +01:00
Dylan Smith b4babc16bb richedit: EM_SETTEXTEX detects ascii richtext with Unicode codepage. 2009-01-19 12:46:41 +01:00
Dylan Smith 164778452c richedit: Added test for detecting ascii rtf with Unicode codepage. 2009-01-19 12:46:41 +01:00
Michael Stefaniuc 273dbe4619 riched20: Fix a typo (stray address of operator). 2009-01-16 16:34:46 +01:00
Dylan Smith f73a34647f richedit: Respect the cbSize field on EM_GETPARAFORMAT.
EM_GETPARAFORMAT previously would overwrite the cbSize field with the
size of PARAFORMAT2, would read past the end of the struct, and might
indicate that PARAFORMAT2 fields are valid using the mask regardless
of the value of cbSize.
2009-01-16 12:57:10 +01:00
Dylan Smith 1181bb762f richedit: Prevent copying PARAFORMAT2 fields from PARAFORMAT struct.
If a EM_SETPARAFORMAT message is sent to the richedit control with bits
in the dwMask field that correspond to PARAFORMAT2 fields, then these
fields should be ignored.  Instead data was copied from outside of the
structure.
2009-01-16 12:56:57 +01:00
Dylan Smith 89f88a49a4 richedit: Store an internal copy of the window style flags. 2009-01-16 12:35:28 +01:00
Dylan Smith 9a902f358b richedit: Added tests for initial options.
Using the WS_VSCROLL style causes the ES_AUTOVSCROLL option to be set,
and using the WS_HSCROLL style causes the ES_AUTOHSCROLL flag to be
set (except with richedit v1.0).
2009-01-16 12:35:17 +01:00
Dylan Smith 77a94bed98 richedit: Fix implementation of handling Page Up/Down keys. 2009-01-16 12:34:54 +01:00
Dylan Smith e6fedf879c richedit: Implemented the horizontal scrollbar. 2009-01-15 14:13:38 +01:00
Dylan Smith 01ee55a8f6 richedit: Clip painting to formatting rectangle. 2009-01-15 14:13:31 +01:00
Dylan Smith b81144b350 richedit: Correct limitations on values for setting zoom ratio. 2009-01-14 14:22:43 +01:00
Dylan Smith fcabbbf30f richedit: Zoom in and out with mouse wheel with control held. 2009-01-14 14:22:37 +01:00
Dylan Smith b70b3e893f richedit: Added tests for zooming.
The contents of the text can be zoomed in with EM_SETZOOM, or with the
mouse wheel.  EM_SETZOOM is implemented, but these tests show bugs in
the implementation, and zooming using the mouse wheel isn't
implemented at all yet.
2009-01-14 14:22:26 +01:00
Andrew Talbot d287e88691 riched20: Declare some functions static. 2009-01-14 12:40:40 +01:00
Andrew Talbot 8ddf6c0a25 riched20: Declare some functions static. 2009-01-13 15:53:43 +01:00
Austin Lund c607ab96b6 riched20/tests: Added ITextServices::TxSetText test. 2009-01-12 16:53:18 +01:00
Dylan Smith f885d40d67 richedit: Store mouse captured state rather than calling GetCapture.
Windowless richedit control will not be able to call GetCapture without
a handle to the host window (and there is no ITextHost_TxGetCapture
method), but there is a ITextHost_TxSetCapture method available for
setting and releasing the capture on the mouse.  This means that the
richedit control will need to keep track of whether it has captured the
mouse or not to implement windowless richedit controls.
2009-01-12 14:42:02 +01:00
Dylan Smith ee19ec056a richedit: Prevent an unsigned integer underflow. 2009-01-12 14:40:30 +01:00
Dylan Smith 8089d980d1 richedit: Set bEmulateVersion10 initially to avoid retroactive changes.
Previously the WM_NCCREATE was handled by the as if it was always for
later versions, then the window proc for version 1.0 would make
appropriate changes afterwards.  Instead both versions should call the
same function (e.g. ME_MakeEditor) and provide the value for
bEmulateVersion10 to make the code clearer.
2009-01-12 14:40:11 +01:00
Dylan Smith 603be645d2 richedit: Pressing enter adds newline on WM_KEYDOWN rather than WM_CHAR. 2009-01-12 14:39:42 +01:00
Dylan Smith 576ff4b104 richedit: Tested EM_CHARFROMPOS with position outside of control. 2009-01-12 14:38:57 +01:00
Dylan Smith 55d9e95892 richedit: Added tests for autoscrolling options based on WS_V/HSCROLL. 2009-01-12 14:38:36 +01:00
Dylan Smith a1aaf97c11 richedit: Added tests to show that options are stored internally. 2009-01-12 14:38:17 +01:00
Juan Lang cfd1a6317d riched20: Add stub IOleClientSite interface. 2009-01-10 14:49:46 +01:00
Dylan Smith 1f6b8c7fd9 richedit: Missing condition for inserting newline before table.
This case occurs when the cursor is at the start of the table, the
table is at the start of the text, and there is no selection.
2009-01-09 14:06:13 +01:00
Dylan Smith 573102ee88 richedit: Fixed implementation of WM_GETDLGCODE message.
This fixes inconsistencies shown in the tests I added for the
WM_GETDLGCODE.  The tests covered different cases handled by the
current implementation in order to show that the native implementation
is simpler for all these cases.
2009-01-08 13:35:05 +01:00
Dylan Smith c636b59bcf richedit: Added tests for WM_GETDLGCODE message. 2009-01-08 13:34:53 +01:00
Dylan Smith 28645c64d5 richedit: Avoid rewrapping all text for isolated format changes.
When the character or paragraph format is changed the paragraph that
is changed is already marked to be rewrapped, so ME_MarkAllForWrapping
shouldn't be called.  Since ME_RewrapRepaint uses this function, it
shouldn't be called in these circumstances, since rewrapping all the
text can cause noticable delays when working with a lot of text.
2009-01-06 12:52:09 +01:00
Dylan Smith 6df4148b04 richedit: Prevent redundant rewraps when scrollbar is shown.
A common case for richedit controls are that a large amount of text is
set initially with word wrap enabled.  This causes the initially
wrapping of the text, which also calculates the text length.  After
this the vertical scrollbar will be shown, which causes the text to be
rewrapped again.  After this there are two redundant rewraps that are
done which this patch eliminates.
2009-01-06 12:51:55 +01:00
Dylan Smith a16db0afc6 richedit: Scroll up with less than page of text with ES_DISABLENOSCROLL. 2009-01-06 12:51:41 +01:00