uppsrc: Ctrl-Y as Redo support

This commit is contained in:
Mirek Fidler 2025-08-18 14:35:06 +02:00
parent 76d27f1cca
commit 11399b1e23
9 changed files with 42 additions and 10 deletions

View file

@ -1184,6 +1184,7 @@ void TextCtrl::StdBar(Bar& menu) {
.Key(K_CTRL_Z);
menu.Add(redo.GetCount() && IsEditable(), t_("Redo"), CtrlImg::redo(), THISBACK(Redo))
.Key(K_SHIFT|K_ALT_BACKSPACE)
.Key(K_CTRL_Y)
.Key(K_SHIFT_CTRL_Z);
menu.Separator();
}

View file

@ -7,8 +7,11 @@ void DiagramEditor::TheBar(Bar& bar)
bool b = IsCursor();
bar.Add(undoredo.IsUndo(), CtrlImg::undo(), [=] { SetCurrent(undoredo.Undo(GetCurrent())); })
.Key(K_ALT_BACKSPACE)
.Key(K_CTRL_Z);
bar.Add(undoredo.IsRedo(), CtrlImg::redo(), [=] { SetCurrent(undoredo.Redo(GetCurrent())); })
.Key(K_SHIFT|K_ALT_BACKSPACE)
.Key(K_CTRL_Y)
.Key(K_SHIFT|K_CTRL_Z);
bar.Separator();
bar.Add(b, "Cut", CtrlImg::cut(), [=] { Cut(); })

View file

@ -100,9 +100,12 @@ bool RichEdit::Key(dword key, int count)
}
break;
case K_CTRL_Z:
case K_ALT_BACKSPACE:
Undo();
return true;
case K_SHIFT_CTRL_Z:
case K_SHIFT|K_ALT_BACKSPACE:
case K_CTRL_Y:
Redo();
return true;
case K_ENTER: {

View file

@ -1028,6 +1028,16 @@ bool isaid(int c)
bool AssistEditor::Key(dword key, int count)
{
CloseTip();
dword *k = IdeKeys::AK_DELLINE().key;
if(key == k[0] || key == k[1]) {
DeleteLine();
return true;
}
k = IdeKeys::AK_CUTLINE().key;
if(key == k[0] || key == k[1]) {
CutLine();
return true;
}
#ifdef _DEBUG
if(key == K_F12) {
DLOG("==================");

View file

@ -98,10 +98,13 @@ void IconDes::EditBar(Bar& bar)
.Check(paste_mode == PASTE_BACK);
bar.Separator();
bar.Add(c && c->undo.GetCount(), "Undo", CtrlImg::undo(), THISBACK(Undo))
.Key(K_ALT_BACKSPACE)
.Key(K_CTRL_Z)
.Repeat();
bar.Add(c && c->redo.GetCount(), "Redo", CtrlImg::redo(), THISBACK(Redo))
.Key(K_CTRL_Y)
.Key(K_SHIFT_CTRL_Z)
.Key(K_SHIFT|K_ALT_BACKSPACE)
.Repeat();
}

View file

@ -36,6 +36,7 @@ void LayDes::EditBar(Bar& bar)
.Key(K_ALT_BACKSPACE)
.Key(K_CTRL_Z);
bar.Add(islayout && CurrentLayout().IsRedo(), "Redo", CtrlImg::redo(), THISBACK(Redo))
.Key(K_CTRL_Y)
.Key(K_SHIFT|K_ALT_BACKSPACE)
.Key(K_SHIFT_CTRL_Z);
bar.MenuSeparator();

View file

@ -404,16 +404,6 @@ void Ide::Activate()
bool Ide::Key(dword key, int count)
{
dword *k = IdeKeys::AK_DELLINE().key;
if(key == k[0] || key == k[1]) {
editor.DeleteLine();
return true;
}
k = IdeKeys::AK_CUTLINE().key;
if(key == k[0] || key == k[1]) {
editor.CutLine();
return true;
}
switch(key) {
case K_ALT|K_CTRL_UP:
case K_ALT|K_CTRL_DOWN:

View file

@ -0,0 +1,9 @@
uses
CtrlLib;
file
main.cpp;
mainconfig
"" = "GUI";

12
upptst/LineEdit/main.cpp Normal file
View file

@ -0,0 +1,12 @@
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
GUI_APP_MAIN
{
TopWindow win;
LineEdit edit;
edit.NoCutLine();
win.Add(edit.SizePos());
win.Run();
}