Commit Graph

698 Commits

Author SHA1 Message Date
Dylan Smith 95d82484e1 richedit: Fixed EM_FINDTEXT to pass todo tests.
There was a bug in ME_FindText which would cause the final caracter
offset to be incorrect when a paragraph was crossed while matching
characters.  The problem was the character offset of the wrong
paragraph was used in the calculation of the start offset of the
match.
2009-02-02 15:21:45 +01:00
Dylan Smith 8662c6fe7b richedit: Implement EM_GETTEXTMODE.
The text mode is already stored, and EM_SETTEXTMODE already exists.

There was however a bug in EM_MakeEditor that could cause TM_PLAINTEXT
and TM_RICHEDIT to be set at the same time.  This was corrected to ensure
EM_GETTEXTMODE returned the proper mode being used.
2009-02-02 15:21:44 +01:00
Dylan Smith 1a3551b630 richedit: Use width from EM_SETTARGETDEVICE for wrapping.
The width for EM_SETTARGETDEVICE is used by some applications to set the
wrapping width to a certain distance in twips.  This can be used even
though the target device is ignored.
2009-02-02 15:21:44 +01:00
Michael Stefaniuc d1a7e41b71 riched20: Remove superfluous pointer casts. 2009-01-30 11:45:23 +01:00
Alasdair Sinclair 0e543a715c riched20/tests: Fix missing void in empty parameter list. 2009-01-30 11:43:31 +01:00
Marcus Meissner a09621b00f riched20: Handle more missing allocs gracefully (Coverity). 2009-01-29 12:45:23 +01:00
Marcus Meissner 605a40e477 riched20: Handle NULL fp more gracefully (Coverity). 2009-01-29 12:45:15 +01:00
Marcus Meissner 9eb4c73ae3 riched20: Handle cp NULL more gracefully (Coverity). 2009-01-29 12:45:07 +01:00
Marcus Meissner 3d8fd826e1 riched20: Exit the loop instead of crashing (Coverity). 2009-01-29 12:45:00 +01:00
Marcus Meissner 4662271afd riched20: Removed unneeded NULL check (Coverity). 2009-01-29 12:44:53 +01:00
Marcus Meissner 43eb9ab9d7 riched20: rcUpdate cannot be NULL in ME_PaintContent (Coverity). 2009-01-28 12:30:43 +01:00
Dylan Smith f42e151a6c richedit: Updated internal style flags on EM_SHOWSCROLLBAR.
The internal style flags are used to determine whether to show or hide
the scrollbar when ME_UpdateScrollBar is called.  EM_SHOWSCROLLBAR seems
to update this state in native richedit controls.
2009-01-28 12:11:59 +01:00
Dylan Smith a051a23119 richedit: Suppress scrollbar if missing WS_[VH]SCROLL style.
If the scrollbar style isn't initially used, then the scrollbar should
be shown.  Otherwise this can be a problem when the horizontal scrollbar
is shown for a single line richedit control, since it will cover all the
text (See bug 12088).
2009-01-28 12:11:44 +01:00
Dylan Smith 5d74f58382 richedit: Actually store end of line string for end paragraph runs.
Previously a count of the carraige returns and line feeds were stored
for end of paragraph runs, and a paragraph sign was stored as the actual
string.  This was causing many special cases where the length of the
run needed to be determined differently if the run was or wasn't an
end of paragraph run.

There wasn't any use for storing the paragraph sign unless some drawing
code gets commented out to allow the end paragraphs to be shown,
therefore I changed the code to store the actual string that gets
retrieved by WM_GETTEXT.
2009-01-28 12:11:36 +01:00
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