Ctrl+Backspace removes word at left but why Ctrl+Del doesn't work (should delete word at right)?
Any easy implementation?
Ctrl+Del in RVE
-
- Site Admin
- Posts: 17555
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Site Admin
- Posts: 17555
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Here you go, call the function DeleteToEndOfWord from your rve:
Code: Select all
Function TfmMain.DeleteToEndOfWord:boolean;
var ItemNo, WordEnd, WordStart: Integer;
s,s2: String;
CodePage: TRVCodePage;
rve1: TCustomRichViewEdit;
begin
rve1 := rve.TopLevelEditor;
ItemNo := rve1.CurItemNo;
WordEnd := rve1.OffsetInCurItem;
CodePage := rve1.RVData.GetItemCodePage(ItemNo);
if (rve1.GetItemStyle(ItemNo)<0) then exit;
s := rve1.GetItemTextW(ItemNo);
WordStart := WordEnd;
if WordStart<1 then
exit;
if s='' then exit;
//calc from cursor to end of word
while ((WordEnd<length(s)) and (not rve1.RVData.IsDelimiterA(s[WordEnd+1],codepage))) do
inc(WordEnd);
//add extra 1 to delete trailing space
if WordEnd<length(s) then inc(WordEnd);
s := Copy(s, WordStart, WordEnd-WordStart);
if s<>'' then
begin
Result:=true;
rve1.SetSelectionBounds(ItemNo, WordStart, ItemNo, WordEnd);
rve1.InsertTextW('');
end
else
Result:=false;
end;
procedure TfmMain.rveKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
Begin
if (ssCtrl in Shift) and (key=vk_delete) then
begin
DeleteToEndOfWord;
end;
end;
-
- Site Admin
- Posts: 17555
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Great! While you are at it, a long-time missing feature is double-click -> select word -> hold mouse button and drag -> continue selection!Sergey Tkachenko wrote:We have implemented Ctrl+Delete in TRichView 15.3, available for registered users.
The only other application missing this feature I know of, is the Delphi IDE itself. And this is often requested by end-users.
I hope you'll consider it.