Commit Graph

150 Commits

Author SHA1 Message Date
Huw Davies a53179dadd riched20: Ensure the cursors are equal after deleting the selection. 2014-01-07 15:21:33 +01:00
Huw Davies c59c582c9a riched20: Correctly handle the cursor at the end of run case while splitting paragraphs. 2014-01-07 15:21:30 +01:00
Huw Davies b0f177b619 riched20: Ensure the cursors are correctly ordered in the case of a zero (logical) length selection bridging two runs. 2013-12-10 13:01:22 +01:00
Huw Davies f13fe24e9e riched20: Remove some over-zealous calls to clear the insert style.
It's cleared correctly, if the selection actually changes, in the
selection change notification handler.
2013-12-06 13:15:02 +01:00
Huw Davies 58e83ebdea riched20: Revert to the default paragraph style when all text is deleted. 2013-11-04 17:41:12 +01:00
Huw Davies 5ddfc36cc0 riched20: Add a visual vs logical order flag to the character to position mapping routines. 2013-04-17 14:26:09 +02:00
Huw Davies 5e53012736 riched20: Don't assume the the runs in a row are in visual order. 2013-02-26 18:18:16 +01:00
Huw Davies c5c4d54905 riched20: Allow the cursor offset to be equal to the run length - this implies the cursor is at the end of the run, which isn't necessarily the start of the next. 2013-02-26 18:18:12 +01:00
Huw Davies a6369b8332 riched20: Rewrite ME_FindPixelPos to use ME_GetRunInRow. 2013-02-25 17:11:58 +01:00
Huw Davies 87163410e5 riched20: Only retrieve the next row. 2013-02-25 17:11:56 +01:00
Huw Davies 41dd421222 riched20: Return a BOOL that indicates whether the hit is exact. 2013-02-25 17:11:53 +01:00
Huw Davies 0730db2b99 riched20: Change ME_FindRunInRow to fill out a cursor structure. 2013-02-25 17:11:51 +01:00
Huw Davies acaad0a842 riched20: Add the ability to CharFromPoint to either pick the closest leading edge or the leading edge of the selected character. 2013-02-18 16:34:10 +01:00
Huw Davies 1c0aaf7dd2 riched20: Use ME_PointFromChar to calculate the caret position. 2013-02-15 17:52:13 +01:00
Huw Davies 5168d66be7 riched20: Move the text to the paragraph level. 2013-02-05 20:15:37 +01:00
Huw Davies 872a2ad031 riched20: Pass a character ptr and length to SplitParagraph. 2013-02-05 20:15:36 +01:00
Huw Davies 48b9ab37ac riched20: Pass the character ptr and string length directly to the break proc helper. 2013-02-05 10:51:26 +01:00
Huw Davies 86f077b163 riched20: Add an explicit run length member and use it rather than accessing the string length. 2013-01-31 16:32:12 +01:00
Huw Davies 27578f8bb6 riched20: Add a helper to retrieve the run text. 2013-01-30 17:19:31 +01:00
Huw Davies c17af77b5c riched20: Add a helper to debug the run text. 2013-01-30 17:19:28 +01:00
Huw Davies dee40e90ce riched20: Move undo handling to a different set of structs as the display item structs are not a good fit. 2013-01-29 17:50:17 +01:00
Huw Davies 7a27ffb28c riched20: Avoid an unnecessary string duplication. 2013-01-22 19:13:07 +01:00
Dan Kegel 4996043374 riched20: Don't need to redraw when changing selection from none to none. 2012-05-10 08:30:58 +02:00
Frédéric Delanoy 7ed4f20305 riched20: Remove dead assignment (Clang). 2011-07-06 11:29:18 +02:00
Dylan Smith 8b8e4f89b2 richedit: Use ME_Cursor as parameter to ME_SplitRunSimple.
The paragraph needed to be included in the parameters to avoid needing
traverse the linked list of display items to find the paragraph.
2010-07-30 11:36:02 +02:00
Gerald Pfeifer f772c799ae riched20: Remove variables yprev and ys which are not really used from ME_ArrowPageUp. 2010-05-17 12:42:31 +02:00
Gerald Pfeifer 2d462ad088 riched20: Remove variable ys which is not really used from ME_ArrowPageDown. 2010-05-10 10:11:29 +02:00
Gerald Pfeifer f29514fbec riched20: Remove variable di which is not really used from ME_InsertEndRowFromCursor. 2010-05-03 15:42:18 +02:00
Gerald Pfeifer 01777ac5ce riched20: Remove variable yprev which is not really used from ME_ArrowPageDown. 2010-05-03 15:37:31 +02:00
David Hedberg 534398a57e richedit: GTL_PRECISE to GETTEXTLENGTHEX implies GTL_NUMBYTES.
If GTL_PRECISE is passed without specifying either GTL_NUMCHARS or
GTL_NUMBYTES, behave as if GTL_NUMBYTES was passed.
2010-03-01 11:33:01 +01:00
Dylan Smith 9106860c85 richedit: Prevent crash on word selection at end of paragraph. 2010-02-18 12:18:17 +01:00
Dylan Smith 0342ab0df1 richedit: Use ITextHost interface in ME_LinkNotify.
Using the ITextHost interface allows this notification to be received
for windowless richedit controls.  Windowed richedit conrols have an
ITextHost implementation that will fill in hwndFrom and idFrom, but
these should probably be initialized to 0 for windowless richedit
controls.
2009-09-28 12:54:16 +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 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 02228ee176 richedit: Use ME_Cursor instead of offsets for ME_CharFromPos. 2009-08-13 15:35:01 +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 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 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 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 e306b91392 richedit: Avoid comparing padding in cursor structures on memcmp. 2009-08-07 14:57:24 +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
Dylan Smith ecb6c2169c richedit: Store paragraph in cursors.
This prevents some needless searching for the start of the paragraph
from a run stored in a cursor.  Usually a pointer to the paragraph is
already available when the cursor is set anyway.
2009-02-10 12:59:09 +01:00
Dylan Smith c8b4455565 richedit: Removed ME_StrRelPos, ME_StrRelPos2, & ME_PosToVPos functions.
These functions were just being used for addition, so it was simpler to
remove the functions and modify the places it was used.

The ME_StrRelPos2 and ME_PosToVPos were just simple wrappers around
ME_StrRelPos, and ME_PosToVPos wasn't being used.
2009-02-09 13:05:13 +01:00
Dylan Smith 5f15de0690 richedit: Removed ME_StrLen and ME_StrVLen field access functions.
These functions were probably previously needed because of some wierd
special handling of backspace characters, but currently there is no
reason why the nLen field can't be accessed directly.

Having to functions that just access the string length field just causes
slightly more effort for someone to look at the code, because they need
to enter the function to find out what it actually is doing.
2009-02-09 13:05:13 +01:00
Dylan Smith d306b6b5e9 richedit: Removed some conditions that are always taken.
ME_GetCursorCoordinates had two conditions that were always taken.  The
first condition was if(pCursor->pRun->type == diRun) was following an
assertion making the exact same check.  The next one, if(row), should
always be taken, otherwise the richedit controls are in a corrupt state,
therefore an assertion is more appropriate.
2009-02-09 13:05:12 +01:00
Dylan Smith 71d797c55c richedit: Directly get start and end of text on Ctrl-Home or Ctrl-End.
Previously it found the start or end by traversing the linked lists of
run, rows, paragraphs, and cells from the current position of the
cursors.  Clearly it is better to get the start or end directly to make
it a constant time operation.
2009-02-09 13:05:12 +01:00