Yes of course.
User writes these items:
"User selects
one or some words.
Drags them so
another place in the same edit. At source position the second space (behind the word(s)) should disappear and at target position."
Then he selects a part of it to move it somwhere else (red=selected words) ...
"User selects
one or some words.
Drags them so
another place
in the same edit. At source position the second space (behind the word(s)) should disappear and at target position."
... and moves it with the mouse to another place:
"User selects
one or some words.
Drags them so
another place . At source position the second space
in the same edit (behind the word(s)) should disappear and at target position."
Now there is one space before the conclusing point of the first sentence and no space between 'space' and 'in'.
In the moment I solved it in a bit complicated way:
1. At OnSelect I copy the selected words to a variable 'FInternalMoveText'
2. At OnItemAction this code:
Code: Select all
if (FScreenplayConv and FHasScreenplay) or FClosing then
Exit; // <<<<<<<<<<<<<<<<<<<<<< EXIT
if not FStyleChanging and (ItemAction = rviaInserting) and (Text <> '') and not FTextLoading and
not FSelectingChars and (Text = FInternalMoveText) and (Length(Text) > 1) then
begin
Text := Format(' %s ', [Text]); // <-------------------------------------------
tiCleanUp.Enabled := True; // <-------------------------------------------
end;
3. At OnTimer I call a method to correct the missing or double spaces (and more) at the source item and the target item: delete double spaces, paying attention to start/end of item, delimiters a.s.o.
a) I don't like timers because they can cause unexpected side effects
b) This method works but it feels not stable nevertheless.
I tried out another way: delete or insert spaces at the source- and target positions and it worked. But only for simple moving from words between words. And that was complicated yet. And I didn't consider all the special options like 'only one word in Item', target/source is last/first in item and a lot more. So I went back to the way described above. But I am not lucky with it. So I thought perhaps you have a more professional solution, because I think it is the problem of more or less everybode who uses TRichViewEdit.