commit e2489c1c310e133e18e6a70e89b6e8545699b308
Author: Jean-Marc Lasgouttes <[email protected]>
Date: Fri Aug 19 14:53:31 2016 +0200
Let M-x give focus to minibuffer when it is already open
(cherry picked from commit 65b0e84b5428897e36ff05fdf701bbba4acee8e8)
---
src/frontends/qt4/GuiToolbar.cpp | 3 +--
src/frontends/qt4/GuiView.cpp | 7 ++++++-
src/frontends/qt4/GuiView.h | 2 ++
src/frontends/qt4/Toolbars.h | 3 ++-
status.22x | 2 ++
5 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/frontends/qt4/GuiToolbar.cpp b/src/frontends/qt4/GuiToolbar.cpp
index 77471c9..2f0b510 100644
--- a/src/frontends/qt4/GuiToolbar.cpp
+++ b/src/frontends/qt4/GuiToolbar.cpp
@@ -324,9 +324,8 @@ void GuiToolbar::add(ToolbarItem const & item)
void GuiToolbar::update(int context)
{
if (visibility_ & Toolbars::AUTO) {
- bool const was_visible = isVisible();
setVisible(visibility_ & context & Toolbars::ALLOWAUTO);
- if (isVisible() && !was_visible && commandBuffer())
+ if (isVisible() && commandBuffer() && (context &
Toolbars::MINIBUFFER_FOCUS))
commandBuffer()->setFocus();
}
diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp
index ba207f2..6511514 100644
--- a/src/frontends/qt4/GuiView.cpp
+++ b/src/frontends/qt4/GuiView.cpp
@@ -513,7 +513,7 @@ QSet<Buffer const *> GuiView::GuiViewPrivate::busyBuffers;
GuiView::GuiView(int id)
: d(*new GuiViewPrivate(this)), id_(id), closing_(false), busy_(0),
- command_execute_(false)
+ command_execute_(false), minibuffer_focus_(false)
{
// GuiToolbars *must* be initialised before the menu bar.
normalSizedIcons(); // at least on Mac the default is 32 otherwise,
which is huge
@@ -1564,6 +1564,10 @@ void GuiView::updateToolbars()
context |= Toolbars::IPA;
if (command_execute_)
context |= Toolbars::MINIBUFFER;
+ if (minibuffer_focus_) {
+ context |= Toolbars::MINIBUFFER_FOCUS;
+ minibuffer_focus_ = false;
+ }
for (ToolbarMap::iterator it = d.toolbars_.begin(); it != end;
++it)
it->second->update(context);
@@ -3655,6 +3659,7 @@ void GuiView::dispatch(FuncRequest const & cmd,
DispatchResult & dr)
case LFUN_COMMAND_EXECUTE: {
command_execute_ = true;
+ minibuffer_focus_ = true;
break;
}
case LFUN_DROP_LAYOUTS_CHOICE:
diff --git a/src/frontends/qt4/GuiView.h b/src/frontends/qt4/GuiView.h
index c3ccdbd..9402c41 100644
--- a/src/frontends/qt4/GuiView.h
+++ b/src/frontends/qt4/GuiView.h
@@ -454,6 +454,8 @@ private:
/// Request to open the command toolbar if it is "auto"
bool command_execute_;
+ /// Request to give focus to minibuffer
+ bool minibuffer_focus_;
};
diff --git a/src/frontends/qt4/Toolbars.h b/src/frontends/qt4/Toolbars.h
index 02d0ebe..dbaf3aa 100644
--- a/src/frontends/qt4/Toolbars.h
+++ b/src/frontends/qt4/Toolbars.h
@@ -108,9 +108,10 @@ public:
TABLE = 256, //< show when in table
REVIEW = 512, //< show when change tracking is enabled
MATHMACROTEMPLATE = 1024, //< show in math macro template
- SAMEROW = 2048, //place to the current row, no new line
+ SAMEROW = 2048, //< place to the current row, no new line
IPA = 4096, //< show when in IPA inset
MINIBUFFER = 8192, //< show when command-execute has been
invoked
+ MINIBUFFER_FOCUS = 16384, //< set focus to minibuffer
ALLOWAUTO = MATH | TABLE | REVIEW | MATHMACROTEMPLATE | IPA |
MINIBUFFER
};
diff --git a/status.22x b/status.22x
index ea8d263..d190f58 100644
--- a/status.22x
+++ b/status.22x
@@ -86,6 +86,8 @@ What's new
- Remove extra whitespace around Preview and IPA insets (bug 10304).
+- Let M-x give focus to minibuffer when it is already open.
+
* INTERNALS