diff --git a/docs/changelog-custom.txt b/docs/changelog-custom.txt index a5a3340a..dd9c9ce0 100644 --- a/docs/changelog-custom.txt +++ b/docs/changelog-custom.txt @@ -1126,6 +1126,7 @@ misc... add RBSP, FBSP support * bobToolz: new Aperture Door builder * .def .ent .fgd can be used simultaneously (removed entityclass="halflife") + * shader editor: save on ctrl + s diff --git a/radiant/gtkdlgs.cpp b/radiant/gtkdlgs.cpp index d743efbc..4f1da956 100644 --- a/radiant/gtkdlgs.cpp +++ b/radiant/gtkdlgs.cpp @@ -605,7 +605,7 @@ retry: ctrl+d duplicate line, selection find and replace f3, shift+f3, ctrl+f -ctrl+s + ctrl+s move selected text block with alt+arrows move line up/dn too ctrl+x to cut whole line @@ -2361,7 +2361,7 @@ class TextEditor : public QObject if( ret == EMessageBoxReturn::eIDYES ){ editor_save(); } - if( ret == EMessageBoxReturn::eIDNO ){ // discard changes + else if( ret == EMessageBoxReturn::eIDNO ){ // discard changes m_textView->clear(); // unset isModified flag this way to avoid messagebox on next opening } else if( ret == EMessageBoxReturn::eIDCANCEL ){ @@ -2411,6 +2411,17 @@ protected: return true; } } + // save + if( event->type() == QEvent::ShortcutOverride ){ + QKeyEvent *keyEvent = static_cast( event ); + if( keyEvent == QKeySequence::StandardKey::Save ){ + if( !keyEvent->isAutoRepeat() && m_textView->document()->isModified() ){ + editor_save(); + } + event->accept(); + return true; + } + } return QObject::eventFilter( obj, event ); // standard event processing } };