changeset 31808:90621682cc03

maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/ * BaseControl.cc, BaseControl.h, ButtonControl.cc, ButtonControl.h, ButtonGroup.cc, ButtonGroup.h, Canvas.cc, Canvas.h, CheckBoxControl.cc, CheckBoxControl.h, Container.cc, Container.h, ContextMenu.cc, ContextMenu.h, EditControl.cc, EditControl.h, Figure.cc, Figure.h, GLCanvas.cc, GLCanvas.h, ListBoxControl.cc, ListBoxControl.h, Menu.cc, Menu.h, Object.cc, Object.h, Panel.cc, Panel.h, PopupMenuControl.cc, PopupMenuControl.h, PushButtonControl.cc, PushButtonControl.h, PushTool.cc, PushTool.h, RadioButtonControl.cc, RadioButtonControl.h, SliderControl.cc, SliderControl.h, Table.cc, Table.h, TextControl.cc, TextControl.h, ToggleButtonControl.cc, ToggleButtonControl.h, ToggleTool.cc, ToggleTool.h, ToolBar.cc, ToolBar.h, ToolBarButton.cc, ToolBarButton.h, qt-graphics-toolkit.cc, qt-graphics-toolkit.h, command-widget.cc, command-widget.h, community-news.cc, community-news.h, dialog.cc, dialog.h, documentation-bookmarks.cc, documentation-bookmarks.h, documentation-dock-widget.cc, documentation-dock-widget.h, documentation.cc, documentation.h, dw-main-window.cc, dw-main-window.h, external-editor-interface.cc, external-editor-interface.h, files-dock-widget.cc, files-dock-widget.h, find-files-dialog.cc, find-files-dialog.h, graphics-init.cc, graphics-init.h, gui-settings.cc, gui-settings.h, history-dock-widget.cc, history-dock-widget.h, interpreter-qobject.cc, file-editor-interface.h, file-editor-tab.cc, file-editor-tab.h, file-editor.cc, file-editor.h, find-dialog.cc, find-dialog.h, octave-qscintilla.cc, main-window.cc, main-window.h, news-reader.cc, news-reader.h, octave-dock-widget.cc, octave-dock-widget.h, octave-qobject.cc, qt-application.cc, qt-application.h, qt-interpreter-events.cc, qt-interpreter-events.h, release-notes.cc, release-notes.h, set-path-dialog.cc, set-path-dialog.h, settings-dialog.cc, settings-dialog.h, terminal-dock-widget.cc, terminal-dock-widget.h, variable-editor.cc, variable-editor.h, welcome-wizard.cc, welcome-wizard.h, workspace-model.cc, workspace-model.h, workspace-view.cc, workspace-view.h: maint: Remove unnecessary indent after OCTAVE_BEGIN_NAMESPACE in libgui/
author Rik <rik@octave.org>
date Thu, 02 Feb 2023 12:25:51 -0800
parents d758cd0288da
children 32acdc376a36
files libgui/graphics/BaseControl.cc libgui/graphics/BaseControl.h libgui/graphics/ButtonControl.cc libgui/graphics/ButtonControl.h libgui/graphics/ButtonGroup.cc libgui/graphics/ButtonGroup.h libgui/graphics/Canvas.cc libgui/graphics/Canvas.h libgui/graphics/CheckBoxControl.cc libgui/graphics/CheckBoxControl.h libgui/graphics/Container.cc libgui/graphics/Container.h libgui/graphics/ContextMenu.cc libgui/graphics/ContextMenu.h libgui/graphics/EditControl.cc libgui/graphics/EditControl.h libgui/graphics/Figure.cc libgui/graphics/Figure.h libgui/graphics/GLCanvas.cc libgui/graphics/GLCanvas.h libgui/graphics/ListBoxControl.cc libgui/graphics/ListBoxControl.h libgui/graphics/Menu.cc libgui/graphics/Menu.h libgui/graphics/Object.cc libgui/graphics/Object.h libgui/graphics/Panel.cc libgui/graphics/Panel.h libgui/graphics/PopupMenuControl.cc libgui/graphics/PopupMenuControl.h libgui/graphics/PushButtonControl.cc libgui/graphics/PushButtonControl.h libgui/graphics/PushTool.cc libgui/graphics/PushTool.h libgui/graphics/RadioButtonControl.cc libgui/graphics/RadioButtonControl.h libgui/graphics/SliderControl.cc libgui/graphics/SliderControl.h libgui/graphics/Table.cc libgui/graphics/Table.h libgui/graphics/TextControl.cc libgui/graphics/TextControl.h libgui/graphics/ToggleButtonControl.cc libgui/graphics/ToggleButtonControl.h libgui/graphics/ToggleTool.cc libgui/graphics/ToggleTool.h libgui/graphics/ToolBar.cc libgui/graphics/ToolBar.h libgui/graphics/ToolBarButton.cc libgui/graphics/ToolBarButton.h libgui/graphics/qt-graphics-toolkit.cc libgui/graphics/qt-graphics-toolkit.h libgui/src/command-widget.cc libgui/src/command-widget.h libgui/src/community-news.cc libgui/src/community-news.h libgui/src/dialog.cc libgui/src/dialog.h libgui/src/documentation-bookmarks.cc libgui/src/documentation-bookmarks.h libgui/src/documentation-dock-widget.cc libgui/src/documentation-dock-widget.h libgui/src/documentation.cc libgui/src/documentation.h libgui/src/dw-main-window.cc libgui/src/dw-main-window.h libgui/src/external-editor-interface.cc libgui/src/external-editor-interface.h libgui/src/files-dock-widget.cc libgui/src/files-dock-widget.h libgui/src/find-files-dialog.cc libgui/src/find-files-dialog.h libgui/src/graphics-init.cc libgui/src/graphics-init.h libgui/src/gui-settings.cc libgui/src/gui-settings.h libgui/src/history-dock-widget.cc libgui/src/history-dock-widget.h libgui/src/interpreter-qobject.cc libgui/src/m-editor/file-editor-interface.h libgui/src/m-editor/file-editor-tab.cc libgui/src/m-editor/file-editor-tab.h libgui/src/m-editor/file-editor.cc libgui/src/m-editor/file-editor.h libgui/src/m-editor/find-dialog.cc libgui/src/m-editor/find-dialog.h libgui/src/m-editor/octave-qscintilla.cc libgui/src/main-window.cc libgui/src/main-window.h libgui/src/news-reader.cc libgui/src/news-reader.h libgui/src/octave-dock-widget.cc libgui/src/octave-dock-widget.h libgui/src/octave-qobject.cc libgui/src/qt-application.cc libgui/src/qt-application.h libgui/src/qt-interpreter-events.cc libgui/src/qt-interpreter-events.h libgui/src/release-notes.cc libgui/src/release-notes.h libgui/src/set-path-dialog.cc libgui/src/set-path-dialog.h libgui/src/settings-dialog.cc libgui/src/settings-dialog.h libgui/src/terminal-dock-widget.cc libgui/src/terminal-dock-widget.h libgui/src/variable-editor.cc libgui/src/variable-editor.h libgui/src/welcome-wizard.cc libgui/src/welcome-wizard.h libgui/src/workspace-model.cc libgui/src/workspace-model.h libgui/src/workspace-view.cc libgui/src/workspace-view.h
diffstat 114 files changed, 31130 insertions(+), 31130 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/graphics/BaseControl.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/BaseControl.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -41,301 +41,301 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  static void
-  updatePalette (const uicontrol::properties& props, QWidget *w)
-  {
-    QPalette p = w->palette ();
+static void
+updatePalette (const uicontrol::properties& props, QWidget *w)
+{
+  QPalette p = w->palette ();
 
-    if (props.style_is ("edit")
-        || props.style_is ("listbox"))
-      {
-        Matrix bg_color = props.get_backgroundcolor_rgb ();
-        // Matlab compatibility: Default color is ignored, and rendered as
-        // white ([1.0, 1.0, 1.0]).  See bug #58261.
-        if (bg_color(0) == bg_color(1) && bg_color(0) == bg_color(2)
-            && (std::abs (bg_color(1) - 0.94) < .005))
-          bg_color.fill (1.0);
+  if (props.style_is ("edit")
+      || props.style_is ("listbox"))
+    {
+      Matrix bg_color = props.get_backgroundcolor_rgb ();
+      // Matlab compatibility: Default color is ignored, and rendered as
+      // white ([1.0, 1.0, 1.0]).  See bug #58261.
+      if (bg_color(0) == bg_color(1) && bg_color(0) == bg_color(2)
+          && (std::abs (bg_color(1) - 0.94) < .005))
+        bg_color.fill (1.0);
 
-        p.setColor (QPalette::Active, QPalette::Base,
-                    Utils::fromRgb (bg_color));
-        p.setColor (QPalette::Inactive, QPalette::Base,
-                    Utils::fromRgb (bg_color));
-        p.setColor (QPalette::Active, QPalette::Text,
-                    Utils::fromRgb (props.get_foregroundcolor_rgb ()));
-        p.setColor (QPalette::Inactive, QPalette::Text,
-                    Utils::fromRgb (props.get_foregroundcolor_rgb ()));
-      }
-    else if (props.style_is ("popupmenu"))
-      {
-        // popupmenu (QComboBox) is a listbox with a button.
-        // This requires setting colors for both.
-        QColor bcol = Utils::fromRgb (props.get_backgroundcolor_rgb ());
-        QColor fcol = Utils::fromRgb (props.get_foregroundcolor_rgb ());
-        QString qss = QString (":enabled { background: %1 none;\n"
-                                          "color: %2; }")
-                      .arg(bcol.name ()).arg (fcol.name ());
-        w->setStyleSheet(qss);
-        return;
-      }
-    else if (props.style_is ("radiobutton")
-             || props.style_is ("checkbox"))
-      {
-        p.setColor (QPalette::Active, QPalette::Button,
-                    Utils::fromRgb (props.get_backgroundcolor_rgb ()));
-        p.setColor (QPalette::Inactive, QPalette::Button,
-                    Utils::fromRgb (props.get_backgroundcolor_rgb ()));
-        p.setColor (QPalette::Active, QPalette::WindowText,
-                    Utils::fromRgb (props.get_foregroundcolor_rgb ()));
-        p.setColor (QPalette::Inactive, QPalette::WindowText,
-                    Utils::fromRgb (props.get_foregroundcolor_rgb ()));
-      }
-    else if (props.style_is ("pushbutton")
-             || props.style_is ("togglebutton"))
-      {
-        QColor bcol = Utils::fromRgb (props.get_backgroundcolor_rgb ());
-        QColor fcol = Utils::fromRgb (props.get_foregroundcolor_rgb ());
-        QString qss = QString (":enabled { background: %1 none;\n"
-                                          "color: %2; }")
-                      .arg(bcol.name ()).arg (fcol.name ());
-        w->setStyleSheet(qss);
-        return;
-      }
-    else
-      {
-        p.setColor (QPalette::Active, QPalette::Window,
-                    Utils::fromRgb (props.get_backgroundcolor_rgb ()));
-        p.setColor (QPalette::Inactive, QPalette::Window,
-                    Utils::fromRgb (props.get_backgroundcolor_rgb ()));
-        p.setColor (QPalette::Active, QPalette::WindowText,
-                    Utils::fromRgb (props.get_foregroundcolor_rgb ()));
-        p.setColor (QPalette::Inactive, QPalette::WindowText,
-                    Utils::fromRgb (props.get_foregroundcolor_rgb ()));
-      }
+      p.setColor (QPalette::Active, QPalette::Base,
+                  Utils::fromRgb (bg_color));
+      p.setColor (QPalette::Inactive, QPalette::Base,
+                  Utils::fromRgb (bg_color));
+      p.setColor (QPalette::Active, QPalette::Text,
+                  Utils::fromRgb (props.get_foregroundcolor_rgb ()));
+      p.setColor (QPalette::Inactive, QPalette::Text,
+                  Utils::fromRgb (props.get_foregroundcolor_rgb ()));
+    }
+  else if (props.style_is ("popupmenu"))
+    {
+      // popupmenu (QComboBox) is a listbox with a button.
+      // This requires setting colors for both.
+      QColor bcol = Utils::fromRgb (props.get_backgroundcolor_rgb ());
+      QColor fcol = Utils::fromRgb (props.get_foregroundcolor_rgb ());
+      QString qss = QString (":enabled { background: %1 none;\n"
+                                        "color: %2; }")
+                    .arg(bcol.name ()).arg (fcol.name ());
+      w->setStyleSheet(qss);
+      return;
+    }
+  else if (props.style_is ("radiobutton")
+           || props.style_is ("checkbox"))
+    {
+      p.setColor (QPalette::Active, QPalette::Button,
+                  Utils::fromRgb (props.get_backgroundcolor_rgb ()));
+      p.setColor (QPalette::Inactive, QPalette::Button,
+                  Utils::fromRgb (props.get_backgroundcolor_rgb ()));
+      p.setColor (QPalette::Active, QPalette::WindowText,
+                  Utils::fromRgb (props.get_foregroundcolor_rgb ()));
+      p.setColor (QPalette::Inactive, QPalette::WindowText,
+                  Utils::fromRgb (props.get_foregroundcolor_rgb ()));
+    }
+  else if (props.style_is ("pushbutton")
+           || props.style_is ("togglebutton"))
+    {
+      QColor bcol = Utils::fromRgb (props.get_backgroundcolor_rgb ());
+      QColor fcol = Utils::fromRgb (props.get_foregroundcolor_rgb ());
+      QString qss = QString (":enabled { background: %1 none;\n"
+                                        "color: %2; }")
+                    .arg(bcol.name ()).arg (fcol.name ());
+      w->setStyleSheet(qss);
+      return;
+    }
+  else
+    {
+      p.setColor (QPalette::Active, QPalette::Window,
+                  Utils::fromRgb (props.get_backgroundcolor_rgb ()));
+      p.setColor (QPalette::Inactive, QPalette::Window,
+                  Utils::fromRgb (props.get_backgroundcolor_rgb ()));
+      p.setColor (QPalette::Active, QPalette::WindowText,
+                  Utils::fromRgb (props.get_foregroundcolor_rgb ()));
+      p.setColor (QPalette::Inactive, QPalette::WindowText,
+                  Utils::fromRgb (props.get_foregroundcolor_rgb ()));
+    }
 
-    w->setPalette (p);
-  }
+  w->setPalette (p);
+}
 
-  BaseControl::BaseControl (octave::interpreter& interp,
-                            const graphics_object& go, QWidget *w)
-    : Object (interp, go, w), m_normalizedFont (false),
-      m_keyPressHandlerDefined (false)
-  {
-    qObject ()->setObjectName ("UIControl");
-    init (w);
-  }
+BaseControl::BaseControl (octave::interpreter& interp,
+                          const graphics_object& go, QWidget *w)
+  : Object (interp, go, w), m_normalizedFont (false),
+    m_keyPressHandlerDefined (false)
+{
+  qObject ()->setObjectName ("UIControl");
+  init (w);
+}
+
+void
+BaseControl::init (QWidget *w, bool callBase)
+{
+  if (callBase)
+    Object::init (w, callBase);
+
+  uicontrol::properties& up = properties<uicontrol> ();
 
-  void
-  BaseControl::init (QWidget *w, bool callBase)
-  {
-    if (callBase)
-      Object::init (w, callBase);
+  Matrix bb = up.get_boundingbox (false);
+  w->setGeometry (octave::math::round (bb(0)), octave::math::round (bb(1)),
+                  octave::math::round (bb(2)), octave::math::round (bb(3)));
+  w->setFont (Utils::computeFont<uicontrol> (up, bb(3)));
+  updatePalette (up, w);
+  if (up.enable_is ("inactive"))
+    w->blockSignals (true);
+  else
+    w->setEnabled (up.enable_is ("on"));
+  w->setToolTip (Utils::fromStdString (up.get_tooltipstring ()));
+  w->setVisible (up.is_visible ());
+  m_keyPressHandlerDefined = ! up.get_keypressfcn ().isempty ();
 
-    uicontrol::properties& up = properties<uicontrol> ();
+  w->installEventFilter (this);
 
-    Matrix bb = up.get_boundingbox (false);
-    w->setGeometry (octave::math::round (bb(0)), octave::math::round (bb(1)),
-                    octave::math::round (bb(2)), octave::math::round (bb(3)));
-    w->setFont (Utils::computeFont<uicontrol> (up, bb(3)));
-    updatePalette (up, w);
-    if (up.enable_is ("inactive"))
-      w->blockSignals (true);
-    else
-      w->setEnabled (up.enable_is ("on"));
-    w->setToolTip (Utils::fromStdString (up.get_tooltipstring ()));
-    w->setVisible (up.is_visible ());
-    m_keyPressHandlerDefined = ! up.get_keypressfcn ().isempty ();
+  m_normalizedFont = up.fontunits_is ("normalized");
+}
+
+BaseControl::~BaseControl ()
+{ }
+
+void
+BaseControl::redraw ()
+{
+  update (uicontrol::properties::ID_POSITION);
+}
+
+void
+BaseControl::update (int pId)
+{
+  uicontrol::properties& up = properties<uicontrol> ();
+  QWidget *w = qWidget<QWidget> ();
 
-    w->installEventFilter (this);
+  switch (pId)
+    {
+    case uicontrol::properties::ID_POSITION:
+      {
+        Matrix bb = up.get_boundingbox (false);
+        w->setGeometry (octave::math::round (bb(0)), octave::math::round (bb(1)),
+                        octave::math::round (bb(2)), octave::math::round (bb(3)));
+      }
+      break;
 
-    m_normalizedFont = up.fontunits_is ("normalized");
-  }
-
-  BaseControl::~BaseControl ()
-  { }
+    case uicontrol::properties::ID_FONTNAME:
+    case uicontrol::properties::ID_FONTSIZE:
+    case uicontrol::properties::ID_FONTWEIGHT:
+    case uicontrol::properties::ID_FONTANGLE:
+      w->setFont (Utils::computeFont<uicontrol> (up));
+      break;
 
-  void
-  BaseControl::redraw ()
-  {
-    update (uicontrol::properties::ID_POSITION);
-  }
+    case uicontrol::properties::ID_FONTUNITS:
+      // FIXME: We shouldn't have to do anything, octave should update
+      //        the "fontsize" property automatically to the new units.
+      //        Hence the actual font used shouldn't change.
+      m_normalizedFont = up.fontunits_is ("normalized");
+      break;
 
-  void
-  BaseControl::update (int pId)
-  {
-    uicontrol::properties& up = properties<uicontrol> ();
-    QWidget *w = qWidget<QWidget> ();
+    case uicontrol::properties::ID_BACKGROUNDCOLOR:
+    case uicontrol::properties::ID_FOREGROUNDCOLOR:
+      updatePalette (up, w);
+      break;
 
-    switch (pId)
-      {
-      case uicontrol::properties::ID_POSITION:
+    case uicontrol::properties::ID_ENABLE:
+      if (up.enable_is ("inactive"))
+        {
+          w->blockSignals (true);
+          w->setEnabled (true);
+        }
+      else
         {
-          Matrix bb = up.get_boundingbox (false);
-          w->setGeometry (octave::math::round (bb(0)), octave::math::round (bb(1)),
-                          octave::math::round (bb(2)), octave::math::round (bb(3)));
+          w->blockSignals (false);
+          w->setEnabled (up.enable_is ("on"));
         }
-        break;
+      break;
+
+    case uicontrol::properties::ID_TOOLTIPSTRING:
+      w->setToolTip (Utils::fromStdString (up.get_tooltipstring ()));
+      break;
 
-      case uicontrol::properties::ID_FONTNAME:
-      case uicontrol::properties::ID_FONTSIZE:
-      case uicontrol::properties::ID_FONTWEIGHT:
-      case uicontrol::properties::ID_FONTANGLE:
-        w->setFont (Utils::computeFont<uicontrol> (up));
-        break;
+    case base_properties::ID_VISIBLE:
+      w->setVisible (up.is_visible ());
+      break;
+
+    case uicontrol::properties::ID_KEYPRESSFCN:
+      m_keyPressHandlerDefined = ! up.get_keypressfcn ().isempty ();
+      break;
+
+    case uicontrol::properties::ID___FOCUS__:
+      if (up.is___focus__ ())
+        w->setFocus ();
+      else
+        w->clearFocus ();
+      break;
 
-      case uicontrol::properties::ID_FONTUNITS:
-        // FIXME: We shouldn't have to do anything, octave should update
-        //        the "fontsize" property automatically to the new units.
-        //        Hence the actual font used shouldn't change.
-        m_normalizedFont = up.fontunits_is ("normalized");
-        break;
+    default:
+      break;
+    }
+}
+
+bool
+BaseControl::eventFilter (QObject *watched, QEvent *xevent)
+{
+  gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
 
-      case uicontrol::properties::ID_BACKGROUNDCOLOR:
-      case uicontrol::properties::ID_FOREGROUNDCOLOR:
-        updatePalette (up, w);
-        break;
+  switch (xevent->type ())
+    {
+    case QEvent::Resize:
+      if (m_normalizedFont)
+        {
+          octave::autolock guard (gh_mgr.graphics_lock ());
 
-      case uicontrol::properties::ID_ENABLE:
-        if (up.enable_is ("inactive"))
+          qWidget<QWidget> ()->setFont (Utils::computeFont<uicontrol>
+                                        (properties<uicontrol> ()));
+        }
+      break;
+
+    case QEvent::MouseButtonPress:
+      {
+        octave::autolock guard (gh_mgr.graphics_lock ());
+
+        QMouseEvent *m = dynamic_cast<QMouseEvent *> (xevent);
+        graphics_object go = object ();
+        uicontrol::properties& up = Utils::properties<uicontrol> (go);
+        graphics_object fig = go.get_ancestor ("figure");
+        if (fig)
           {
-            w->blockSignals (true);
-            w->setEnabled (true);
-          }
-        else
-          {
-            w->blockSignals (false);
-            w->setEnabled (up.enable_is ("on"));
-          }
-        break;
+            emit gh_set_event (fig.get_handle (), "currentobject",
+                               m_handle.value (), false);
 
-      case uicontrol::properties::ID_TOOLTIPSTRING:
-        w->setToolTip (Utils::fromStdString (up.get_tooltipstring ()));
-        break;
-
-      case base_properties::ID_VISIBLE:
-        w->setVisible (up.is_visible ());
-        break;
-
-      case uicontrol::properties::ID_KEYPRESSFCN:
-        m_keyPressHandlerDefined = ! up.get_keypressfcn ().isempty ();
-        break;
+            if (m->button () != Qt::LeftButton || ! up.enable_is ("on"))
+              {
+                emit gh_set_event (fig.get_handle (), "selectiontype",
+                                   Utils::figureSelectionType (m), false);
+                emit gh_set_event (fig.get_handle (), "currentpoint",
+                                   Utils::figureCurrentPoint (fig, m),
+                                   false);
+                emit gh_callback_event (fig.get_handle (),
+                                        "windowbuttondownfcn");
+                emit gh_callback_event (m_handle, "buttondownfcn");
 
-      case uicontrol::properties::ID___FOCUS__:
-        if (up.is___focus__ ())
-          w->setFocus ();
-        else
-          w->clearFocus ();
-        break;
-
-      default:
-        break;
+                if (m->button () == Qt::RightButton)
+                  ContextMenu::executeAt (m_interpreter, up, m->globalPos ());
+              }
+            else
+              {
+                if (up.style_is ("listbox"))
+                  emit gh_set_event (fig.get_handle (), "selectiontype",
+                                     Utils::figureSelectionType (m),
+                                     false);
+                else
+                  emit gh_set_event (fig.get_handle (), "selectiontype",
+                                     octave_value ("normal"), false);
+              }
+          }
       }
-  }
+      break;
 
-  bool
-  BaseControl::eventFilter (QObject *watched, QEvent *xevent)
-  {
-    gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
-
-    switch (xevent->type ())
-      {
-      case QEvent::Resize:
-        if (m_normalizedFont)
-          {
-            octave::autolock guard (gh_mgr.graphics_lock ());
-
-            qWidget<QWidget> ()->setFont (Utils::computeFont<uicontrol>
-                                          (properties<uicontrol> ()));
-          }
-        break;
-
-      case QEvent::MouseButtonPress:
+    case QEvent::MouseMove:
+      if (qWidget<QWidget> ()->hasMouseTracking ())
         {
           octave::autolock guard (gh_mgr.graphics_lock ());
 
           QMouseEvent *m = dynamic_cast<QMouseEvent *> (xevent);
           graphics_object go = object ();
-          uicontrol::properties& up = Utils::properties<uicontrol> (go);
           graphics_object fig = go.get_ancestor ("figure");
+
           if (fig)
             {
-              emit gh_set_event (fig.get_handle (), "currentobject",
-                                 m_handle.value (), false);
-
-              if (m->button () != Qt::LeftButton || ! up.enable_is ("on"))
-                {
-                  emit gh_set_event (fig.get_handle (), "selectiontype",
-                                     Utils::figureSelectionType (m), false);
-                  emit gh_set_event (fig.get_handle (), "currentpoint",
-                                     Utils::figureCurrentPoint (fig, m),
-                                     false);
-                  emit gh_callback_event (fig.get_handle (),
-                                          "windowbuttondownfcn");
-                  emit gh_callback_event (m_handle, "buttondownfcn");
-
-                  if (m->button () == Qt::RightButton)
-                    ContextMenu::executeAt (m_interpreter, up, m->globalPos ());
-                }
-              else
-                {
-                  if (up.style_is ("listbox"))
-                    emit gh_set_event (fig.get_handle (), "selectiontype",
-                                       Utils::figureSelectionType (m),
-                                       false);
-                  else
-                    emit gh_set_event (fig.get_handle (), "selectiontype",
-                                       octave_value ("normal"), false);
-                }
+              emit gh_set_event (fig.get_handle (), "currentpoint",
+                                 Utils::figureCurrentPoint (fig, m), false);
+              emit gh_callback_event (fig.get_handle (),
+                                      "windowbuttonmotionfcn");
             }
         }
-        break;
-
-      case QEvent::MouseMove:
-        if (qWidget<QWidget> ()->hasMouseTracking ())
-          {
-            octave::autolock guard (gh_mgr.graphics_lock ());
+      break;
 
-            QMouseEvent *m = dynamic_cast<QMouseEvent *> (xevent);
-            graphics_object go = object ();
-            graphics_object fig = go.get_ancestor ("figure");
+    case QEvent::KeyPress:
+      if (m_keyPressHandlerDefined)
+        {
+          octave::autolock guard (gh_mgr.graphics_lock ());
 
-            if (fig)
-              {
-                emit gh_set_event (fig.get_handle (), "currentpoint",
-                                   Utils::figureCurrentPoint (fig, m), false);
-                emit gh_callback_event (fig.get_handle (),
-                                        "windowbuttonmotionfcn");
-              }
-          }
-        break;
+          octave_scalar_map keyData =
+            Utils::makeKeyEventStruct (dynamic_cast<QKeyEvent *> (xevent));
+          graphics_object fig = object ().get_ancestor ("figure");
 
-      case QEvent::KeyPress:
-        if (m_keyPressHandlerDefined)
-          {
-            octave::autolock guard (gh_mgr.graphics_lock ());
+          emit gh_set_event (fig.get_handle (), "currentcharacter",
+                             keyData.getfield ("Character"), false);
+          emit gh_callback_event (m_handle, "keypressfcn", keyData);
+        }
+      break;
 
-            octave_scalar_map keyData =
-              Utils::makeKeyEventStruct (dynamic_cast<QKeyEvent *> (xevent));
-            graphics_object fig = object ().get_ancestor ("figure");
-
-            emit gh_set_event (fig.get_handle (), "currentcharacter",
-                               keyData.getfield ("Character"), false);
-            emit gh_callback_event (m_handle, "keypressfcn", keyData);
-          }
-        break;
+    case QEvent::FocusIn:
+      emit gh_set_event (m_handle, "__focus__", "on", false);
+      break;
 
-      case QEvent::FocusIn:
-        emit gh_set_event (m_handle, "__focus__", "on", false);
-        break;
+    case QEvent::FocusOut:
+      emit gh_set_event (m_handle, "__focus__", "off", false);
+      break;
 
-      case QEvent::FocusOut:
-        emit gh_set_event (m_handle, "__focus__", "off", false);
-        break;
+    default:
+      break;
+    }
 
-      default:
-        break;
-      }
-
-    return Object::eventFilter (watched, xevent);
-  }
+  return Object::eventFilter (watched, xevent);
+}
 
 OCTAVE_END_NAMESPACE(octave)
--- a/libgui/graphics/BaseControl.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/BaseControl.h	Thu Feb 02 12:25:51 2023 -0800
@@ -33,28 +33,28 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class interpreter;
+class interpreter;
 
-  class BaseControl : public Object
-  {
-  public:
-    BaseControl (octave::interpreter& interp,
-                 const graphics_object& go, QWidget *w);
-    ~BaseControl ();
+class BaseControl : public Object
+{
+public:
+  BaseControl (octave::interpreter& interp,
+               const graphics_object& go, QWidget *w);
+  ~BaseControl ();
 
-    Container * innerContainer () { return nullptr; }
+  Container * innerContainer () { return nullptr; }
 
-    bool eventFilter (QObject *watched, QEvent *e);
+  bool eventFilter (QObject *watched, QEvent *e);
 
-  protected:
-    void init (QWidget *w, bool callBase = false);
-    void redraw ();
-    void update (int pId);
+protected:
+  void init (QWidget *w, bool callBase = false);
+  void redraw ();
+  void update (int pId);
 
-  private:
-    bool m_normalizedFont;
-    bool m_keyPressHandlerDefined;
-  };
+private:
+  bool m_normalizedFont;
+  bool m_keyPressHandlerDefined;
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/graphics/ButtonControl.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/ButtonControl.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -39,116 +39,116 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  ButtonControl::ButtonControl (octave::interpreter& interp,
-                                const graphics_object& go,
-                                QAbstractButton *btn)
-    : BaseControl (interp, go, btn), m_blockCallback (false)
-  {
-    uicontrol::properties& up = properties<uicontrol> ();
+ButtonControl::ButtonControl (octave::interpreter& interp,
+                              const graphics_object& go,
+                              QAbstractButton *btn)
+  : BaseControl (interp, go, btn), m_blockCallback (false)
+{
+  uicontrol::properties& up = properties<uicontrol> ();
+
+  QString str = Utils::fromStdString (up.get_string_string ());
+  str.replace ("&", "&&");
+  btn->setText (str);
+  if (btn->isCheckable () || up.style_is ("togglebutton"))
+    {
+      btn->setCheckable (true);
+
+      Matrix value = up.get_value ().matrix_value ();
+
+      if (value.numel () > 0 && value(0) == up.get_max ())
+        btn->setChecked (true);
+    }
 
-    QString str = Utils::fromStdString (up.get_string_string ());
-    str.replace ("&", "&&");
-    btn->setText (str);
-    if (btn->isCheckable () || up.style_is ("togglebutton"))
+  connect (btn, &QAbstractButton::clicked, this, &ButtonControl::clicked);
+  connect (btn, &QAbstractButton::toggled, this, &ButtonControl::toggled);
+}
+
+ButtonControl::~ButtonControl ()
+{ }
+
+void
+ButtonControl::update (int pId)
+{
+  uicontrol::properties& up = properties<uicontrol> ();
+  QAbstractButton *btn = qWidget<QAbstractButton> ();
+
+  switch (pId)
+    {
+    case uicontrol::properties::ID_STRING:
       {
-        btn->setCheckable (true);
-
-        Matrix value = up.get_value ().matrix_value ();
-
-        if (value.numel () > 0 && value(0) == up.get_max ())
-          btn->setChecked (true);
+        QString str = Utils::fromStdString (up.get_string_string ());
+        str.replace ("&", "&&");
+        btn->setText (str);
+        break;
       }
 
-    connect (btn, &QAbstractButton::clicked, this, &ButtonControl::clicked);
-    connect (btn, &QAbstractButton::toggled, this, &ButtonControl::toggled);
-  }
-
-  ButtonControl::~ButtonControl ()
-  { }
-
-  void
-  ButtonControl::update (int pId)
-  {
-    uicontrol::properties& up = properties<uicontrol> ();
-    QAbstractButton *btn = qWidget<QAbstractButton> ();
-
-    switch (pId)
-      {
-      case uicontrol::properties::ID_STRING:
+    case uicontrol::properties::ID_VALUE:
+      m_blockCallback = true;
+      if (btn->isCheckable ())
         {
-          QString str = Utils::fromStdString (up.get_string_string ());
-          str.replace ("&", "&&");
-          btn->setText (str);
-          break;
-        }
+          Matrix value = up.get_value ().matrix_value ();
 
-      case uicontrol::properties::ID_VALUE:
-        m_blockCallback = true;
-        if (btn->isCheckable ())
-          {
-            Matrix value = up.get_value ().matrix_value ();
+          if (value.numel () > 0)
+            {
+              double dValue = value(0);
 
-            if (value.numel () > 0)
-              {
-                double dValue = value(0);
+              if (dValue != 0.0 && dValue != 1.0)
+                warning ("button value not within valid display range");
+              else if (dValue == up.get_min () && btn->isChecked ())
+                {
+                  btn->setChecked (false);
+                  if (up.style_is ("radiobutton") || up.style_is ("togglebutton"))
+                    {
+                      gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
 
-                if (dValue != 0.0 && dValue != 1.0)
-                  warning ("button value not within valid display range");
-                else if (dValue == up.get_min () && btn->isChecked ())
-                  {
-                    btn->setChecked (false);
-                    if (up.style_is ("radiobutton") || up.style_is ("togglebutton"))
-                      {
-                        gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+                      Object *parent = Object::parentObject (m_interpreter, gh_mgr.get_object (up.get___myhandle__ ()));
+                      ButtonGroup *btnGroup = dynamic_cast<ButtonGroup *>(parent);
+                      if (btnGroup)
+                        btnGroup->selectNothing ();
+                    }
+                }
+              else if (dValue == up.get_max () && ! btn->isChecked ())
+                btn->setChecked (true);
+            }
+        }
+      m_blockCallback = false;
+      break;
 
-                        Object *parent = Object::parentObject (m_interpreter, gh_mgr.get_object (up.get___myhandle__ ()));
-                        ButtonGroup *btnGroup = dynamic_cast<ButtonGroup *>(parent);
-                        if (btnGroup)
-                          btnGroup->selectNothing ();
-                      }
-                  }
-                else if (dValue == up.get_max () && ! btn->isChecked ())
-                  btn->setChecked (true);
-              }
-          }
-        m_blockCallback = false;
-        break;
+    default:
+      BaseControl::update (pId);
+      break;
+    }
+}
 
-      default:
-        BaseControl::update (pId);
-        break;
-      }
-  }
+void
+ButtonControl::toggled (bool checked)
+{
+  QAbstractButton *btn = qWidget<QAbstractButton> ();
 
-  void
-  ButtonControl::toggled (bool checked)
-  {
-    QAbstractButton *btn = qWidget<QAbstractButton> ();
+  if (! m_blockCallback && btn->isCheckable ())
+    {
+      gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+
+      octave::autolock guard (gh_mgr.graphics_lock ());
 
-    if (! m_blockCallback && btn->isCheckable ())
-      {
-        gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+      uicontrol::properties& up = properties<uicontrol> ();
 
-        octave::autolock guard (gh_mgr.graphics_lock ());
-
-        uicontrol::properties& up = properties<uicontrol> ();
-
-        Matrix oldValue = up.get_value ().matrix_value ();
-        double newValue = (checked ? up.get_max () : up.get_min ());
+      Matrix oldValue = up.get_value ().matrix_value ();
+      double newValue = (checked ? up.get_max () : up.get_min ());
 
-        if (oldValue.numel () != 1 || (newValue != oldValue(0)))
-          emit gh_set_event (m_handle, "value", newValue, false);
-        emit gh_callback_event (m_handle, "callback");
-      }
-  }
+      if (oldValue.numel () != 1 || (newValue != oldValue(0)))
+        emit gh_set_event (m_handle, "value", newValue, false);
+      emit gh_callback_event (m_handle, "callback");
+    }
+}
 
-  void
-  ButtonControl::clicked ()
-  {
-    QAbstractButton *btn = qWidget<QAbstractButton> ();
+void
+ButtonControl::clicked ()
+{
+  QAbstractButton *btn = qWidget<QAbstractButton> ();
 
-    if (! btn->isCheckable ())
-      emit gh_callback_event (m_handle, "callback");
-  }
+  if (! btn->isCheckable ())
+    emit gh_callback_event (m_handle, "callback");
+}
 
 OCTAVE_END_NAMESPACE(octave);
--- a/libgui/graphics/ButtonControl.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/ButtonControl.h	Thu Feb 02 12:25:51 2023 -0800
@@ -32,27 +32,27 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class interpreter;
+class interpreter;
 
-  class ButtonControl : public BaseControl
-  {
-    Q_OBJECT
+class ButtonControl : public BaseControl
+{
+  Q_OBJECT
 
-  public:
-    ButtonControl (octave::interpreter& interp,
-                   const graphics_object& go, QAbstractButton *btn);
-    ~ButtonControl ();
+public:
+  ButtonControl (octave::interpreter& interp,
+                 const graphics_object& go, QAbstractButton *btn);
+  ~ButtonControl ();
 
-  protected:
-    void update (int pId);
+protected:
+  void update (int pId);
 
-  private slots:
-    void clicked ();
-    void toggled (bool checked);
+private slots:
+  void clicked ();
+  void toggled (bool checked);
 
-  private:
-    bool m_blockCallback;
-  };
+private:
+  bool m_blockCallback;
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/graphics/ButtonGroup.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/ButtonGroup.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -50,477 +50,477 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  static int
-  frameStyleFromProperties (const uibuttongroup::properties& pp)
-  {
-    if (pp.bordertype_is ("none"))
-      return QFrame::NoFrame;
-    else if (pp.bordertype_is ("etchedin"))
-      return (QFrame::Box | QFrame::Sunken);
-    else if (pp.bordertype_is ("etchedout"))
-      return (QFrame::Box | QFrame::Raised);
-    else if (pp.bordertype_is ("beveledin"))
-      return (QFrame::Panel | QFrame::Sunken);
-    else if (pp.bordertype_is ("beveledout"))
-      return (QFrame::Panel | QFrame::Raised);
-    else
-      return (QFrame::Panel | QFrame::Plain);
-  }
+static int
+frameStyleFromProperties (const uibuttongroup::properties& pp)
+{
+  if (pp.bordertype_is ("none"))
+    return QFrame::NoFrame;
+  else if (pp.bordertype_is ("etchedin"))
+    return (QFrame::Box | QFrame::Sunken);
+  else if (pp.bordertype_is ("etchedout"))
+    return (QFrame::Box | QFrame::Raised);
+  else if (pp.bordertype_is ("beveledin"))
+    return (QFrame::Panel | QFrame::Sunken);
+  else if (pp.bordertype_is ("beveledout"))
+    return (QFrame::Panel | QFrame::Raised);
+  else
+    return (QFrame::Panel | QFrame::Plain);
+}
 
-  static void
-  setupPalette (const uibuttongroup::properties& pp, QPalette& p)
-  {
-    p.setColor (QPalette::Window,
-                Utils::fromRgb (pp.get_backgroundcolor_rgb ()));
-    p.setColor (QPalette::WindowText,
-                Utils::fromRgb (pp.get_foregroundcolor_rgb ()));
-    p.setColor (QPalette::Light,
-                Utils::fromRgb (pp.get_highlightcolor_rgb ()));
-    p.setColor (QPalette::Dark,
-                Utils::fromRgb (pp.get_shadowcolor_rgb ()));
-  }
+static void
+setupPalette (const uibuttongroup::properties& pp, QPalette& p)
+{
+  p.setColor (QPalette::Window,
+              Utils::fromRgb (pp.get_backgroundcolor_rgb ()));
+  p.setColor (QPalette::WindowText,
+              Utils::fromRgb (pp.get_foregroundcolor_rgb ()));
+  p.setColor (QPalette::Light,
+              Utils::fromRgb (pp.get_highlightcolor_rgb ()));
+  p.setColor (QPalette::Dark,
+              Utils::fromRgb (pp.get_shadowcolor_rgb ()));
+}
 
-  static int
-  borderWidthFromProperties (const uibuttongroup::properties& pp)
-  {
-    int bw = 0;
+static int
+borderWidthFromProperties (const uibuttongroup::properties& pp)
+{
+  int bw = 0;
 
-    if (! pp.bordertype_is ("none"))
-      {
-        bw = octave::math::round (pp.get_borderwidth ());
-        if (pp.bordertype_is ("etchedin") || pp.bordertype_is ("etchedout"))
-          bw *= 2;
-      }
-
-    return bw;
-  }
+  if (! pp.bordertype_is ("none"))
+    {
+      bw = octave::math::round (pp.get_borderwidth ());
+      if (pp.bordertype_is ("etchedin") || pp.bordertype_is ("etchedout"))
+        bw *= 2;
+    }
 
-  ButtonGroup *
-  ButtonGroup::create (octave::interpreter& interp, const graphics_object& go)
-  {
-    Object *parent = parentObject (interp, go);
+  return bw;
+}
 
-    if (parent)
-      {
-        Container *container = parent->innerContainer ();
+ButtonGroup *
+ButtonGroup::create (octave::interpreter& interp, const graphics_object& go)
+{
+  Object *parent = parentObject (interp, go);
 
-        if (container)
-          {
-            QFrame *frame = new QFrame (container);
-            return new ButtonGroup (interp, go,
-                                    new QButtonGroup (frame), frame);
-          }
-      }
+  if (parent)
+    {
+      Container *container = parent->innerContainer ();
 
-    return nullptr;
-  }
+      if (container)
+        {
+          QFrame *frame = new QFrame (container);
+          return new ButtonGroup (interp, go,
+                                  new QButtonGroup (frame), frame);
+        }
+    }
+
+  return nullptr;
+}
 
-  ButtonGroup::ButtonGroup (octave::interpreter& interp,
-                            const graphics_object& go,
-                            QButtonGroup *buttongroup, QFrame *frame)
-    : Object (interp, go, frame), m_hiddenbutton (nullptr),
-      m_container (nullptr), m_title (nullptr), m_blockUpdates (false)
-  {
-    uibuttongroup::properties& pp = properties<uibuttongroup> ();
+ButtonGroup::ButtonGroup (octave::interpreter& interp,
+                          const graphics_object& go,
+                          QButtonGroup *buttongroup, QFrame *frame)
+  : Object (interp, go, frame), m_hiddenbutton (nullptr),
+    m_container (nullptr), m_title (nullptr), m_blockUpdates (false)
+{
+  uibuttongroup::properties& pp = properties<uibuttongroup> ();
 
-    frame->setObjectName ("UIButtonGroup");
-    frame->setAutoFillBackground (true);
-    Matrix bb = pp.get_boundingbox (false);
-    frame->setGeometry (octave::math::round (bb(0)), octave::math::round (bb(1)),
-                        octave::math::round (bb(2)), octave::math::round (bb(3)));
-    frame->setFrameStyle (frameStyleFromProperties (pp));
-    frame->setLineWidth (octave::math::round (pp.get_borderwidth ()));
-    QPalette pal = frame->palette ();
-    setupPalette (pp, pal);
-    frame->setPalette (pal);
-    m_buttongroup = buttongroup;
-    m_hiddenbutton = new QRadioButton (frame);
-    m_hiddenbutton->hide ();
-    m_buttongroup->addButton (m_hiddenbutton);
-
-    m_container = new Container (frame, interp);
-    m_container->canvas (m_handle);
-
-    connect (m_container, SIGNAL (interpeter_event (const fcn_callback&)),
-             this, SIGNAL (interpeter_event (const fcn_callback&)));
-
-    connect (m_container, SIGNAL (interpeter_event (const meth_callback&)),
-             this, SIGNAL (interpeter_event (const meth_callback&)));
+  frame->setObjectName ("UIButtonGroup");
+  frame->setAutoFillBackground (true);
+  Matrix bb = pp.get_boundingbox (false);
+  frame->setGeometry (octave::math::round (bb(0)), octave::math::round (bb(1)),
+                      octave::math::round (bb(2)), octave::math::round (bb(3)));
+  frame->setFrameStyle (frameStyleFromProperties (pp));
+  frame->setLineWidth (octave::math::round (pp.get_borderwidth ()));
+  QPalette pal = frame->palette ();
+  setupPalette (pp, pal);
+  frame->setPalette (pal);
+  m_buttongroup = buttongroup;
+  m_hiddenbutton = new QRadioButton (frame);
+  m_hiddenbutton->hide ();
+  m_buttongroup->addButton (m_hiddenbutton);
 
-    if (frame->hasMouseTracking ())
-      {
-        for (auto *w : frame->findChildren<QWidget *> ())
-          w->setMouseTracking (true);
-        for (auto *w : buttongroup->findChildren<QWidget *> ())
-          w->setMouseTracking (true);
-      }
+  m_container = new Container (frame, interp);
+  m_container->canvas (m_handle);
+
+  connect (m_container, SIGNAL (interpeter_event (const fcn_callback&)),
+           this, SIGNAL (interpeter_event (const fcn_callback&)));
+
+  connect (m_container, SIGNAL (interpeter_event (const meth_callback&)),
+           this, SIGNAL (interpeter_event (const meth_callback&)));
 
-    QString title = Utils::fromStdString (pp.get_title ());
-    if (! title.isEmpty ())
-      {
-        m_title = new QLabel (title, frame);
-        m_title->setAutoFillBackground (true);
-        m_title->setContentsMargins (4, 0, 4, 0);
-        m_title->setPalette (pal);
-        m_title->setFont (Utils::computeFont<uibuttongroup> (pp, bb(3)));
-      }
+  if (frame->hasMouseTracking ())
+    {
+      for (auto *w : frame->findChildren<QWidget *> ())
+        w->setMouseTracking (true);
+      for (auto *w : buttongroup->findChildren<QWidget *> ())
+        w->setMouseTracking (true);
+    }
 
-    frame->installEventFilter (this);
-    m_container->installEventFilter (this);
+  QString title = Utils::fromStdString (pp.get_title ());
+  if (! title.isEmpty ())
+    {
+      m_title = new QLabel (title, frame);
+      m_title->setAutoFillBackground (true);
+      m_title->setContentsMargins (4, 0, 4, 0);
+      m_title->setPalette (pal);
+      m_title->setFont (Utils::computeFont<uibuttongroup> (pp, bb(3)));
+    }
+
+  frame->installEventFilter (this);
+  m_container->installEventFilter (this);
 
-    if (pp.is_visible ())
-      {
-        QTimer::singleShot (0, frame, &QFrame::show);
-        // FIXME: What is the intent here?  QButtonGroup::show is not a
-        // member of QButtonGroup.
-        QTimer::singleShot (0, buttongroup, SLOT (show ()));
-      }
-    else
-      frame->hide ();
+  if (pp.is_visible ())
+    {
+      QTimer::singleShot (0, frame, &QFrame::show);
+      // FIXME: What is the intent here?  QButtonGroup::show is not a
+      // member of QButtonGroup.
+      QTimer::singleShot (0, buttongroup, SLOT (show ()));
+    }
+  else
+    frame->hide ();
+
+  connect (m_buttongroup,
+           QOverload<QAbstractButton *>::of (&QButtonGroup::buttonClicked),
+           this, &ButtonGroup::buttonClicked);
+}
 
-    connect (m_buttongroup,
-             QOverload<QAbstractButton *>::of (&QButtonGroup::buttonClicked),
-             this, &ButtonGroup::buttonClicked);
-  }
-
-  ButtonGroup::~ButtonGroup ()
-  { }
+ButtonGroup::~ButtonGroup ()
+{ }
 
-  bool
-  ButtonGroup::eventFilter (QObject *watched, QEvent *xevent)
-  {
-    if (! m_blockUpdates)
-      {
-        gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+bool
+ButtonGroup::eventFilter (QObject *watched, QEvent *xevent)
+{
+  if (! m_blockUpdates)
+    {
+      gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
 
-        if (watched == qObject ())
-          {
-            switch (xevent->type ())
+      if (watched == qObject ())
+        {
+          switch (xevent->type ())
+            {
+            case QEvent::Resize:
               {
-              case QEvent::Resize:
-                {
-                  octave::autolock guard (gh_mgr.graphics_lock ());
+                octave::autolock guard (gh_mgr.graphics_lock ());
 
-                  graphics_object go = object ();
+                graphics_object go = object ();
 
-                  if (go.valid_object ())
-                    {
-                      if (m_title)
-                        {
-                          const uibuttongroup::properties& pp =
-                            Utils::properties<uibuttongroup> (go);
+                if (go.valid_object ())
+                  {
+                    if (m_title)
+                      {
+                        const uibuttongroup::properties& pp =
+                          Utils::properties<uibuttongroup> (go);
 
-                          if (pp.fontunits_is ("normalized"))
-                            {
-                              QFrame *frame = qWidget<QFrame> ();
+                        if (pp.fontunits_is ("normalized"))
+                          {
+                            QFrame *frame = qWidget<QFrame> ();
 
-                              m_title->setFont (Utils::computeFont<uibuttongroup>
-                                                (pp, frame->height ()));
-                              m_title->resize (m_title->sizeHint ());
-                            }
-                        }
-                      updateLayout ();
-                    }
-                }
-                break;
-
-              case QEvent::MouseButtonPress:
-                {
-                  QMouseEvent *m = dynamic_cast<QMouseEvent *> (xevent);
+                            m_title->setFont (Utils::computeFont<uibuttongroup>
+                                              (pp, frame->height ()));
+                            m_title->resize (m_title->sizeHint ());
+                          }
+                      }
+                    updateLayout ();
+                  }
+              }
+              break;
 
-                  if (m->button () == Qt::RightButton)
-                    {
-                      octave::autolock guard (gh_mgr.graphics_lock ());
-
-                      ContextMenu::executeAt (m_interpreter, properties (),
-                                              m->globalPos ());
-                    }
-                }
-                break;
+            case QEvent::MouseButtonPress:
+              {
+                QMouseEvent *m = dynamic_cast<QMouseEvent *> (xevent);
 
-              default:
-                break;
-              }
-          }
-        else if (watched == m_container)
-          {
-            switch (xevent->type ())
-              {
-              case QEvent::Resize:
-                if (qWidget<QWidget> ()->isVisible ())
+                if (m->button () == Qt::RightButton)
                   {
                     octave::autolock guard (gh_mgr.graphics_lock ());
 
-                    properties ().update_boundingbox ();
+                    ContextMenu::executeAt (m_interpreter, properties (),
+                                            m->globalPos ());
                   }
-                break;
+              }
+              break;
+
+            default:
+              break;
+            }
+        }
+      else if (watched == m_container)
+        {
+          switch (xevent->type ())
+            {
+            case QEvent::Resize:
+              if (qWidget<QWidget> ()->isVisible ())
+                {
+                  octave::autolock guard (gh_mgr.graphics_lock ());
+
+                  properties ().update_boundingbox ();
+                }
+              break;
+
+            default:
+              break;
+            }
+        }
+    }
+
+  return false;
+}
+
+void
+ButtonGroup::update (int pId)
+{
+  uibuttongroup::properties& pp = properties<uibuttongroup> ();
+  QFrame *frame = qWidget<QFrame> ();
+
+  m_blockUpdates = true;
+
+  switch (pId)
+    {
+    case uibuttongroup::properties::ID_POSITION:
+      {
+        Matrix bb = pp.get_boundingbox (false);
 
-              default:
-                break;
+        frame->setGeometry (octave::math::round (bb(0)), octave::math::round (bb(1)),
+                            octave::math::round (bb(2)), octave::math::round (bb(3)));
+        updateLayout ();
+      }
+      break;
+
+    case uibuttongroup::properties::ID_BORDERWIDTH:
+      frame->setLineWidth (octave::math::round (pp.get_borderwidth ()));
+      updateLayout ();
+      break;
+
+    case uibuttongroup::properties::ID_BACKGROUNDCOLOR:
+    case uibuttongroup::properties::ID_FOREGROUNDCOLOR:
+    case uibuttongroup::properties::ID_HIGHLIGHTCOLOR:
+    case uibuttongroup::properties::ID_SHADOWCOLOR:
+      {
+        QPalette pal = frame->palette ();
+
+        setupPalette (pp, pal);
+        frame->setPalette (pal);
+        if (m_title)
+          m_title->setPalette (pal);
+      }
+      break;
+
+    case uibuttongroup::properties::ID_TITLE:
+      {
+        QString title = Utils::fromStdString (pp.get_title ());
+
+        if (title.isEmpty ())
+          {
+            if (m_title)
+              delete m_title;
+            m_title = nullptr;
+          }
+        else
+          {
+            if (! m_title)
+              {
+                QPalette pal = frame->palette ();
+
+                m_title = new QLabel (title, frame);
+                m_title->setAutoFillBackground (true);
+                m_title->setContentsMargins (4, 0, 4, 0);
+                m_title->setPalette (pal);
+                m_title->setFont (Utils::computeFont<uibuttongroup> (pp));
+                m_title->show ();
+              }
+            else
+              {
+                m_title->setText (title);
+                m_title->resize (m_title->sizeHint ());
               }
           }
+        updateLayout ();
       }
-
-    return false;
-  }
-
-  void
-  ButtonGroup::update (int pId)
-  {
-    uibuttongroup::properties& pp = properties<uibuttongroup> ();
-    QFrame *frame = qWidget<QFrame> ();
-
-    m_blockUpdates = true;
+      break;
 
-    switch (pId)
-      {
-      case uibuttongroup::properties::ID_POSITION:
-        {
-          Matrix bb = pp.get_boundingbox (false);
-
-          frame->setGeometry (octave::math::round (bb(0)), octave::math::round (bb(1)),
-                              octave::math::round (bb(2)), octave::math::round (bb(3)));
-          updateLayout ();
-        }
-        break;
-
-      case uibuttongroup::properties::ID_BORDERWIDTH:
-        frame->setLineWidth (octave::math::round (pp.get_borderwidth ()));
-        updateLayout ();
-        break;
-
-      case uibuttongroup::properties::ID_BACKGROUNDCOLOR:
-      case uibuttongroup::properties::ID_FOREGROUNDCOLOR:
-      case uibuttongroup::properties::ID_HIGHLIGHTCOLOR:
-      case uibuttongroup::properties::ID_SHADOWCOLOR:
-        {
-          QPalette pal = frame->palette ();
+    case uibuttongroup::properties::ID_TITLEPOSITION:
+      updateLayout ();
+      break;
 
-          setupPalette (pp, pal);
-          frame->setPalette (pal);
-          if (m_title)
-            m_title->setPalette (pal);
-        }
-        break;
-
-      case uibuttongroup::properties::ID_TITLE:
-        {
-          QString title = Utils::fromStdString (pp.get_title ());
+    case uibuttongroup::properties::ID_BORDERTYPE:
+      frame->setFrameStyle (frameStyleFromProperties (pp));
+      updateLayout ();
+      break;
 
-          if (title.isEmpty ())
-            {
-              if (m_title)
-                delete m_title;
-              m_title = nullptr;
-            }
-          else
-            {
-              if (! m_title)
-                {
-                  QPalette pal = frame->palette ();
-
-                  m_title = new QLabel (title, frame);
-                  m_title->setAutoFillBackground (true);
-                  m_title->setContentsMargins (4, 0, 4, 0);
-                  m_title->setPalette (pal);
-                  m_title->setFont (Utils::computeFont<uibuttongroup> (pp));
-                  m_title->show ();
-                }
-              else
-                {
-                  m_title->setText (title);
-                  m_title->resize (m_title->sizeHint ());
-                }
-            }
+    case uibuttongroup::properties::ID_FONTNAME:
+    case uibuttongroup::properties::ID_FONTSIZE:
+    case uibuttongroup::properties::ID_FONTWEIGHT:
+    case uibuttongroup::properties::ID_FONTANGLE:
+      if (m_title)
+        {
+          m_title->setFont (Utils::computeFont<uibuttongroup> (pp));
+          m_title->resize (m_title->sizeHint ());
           updateLayout ();
         }
-        break;
-
-      case uibuttongroup::properties::ID_TITLEPOSITION:
-        updateLayout ();
-        break;
-
-      case uibuttongroup::properties::ID_BORDERTYPE:
-        frame->setFrameStyle (frameStyleFromProperties (pp));
-        updateLayout ();
-        break;
-
-      case uibuttongroup::properties::ID_FONTNAME:
-      case uibuttongroup::properties::ID_FONTSIZE:
-      case uibuttongroup::properties::ID_FONTWEIGHT:
-      case uibuttongroup::properties::ID_FONTANGLE:
-        if (m_title)
-          {
-            m_title->setFont (Utils::computeFont<uibuttongroup> (pp));
-            m_title->resize (m_title->sizeHint ());
-            updateLayout ();
-          }
-        break;
-
-      case uibuttongroup::properties::ID_VISIBLE:
-        frame->setVisible (pp.is_visible ());
-        updateLayout ();
-        break;
-
-      case uibuttongroup::properties::ID_SELECTEDOBJECT:
-        {
-          graphics_handle h = pp.get_selectedobject ();
-
-          gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
-
-          octave::autolock guard (gh_mgr.graphics_lock ());
-
-          graphics_object go = gh_mgr.get_object (h);
-
-          Object *selectedObject = qt_graphics_toolkit::toolkitObject (go);
-          ToggleButtonControl *toggle = static_cast<ToggleButtonControl *>
-                                        (selectedObject);
-          RadioButtonControl *radio = static_cast<RadioButtonControl *>(selectedObject);
-          if (toggle)
-            {
-              go.get_properties ().set ("value", 1);
-            }
-          else if (radio)
-            {
-              go.get_properties ().set ("value", 1);
-            }
-          else
-            {
-              m_hiddenbutton->setChecked (true);
-            }
-        }
-        break;
-
-      default:
-        break;
-      }
-
-    m_blockUpdates = false;
-  }
+      break;
 
-  void
-  ButtonGroup::redraw ()
-  {
-    update (uibuttongroup::properties::ID_POSITION);
-
-    // FIXME: is it really necessary to update the opengl canvas here?
-    Canvas *canvas = m_container->canvas (m_handle);
-
-    if (canvas)
-      canvas->redraw ();
-  }
-
-  void
-  ButtonGroup::updateLayout ()
-  {
-    uibuttongroup::properties& pp = properties<uibuttongroup> ();
-    QFrame *frame = qWidget<QFrame> ();
-
-    Matrix bb = pp.get_boundingbox (true);
-    int bw = borderWidthFromProperties (pp);
-
-    frame->setFrameRect (QRect (octave::math::round (bb(0)) - bw,
-                                octave::math::round (bb(1)) - bw,
-                                octave::math::round (bb(2)) + 2*bw, octave::math::round (bb(3)) + 2*bw));
-    m_container->setGeometry (octave::math::round (bb(0)),
-                              octave::math::round (bb(1)),
-                              octave::math::round (bb(2)), octave::math::round (bb(3)));
-
-    if (m_blockUpdates)
-      pp.update_boundingbox ();
-
-    if (m_title)
-      {
-        QSize sz = m_title->sizeHint ();
-        int offset = 5;
+    case uibuttongroup::properties::ID_VISIBLE:
+      frame->setVisible (pp.is_visible ());
+      updateLayout ();
+      break;
 
-        if (pp.titleposition_is ("lefttop"))
-          m_title->move (bw+offset, 0);
-        else if (pp.titleposition_is ("righttop"))
-          m_title->move (frame->width () - bw - offset - sz.width (), 0);
-        else if (pp.titleposition_is ("leftbottom"))
-          m_title->move (bw+offset, frame->height () - sz.height ());
-        else if (pp.titleposition_is ("rightbottom"))
-          m_title->move (frame->width () - bw - offset - sz.width (),
-                         frame->height () - sz.height ());
-        else if (pp.titleposition_is ("centertop"))
-          m_title->move (frame->width () / 2 - sz.width () / 2, 0);
-        else if (pp.titleposition_is ("centerbottom"))
-          m_title->move (frame->width () / 2 - sz.width () / 2,
-                         frame->height () - sz.height ());
-      }
-  }
+    case uibuttongroup::properties::ID_SELECTEDOBJECT:
+      {
+        graphics_handle h = pp.get_selectedobject ();
 
-  void
-  ButtonGroup::selectNothing ()
-  {
-    m_hiddenbutton->setChecked (true);
-  }
-
-  void
-  ButtonGroup::addButton (QAbstractButton *btn)
-  {
-    m_buttongroup->addButton (btn);
-    connect (btn, &QAbstractButton::toggled, this, &ButtonGroup::buttonToggled);
-  }
-
-  void
-  ButtonGroup::buttonToggled (bool toggled)
-  {
-    Q_UNUSED (toggled);
-    if (! m_blockUpdates)
-      {
         gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
 
         octave::autolock guard (gh_mgr.graphics_lock ());
 
-        uibuttongroup::properties& bp = properties<uibuttongroup> ();
-
-        graphics_handle oldValue = bp.get_selectedobject ();
-
-        QAbstractButton *checkedBtn = m_buttongroup->checkedButton ();
+        graphics_object go = gh_mgr.get_object (h);
 
-        graphics_handle newValue = graphics_handle ();
-        if (checkedBtn != m_hiddenbutton)
+        Object *selectedObject = qt_graphics_toolkit::toolkitObject (go);
+        ToggleButtonControl *toggle = static_cast<ToggleButtonControl *>
+                                      (selectedObject);
+        RadioButtonControl *radio = static_cast<RadioButtonControl *>(selectedObject);
+        if (toggle)
           {
-            Object *checkedObj = Object::fromQObject (checkedBtn);
-            newValue = checkedObj->properties ().get___myhandle__ ();
+            go.get_properties ().set ("value", 1);
+          }
+        else if (radio)
+          {
+            go.get_properties ().set ("value", 1);
+          }
+        else
+          {
+            m_hiddenbutton->setChecked (true);
           }
+      }
+      break;
 
-        if (oldValue != newValue)
-          emit gh_set_event (m_handle, "selectedobject",
-                             newValue.as_octave_value (), false);
-      }
-  }
+    default:
+      break;
+    }
+
+  m_blockUpdates = false;
+}
+
+void
+ButtonGroup::redraw ()
+{
+  update (uibuttongroup::properties::ID_POSITION);
+
+  // FIXME: is it really necessary to update the opengl canvas here?
+  Canvas *canvas = m_container->canvas (m_handle);
+
+  if (canvas)
+    canvas->redraw ();
+}
 
-  void
-  ButtonGroup::buttonClicked (QAbstractButton *btn)
-  {
-    Q_UNUSED (btn);
+void
+ButtonGroup::updateLayout ()
+{
+  uibuttongroup::properties& pp = properties<uibuttongroup> ();
+  QFrame *frame = qWidget<QFrame> ();
+
+  Matrix bb = pp.get_boundingbox (true);
+  int bw = borderWidthFromProperties (pp);
+
+  frame->setFrameRect (QRect (octave::math::round (bb(0)) - bw,
+                              octave::math::round (bb(1)) - bw,
+                              octave::math::round (bb(2)) + 2*bw, octave::math::round (bb(3)) + 2*bw));
+  m_container->setGeometry (octave::math::round (bb(0)),
+                            octave::math::round (bb(1)),
+                            octave::math::round (bb(2)), octave::math::round (bb(3)));
+
+  if (m_blockUpdates)
+    pp.update_boundingbox ();
+
+  if (m_title)
+    {
+      QSize sz = m_title->sizeHint ();
+      int offset = 5;
 
-    gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
-
-    octave::autolock guard (gh_mgr.graphics_lock ());
-
-    uibuttongroup::properties& bp = properties<uibuttongroup> ();
+      if (pp.titleposition_is ("lefttop"))
+        m_title->move (bw+offset, 0);
+      else if (pp.titleposition_is ("righttop"))
+        m_title->move (frame->width () - bw - offset - sz.width (), 0);
+      else if (pp.titleposition_is ("leftbottom"))
+        m_title->move (bw+offset, frame->height () - sz.height ());
+      else if (pp.titleposition_is ("rightbottom"))
+        m_title->move (frame->width () - bw - offset - sz.width (),
+                       frame->height () - sz.height ());
+      else if (pp.titleposition_is ("centertop"))
+        m_title->move (frame->width () / 2 - sz.width () / 2, 0);
+      else if (pp.titleposition_is ("centerbottom"))
+        m_title->move (frame->width () / 2 - sz.width () / 2,
+                       frame->height () - sz.height ());
+    }
+}
 
-    graphics_handle oldValue = bp.get_selectedobject ();
+void
+ButtonGroup::selectNothing ()
+{
+  m_hiddenbutton->setChecked (true);
+}
+
+void
+ButtonGroup::addButton (QAbstractButton *btn)
+{
+  m_buttongroup->addButton (btn);
+  connect (btn, &QAbstractButton::toggled, this, &ButtonGroup::buttonToggled);
+}
 
-    QAbstractButton *checkedBtn = m_buttongroup->checkedButton ();
-    Object *checkedObj = Object::fromQObject (checkedBtn);
-    graphics_handle newValue = checkedObj->properties ().get___myhandle__ ();
+void
+ButtonGroup::buttonToggled (bool toggled)
+{
+  Q_UNUSED (toggled);
+  if (! m_blockUpdates)
+    {
+      gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+
+      octave::autolock guard (gh_mgr.graphics_lock ());
+
+      uibuttongroup::properties& bp = properties<uibuttongroup> ();
+
+      graphics_handle oldValue = bp.get_selectedobject ();
 
-    if (oldValue != newValue)
-      {
-        octave_scalar_map eventData;
-        eventData.setfield ("OldValue", oldValue.as_octave_value ());
-        eventData.setfield ("NewValue", newValue.as_octave_value ());
-        eventData.setfield ("Source", bp.get___myhandle__ ().as_octave_value ());
-        eventData.setfield ("EventName", "SelectionChanged");
-        octave_value selectionChangedEventObject (eventData);
-        emit gh_callback_event (m_handle, "selectionchangedfcn",
-                                selectionChangedEventObject);
-      }
-  }
+      QAbstractButton *checkedBtn = m_buttongroup->checkedButton ();
+
+      graphics_handle newValue = graphics_handle ();
+      if (checkedBtn != m_hiddenbutton)
+        {
+          Object *checkedObj = Object::fromQObject (checkedBtn);
+          newValue = checkedObj->properties ().get___myhandle__ ();
+        }
+
+      if (oldValue != newValue)
+        emit gh_set_event (m_handle, "selectedobject",
+                           newValue.as_octave_value (), false);
+    }
+}
+
+void
+ButtonGroup::buttonClicked (QAbstractButton *btn)
+{
+  Q_UNUSED (btn);
+
+  gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+
+  octave::autolock guard (gh_mgr.graphics_lock ());
+
+  uibuttongroup::properties& bp = properties<uibuttongroup> ();
+
+  graphics_handle oldValue = bp.get_selectedobject ();
+
+  QAbstractButton *checkedBtn = m_buttongroup->checkedButton ();
+  Object *checkedObj = Object::fromQObject (checkedBtn);
+  graphics_handle newValue = checkedObj->properties ().get___myhandle__ ();
+
+  if (oldValue != newValue)
+    {
+      octave_scalar_map eventData;
+      eventData.setfield ("OldValue", oldValue.as_octave_value ());
+      eventData.setfield ("NewValue", newValue.as_octave_value ());
+      eventData.setfield ("Source", bp.get___myhandle__ ().as_octave_value ());
+      eventData.setfield ("EventName", "SelectionChanged");
+      octave_value selectionChangedEventObject (eventData);
+      emit gh_callback_event (m_handle, "selectionchangedfcn",
+                              selectionChangedEventObject);
+    }
+}
 
 OCTAVE_END_NAMESPACE(octave);
--- a/libgui/graphics/ButtonGroup.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/ButtonGroup.h	Thu Feb 02 12:25:51 2023 -0800
@@ -36,50 +36,50 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class interpreter;
+class interpreter;
 
-  class Container;
+class Container;
 
-  class ButtonGroup : public Object
-  {
-    Q_OBJECT
+class ButtonGroup : public Object
+{
+  Q_OBJECT
 
-  public:
-    ButtonGroup (octave::interpreter& interp,
-                 const graphics_object& go, QButtonGroup *buttongroup,
-                 QFrame *frame);
-    ~ButtonGroup ();
+public:
+  ButtonGroup (octave::interpreter& interp,
+               const graphics_object& go, QButtonGroup *buttongroup,
+               QFrame *frame);
+  ~ButtonGroup ();
 
-    Container * innerContainer () { return m_container; }
+  Container * innerContainer () { return m_container; }
 
-    bool eventFilter (QObject *watched, QEvent *event);
+  bool eventFilter (QObject *watched, QEvent *event);
 
-    static ButtonGroup *
-    create (octave::interpreter& interp,
-            const graphics_object& go);
+  static ButtonGroup *
+  create (octave::interpreter& interp,
+          const graphics_object& go);
 
-    void addButton (QAbstractButton *btn);
+  void addButton (QAbstractButton *btn);
 
-    void selectNothing ();
+  void selectNothing ();
 
-  protected:
-    void update (int pId);
-    void redraw ();
+protected:
+  void update (int pId);
+  void redraw ();
 
-  private slots:
-    void buttonToggled (bool toggled);
-    void buttonClicked (QAbstractButton *btn);
+private slots:
+  void buttonToggled (bool toggled);
+  void buttonClicked (QAbstractButton *btn);
 
-  private:
-    void updateLayout ();
+private:
+  void updateLayout ();
 
-  private:
-    QButtonGroup *m_buttongroup;
-    QRadioButton *m_hiddenbutton;
-    Container *m_container;
-    QLabel *m_title;
-    bool m_blockUpdates;
-  };
+private:
+  QButtonGroup *m_buttongroup;
+  QRadioButton *m_hiddenbutton;
+  Container *m_container;
+  QLabel *m_title;
+  bool m_blockUpdates;
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/graphics/Canvas.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/Canvas.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -53,1036 +53,1036 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  void
-  Canvas::redraw (bool sync)
-  {
-    QWidget *w = qWidget ();
+void
+Canvas::redraw (bool sync)
+{
+  QWidget *w = qWidget ();
 
-    if (w)
-      {
-        if (sync)
-          w->repaint ();
-        else
-          w->update ();
-      }
-  }
+  if (w)
+    {
+      if (sync)
+        w->repaint ();
+      else
+        w->update ();
+    }
+}
 
-  void
-  Canvas::blockRedraw (bool block)
-  {
-    m_redrawBlocked = block;
-  }
+void
+Canvas::blockRedraw (bool block)
+{
+  m_redrawBlocked = block;
+}
 
-  QCursor
-  Canvas::make_cursor (const QString& name, int hot_x, int hot_y)
-  {
-    gui_settings settings;
+QCursor
+Canvas::make_cursor (const QString& name, int hot_x, int hot_y)
+{
+  gui_settings settings;
 
-    QIcon icon = settings.icon (name);
+  QIcon icon = settings.icon (name);
 
-    return QCursor (icon.pixmap (22, 22), hot_x, hot_y);
-  }
+  return QCursor (icon.pixmap (22, 22), hot_x, hot_y);
+}
 
-  void
-  Canvas::setCursor (MouseMode mode, std::string fallback,
-                     QImage cdata, Matrix hotspot)
-  {
-    QWidget *w = qWidget ();
-    QCursor cursor = Qt::ArrowCursor;
-    if (w)
-      {
-        switch (mode)
+void
+Canvas::setCursor (MouseMode mode, std::string fallback,
+                   QImage cdata, Matrix hotspot)
+{
+  QWidget *w = qWidget ();
+  QCursor cursor = Qt::ArrowCursor;
+  if (w)
+    {
+      switch (mode)
+        {
+        case NoMode:
           {
-          case NoMode:
-            {
-              cursor = Qt::ArrowCursor;
+            cursor = Qt::ArrowCursor;
 
-              if (fallback == "arrow")
-                cursor = Qt::ArrowCursor;
-              else if (fallback == "botl")
-                cursor = make_cursor ("bottom_left_corner", 5, 16);
-              else if (fallback == "botr")
-                cursor = make_cursor ("bottom_right_corner", 16, 16);
-              else if (fallback == "bottom")
-                cursor = make_cursor ("bottom_side", 11, 16);
-              else if (fallback == "circle")
-                cursor = make_cursor ("circle", 10, 10);
-              else if (fallback == "cross" || fallback == "crosshair")
-                cursor = make_cursor ("cross", 10, 10);
-              else if (fallback == "custom")
-                {
-                  if (hotspot(0) > cdata.width () || hotspot(0) < 1.0
-                      || hotspot(1) > cdata.height () || hotspot(1) < 1.0)
-                    hotspot = Matrix (1, 2, 1);
+            if (fallback == "arrow")
+              cursor = Qt::ArrowCursor;
+            else if (fallback == "botl")
+              cursor = make_cursor ("bottom_left_corner", 5, 16);
+            else if (fallback == "botr")
+              cursor = make_cursor ("bottom_right_corner", 16, 16);
+            else if (fallback == "bottom")
+              cursor = make_cursor ("bottom_side", 11, 16);
+            else if (fallback == "circle")
+              cursor = make_cursor ("circle", 10, 10);
+            else if (fallback == "cross" || fallback == "crosshair")
+              cursor = make_cursor ("cross", 10, 10);
+            else if (fallback == "custom")
+              {
+                if (hotspot(0) > cdata.width () || hotspot(0) < 1.0
+                    || hotspot(1) > cdata.height () || hotspot(1) < 1.0)
+                  hotspot = Matrix (1, 2, 1);
 
-                  cursor = QCursor (QPixmap::fromImage (cdata),
-                                    static_cast<int> (hotspot(1) - 1),
-                                    static_cast<int> (hotspot(0) - 1));
-                }
-              else if (fallback == "fleur")
-                cursor = make_cursor ("fleur", 10, 4);
-              else if (fallback == "hand")
-                cursor = make_cursor ("hand2", 7, 3);
-              else if (fallback == "ibeam")
-                cursor = Qt::IBeamCursor;
-              else if (fallback == "left")
-                cursor = make_cursor ("left_side", 4, 10);
-              else if (fallback == "right")
-                cursor = make_cursor ("right_side", 17, 10);
-              else if (fallback == "top")
-                cursor = make_cursor ("top_side", 11, 4);
-              else if (fallback == "topl")
-                cursor = make_cursor ("top_left_corner", 4, 4);
-              else if (fallback == "topr")
-                cursor = make_cursor ("top_right_corner", 16, 4);
-              else if (fallback == "watch")
-                cursor = Qt::BusyCursor;
-            }
-            break;
-          case SelectMode:
-            cursor = Qt::ArrowCursor;
-            break;
-
-          case PanMode:
-            cursor = make_cursor ("figure-pan");
-            break;
-
-          case RotateMode:
-            cursor = make_cursor ("figure-rotate");
-            break;
-
-          case TextMode:
-            cursor = Qt::IBeamCursor;
-            break;
-
-          case ZoomInMode:
-            cursor = make_cursor ("figure-zoom-in", 9, 9);
-            break;
+                cursor = QCursor (QPixmap::fromImage (cdata),
+                                  static_cast<int> (hotspot(1) - 1),
+                                  static_cast<int> (hotspot(0) - 1));
+              }
+            else if (fallback == "fleur")
+              cursor = make_cursor ("fleur", 10, 4);
+            else if (fallback == "hand")
+              cursor = make_cursor ("hand2", 7, 3);
+            else if (fallback == "ibeam")
+              cursor = Qt::IBeamCursor;
+            else if (fallback == "left")
+              cursor = make_cursor ("left_side", 4, 10);
+            else if (fallback == "right")
+              cursor = make_cursor ("right_side", 17, 10);
+            else if (fallback == "top")
+              cursor = make_cursor ("top_side", 11, 4);
+            else if (fallback == "topl")
+              cursor = make_cursor ("top_left_corner", 4, 4);
+            else if (fallback == "topr")
+              cursor = make_cursor ("top_right_corner", 16, 4);
+            else if (fallback == "watch")
+              cursor = Qt::BusyCursor;
+          }
+          break;
+        case SelectMode:
+          cursor = Qt::ArrowCursor;
+          break;
 
-          case ZoomOutMode:
-            cursor = make_cursor ("figure-zoom-out", 9, 9);
-            break;
+        case PanMode:
+          cursor = make_cursor ("figure-pan");
+          break;
 
-          default:
-            cursor = Qt::ArrowCursor;
-            break;
-          }
-        w->setCursor (cursor);
-      }
-  }
+        case RotateMode:
+          cursor = make_cursor ("figure-rotate");
+          break;
 
-  /*
-     Two updateCurrentPoint() routines are required:
-     1) Used for QMouseEvents where cursor position data is in callback from Qt.
-     2) Used for QKeyEvents where cursor position must be determined.
-  */
-  void
-  Canvas::updateCurrentPoint (const graphics_object& fig,
-                              const graphics_object& obj, QMouseEvent *event)
-  {
-    gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+        case TextMode:
+          cursor = Qt::IBeamCursor;
+          break;
 
-    octave::autolock guard (gh_mgr.graphics_lock ());
+        case ZoomInMode:
+          cursor = make_cursor ("figure-zoom-in", 9, 9);
+          break;
+
+        case ZoomOutMode:
+          cursor = make_cursor ("figure-zoom-out", 9, 9);
+          break;
 
-    emit gh_set_event (fig.get_handle (), "currentpoint",
-                       Utils::figureCurrentPoint (fig, event), false);
-
-    Matrix children = obj.get_properties ().get_children ();
-    octave_idx_type num_children = children.numel ();
-
-    for (int i = 0; i < num_children; i++)
-      {
-        graphics_object childObj (gh_mgr.get_object (children(i)));
+        default:
+          cursor = Qt::ArrowCursor;
+          break;
+        }
+      w->setCursor (cursor);
+    }
+}
 
-        if (childObj.isa ("axes"))
-          {
-            axes::properties& ap = Utils::properties<axes> (childObj);
-            Matrix x_zlim = ap.get_transform_zlim ();
-            graphics_xform x_form = ap.get_transform ();
+/*
+   Two updateCurrentPoint() routines are required:
+   1) Used for QMouseEvents where cursor position data is in callback from Qt.
+   2) Used for QKeyEvents where cursor position must be determined.
+*/
+void
+Canvas::updateCurrentPoint (const graphics_object& fig,
+                            const graphics_object& obj, QMouseEvent *event)
+{
+  gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
 
-            ColumnVector p1 = x_form.untransform (event->x (), event->y (),
-                                                  x_zlim(0));
-            ColumnVector p2 = x_form.untransform (event->x (), event->y (),
-                                                  x_zlim(1));
+  octave::autolock guard (gh_mgr.graphics_lock ());
 
-            Matrix cp (2, 3, 0.0);
-
-            cp(0, 0) = p1(0); cp(0, 1) = p1(1); cp(0, 2) = p1(2);
-            cp(1, 0) = p2(0); cp(1, 1) = p2(1); cp(1, 2) = p2(2);
+  emit gh_set_event (fig.get_handle (), "currentpoint",
+                     Utils::figureCurrentPoint (fig, event), false);
 
-            emit gh_set_event (childObj.get_handle (), "currentpoint", cp,
-                               false);
-          }
-      }
-  }
+  Matrix children = obj.get_properties ().get_children ();
+  octave_idx_type num_children = children.numel ();
 
-  void
-  Canvas::updateCurrentPoint (const graphics_object& fig,
-                              const graphics_object& obj)
-  {
-    gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+  for (int i = 0; i < num_children; i++)
+    {
+      graphics_object childObj (gh_mgr.get_object (children(i)));
 
-    octave::autolock guard (gh_mgr.graphics_lock ());
-
-    emit gh_set_event (fig.get_handle (), "currentpoint",
-                       Utils::figureCurrentPoint (fig), false);
+      if (childObj.isa ("axes"))
+        {
+          axes::properties& ap = Utils::properties<axes> (childObj);
+          Matrix x_zlim = ap.get_transform_zlim ();
+          graphics_xform x_form = ap.get_transform ();
 
-    Matrix children = obj.get_properties ().get_children ();
-    octave_idx_type num_children = children.numel ();
+          ColumnVector p1 = x_form.untransform (event->x (), event->y (),
+                                                x_zlim(0));
+          ColumnVector p2 = x_form.untransform (event->x (), event->y (),
+                                                x_zlim(1));
 
-    for (int i = 0; i < num_children; i++)
-      {
-        graphics_object childObj (gh_mgr.get_object (children(i)));
+          Matrix cp (2, 3, 0.0);
+
+          cp(0, 0) = p1(0); cp(0, 1) = p1(1); cp(0, 2) = p1(2);
+          cp(1, 0) = p2(0); cp(1, 1) = p2(1); cp(1, 2) = p2(2);
 
-        if (childObj.isa ("axes"))
-          {
-            // FIXME: QCursor::pos() may give inaccurate results with
-            //        asynchronous window systems like X11 over ssh.
-            QWidget *w = qWidget ();
-            QPoint p = w->mapFromGlobal (QCursor::pos ());
-            axes::properties& ap = Utils::properties<axes> (childObj);
-            Matrix x_zlim = ap.get_transform_zlim ();
-            graphics_xform x_form = ap.get_transform ();
+          emit gh_set_event (childObj.get_handle (), "currentpoint", cp,
+                             false);
+        }
+    }
+}
 
-            ColumnVector p1 = x_form.untransform (p.x (), p.y (), x_zlim(0));
-            ColumnVector p2 = x_form.untransform (p.x (), p.y (), x_zlim(1));
-
-            Matrix cp (2, 3, 0.0);
-
-            cp(0, 0) = p1(0); cp(0, 1) = p1(1); cp(0, 2) = p1(2);
-            cp(1, 0) = p2(0); cp(1, 1) = p2(1); cp(1, 2) = p2(2);
+void
+Canvas::updateCurrentPoint (const graphics_object& fig,
+                            const graphics_object& obj)
+{
+  gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
 
-            emit gh_set_event (childObj.get_handle (), "currentpoint", cp,
-                               false);
-          }
-      }
-  }
+  octave::autolock guard (gh_mgr.graphics_lock ());
+
+  emit gh_set_event (fig.get_handle (), "currentpoint",
+                     Utils::figureCurrentPoint (fig), false);
 
-  static void
-  autoscale_axes (gh_manager& gh_mgr, axes::properties& ap)
-  {
-    octave::autolock guard (gh_mgr.graphics_lock ());
+  Matrix children = obj.get_properties ().get_children ();
+  octave_idx_type num_children = children.numel ();
 
-    // Reset zoom stack
-    ap.clear_zoom_stack (false);
-
-    ap.set_xlimmode ("auto");
-    ap.set_ylimmode ("auto");
-    ap.set_zlimmode ("auto");
-  }
+  for (int i = 0; i < num_children; i++)
+    {
+      graphics_object childObj (gh_mgr.get_object (children(i)));
 
-  void
-  Canvas::canvasPaintEvent ()
-  {
-    if (! m_redrawBlocked)
-      {
-        gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
-
-        octave::autolock guard (gh_mgr.graphics_lock ());
-
-        draw (m_handle);
+      if (childObj.isa ("axes"))
+        {
+          // FIXME: QCursor::pos() may give inaccurate results with
+          //        asynchronous window systems like X11 over ssh.
+          QWidget *w = qWidget ();
+          QPoint p = w->mapFromGlobal (QCursor::pos ());
+          axes::properties& ap = Utils::properties<axes> (childObj);
+          Matrix x_zlim = ap.get_transform_zlim ();
+          graphics_xform x_form = ap.get_transform ();
 
-        if ((m_mouseMode == ZoomInMode && m_mouseAxes.ok ()) || m_rectMode)
-          drawZoomBox (m_mouseAnchor, m_mouseCurrent);
-      }
-  }
+          ColumnVector p1 = x_form.untransform (p.x (), p.y (), x_zlim(0));
+          ColumnVector p2 = x_form.untransform (p.x (), p.y (), x_zlim(1));
+
+          Matrix cp (2, 3, 0.0);
 
-  static bool
-  pan_enabled (const graphics_object figObj)
-  {
-    // Getting pan mode property:
-    octave_value ov_pm
-      = Utils::properties<figure> (figObj).get___pan_mode__ ();
+          cp(0, 0) = p1(0); cp(0, 1) = p1(1); cp(0, 2) = p1(2);
+          cp(1, 0) = p2(0); cp(1, 1) = p2(1); cp(1, 2) = p2(2);
 
-    octave_scalar_map pm = ov_pm.scalar_map_value ();
+          emit gh_set_event (childObj.get_handle (), "currentpoint", cp,
+                             false);
+        }
+    }
+}
 
-    return pm.contents ("Enable").string_value () == "on";
-  }
+static void
+autoscale_axes (gh_manager& gh_mgr, axes::properties& ap)
+{
+  octave::autolock guard (gh_mgr.graphics_lock ());
 
-  static std::string
-  pan_mode (const graphics_object figObj)
-  {
-    // Getting pan mode property:
-    octave_value ov_pm
-      = Utils::properties<figure> (figObj).get___pan_mode__ ();
-
-    octave_scalar_map pm = ov_pm.scalar_map_value ();
+  // Reset zoom stack
+  ap.clear_zoom_stack (false);
 
-    return pm.contents ("Motion").string_value ();
-  }
+  ap.set_xlimmode ("auto");
+  ap.set_ylimmode ("auto");
+  ap.set_zlimmode ("auto");
+}
 
-  static bool
-  zoom_enabled (const graphics_object figObj)
-  {
-    // Getting zoom mode property:
-    octave_value ov_zm
-      = Utils::properties<figure> (figObj).get___zoom_mode__ ();
+void
+Canvas::canvasPaintEvent ()
+{
+  if (! m_redrawBlocked)
+    {
+      gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
 
-    octave_scalar_map zm = ov_zm.scalar_map_value ();
+      octave::autolock guard (gh_mgr.graphics_lock ());
 
-    return zm.contents ("Enable").string_value () == "on";
-  }
+      draw (m_handle);
 
-  static std::string
-  zoom_mode (const graphics_object figObj)
-  {
-    // Getting zoom mode property:
-    octave_value ov_zm
-      = Utils::properties<figure> (figObj).get___zoom_mode__ ();
+      if ((m_mouseMode == ZoomInMode && m_mouseAxes.ok ()) || m_rectMode)
+        drawZoomBox (m_mouseAnchor, m_mouseCurrent);
+    }
+}
 
-    octave_scalar_map zm = ov_zm.scalar_map_value ();
-
-    return zm.contents ("Motion").string_value ();
-  }
+static bool
+pan_enabled (const graphics_object figObj)
+{
+  // Getting pan mode property:
+  octave_value ov_pm
+    = Utils::properties<figure> (figObj).get___pan_mode__ ();
 
-  void
-  Canvas::select_object (graphics_object obj, QMouseEvent *event,
-                         graphics_object& currentObj, graphics_object& axesObj,
-                         bool axes_only, std::vector<std::string> omit)
-  {
-    QList<graphics_object> axesList;
-    Matrix children = obj.get_properties ().get_all_children ();
-    octave_idx_type num_children = children.numel ();
+  octave_scalar_map pm = ov_pm.scalar_map_value ();
+
+  return pm.contents ("Enable").string_value () == "on";
+}
 
-    gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
-
-    for (int i = 0; i < num_children; i++)
-      {
-        graphics_object childObj (gh_mgr.get_object (children(i)));
+static std::string
+pan_mode (const graphics_object figObj)
+{
+  // Getting pan mode property:
+  octave_value ov_pm
+    = Utils::properties<figure> (figObj).get___pan_mode__ ();
 
-        if (childObj.isa ("axes"))
-          {
-            auto p = omit.begin ();
-            bool omitfound = false;
-            while (p != omit.end () && ! omitfound)
-              {
-                omitfound = (childObj.get ("tag").string_value () == *p);
-                p++;
-              }
-            if (! omitfound)
-              axesList.append (childObj);
-          }
-        else if (childObj.isa ("uicontrol") || childObj.isa ("uipanel")
-                 || childObj.isa ("uibuttongroup") || childObj.isa ("uitable"))
-          {
-            Matrix bb = childObj.get_properties ().get_boundingbox (false);
-            QRectF r (bb(0), bb(1), bb(2), bb(3));
+  octave_scalar_map pm = ov_pm.scalar_map_value ();
+
+  return pm.contents ("Motion").string_value ();
+}
+
+static bool
+zoom_enabled (const graphics_object figObj)
+{
+  // Getting zoom mode property:
+  octave_value ov_zm
+    = Utils::properties<figure> (figObj).get___zoom_mode__ ();
 
-            r.adjust (-5, -5, 5, 5);
+  octave_scalar_map zm = ov_zm.scalar_map_value ();
+
+  return zm.contents ("Enable").string_value () == "on";
+}
 
-            bool rect_contains_pos = r.contains (event->localPos ());
-            if (rect_contains_pos)
-              {
-                currentObj = childObj;
-                break;
-              }
-          }
-      }
+static std::string
+zoom_mode (const graphics_object figObj)
+{
+  // Getting zoom mode property:
+  octave_value ov_zm
+    = Utils::properties<figure> (figObj).get___zoom_mode__ ();
 
-    if (axes_only)
-      {
-        QPoint pt = event->pos ();
+  octave_scalar_map zm = ov_zm.scalar_map_value ();
+
+  return zm.contents ("Motion").string_value ();
+}
 
-        for (QList<graphics_object>::ConstIterator it = axesList.begin ();
-             it != axesList.end (); ++it)
-          {
-            const axes::properties& ap =
-              dynamic_cast<const axes::properties&> ((*it).get_properties ());
+void
+Canvas::select_object (graphics_object obj, QMouseEvent *event,
+                       graphics_object& currentObj, graphics_object& axesObj,
+                       bool axes_only, std::vector<std::string> omit)
+{
+  QList<graphics_object> axesList;
+  Matrix children = obj.get_properties ().get_all_children ();
+  octave_idx_type num_children = children.numel ();
 
-            ColumnVector p0 = ap.pixel2coord (pt.x (), pt.y ());
-            Matrix xlim = ap.get_xlim ().matrix_value ();
-            Matrix ylim = ap.get_ylim ().matrix_value ();
+  gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+
+  for (int i = 0; i < num_children; i++)
+    {
+      graphics_object childObj (gh_mgr.get_object (children(i)));
 
-            if (xlim(0) < p0(0) && xlim(1) > p0(0)
-                && ylim(0) < p0(1) && ylim(1) > p0(1))
-              {
-                axesObj = *it;
-                return;
-              }
-          }
-      }
-    else if (! currentObj)
-      {
-        for (QList<graphics_object>::ConstIterator it = axesList.begin ();
-             it != axesList.end (); ++it)
-          {
-            graphics_object go = selectFromAxes (*it, event->pos ());
+      if (childObj.isa ("axes"))
+        {
+          auto p = omit.begin ();
+          bool omitfound = false;
+          while (p != omit.end () && ! omitfound)
+            {
+              omitfound = (childObj.get ("tag").string_value () == *p);
+              p++;
+            }
+          if (! omitfound)
+            axesList.append (childObj);
+        }
+      else if (childObj.isa ("uicontrol") || childObj.isa ("uipanel")
+               || childObj.isa ("uibuttongroup") || childObj.isa ("uitable"))
+        {
+          Matrix bb = childObj.get_properties ().get_boundingbox (false);
+          QRectF r (bb(0), bb(1), bb(2), bb(3));
 
-            if (go)
-              {
-                currentObj = go;
-                axesObj = *it;
-              }
-            // FIXME: is this really necessary? the axes object should
-            //        have been selected through selectFromAxes anyway
-            else if (it->get_properties ().is_hittest ())
-              {
-                Matrix bb = it->get_properties ().get_boundingbox (true);
-                QRectF r (bb(0), bb(1), bb(2), bb(3));
+          r.adjust (-5, -5, 5, 5);
 
-                // Allow a rectangle (e.g., Zoom box) to be slightly outside
-                // the axes and still select it.
-                r.adjust (-20, -20, 20, 20);
-
-                bool rect_contains_pos = r.contains (event->localPos ());
-                if (rect_contains_pos)
-                  axesObj = *it;
-              }
-
-            if (axesObj && currentObj)
+          bool rect_contains_pos = r.contains (event->localPos ());
+          if (rect_contains_pos)
+            {
+              currentObj = childObj;
               break;
-          }
-      }
-  }
+            }
+        }
+    }
 
-  void
-  Canvas::canvasMouseMoveEvent (QMouseEvent *event)
-  {
-    gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
-
-    octave::autolock guard (gh_mgr.graphics_lock ());
-
-    graphics_object ax = gh_mgr.get_object (m_mouseAxes);
+  if (axes_only)
+    {
+      QPoint pt = event->pos ();
 
-    if (m_mouseMode != NoMode && (ax.valid_object () || m_mouseMode == TextMode))
-      {
-        switch (m_mouseMode)
-          {
-          case RotateMode:
-            {
-              axes::properties& ap = Utils::properties<axes> (ax);
+      for (QList<graphics_object>::ConstIterator it = axesList.begin ();
+           it != axesList.end (); ++it)
+        {
+          const axes::properties& ap =
+            dynamic_cast<const axes::properties&> ((*it).get_properties ());
 
-              ap.rotate3d (m_mouseCurrent.x (), event->x (),
-                           m_mouseCurrent.y (), event->y ());
-
-              // Update current mouse position
-              m_mouseCurrent = event->pos ();
+          ColumnVector p0 = ap.pixel2coord (pt.x (), pt.y ());
+          Matrix xlim = ap.get_xlim ().matrix_value ();
+          Matrix ylim = ap.get_ylim ().matrix_value ();
 
-              // Force immediate redraw
-              redraw (true);
+          if (xlim(0) < p0(0) && xlim(1) > p0(0)
+              && ylim(0) < p0(1) && ylim(1) > p0(1))
+            {
+              axesObj = *it;
+              return;
             }
-            break;
-          case TextMode:
-          case ZoomInMode:
-          case ZoomOutMode:
-            m_mouseCurrent = event->pos ();
-            redraw (true);
-            break;
-
-          case PanMode:
-            {
-              axes::properties& ap = Utils::properties<axes> (ax);
+        }
+    }
+  else if (! currentObj)
+    {
+      for (QList<graphics_object>::ConstIterator it = axesList.begin ();
+           it != axesList.end (); ++it)
+        {
+          graphics_object go = selectFromAxes (*it, event->pos ());
 
-              graphics_object figObj (ax.get_ancestor ("figure"));
-
-              std::string mode = pan_mode (figObj);
+          if (go)
+            {
+              currentObj = go;
+              axesObj = *it;
+            }
+          // FIXME: is this really necessary? the axes object should
+          //        have been selected through selectFromAxes anyway
+          else if (it->get_properties ().is_hittest ())
+            {
+              Matrix bb = it->get_properties ().get_boundingbox (true);
+              QRectF r (bb(0), bb(1), bb(2), bb(3));
 
-              ColumnVector p0 = ap.pixel2coord (m_mouseCurrent.x (),
-                                                m_mouseCurrent.y ());
-              ColumnVector p1 = ap.pixel2coord (event->x (),
-                                                event->y ());
+              // Allow a rectangle (e.g., Zoom box) to be slightly outside
+              // the axes and still select it.
+              r.adjust (-20, -20, 20, 20);
 
-              ap.translate_view (mode, p0(0), p1(0), p0(1), p1(1));
-
-              // Update current mouse position
-              m_mouseCurrent = event->pos ();
-
-              // Force immediate redraw
-              redraw (true);
+              bool rect_contains_pos = r.contains (event->localPos ());
+              if (rect_contains_pos)
+                axesObj = *it;
             }
 
-          default:
+          if (axesObj && currentObj)
             break;
-          }
-      }
-    else if (m_mouseMode == NoMode)
-      {
-        graphics_object obj = gh_mgr.get_object (m_handle);
+        }
+    }
+}
 
-        if (obj.valid_object ())
-          {
-            graphics_object figObj (obj.get_ancestor ("figure"));
+void
+Canvas::canvasMouseMoveEvent (QMouseEvent *event)
+{
+  gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
 
-            if (figObj.valid_object ()
-                && ! figObj.get ("windowbuttonmotionfcn").isempty ())
-              {
-                updateCurrentPoint (figObj, obj, event);
-                emit gh_callback_event (figObj.get_handle (),
-                                        "windowbuttonmotionfcn");
-              }
-          }
-      }
+  octave::autolock guard (gh_mgr.graphics_lock ());
 
-    // Update mouse coordinates in the figure window status bar
-    graphics_object obj = gh_mgr.get_object (m_handle);
-    graphics_object figObj = obj.get_ancestor ("figure");
+  graphics_object ax = gh_mgr.get_object (m_mouseAxes);
 
-    if (figObj.valid_object () && obj.valid_object ())
-      {
-        graphics_object currentObj, axesObj;
-        std::vector<std::string> omit = {"legend", "colorbar", "scribeoverlay"};
-        select_object (obj, event, currentObj, axesObj, true, omit);
-
-        if (axesObj.valid_object ())
+  if (m_mouseMode != NoMode && (ax.valid_object () || m_mouseMode == TextMode))
+    {
+      switch (m_mouseMode)
+        {
+        case RotateMode:
           {
-            // FIXME: should we use signal/slot mechanism instead of
-            //        directly calling parent fig methods
-            Figure *fig =
-              dynamic_cast<Figure *> (qt_graphics_toolkit::toolkitObject (figObj));
-            axes::properties& ap = Utils::properties<axes> (axesObj);
+            axes::properties& ap = Utils::properties<axes> (ax);
 
-            if (fig)
-              fig->updateStatusBar (ap.pixel2coord (event->x (), event->y ()));
-          }
-      }
-  }
+            ap.rotate3d (m_mouseCurrent.x (), event->x (),
+                         m_mouseCurrent.y (), event->y ());
+
+            // Update current mouse position
+            m_mouseCurrent = event->pos ();
 
-  void
-  Canvas::canvasMouseDoubleClickEvent (QMouseEvent *event)
-  {
-    // same processing as normal click, but event type is MouseButtonDblClick
-    canvasMousePressEvent (event);
-  }
-
-  static double
-  button_number (QMouseEvent *event)
-  {
-    double retval = 0;
+            // Force immediate redraw
+            redraw (true);
+          }
+          break;
+        case TextMode:
+        case ZoomInMode:
+        case ZoomOutMode:
+          m_mouseCurrent = event->pos ();
+          redraw (true);
+          break;
 
-    switch (event->button ())
-      {
-      case Qt::LeftButton:
-        retval = 1;
-        break;
-
-      case Qt::MiddleButton:
-        retval = 2;
-        break;
-
-      case Qt::RightButton:
-        retval = 3;
-        break;
+        case PanMode:
+          {
+            axes::properties& ap = Utils::properties<axes> (ax);
 
-      default:
-        break;
-      }
-
-    return retval;
-  }
+            graphics_object figObj (ax.get_ancestor ("figure"));
 
-  void
-  Canvas::canvasMousePressEvent (QMouseEvent *event)
-  {
-    gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
-
-    octave::autolock guard (gh_mgr.graphics_lock ());
+            std::string mode = pan_mode (figObj);
 
-    graphics_object obj = gh_mgr.get_object (m_handle);
-
-    bool isdblclick = (event->type () == QEvent::MouseButtonDblClick);
+            ColumnVector p0 = ap.pixel2coord (m_mouseCurrent.x (),
+                                              m_mouseCurrent.y ());
+            ColumnVector p1 = ap.pixel2coord (event->x (),
+                                              event->y ());
 
-    if (obj.valid_object ())
-      {
-        graphics_object figObj (obj.get_ancestor ("figure"));
+            ap.translate_view (mode, p0(0), p1(0), p0(1), p1(1));
 
-        // Any click in a figure canvas makes it current
-        if (figObj)
-          {
-            graphics_object root = gh_mgr.get_object (0);
-            Utils::properties<root_figure> (root)
-              .set_currentfigure (figObj.get_handle ().as_octave_value ());
+            // Update current mouse position
+            m_mouseCurrent = event->pos ();
+
+            // Force immediate redraw
+            redraw (true);
           }
 
-        graphics_object currentObj, axesObj;
+        default:
+          break;
+        }
+    }
+  else if (m_mouseMode == NoMode)
+    {
+      graphics_object obj = gh_mgr.get_object (m_handle);
+
+      if (obj.valid_object ())
+        {
+          graphics_object figObj (obj.get_ancestor ("figure"));
 
-        // Retrieve selected object.
-        select_object (obj, event, currentObj, axesObj);
+          if (figObj.valid_object ()
+              && ! figObj.get ("windowbuttonmotionfcn").isempty ())
+            {
+              updateCurrentPoint (figObj, obj, event);
+              emit gh_callback_event (figObj.get_handle (),
+                                      "windowbuttonmotionfcn");
+            }
+        }
+    }
+
+  // Update mouse coordinates in the figure window status bar
+  graphics_object obj = gh_mgr.get_object (m_handle);
+  graphics_object figObj = obj.get_ancestor ("figure");
 
-        // currentObj may be invalid if, e.g., all objects under the mouse
-        // click had "hittest" -> "off" or "pickableparts" -> "none".  In that
-        // case, replace with underlying figObj which always accepts mouse
-        // clicks.
-        if (! currentObj.valid_object ())
-          currentObj = figObj;
-        else if (! currentObj.get_properties ().is_hittest ())
-          {
-            // Objects with "hittest"->"off" pass the mouse event to their
-            // parent and so on.
-            graphics_object tmpgo;
-            tmpgo = gh_mgr.get_object (currentObj.get_parent ());
-            while (tmpgo && ! tmpgo.get_properties ().is_hittest ())
-              tmpgo = gh_mgr.get_object (tmpgo.get_parent ());
+  if (figObj.valid_object () && obj.valid_object ())
+    {
+      graphics_object currentObj, axesObj;
+      std::vector<std::string> omit = {"legend", "colorbar", "scribeoverlay"};
+      select_object (obj, event, currentObj, axesObj, true, omit);
+
+      if (axesObj.valid_object ())
+        {
+          // FIXME: should we use signal/slot mechanism instead of
+          //        directly calling parent fig methods
+          Figure *fig =
+            dynamic_cast<Figure *> (qt_graphics_toolkit::toolkitObject (figObj));
+          axes::properties& ap = Utils::properties<axes> (axesObj);
+
+          if (fig)
+            fig->updateStatusBar (ap.pixel2coord (event->x (), event->y ()));
+        }
+    }
+}
+
+void
+Canvas::canvasMouseDoubleClickEvent (QMouseEvent *event)
+{
+  // same processing as normal click, but event type is MouseButtonDblClick
+  canvasMousePressEvent (event);
+}
 
-            if (tmpgo && tmpgo.get_handle () != 0.0)
-              currentObj = tmpgo;
-            else
-              currentObj = graphics_object ();
-          }
+static double
+button_number (QMouseEvent *event)
+{
+  double retval = 0;
+
+  switch (event->button ())
+    {
+    case Qt::LeftButton:
+      retval = 1;
+      break;
+
+    case Qt::MiddleButton:
+      retval = 2;
+      break;
+
+    case Qt::RightButton:
+      retval = 3;
+      break;
+
+    default:
+      break;
+    }
+
+  return retval;
+}
 
-        // Make selected axes current
-        bool valid_axes = axesObj.valid_object ()
-                          && axesObj.get_properties ().handlevisibility_is ("on")
-                          && axesObj.get_properties ().get_tag () != "legend"
-                          && axesObj.get_properties ().get_tag () != "colorbar";
+void
+Canvas::canvasMousePressEvent (QMouseEvent *event)
+{
+  gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+
+  octave::autolock guard (gh_mgr.graphics_lock ());
+
+  graphics_object obj = gh_mgr.get_object (m_handle);
+
+  bool isdblclick = (event->type () == QEvent::MouseButtonDblClick);
 
-        if (valid_axes)
-          Utils::properties<figure> (figObj)
-            .set_currentaxes (axesObj.get_handle ().as_octave_value ());
+  if (obj.valid_object ())
+    {
+      graphics_object figObj (obj.get_ancestor ("figure"));
 
-        Figure *fig = dynamic_cast<Figure *> (qt_graphics_toolkit::toolkitObject (figObj));
+      // Any click in a figure canvas makes it current
+      if (figObj)
+        {
+          graphics_object root = gh_mgr.get_object (0);
+          Utils::properties<root_figure> (root)
+            .set_currentfigure (figObj.get_handle ().as_octave_value ());
+        }
 
-        MouseMode newMouseMode = NoMode;
+      graphics_object currentObj, axesObj;
 
-        if (fig)
-          newMouseMode = fig->mouseMode ();
+      // Retrieve selected object.
+      select_object (obj, event, currentObj, axesObj);
 
-        switch (newMouseMode)
-          {
-          case NoMode:
-            {
-              // Update the figure "currentobject"
-              auto& fprop = Utils::properties<figure> (figObj);
+      // currentObj may be invalid if, e.g., all objects under the mouse
+      // click had "hittest" -> "off" or "pickableparts" -> "none".  In that
+      // case, replace with underlying figObj which always accepts mouse
+      // clicks.
+      if (! currentObj.valid_object ())
+        currentObj = figObj;
+      else if (! currentObj.get_properties ().is_hittest ())
+        {
+          // Objects with "hittest"->"off" pass the mouse event to their
+          // parent and so on.
+          graphics_object tmpgo;
+          tmpgo = gh_mgr.get_object (currentObj.get_parent ());
+          while (tmpgo && ! tmpgo.get_properties ().is_hittest ())
+            tmpgo = gh_mgr.get_object (tmpgo.get_parent ());
+
+          if (tmpgo && tmpgo.get_handle () != 0.0)
+            currentObj = tmpgo;
+          else
+            currentObj = graphics_object ();
+        }
+
+      // Make selected axes current
+      bool valid_axes = axesObj.valid_object ()
+                        && axesObj.get_properties ().handlevisibility_is ("on")
+                        && axesObj.get_properties ().get_tag () != "legend"
+                        && axesObj.get_properties ().get_tag () != "colorbar";
+
+      if (valid_axes)
+        Utils::properties<figure> (figObj)
+          .set_currentaxes (axesObj.get_handle ().as_octave_value ());
+
+      Figure *fig = dynamic_cast<Figure *> (qt_graphics_toolkit::toolkitObject (figObj));
+
+      MouseMode newMouseMode = NoMode;
 
-              if (currentObj
-                  && currentObj.get_properties ().handlevisibility_is ("on"))
-                fprop.set_currentobject (currentObj.get_handle ()
-                                         .as_octave_value ());
-              else
-                fprop.set_currentobject (Matrix ());
+      if (fig)
+        newMouseMode = fig->mouseMode ();
+
+      switch (newMouseMode)
+        {
+        case NoMode:
+          {
+            // Update the figure "currentobject"
+            auto& fprop = Utils::properties<figure> (figObj);
+
+            if (currentObj
+                && currentObj.get_properties ().handlevisibility_is ("on"))
+              fprop.set_currentobject (currentObj.get_handle ()
+                                       .as_octave_value ());
+            else
+              fprop.set_currentobject (Matrix ());
 
-              // Update figure "selectiontype" and "currentpoint"
-              emit gh_set_event (figObj.get_handle (), "selectiontype",
-                                 Utils::figureSelectionType (event, isdblclick),
-                                 false);
+            // Update figure "selectiontype" and "currentpoint"
+            emit gh_set_event (figObj.get_handle (), "selectiontype",
+                               Utils::figureSelectionType (event, isdblclick),
+                               false);
+
+            updateCurrentPoint (figObj, obj, event);
 
-              updateCurrentPoint (figObj, obj, event);
+            emit gh_callback_event (figObj.get_handle (),
+                                    "windowbuttondownfcn",
+                                    button_number (event));
 
+            // Execute the "buttondownfcn" of the selected object.  If the
+            // latter is empty then execute the figure "buttondownfcn"
+            if (currentObj && ! currentObj.get ("buttondownfcn").isempty ())
+              emit gh_callback_event (currentObj.get_handle (),
+                                      "buttondownfcn", button_number (event));
+            else if (figObj && ! figObj.get ("buttondownfcn").isempty ())
               emit gh_callback_event (figObj.get_handle (),
-                                      "windowbuttondownfcn",
-                                      button_number (event));
+                                      "buttondownfcn", button_number (event));
 
-              // Execute the "buttondownfcn" of the selected object.  If the
-              // latter is empty then execute the figure "buttondownfcn"
-              if (currentObj && ! currentObj.get ("buttondownfcn").isempty ())
-                emit gh_callback_event (currentObj.get_handle (),
-                                        "buttondownfcn", button_number (event));
-              else if (figObj && ! figObj.get ("buttondownfcn").isempty ())
-                emit gh_callback_event (figObj.get_handle (),
-                                        "buttondownfcn", button_number (event));
+            // Show context menu of the selected object
+            if (currentObj && event->button () == Qt::RightButton)
+              ContextMenu::executeAt (m_interpreter,
+                                      currentObj.get_properties (),
+                                      event->globalPos ());
+          }
+          break;
 
-              // Show context menu of the selected object
-              if (currentObj && event->button () == Qt::RightButton)
-                ContextMenu::executeAt (m_interpreter,
-                                        currentObj.get_properties (),
-                                        event->globalPos ());
-            }
-            break;
+        case TextMode:
+          {
+            if (event->modifiers () == Qt::NoModifier)
+              {
+                switch (event->buttons ())
+                  {
+                  case Qt::LeftButton:
+                    m_mouseAnchor = m_mouseCurrent = event->pos ();
+                    m_mouseMode = newMouseMode;
+                    m_rectMode = true;
+                  }
+              }
+            redraw (false);
+          }
+          break;
 
-          case TextMode:
+        case PanMode:
+        case RotateMode:
+        case ZoomInMode:
+        case ZoomOutMode:
+          if (valid_axes)
             {
-              if (event->modifiers () == Qt::NoModifier)
+              bool redraw_figure = true;
+
+              if (isdblclick)
+                {
+                  if (event->button () == Qt::LeftButton)
+                    {
+                      axes::properties& ap = Utils::properties<axes> (axesObj);
+
+                      autoscale_axes (gh_mgr, ap);
+                    }
+                  else
+                    {
+                      redraw_figure = false;
+                    }
+                }
+              else if (event->modifiers () == Qt::NoModifier)
                 {
                   switch (event->buttons ())
                     {
                     case Qt::LeftButton:
                       m_mouseAnchor = m_mouseCurrent = event->pos ();
+                      m_mouseAxes = axesObj.get_handle ();
                       m_mouseMode = newMouseMode;
-                      m_rectMode = true;
-                    }
-                }
-              redraw (false);
-            }
-            break;
+                      m_clickMode = newMouseMode == ZoomInMode;
+                      break;
 
-          case PanMode:
-          case RotateMode:
-          case ZoomInMode:
-          case ZoomOutMode:
-            if (valid_axes)
-              {
-                bool redraw_figure = true;
+                    case Qt::RightButton:
+                      if (newMouseMode == ZoomInMode)
+                        {
+                          m_mouseAnchor = m_mouseCurrent = event->pos ();
+                          m_mouseAxes = axesObj.get_handle ();
+                          m_mouseMode = newMouseMode;
+                          m_clickMode = false;
+                        }
 
-                if (isdblclick)
-                  {
-                    if (event->button () == Qt::LeftButton)
+                      break;
+
+                    case Qt::MiddleButton:
                       {
-                        axes::properties& ap = Utils::properties<axes> (axesObj);
+                        axes::properties& ap =
+                          Utils::properties<axes> (axesObj);
 
                         autoscale_axes (gh_mgr, ap);
                       }
-                    else
-                      {
-                        redraw_figure = false;
-                      }
-                  }
-                else if (event->modifiers () == Qt::NoModifier)
-                  {
-                    switch (event->buttons ())
-                      {
-                      case Qt::LeftButton:
-                        m_mouseAnchor = m_mouseCurrent = event->pos ();
-                        m_mouseAxes = axesObj.get_handle ();
-                        m_mouseMode = newMouseMode;
-                        m_clickMode = newMouseMode == ZoomInMode;
-                        break;
+                      break;
 
-                      case Qt::RightButton:
-                        if (newMouseMode == ZoomInMode)
-                          {
-                            m_mouseAnchor = m_mouseCurrent = event->pos ();
-                            m_mouseAxes = axesObj.get_handle ();
-                            m_mouseMode = newMouseMode;
-                            m_clickMode = false;
-                          }
+                    default:
+                      redraw_figure = false;
+                      break;
+                    }
+                }
+              else if (event->modifiers () == Qt::ShiftModifier)
+                {
+                  switch (event->buttons ())
+                    {
+                    case Qt::LeftButton:
+                      if (newMouseMode == ZoomInMode)
+                        {
+                          m_mouseAnchor = m_mouseCurrent = event->pos ();
+                          m_mouseAxes = axesObj.get_handle ();
+                          m_mouseMode = newMouseMode;
+                          m_clickMode = false;
+                        }
+                      break;
 
-                        break;
+                    default:
+                      redraw_figure = false;
+                      break;
+                    }
+                }
 
-                      case Qt::MiddleButton:
-                        {
-                          axes::properties& ap =
-                            Utils::properties<axes> (axesObj);
+              if (redraw_figure)
+                redraw (false);
+            }
+          break;
 
-                          autoscale_axes (gh_mgr, ap);
-                        }
-                        break;
+        default:
+          break;
+        }
+    }
+
+}
 
-                      default:
-                        redraw_figure = false;
-                        break;
-                      }
-                  }
-                else if (event->modifiers () == Qt::ShiftModifier)
-                  {
-                    switch (event->buttons ())
-                      {
-                      case Qt::LeftButton:
-                        if (newMouseMode == ZoomInMode)
-                          {
-                            m_mouseAnchor = m_mouseCurrent = event->pos ();
-                            m_mouseAxes = axesObj.get_handle ();
-                            m_mouseMode = newMouseMode;
-                            m_clickMode = false;
-                          }
-                        break;
+void
+Canvas::canvasMouseReleaseEvent (QMouseEvent *event)
+{
+  gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+
+  if ((m_mouseMode == ZoomInMode || m_mouseMode == ZoomOutMode)
+      && m_mouseAxes.ok ())
+    {
+      octave::autolock guard (gh_mgr.graphics_lock ());
 
-                      default:
-                        redraw_figure = false;
-                        break;
-                      }
-                  }
+      graphics_object ax = gh_mgr.get_object (m_mouseAxes);
+
+      if (ax.valid_object ())
+        {
+          axes::properties& ap = Utils::properties<axes> (ax);
+
+          graphics_object obj = gh_mgr.get_object (m_handle);
+
+          graphics_object figObj (obj.get_ancestor ("figure"));
+
+          std::string zm = zoom_mode (figObj);
 
-                if (redraw_figure)
-                  redraw (false);
-              }
-            break;
+          if (m_mouseAnchor == event->pos ())
+            {
+              double factor = (m_clickMode ? 2.0 : 0.5);
 
-          default:
-            break;
-          }
-      }
-
-  }
+              ColumnVector p1 = ap.pixel2coord (event->x (), event->y ());
 
-  void
-  Canvas::canvasMouseReleaseEvent (QMouseEvent *event)
-  {
-    gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+              ap.zoom_about_point (zm, p1(0), p1(1), factor);
+            }
+          else if (m_mouseMode == ZoomInMode)
+            {
+              ColumnVector p0 = ap.pixel2coord (m_mouseAnchor.x (),
+                                                m_mouseAnchor.y ());
+              ColumnVector p1 = ap.pixel2coord (event->x (),
+                                                event->y ());
 
-    if ((m_mouseMode == ZoomInMode || m_mouseMode == ZoomOutMode)
-        && m_mouseAxes.ok ())
-      {
-        octave::autolock guard (gh_mgr.graphics_lock ());
+              Matrix xl (1, 2, 0.0);
+              Matrix yl (1, 2, 0.0);
 
-        graphics_object ax = gh_mgr.get_object (m_mouseAxes);
-
-        if (ax.valid_object ())
-          {
-            axes::properties& ap = Utils::properties<axes> (ax);
-
-            graphics_object obj = gh_mgr.get_object (m_handle);
+              xl(0) = std::min (p0(0), p1(0));
+              xl(1) = std::max (p0(0), p1(0));
+              yl(0) = std::min (p0(1), p1(1));
+              yl(1) = std::max (p0(1), p1(1));
 
-            graphics_object figObj (obj.get_ancestor ("figure"));
-
-            std::string zm = zoom_mode (figObj);
-
-            if (m_mouseAnchor == event->pos ())
-              {
-                double factor = (m_clickMode ? 2.0 : 0.5);
+              ap.zoom (zm, xl, yl);
+            }
 
-                ColumnVector p1 = ap.pixel2coord (event->x (), event->y ());
+          redraw (false);
+        }
+    }
+  else if (m_mouseMode == NoMode)
+    {
+      octave::autolock guard (gh_mgr.graphics_lock ());
 
-                ap.zoom_about_point (zm, p1(0), p1(1), factor);
-              }
-            else if (m_mouseMode == ZoomInMode)
-              {
-                ColumnVector p0 = ap.pixel2coord (m_mouseAnchor.x (),
-                                                  m_mouseAnchor.y ());
-                ColumnVector p1 = ap.pixel2coord (event->x (),
-                                                  event->y ());
+      graphics_object obj = gh_mgr.get_object (m_handle);
+
+      if (obj.valid_object ())
+        {
+          graphics_object figObj (obj.get_ancestor ("figure"));
 
-                Matrix xl (1, 2, 0.0);
-                Matrix yl (1, 2, 0.0);
+          updateCurrentPoint (figObj, obj, event);
+          emit gh_callback_event (figObj.get_handle (), "windowbuttonupfcn");
+        }
+    }
+  else if (m_mouseMode == TextMode)
+    {
+      octave::autolock guard (gh_mgr.graphics_lock ());
 
-                xl(0) = std::min (p0(0), p1(0));
-                xl(1) = std::max (p0(0), p1(0));
-                yl(0) = std::min (p0(1), p1(1));
-                yl(1) = std::max (p0(1), p1(1));
-
-                ap.zoom (zm, xl, yl);
-              }
+      graphics_object figObj
+        = gh_mgr.get_object (m_handle).get_ancestor ("figure");
 
-            redraw (false);
-          }
-      }
-    else if (m_mouseMode == NoMode)
-      {
-        octave::autolock guard (gh_mgr.graphics_lock ());
+      if (figObj.valid_object ())
+        {
+          QWidget *w = qWidget ();
+          if (w)
+            {
+              Matrix bb = figObj.get ("position").matrix_value ();
+              bb(0) = m_mouseAnchor.x () / bb(2);
+              bb(1) = 1.0 - (m_mouseAnchor.y () / bb(3));
+              bb(2) = (event->x () - m_mouseAnchor.x ()) / bb(2);
+              bb(3) = (m_mouseAnchor.y () - event->y ()) / bb(3);
 
-        graphics_object obj = gh_mgr.get_object (m_handle);
+              octave_value_list props = ovl ("textbox", bb);
 
-        if (obj.valid_object ())
-          {
-            graphics_object figObj (obj.get_ancestor ("figure"));
+              annotation_dialog anno_dlg (w, props);
 
-            updateCurrentPoint (figObj, obj, event);
-            emit gh_callback_event (figObj.get_handle (), "windowbuttonupfcn");
-          }
-      }
-    else if (m_mouseMode == TextMode)
-      {
-        octave::autolock guard (gh_mgr.graphics_lock ());
-
-        graphics_object figObj
-          = gh_mgr.get_object (m_handle).get_ancestor ("figure");
+              if (anno_dlg.exec () == QDialog::Accepted)
+                {
+                  props = anno_dlg.get_properties ();
+                  props.prepend (figObj.get_handle ().as_octave_value ());
 
-        if (figObj.valid_object ())
-          {
-            QWidget *w = qWidget ();
-            if (w)
-              {
-                Matrix bb = figObj.get ("position").matrix_value ();
-                bb(0) = m_mouseAnchor.x () / bb(2);
-                bb(1) = 1.0 - (m_mouseAnchor.y () / bb(3));
-                bb(2) = (event->x () - m_mouseAnchor.x ()) / bb(2);
-                bb(3) = (m_mouseAnchor.y () - event->y ()) / bb(3);
+                  emit interpreter_event
+                    ([=] (octave::interpreter& interp)
+                     {
+                       // INTERPRETER THREAD
 
-                octave_value_list props = ovl ("textbox", bb);
+                       interp.feval ("annotation", props);
 
-                annotation_dialog anno_dlg (w, props);
-
-                if (anno_dlg.exec () == QDialog::Accepted)
-                  {
-                    props = anno_dlg.get_properties ();
-                    props.prepend (figObj.get_handle ().as_octave_value ());
-
-                    emit interpreter_event
-                      ([=] (octave::interpreter& interp)
-                       {
-                         // INTERPRETER THREAD
+                       redraw ();
+                     });
+                }
+            }
+        }
+    }
+  m_rectMode = false;
+  m_mouseAxes = graphics_handle ();
+  m_mouseMode = NoMode;
+}
 
-                         interp.feval ("annotation", props);
+void
+Canvas::canvasWheelEvent (QWheelEvent *event)
+{
+  gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+
+  octave::autolock guard (gh_mgr.graphics_lock ());
+
+  graphics_object obj = gh_mgr.get_object (m_handle);
 
-                         redraw ();
-                       });
-                  }
-              }
-          }
-      }
-    m_rectMode = false;
-    m_mouseAxes = graphics_handle ();
-    m_mouseMode = NoMode;
-  }
+  if (obj.valid_object ())
+    {
+      std::string mode;
+
+      graphics_object figObj (obj.get_ancestor ("figure"));
+
+      graphics_object axesObj;
+
+      Matrix children = obj.get_properties ().get_children ();
+      octave_idx_type num_children = children.numel ();
 
-  void
-  Canvas::canvasWheelEvent (QWheelEvent *event)
-  {
-    gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
-
-    octave::autolock guard (gh_mgr.graphics_lock ());
-
-    graphics_object obj = gh_mgr.get_object (m_handle);
+      for (int i = 0; i < num_children; i++)
+        {
+          graphics_object childObj (gh_mgr.get_object (children(i)));
 
-    if (obj.valid_object ())
-      {
-        std::string mode;
-
-        graphics_object figObj (obj.get_ancestor ("figure"));
-
-        graphics_object axesObj;
-
-        Matrix children = obj.get_properties ().get_children ();
-        octave_idx_type num_children = children.numel ();
+          if (childObj.isa ("axes"))
+            {
+#if defined (HAVE_QWHEELEVENT_POSITION)
+              QPoint pos = event->position().toPoint ();
+#else
+              QPoint pos = event->pos ();
+#endif
+              graphics_object go = selectFromAxes (childObj, pos);
 
-        for (int i = 0; i < num_children; i++)
-          {
-            graphics_object childObj (gh_mgr.get_object (children(i)));
-
-            if (childObj.isa ("axes"))
-              {
-#if defined (HAVE_QWHEELEVENT_POSITION)
-                QPoint pos = event->position().toPoint ();
-#else
-                QPoint pos = event->pos ();
-#endif
-                graphics_object go = selectFromAxes (childObj, pos);
+              if (go)
+                {
+                  axesObj = childObj;
+                  break;
+                }
+            }
+        }
 
-                if (go)
-                  {
-                    axesObj = childObj;
-                    break;
-                  }
-              }
-          }
+      if (axesObj)
+        {
+          MouseMode newMouseMode = NoMode;
+
+          Figure *fig = dynamic_cast<Figure *> (qt_graphics_toolkit::toolkitObject (figObj));
 
-        if (axesObj)
-          {
-            MouseMode newMouseMode = NoMode;
+          if (fig)
+            newMouseMode = fig->mouseMode ();
 
-            Figure *fig = dynamic_cast<Figure *> (qt_graphics_toolkit::toolkitObject (figObj));
+          if (axesObj.get_properties ().handlevisibility_is ("on"))
+            {
+              Utils::properties<figure> (figObj)
+              .set_currentaxes (axesObj.get_handle ().as_octave_value ());
 
-            if (fig)
-              newMouseMode = fig->mouseMode ();
+              if (zoom_enabled (figObj))
+                {
+                  if (event->angleDelta().y () > 0)
+                    newMouseMode = ZoomInMode;
+                  else
+                    newMouseMode = ZoomOutMode;
 
-            if (axesObj.get_properties ().handlevisibility_is ("on"))
-              {
-                Utils::properties<figure> (figObj)
-                .set_currentaxes (axesObj.get_handle ().as_octave_value ());
+                  mode = zoom_mode (figObj);
+                }
+              else if (pan_enabled (figObj))
+                {
+                  newMouseMode = PanMode;
+
+                  mode = pan_mode (figObj);
+                }
+            }
+
+          bool redrawFigure = true;
 
-                if (zoom_enabled (figObj))
-                  {
-                    if (event->angleDelta().y () > 0)
-                      newMouseMode = ZoomInMode;
-                    else
-                      newMouseMode = ZoomOutMode;
+          switch (newMouseMode)
+            {
+            case ZoomInMode:
+            case ZoomOutMode:
+              {
+                axes::properties& ap = Utils::properties<axes> (axesObj);
 
-                    mode = zoom_mode (figObj);
-                  }
-                else if (pan_enabled (figObj))
-                  {
-                    newMouseMode = PanMode;
+                // Control how fast to zoom when using scroll wheel.
+                double wheel_zoom_speed = ap.get_mousewheelzoom ();
 
-                    mode = pan_mode (figObj);
-                  }
+                // Determine if we're zooming in or out.
+                double factor = (newMouseMode == ZoomInMode
+                                 ? 1 / (1.0 - wheel_zoom_speed)
+                                 : 1.0 - wheel_zoom_speed);
+
+                // FIXME: should we zoom about point for 2D plots?
+
+                ap.zoom (mode, factor);
               }
-
-            bool redrawFigure = true;
-
-            switch (newMouseMode)
-              {
-              case ZoomInMode:
-              case ZoomOutMode:
-                {
-                  axes::properties& ap = Utils::properties<axes> (axesObj);
+              break;
 
-                  // Control how fast to zoom when using scroll wheel.
-                  double wheel_zoom_speed = ap.get_mousewheelzoom ();
+            case PanMode:
+              {
+                axes::properties& ap = Utils::properties<axes> (axesObj);
 
-                  // Determine if we're zooming in or out.
-                  double factor = (newMouseMode == ZoomInMode
-                                   ? 1 / (1.0 - wheel_zoom_speed)
-                                   : 1.0 - wheel_zoom_speed);
-
-                  // FIXME: should we zoom about point for 2D plots?
-
-                  ap.zoom (mode, factor);
-                }
-                break;
+                double factor = (event->angleDelta().y () > 0 ? 0.1 : -0.1);
 
-              case PanMode:
-                {
-                  axes::properties& ap = Utils::properties<axes> (axesObj);
-
-                  double factor = (event->angleDelta().y () > 0 ? 0.1 : -0.1);
+                if (event->modifiers () == Qt::NoModifier
+                    && mode != "horizontal")
+                  ap.pan ("vertical", factor);
+                else if (event->modifiers () == Qt::ShiftModifier
+                         && mode != "vertical")
+                  ap.pan ("horizontal", factor);
+              }
+              break;
 
-                  if (event->modifiers () == Qt::NoModifier
-                      && mode != "horizontal")
-                    ap.pan ("vertical", factor);
-                  else if (event->modifiers () == Qt::ShiftModifier
-                           && mode != "vertical")
-                    ap.pan ("horizontal", factor);
-                }
-                break;
+            default:
+              redrawFigure = false;
+              break;
+            }
 
-              default:
-                redrawFigure = false;
-                break;
-              }
-
-            if (redrawFigure)
-              redraw (false);
-          }
+          if (redrawFigure)
+            redraw (false);
+        }
 
-        if (! figObj.get ("windowscrollwheelfcn").isempty ())
-          {
-            octave_scalar_map eventData = Utils::makeScrollEventStruct (event);
-            emit gh_callback_event (m_handle, "windowscrollwheelfcn",
-                                    eventData);
-          }
-      }
-  }
+      if (! figObj.get ("windowscrollwheelfcn").isempty ())
+        {
+          octave_scalar_map eventData = Utils::makeScrollEventStruct (event);
+          emit gh_callback_event (m_handle, "windowscrollwheelfcn",
+                                  eventData);
+        }
+    }
+}
 
-  bool
-  Canvas::canvasKeyPressEvent (QKeyEvent *event)
-  {
-    if (m_eventMask & KeyPress)
-      {
-        gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+bool
+Canvas::canvasKeyPressEvent (QKeyEvent *event)
+{
+  if (m_eventMask & KeyPress)
+    {
+      gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
 
-        octave::autolock guard (gh_mgr.graphics_lock ());
+      octave::autolock guard (gh_mgr.graphics_lock ());
 
-        graphics_object obj = gh_mgr.get_object (m_handle);
+      graphics_object obj = gh_mgr.get_object (m_handle);
 
-        if (obj.valid_object ())
-          {
-            graphics_object figObj (obj.get_ancestor ("figure"));
+      if (obj.valid_object ())
+        {
+          graphics_object figObj (obj.get_ancestor ("figure"));
+
+          updateCurrentPoint (figObj, obj);
 
-            updateCurrentPoint (figObj, obj);
-
-            octave_scalar_map eventData = Utils::makeKeyEventStruct (event);
+          octave_scalar_map eventData = Utils::makeKeyEventStruct (event);
 
-            emit gh_set_event (figObj.get_handle (), "currentcharacter",
-                               eventData.getfield ("Character"), false);
-            emit gh_callback_event (figObj.get_handle (), "keypressfcn",
-                                    eventData);
-          }
+          emit gh_set_event (figObj.get_handle (), "currentcharacter",
+                             eventData.getfield ("Character"), false);
+          emit gh_callback_event (figObj.get_handle (), "keypressfcn",
+                                  eventData);
+        }
+
+      return true;
+    }
 
-        return true;
-      }
-
-    return false;
-  }
+  return false;
+}
 
-  bool
-  Canvas::canvasKeyReleaseEvent (QKeyEvent *event)
-  {
-    if (! event->isAutoRepeat () && (m_eventMask & KeyRelease))
-      {
-        gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+bool
+Canvas::canvasKeyReleaseEvent (QKeyEvent *event)
+{
+  if (! event->isAutoRepeat () && (m_eventMask & KeyRelease))
+    {
+      gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+
+      octave::autolock guard (gh_mgr.graphics_lock ());
 
-        octave::autolock guard (gh_mgr.graphics_lock ());
-
-        graphics_object obj = gh_mgr.get_object (m_handle);
+      graphics_object obj = gh_mgr.get_object (m_handle);
 
-        if (obj.valid_object ())
-          {
-            graphics_object figObj (obj.get_ancestor ("figure"));
-            emit gh_callback_event (figObj.get_handle (), "keyreleasefcn",
-                                    Utils::makeKeyEventStruct (event));
-          }
+      if (obj.valid_object ())
+        {
+          graphics_object figObj (obj.get_ancestor ("figure"));
+          emit gh_callback_event (figObj.get_handle (), "keyreleasefcn",
+                                  Utils::makeKeyEventStruct (event));
+        }
+
+      return true;
+    }
 
-        return true;
-      }
-
-    return false;
-  }
+  return false;
+}
 
-  Canvas *
-  Canvas::create (octave::interpreter& interp,
-                  const graphics_handle& handle, QWidget *parent,
-                  const std::string& /* name */)
-  {
-    // Only OpenGL
-    return new GLCanvas (interp, handle, parent);
-  }
+Canvas *
+Canvas::create (octave::interpreter& interp,
+                const graphics_handle& handle, QWidget *parent,
+                const std::string& /* name */)
+{
+  // Only OpenGL
+  return new GLCanvas (interp, handle, parent);
+}
 
 OCTAVE_END_NAMESPACE(octave)
--- a/libgui/graphics/Canvas.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/Canvas.h	Thu Feb 02 12:25:51 2023 -0800
@@ -43,123 +43,123 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class interpreter;
+class interpreter;
 
-  class Canvas : public QObject
-  {
-    Q_OBJECT
+class Canvas : public QObject
+{
+  Q_OBJECT
 
-  public:
-    enum EventMask
-    {
-      KeyPress   = 0x01,
-      KeyRelease = 0x02
-    };
+public:
+  enum EventMask
+  {
+    KeyPress   = 0x01,
+    KeyRelease = 0x02
+  };
 
-  public:
-    virtual ~Canvas () = default;
+public:
+  virtual ~Canvas () = default;
 
-    void redraw (bool sync = false);
-    void blockRedraw (bool block = true);
+  void redraw (bool sync = false);
+  void blockRedraw (bool block = true);
 
-    void print (const QString& file_cmd, const QString& term)
-    {
-      do_print (file_cmd, term, m_handle);
-    }
+  void print (const QString& file_cmd, const QString& term)
+  {
+    do_print (file_cmd, term, m_handle);
+  }
 
-    void addEventMask (int m) { m_eventMask |= m; }
-    void clearEventMask (int m) { m_eventMask &= (~m); }
-    void setEventMask (int m) { m_eventMask = m; }
+  void addEventMask (int m) { m_eventMask |= m; }
+  void clearEventMask (int m) { m_eventMask &= (~m); }
+  void setEventMask (int m) { m_eventMask = m; }
 
-    void setCursor (MouseMode mode, std::string fallback,
-                    QImage cdata, Matrix hotspot);
+  void setCursor (MouseMode mode, std::string fallback,
+                  QImage cdata, Matrix hotspot);
 
-    virtual QWidget * qWidget () = 0;
+  virtual QWidget * qWidget () = 0;
 
-    static Canvas *
-    create (octave::interpreter& interp, const graphics_handle& handle,
-            QWidget *parent, const std::string& name);
+  static Canvas *
+  create (octave::interpreter& interp, const graphics_handle& handle,
+          QWidget *parent, const std::string& name);
 
-    virtual uint8NDArray getPixels () { return do_getPixels (m_handle); };
+  virtual uint8NDArray getPixels () { return do_getPixels (m_handle); };
 
-  signals:
+signals:
 
-    void interpreter_event (const octave::fcn_callback& fcn);
-    void interpreter_event (const octave::meth_callback& meth);
+  void interpreter_event (const octave::fcn_callback& fcn);
+  void interpreter_event (const octave::meth_callback& meth);
 
-    void gh_callback_event (const graphics_handle& h, const std::string& name);
+  void gh_callback_event (const graphics_handle& h, const std::string& name);
 
-    void gh_callback_event (const graphics_handle& h, const std::string& name,
-                            const octave_value& data);
+  void gh_callback_event (const graphics_handle& h, const std::string& name,
+                          const octave_value& data);
 
-    void gh_set_event (const graphics_handle& h, const std::string& name,
-                       const octave_value& value);
+  void gh_set_event (const graphics_handle& h, const std::string& name,
+                     const octave_value& value);
 
-    void gh_set_event (const graphics_handle& h, const std::string& name,
-                       const octave_value& value, bool notify_toolkit);
+  void gh_set_event (const graphics_handle& h, const std::string& name,
+                     const octave_value& value, bool notify_toolkit);
 
-    void gh_set_event (const graphics_handle& h, const std::string& name,
-                       const octave_value& value, bool notify_toolkit,
-                       bool redraw_figure);
-  protected:
-    virtual void draw (const graphics_handle& handle) = 0;
-    virtual void drawZoomBox (const QPoint& p1, const QPoint& p2) = 0;
-    virtual void resize (int x, int y, int width, int height) = 0;
-    virtual graphics_object selectFromAxes (const graphics_object& ax,
-                                            const QPoint& pt) = 0;
-    virtual uint8NDArray do_getPixels (const graphics_handle& handle) = 0;
-    virtual void do_print (const QString& file_cmd, const QString& term,
-                           const graphics_handle& handle) = 0;
+  void gh_set_event (const graphics_handle& h, const std::string& name,
+                     const octave_value& value, bool notify_toolkit,
+                     bool redraw_figure);
+protected:
+  virtual void draw (const graphics_handle& handle) = 0;
+  virtual void drawZoomBox (const QPoint& p1, const QPoint& p2) = 0;
+  virtual void resize (int x, int y, int width, int height) = 0;
+  virtual graphics_object selectFromAxes (const graphics_object& ax,
+                                          const QPoint& pt) = 0;
+  virtual uint8NDArray do_getPixels (const graphics_handle& handle) = 0;
+  virtual void do_print (const QString& file_cmd, const QString& term,
+                         const graphics_handle& handle) = 0;
 
-  protected:
+protected:
 
-    Canvas (octave::interpreter& interp, const graphics_handle& handle)
-      : QObject (), m_interpreter (interp), m_handle (handle),
-        m_redrawBlocked (false), m_mouseMode (NoMode), m_clickMode (false),
-        m_eventMask (0), m_rectMode (false)
-    { }
+  Canvas (octave::interpreter& interp, const graphics_handle& handle)
+    : QObject (), m_interpreter (interp), m_handle (handle),
+      m_redrawBlocked (false), m_mouseMode (NoMode), m_clickMode (false),
+      m_eventMask (0), m_rectMode (false)
+  { }
 
-  public:
-    void canvasToggleAxes (const graphics_handle& handle);
-    void canvasToggleGrid (const graphics_handle& handle);
-    void canvasAutoAxes (const graphics_handle& handle);
-    void canvasPaintEvent ();
-    void canvasMouseDoubleClickEvent (QMouseEvent *event);
-    void canvasMouseMoveEvent (QMouseEvent *event);
-    void canvasMousePressEvent (QMouseEvent *event);
-    void canvasMouseReleaseEvent (QMouseEvent *event);
-    void canvasWheelEvent (QWheelEvent *event);
-    bool canvasKeyPressEvent (QKeyEvent *event);
-    bool canvasKeyReleaseEvent (QKeyEvent *event);
+public:
+  void canvasToggleAxes (const graphics_handle& handle);
+  void canvasToggleGrid (const graphics_handle& handle);
+  void canvasAutoAxes (const graphics_handle& handle);
+  void canvasPaintEvent ();
+  void canvasMouseDoubleClickEvent (QMouseEvent *event);
+  void canvasMouseMoveEvent (QMouseEvent *event);
+  void canvasMousePressEvent (QMouseEvent *event);
+  void canvasMouseReleaseEvent (QMouseEvent *event);
+  void canvasWheelEvent (QWheelEvent *event);
+  bool canvasKeyPressEvent (QKeyEvent *event);
+  bool canvasKeyReleaseEvent (QKeyEvent *event);
 
-    void updateCurrentPoint (const graphics_object& fig,
-                             const graphics_object& obj, QMouseEvent *event);
-    void updateCurrentPoint (const graphics_object& fig,
-                             const graphics_object& obj);
+  void updateCurrentPoint (const graphics_object& fig,
+                           const graphics_object& obj, QMouseEvent *event);
+  void updateCurrentPoint (const graphics_object& fig,
+                           const graphics_object& obj);
 
-    void select_object (graphics_object obj, QMouseEvent *event,
-                        graphics_object& currentObj, graphics_object& axesObj,
-                        bool axes_only = false,
-                        std::vector<std::string> omit = std::vector<std::string> ());
+  void select_object (graphics_object obj, QMouseEvent *event,
+                      graphics_object& currentObj, graphics_object& axesObj,
+                      bool axes_only = false,
+                      std::vector<std::string> omit = std::vector<std::string> ());
 
-  protected:
+protected:
 
-    octave::interpreter& m_interpreter;
+  octave::interpreter& m_interpreter;
 
-  private:
+private:
 
-    QCursor make_cursor (const QString& name, int hot_x  = -1, int hot_y = -1);
+  QCursor make_cursor (const QString& name, int hot_x  = -1, int hot_y = -1);
 
-    graphics_handle m_handle;
-    bool m_redrawBlocked;
-    MouseMode m_mouseMode;
-    bool m_clickMode;              // True: ZoomIn, False: ZoomOut
-    QPoint m_mouseAnchor;
-    QPoint m_mouseCurrent;
-    graphics_handle m_mouseAxes;
-    int m_eventMask;
-    bool m_rectMode;
-  };
+  graphics_handle m_handle;
+  bool m_redrawBlocked;
+  MouseMode m_mouseMode;
+  bool m_clickMode;              // True: ZoomIn, False: ZoomOut
+  QPoint m_mouseAnchor;
+  QPoint m_mouseCurrent;
+  graphics_handle m_mouseAxes;
+  int m_eventMask;
+  bool m_rectMode;
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/graphics/CheckBoxControl.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/CheckBoxControl.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -34,60 +34,60 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  CheckBoxControl *
-  CheckBoxControl::create (octave::interpreter& interp,
-                           const graphics_object& go)
-  {
-    Object *parent = parentObject (interp, go);
+CheckBoxControl *
+CheckBoxControl::create (octave::interpreter& interp,
+                         const graphics_object& go)
+{
+  Object *parent = parentObject (interp, go);
 
-    if (parent)
-      {
-        Container *container = parent->innerContainer ();
+  if (parent)
+    {
+      Container *container = parent->innerContainer ();
 
-        if (container)
-          return new CheckBoxControl (interp, go,
-                                      new QCheckBox (container));
-      }
+      if (container)
+        return new CheckBoxControl (interp, go,
+                                    new QCheckBox (container));
+    }
 
-    return nullptr;
-  }
+  return nullptr;
+}
 
-  CheckBoxControl::CheckBoxControl (octave::interpreter& interp,
-                                    const graphics_object& go, QCheckBox *box)
-    : ButtonControl (interp, go, box)
-  {
-    uicontrol::properties& up = properties<uicontrol> ();
+CheckBoxControl::CheckBoxControl (octave::interpreter& interp,
+                                  const graphics_object& go, QCheckBox *box)
+  : ButtonControl (interp, go, box)
+{
+  uicontrol::properties& up = properties<uicontrol> ();
 
-    box->setAutoFillBackground (true);
-    if (up.enable_is ("inactive"))
-      box->setCheckable (false);
-  }
+  box->setAutoFillBackground (true);
+  if (up.enable_is ("inactive"))
+    box->setCheckable (false);
+}
 
-  CheckBoxControl::~CheckBoxControl ()
-  { }
+CheckBoxControl::~CheckBoxControl ()
+{ }
 
-  void
-  CheckBoxControl::update (int pId)
-  {
-    uicontrol::properties& up = properties<uicontrol> ();
-    QCheckBox *box = qWidget<QCheckBox> ();
+void
+CheckBoxControl::update (int pId)
+{
+  uicontrol::properties& up = properties<uicontrol> ();
+  QCheckBox *box = qWidget<QCheckBox> ();
 
-    switch (pId)
+  switch (pId)
+    {
+    case uicontrol::properties::ID_ENABLE:
       {
-      case uicontrol::properties::ID_ENABLE:
-        {
-          if (up.enable_is ("inactive"))
-            box->setCheckable (false);
-          else
-            box->setCheckable (true);
-          ButtonControl::update (pId);
-        }
-        break;
+        if (up.enable_is ("inactive"))
+          box->setCheckable (false);
+        else
+          box->setCheckable (true);
+        ButtonControl::update (pId);
+      }
+      break;
 
-      default:
-        ButtonControl::update (pId);
-        break;
-      }
-  }
+    default:
+      ButtonControl::update (pId);
+      break;
+    }
+}
 
 OCTAVE_END_NAMESPACE(octave);
--- a/libgui/graphics/CheckBoxControl.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/CheckBoxControl.h	Thu Feb 02 12:25:51 2023 -0800
@@ -32,22 +32,22 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class interpreter;
+class interpreter;
 
-  class CheckBoxControl : public ButtonControl
-  {
-  public:
-    CheckBoxControl (octave::interpreter& interp, const graphics_object& go,
-                     QCheckBox *box);
-    ~CheckBoxControl ();
+class CheckBoxControl : public ButtonControl
+{
+public:
+  CheckBoxControl (octave::interpreter& interp, const graphics_object& go,
+                   QCheckBox *box);
+  ~CheckBoxControl ();
 
-    static CheckBoxControl *
-    create (octave::interpreter& interp,
-            const graphics_object& go);
+  static CheckBoxControl *
+  create (octave::interpreter& interp,
+          const graphics_object& go);
 
-  protected:
-    void update (int pId);
-  };
+protected:
+  void update (int pId);
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/graphics/Container.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/Container.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -40,147 +40,147 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  Container::Container (QWidget *xparent, octave::interpreter& interp)
-    : ContainerBase (xparent), m_interpreter (interp),  m_canvas (nullptr)
-  {
-    setFocusPolicy (Qt::ClickFocus);
-  }
+Container::Container (QWidget *xparent, octave::interpreter& interp)
+  : ContainerBase (xparent), m_interpreter (interp),  m_canvas (nullptr)
+{
+  setFocusPolicy (Qt::ClickFocus);
+}
 
-  Container::~Container ()
-  { }
+Container::~Container ()
+{ }
 
-  Canvas *
-  Container::canvas (const graphics_handle& gh, bool xcreate)
-  {
-    if (! m_canvas && xcreate)
-      {
-        gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+Canvas *
+Container::canvas (const graphics_handle& gh, bool xcreate)
+{
+  if (! m_canvas && xcreate)
+    {
+      gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
 
-        octave::autolock guard (gh_mgr.graphics_lock ());
+      octave::autolock guard (gh_mgr.graphics_lock ());
 
-        graphics_object go = gh_mgr.get_object (gh);
+      graphics_object go = gh_mgr.get_object (gh);
 
-        if (go)
-          {
-            graphics_object fig = go.get_ancestor ("figure");
+      if (go)
+        {
+          graphics_object fig = go.get_ancestor ("figure");
 
-            m_canvas = Canvas::create (m_interpreter, gh, this,
-                                       fig.get ("renderer").string_value ());
+          m_canvas = Canvas::create (m_interpreter, gh, this,
+                                     fig.get ("renderer").string_value ());
 
-            connect (m_canvas, QOverload<const octave::fcn_callback&>::of (&Canvas::interpreter_event),
-                     this, QOverload<const octave::fcn_callback&>::of (&Container::interpreter_event));
+          connect (m_canvas, QOverload<const octave::fcn_callback&>::of (&Canvas::interpreter_event),
+                   this, QOverload<const octave::fcn_callback&>::of (&Container::interpreter_event));
 
-            connect (m_canvas, QOverload<const octave::meth_callback&>::of (&Canvas::interpreter_event),
-                     this, QOverload<const octave::meth_callback&>::of (&Container::interpreter_event));
+          connect (m_canvas, QOverload<const octave::meth_callback&>::of (&Canvas::interpreter_event),
+                   this, QOverload<const octave::meth_callback&>::of (&Container::interpreter_event));
 
-            connect (m_canvas,
-                     SIGNAL (gh_callback_event (const graphics_handle&,
-                                                const std::string&)),
-                     this,
-                     SIGNAL (gh_callback_event (const graphics_handle&,
-                                                const std::string&)));
+          connect (m_canvas,
+                   SIGNAL (gh_callback_event (const graphics_handle&,
+                                              const std::string&)),
+                   this,
+                   SIGNAL (gh_callback_event (const graphics_handle&,
+                                              const std::string&)));
 
-            connect (m_canvas,
-                     SIGNAL (gh_callback_event (const graphics_handle&,
-                                                const std::string&,
-                                                const octave_value&)),
-                     this,
-                     SIGNAL (gh_callback_event (const graphics_handle&,
-                                                const std::string&,
-                                                const octave_value&)));
+          connect (m_canvas,
+                   SIGNAL (gh_callback_event (const graphics_handle&,
+                                              const std::string&,
+                                              const octave_value&)),
+                   this,
+                   SIGNAL (gh_callback_event (const graphics_handle&,
+                                              const std::string&,
+                                              const octave_value&)));
 
-            connect (m_canvas,
-                     SIGNAL (gh_set_event (const graphics_handle&,
-                                           const std::string&,
-                                           const octave_value&)),
-                     this,
-                     SIGNAL (gh_set_event (const graphics_handle&,
-                                           const std::string&,
-                                           const octave_value&)));
+          connect (m_canvas,
+                   SIGNAL (gh_set_event (const graphics_handle&,
+                                         const std::string&,
+                                         const octave_value&)),
+                   this,
+                   SIGNAL (gh_set_event (const graphics_handle&,
+                                         const std::string&,
+                                         const octave_value&)));
 
-            connect (m_canvas,
-                     SIGNAL (gh_set_event (const graphics_handle&,
-                                           const std::string&,
-                                           const octave_value&, bool)),
-                     this,
-                     SIGNAL (gh_set_event (const graphics_handle&,
-                                           const std::string&,
-                                           const octave_value&, bool)));
+          connect (m_canvas,
+                   SIGNAL (gh_set_event (const graphics_handle&,
+                                         const std::string&,
+                                         const octave_value&, bool)),
+                   this,
+                   SIGNAL (gh_set_event (const graphics_handle&,
+                                         const std::string&,
+                                         const octave_value&, bool)));
 
-            connect (m_canvas,
-                     SIGNAL (gh_set_event (const graphics_handle&,
-                                           const std::string&,
-                                           const octave_value&, bool, bool)),
-                     this,
-                     SIGNAL (gh_set_event (const graphics_handle&,
-                                           const std::string&,
-                                           const octave_value&, bool, bool)));
+          connect (m_canvas,
+                   SIGNAL (gh_set_event (const graphics_handle&,
+                                         const std::string&,
+                                         const octave_value&, bool, bool)),
+                   this,
+                   SIGNAL (gh_set_event (const graphics_handle&,
+                                         const std::string&,
+                                         const octave_value&, bool, bool)));
 
-            QWidget *canvasWidget = m_canvas->qWidget ();
+          QWidget *canvasWidget = m_canvas->qWidget ();
 
-            canvasWidget->lower ();
-            canvasWidget->show ();
-            canvasWidget->setGeometry (0, 0, width (), height ());
-          }
-      }
+          canvasWidget->lower ();
+          canvasWidget->show ();
+          canvasWidget->setGeometry (0, 0, width (), height ());
+        }
+    }
 
-    return m_canvas;
-  }
+  return m_canvas;
+}
 
-  void
-  Container::resizeEvent (QResizeEvent * /* event */)
-  {
-    if (m_canvas)
-      m_canvas->qWidget ()->setGeometry (0, 0, width (), height ());
+void
+Container::resizeEvent (QResizeEvent * /* event */)
+{
+  if (m_canvas)
+    m_canvas->qWidget ()->setGeometry (0, 0, width (), height ());
 
-    gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+  gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
 
-    octave::autolock guard (gh_mgr.graphics_lock ());
+  octave::autolock guard (gh_mgr.graphics_lock ());
 
-    for (auto *qObj : children ())
-      {
-        if (qObj->isWidgetType ())
-          {
-            Object *obj = Object::fromQObject (qObj);
+  for (auto *qObj : children ())
+    {
+      if (qObj->isWidgetType ())
+        {
+          Object *obj = Object::fromQObject (qObj);
 
-            if (obj)
-              {
-                graphics_object go = obj->object ();
+          if (obj)
+            {
+              graphics_object go = obj->object ();
 
-                if (go.valid_object ())
-                  {
-                    Matrix bb = go.get_properties ().get_boundingbox (false);
+              if (go.valid_object ())
+                {
+                  Matrix bb = go.get_properties ().get_boundingbox (false);
 
-                    obj->qWidget<QWidget> ()->setGeometry
-                      (octave::math::round (bb(0)),
-                       octave::math::round (bb(1)),
-                       octave::math::round (bb(2)),
-                       octave::math::round (bb(3)));
-                  }
-              }
-          }
-      }
-  }
+                  obj->qWidget<QWidget> ()->setGeometry
+                    (octave::math::round (bb(0)),
+                     octave::math::round (bb(1)),
+                     octave::math::round (bb(2)),
+                     octave::math::round (bb(3)));
+                }
+            }
+        }
+    }
+}
 
-  void
-  Container::childEvent (QChildEvent *xevent)
-  {
-    // Enable mouse tracking in child widgets as they are added if the
-    // container also has mouse tracking enabled.  There is no need to
-    // do this when child objects are removed.
+void
+Container::childEvent (QChildEvent *xevent)
+{
+  // Enable mouse tracking in child widgets as they are added if the
+  // container also has mouse tracking enabled.  There is no need to
+  // do this when child objects are removed.
 
-    if (xevent->added ())
-      {
-        QObject *obj = xevent->child ();
+  if (xevent->added ())
+    {
+      QObject *obj = xevent->child ();
 
-        if (obj && obj->isWidgetType ())
-          {
-            QWidget *widget = qobject_cast<QWidget *> (obj);
+      if (obj && obj->isWidgetType ())
+        {
+          QWidget *widget = qobject_cast<QWidget *> (obj);
 
-            if (widget)
-              widget->setMouseTracking (hasMouseTracking ());
-          }
-      }
-  }
+          if (widget)
+            widget->setMouseTracking (hasMouseTracking ());
+        }
+    }
+}
 
 OCTAVE_END_NAMESPACE(octave)
--- a/libgui/graphics/Container.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/Container.h	Thu Feb 02 12:25:51 2023 -0800
@@ -35,48 +35,48 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  DECLARE_GENERICEVENTNOTIFY_SENDER(ContainerBase, QWidget);
+DECLARE_GENERICEVENTNOTIFY_SENDER(ContainerBase, QWidget);
 
-  class Canvas;
+class Canvas;
 
-  class Container : public ContainerBase
-  {
-    Q_OBJECT
+class Container : public ContainerBase
+{
+  Q_OBJECT
 
-  public:
-    Container (QWidget *parent, octave::interpreter& interp);
-    ~Container ();
+public:
+  Container (QWidget *parent, octave::interpreter& interp);
+  ~Container ();
 
-    Canvas * canvas (const graphics_handle& handle, bool create = true);
+  Canvas * canvas (const graphics_handle& handle, bool create = true);
 
-  signals:
+signals:
 
-    void interpreter_event (const octave::fcn_callback& fcn);
-    void interpreter_event (const octave::meth_callback& meth);
+  void interpreter_event (const octave::fcn_callback& fcn);
+  void interpreter_event (const octave::meth_callback& meth);
 
-    void gh_callback_event (const graphics_handle& h, const std::string& name);
+  void gh_callback_event (const graphics_handle& h, const std::string& name);
 
-    void gh_callback_event (const graphics_handle& h, const std::string& name,
-                            const octave_value& data);
+  void gh_callback_event (const graphics_handle& h, const std::string& name,
+                          const octave_value& data);
 
-    void gh_set_event (const graphics_handle& h, const std::string& name,
-                       const octave_value& value);
+  void gh_set_event (const graphics_handle& h, const std::string& name,
+                     const octave_value& value);
 
-    void gh_set_event (const graphics_handle& h, const std::string& name,
-                       const octave_value& value, bool notify_toolkit);
+  void gh_set_event (const graphics_handle& h, const std::string& name,
+                     const octave_value& value, bool notify_toolkit);
 
-    void gh_set_event (const graphics_handle& h, const std::string& name,
-                       const octave_value& value, bool notify_toolkit,
-                       bool redraw_figure);
+  void gh_set_event (const graphics_handle& h, const std::string& name,
+                     const octave_value& value, bool notify_toolkit,
+                     bool redraw_figure);
 
-  protected:
-    void childEvent (QChildEvent *event);
-    void resizeEvent (QResizeEvent *event);
+protected:
+  void childEvent (QChildEvent *event);
+  void resizeEvent (QResizeEvent *event);
 
-  private:
-    octave::interpreter& m_interpreter;
-    Canvas *m_canvas;
-  };
+private:
+  octave::interpreter& m_interpreter;
+  Canvas *m_canvas;
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/graphics/ContextMenu.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/ContextMenu.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -37,110 +37,110 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  ContextMenu *
-  ContextMenu::create (octave::interpreter& interp, const graphics_object& go)
-  {
-    Object *xparent = parentObject (interp, go);
+ContextMenu *
+ContextMenu::create (octave::interpreter& interp, const graphics_object& go)
+{
+  Object *xparent = parentObject (interp, go);
 
-    if (xparent)
-      {
-        QWidget *w = xparent->qWidget<QWidget> ();
+  if (xparent)
+    {
+      QWidget *w = xparent->qWidget<QWidget> ();
 
-        return new ContextMenu (interp, go, new QMenu (w));
-      }
+      return new ContextMenu (interp, go, new QMenu (w));
+    }
 
-    return nullptr;
-  }
+  return nullptr;
+}
 
-  ContextMenu::ContextMenu (octave::interpreter& interp,
-                            const graphics_object& go, QMenu *xmenu)
-    : Object (interp, go, xmenu)
-  {
-    xmenu->setAutoFillBackground (true);
+ContextMenu::ContextMenu (octave::interpreter& interp,
+                          const graphics_object& go, QMenu *xmenu)
+  : Object (interp, go, xmenu)
+{
+  xmenu->setAutoFillBackground (true);
 
-    connect (xmenu, &QMenu::aboutToShow, this, &ContextMenu::aboutToShow);
-    connect (xmenu, &QMenu::aboutToHide, this, &ContextMenu::aboutToHide);
-  }
+  connect (xmenu, &QMenu::aboutToShow, this, &ContextMenu::aboutToShow);
+  connect (xmenu, &QMenu::aboutToHide, this, &ContextMenu::aboutToHide);
+}
 
-  ContextMenu::~ContextMenu ()
-  { }
+ContextMenu::~ContextMenu ()
+{ }
 
-  void
-  ContextMenu::update (int pId)
-  {
-    uicontextmenu::properties& up = properties<uicontextmenu> ();
-    QMenu *xmenu = qWidget<QMenu> ();
+void
+ContextMenu::update (int pId)
+{
+  uicontextmenu::properties& up = properties<uicontextmenu> ();
+  QMenu *xmenu = qWidget<QMenu> ();
 
-    switch (pId)
-      {
-      case base_properties::ID_VISIBLE:
-        if (up.is_visible ())
-          {
-            Matrix pos = up.get_position ().matrix_value ();
-            QWidget *parentW = xmenu->parentWidget ();
-            QPoint pt;
+  switch (pId)
+    {
+    case base_properties::ID_VISIBLE:
+      if (up.is_visible ())
+        {
+          Matrix pos = up.get_position ().matrix_value ();
+          QWidget *parentW = xmenu->parentWidget ();
+          QPoint pt;
 
-            pt.rx () = octave::math::round (pos(0));
-            pt.ry () = parentW->height () - octave::math::round (pos(1));
-            pt = parentW->mapToGlobal (pt);
+          pt.rx () = octave::math::round (pos(0));
+          pt.ry () = parentW->height () - octave::math::round (pos(1));
+          pt = parentW->mapToGlobal (pt);
 
-            xmenu->popup (pt);
-          }
-        else
-          xmenu->hide ();
-        break;
-      default:
-        Object::update (pId);
-        break;
-      }
-  }
+          xmenu->popup (pt);
+        }
+      else
+        xmenu->hide ();
+      break;
+    default:
+      Object::update (pId);
+      break;
+    }
+}
 
-  void
-  ContextMenu::aboutToShow ()
-  {
-    emit gh_callback_event (m_handle, "callback");
-    emit gh_set_event (m_handle, "visible", "on", false);
-  }
+void
+ContextMenu::aboutToShow ()
+{
+  emit gh_callback_event (m_handle, "callback");
+  emit gh_set_event (m_handle, "visible", "on", false);
+}
 
-  void
-  ContextMenu::aboutToHide ()
-  {
-    emit gh_set_event (m_handle, "visible", "off", false);
-  }
+void
+ContextMenu::aboutToHide ()
+{
+  emit gh_set_event (m_handle, "visible", "off", false);
+}
 
-  QWidget *
-  ContextMenu::menu ()
-  {
-    return qWidget<QWidget> ();
-  }
+QWidget *
+ContextMenu::menu ()
+{
+  return qWidget<QWidget> ();
+}
 
-  void
-  ContextMenu::executeAt (octave::interpreter& interp,
-                          const base_properties& props, const QPoint& pt)
-  {
-    graphics_handle h = props.get_uicontextmenu ();
+void
+ContextMenu::executeAt (octave::interpreter& interp,
+                        const base_properties& props, const QPoint& pt)
+{
+  graphics_handle h = props.get_uicontextmenu ();
 
-    if (h.ok ())
-      {
-        gh_manager& gh_mgr = interp.get_gh_manager ();
-        octave::autolock guard (gh_mgr.graphics_lock ());
+  if (h.ok ())
+    {
+      gh_manager& gh_mgr = interp.get_gh_manager ();
+      octave::autolock guard (gh_mgr.graphics_lock ());
 
-        graphics_object go = gh_mgr.get_object (h);
+      graphics_object go = gh_mgr.get_object (h);
 
-        if (go.valid_object ())
-          {
-            ContextMenu *cMenu =
-              dynamic_cast<ContextMenu *> (qt_graphics_toolkit::toolkitObject (go));
+      if (go.valid_object ())
+        {
+          ContextMenu *cMenu =
+            dynamic_cast<ContextMenu *> (qt_graphics_toolkit::toolkitObject (go));
 
-            if (cMenu)
-              {
-                QMenu *menu = cMenu->qWidget<QMenu> ();
+          if (cMenu)
+            {
+              QMenu *menu = cMenu->qWidget<QMenu> ();
 
-                if (menu)
-                  menu->popup (pt);
-              }
-          }
-      }
-  }
+              if (menu)
+                menu->popup (pt);
+            }
+        }
+    }
+}
 
 OCTAVE_END_NAMESPACE(octave)
--- a/libgui/graphics/ContextMenu.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/ContextMenu.h	Thu Feb 02 12:25:51 2023 -0800
@@ -35,35 +35,35 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class interpreter;
+class interpreter;
 
-  class ContextMenu : public Object, public MenuContainer
-  {
-    Q_OBJECT
+class ContextMenu : public Object, public MenuContainer
+{
+  Q_OBJECT
 
-  public:
-    ContextMenu (octave::interpreter& interp,
-                 const graphics_object& go, QMenu *menu);
-    ~ContextMenu ();
+public:
+  ContextMenu (octave::interpreter& interp,
+               const graphics_object& go, QMenu *menu);
+  ~ContextMenu ();
 
-    static ContextMenu *
-    create (octave::interpreter& interp,
-            const graphics_object& go);
+  static ContextMenu *
+  create (octave::interpreter& interp,
+          const graphics_object& go);
 
-    static void executeAt (octave::interpreter& interp,
-                           const base_properties& props, const QPoint& pt);
+  static void executeAt (octave::interpreter& interp,
+                         const base_properties& props, const QPoint& pt);
 
-    Container * innerContainer () { return nullptr; }
+  Container * innerContainer () { return nullptr; }
 
-    QWidget * menu ();
+  QWidget * menu ();
 
-  protected:
-    void update (int pId);
+protected:
+  void update (int pId);
 
-  private slots:
-    void aboutToShow ();
-    void aboutToHide ();
-  };
+private slots:
+  void aboutToShow ();
+  void aboutToHide ();
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/graphics/EditControl.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/EditControl.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -36,273 +36,273 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  EditControl *
-  EditControl::create (octave::interpreter& interp, const graphics_object& go)
-  {
-    Object *parent = parentObject (interp, go);
+EditControl *
+EditControl::create (octave::interpreter& interp, const graphics_object& go)
+{
+  Object *parent = parentObject (interp, go);
 
-    if (parent)
-      {
-        Container *container = parent->innerContainer ();
+  if (parent)
+    {
+      Container *container = parent->innerContainer ();
 
-        if (container)
-          {
-            uicontrol::properties& up = Utils::properties<uicontrol> (go);
+      if (container)
+        {
+          uicontrol::properties& up = Utils::properties<uicontrol> (go);
 
-            if ((up.get_max () - up.get_min ()) > 1)
-              return new EditControl (interp, go,
-                                      new TextEdit (container));
-            else
-              return new EditControl (interp, go,
-                                      new QLineEdit (container));
-          }
-      }
+          if ((up.get_max () - up.get_min ()) > 1)
+            return new EditControl (interp, go,
+                                    new TextEdit (container));
+          else
+            return new EditControl (interp, go,
+                                    new QLineEdit (container));
+        }
+    }
 
-    return nullptr;
-  }
+  return nullptr;
+}
 
-  EditControl::EditControl (octave::interpreter& interp,
-                            const graphics_object& go, QLineEdit *edit)
-    : BaseControl (interp, go, edit), m_multiLine (false),
-      m_textChanged (false)
-  {
-    init (edit);
-  }
+EditControl::EditControl (octave::interpreter& interp,
+                          const graphics_object& go, QLineEdit *edit)
+  : BaseControl (interp, go, edit), m_multiLine (false),
+    m_textChanged (false)
+{
+  init (edit);
+}
 
-  void
-  EditControl::init (QLineEdit *edit, bool callBase)
-  {
-    if (callBase)
-      BaseControl::init (edit, callBase);
+void
+EditControl::init (QLineEdit *edit, bool callBase)
+{
+  if (callBase)
+    BaseControl::init (edit, callBase);
 
-    m_multiLine = false;
-    initCommon (edit);
+  m_multiLine = false;
+  initCommon (edit);
 
-    uicontrol::properties& up = properties<uicontrol> ();
+  uicontrol::properties& up = properties<uicontrol> ();
 
-    if (up.enable_is ("inactive"))
-      edit->setReadOnly (true);
-    else
-      edit->setEnabled (up.enable_is ("on"));
-    edit->setText (Utils::fromStdString (up.get_string_string ()));
-    edit->setAlignment (Utils::fromHVAlign (up.get_horizontalalignment (),
-                                            up.get_verticalalignment ()));
+  if (up.enable_is ("inactive"))
+    edit->setReadOnly (true);
+  else
+    edit->setEnabled (up.enable_is ("on"));
+  edit->setText (Utils::fromStdString (up.get_string_string ()));
+  edit->setAlignment (Utils::fromHVAlign (up.get_horizontalalignment (),
+                                          up.get_verticalalignment ()));
 
-    connect (edit, &QLineEdit::textEdited,
-             this, &EditControl::textChanged);
-    connect (edit, &QLineEdit::editingFinished,
-             this, &EditControl::editingFinished);
-    connect (edit, &QLineEdit::returnPressed,
-             this, &EditControl::returnPressed);
-  }
+  connect (edit, &QLineEdit::textEdited,
+           this, &EditControl::textChanged);
+  connect (edit, &QLineEdit::editingFinished,
+           this, &EditControl::editingFinished);
+  connect (edit, &QLineEdit::returnPressed,
+           this, &EditControl::returnPressed);
+}
 
-  EditControl::EditControl (octave::interpreter& interp,
-                            const graphics_object& go, TextEdit *edit)
-    : BaseControl (interp, go, edit), m_multiLine (true),
-      m_textChanged (false)
-  {
-    init (edit);
-  }
+EditControl::EditControl (octave::interpreter& interp,
+                          const graphics_object& go, TextEdit *edit)
+  : BaseControl (interp, go, edit), m_multiLine (true),
+    m_textChanged (false)
+{
+  init (edit);
+}
 
-  void
-  EditControl::init (TextEdit *edit, bool callBase)
-  {
-    if (callBase)
-      BaseControl::init (edit, callBase);
+void
+EditControl::init (TextEdit *edit, bool callBase)
+{
+  if (callBase)
+    BaseControl::init (edit, callBase);
 
-    m_multiLine = true;
-    initCommon (edit);
+  m_multiLine = true;
+  initCommon (edit);
 
-    uicontrol::properties& up = properties<uicontrol> ();
+  uicontrol::properties& up = properties<uicontrol> ();
 
-    if (up.enable_is ("inactive"))
-      edit->setReadOnly (true);
-    else
-      edit->setEnabled (up.enable_is ("on"));
-    edit->setAcceptRichText (false);
-    edit->setPlainText (Utils::fromStringVector
-                        (up.get_string_vector ()).join ("\n"));
-    edit->setAlignment (Utils::fromHVAlign (up.get_horizontalalignment (),
-                                            up.get_verticalalignment ()));
+  if (up.enable_is ("inactive"))
+    edit->setReadOnly (true);
+  else
+    edit->setEnabled (up.enable_is ("on"));
+  edit->setAcceptRichText (false);
+  edit->setPlainText (Utils::fromStringVector
+                      (up.get_string_vector ()).join ("\n"));
+  edit->setAlignment (Utils::fromHVAlign (up.get_horizontalalignment (),
+                                          up.get_verticalalignment ()));
 
-    connect (edit, &TextEdit::textChanged,
-             this, &EditControl::textChanged);
-    connect (edit, &TextEdit::editingFinished,
-             this, &EditControl::editingFinished);
-    connect (edit, &TextEdit::returnPressed,
-             this, &EditControl::returnPressed);
-  }
+  connect (edit, &TextEdit::textChanged,
+           this, &EditControl::textChanged);
+  connect (edit, &TextEdit::editingFinished,
+           this, &EditControl::editingFinished);
+  connect (edit, &TextEdit::returnPressed,
+           this, &EditControl::returnPressed);
+}
 
-  EditControl::~EditControl ()
-  { }
+EditControl::~EditControl ()
+{ }
 
-  void
-  EditControl::initCommon (QWidget *)
-  {
-    m_textChanged = false;
-  }
+void
+EditControl::initCommon (QWidget *)
+{
+  m_textChanged = false;
+}
 
-  void
-  EditControl::update (int pId)
-  {
-    bool handled = false;
+void
+EditControl::update (int pId)
+{
+  bool handled = false;
 
-    if (m_multiLine)
-      handled = updateMultiLine (pId);
-    else
-      handled = updateSingleLine (pId);
+  if (m_multiLine)
+    handled = updateMultiLine (pId);
+  else
+    handled = updateSingleLine (pId);
 
-    if (! handled)
-      {
-        switch (pId)
-          {
-          default:
-            BaseControl::update (pId);
-            break;
-          }
-      }
-  }
+  if (! handled)
+    {
+      switch (pId)
+        {
+        default:
+          BaseControl::update (pId);
+          break;
+        }
+    }
+}
 
-  bool
-  EditControl::updateSingleLine (int pId)
-  {
-    uicontrol::properties& up = properties<uicontrol> ();
-    QLineEdit *edit = qWidget<QLineEdit> ();
+bool
+EditControl::updateSingleLine (int pId)
+{
+  uicontrol::properties& up = properties<uicontrol> ();
+  QLineEdit *edit = qWidget<QLineEdit> ();
 
-    switch (pId)
-      {
-      case uicontrol::properties::ID_STRING:
-        edit->setText (Utils::fromStdString (up.get_string_string ()));
-        return true;
+  switch (pId)
+    {
+    case uicontrol::properties::ID_STRING:
+      edit->setText (Utils::fromStdString (up.get_string_string ()));
+      return true;
 
-      case uicontrol::properties::ID_HORIZONTALALIGNMENT:
-      case uicontrol::properties::ID_VERTICALALIGNMENT:
-        edit->setAlignment (Utils::fromHVAlign (up.get_horizontalalignment (),
-                                                up.get_verticalalignment ()));
-        return true;
+    case uicontrol::properties::ID_HORIZONTALALIGNMENT:
+    case uicontrol::properties::ID_VERTICALALIGNMENT:
+      edit->setAlignment (Utils::fromHVAlign (up.get_horizontalalignment (),
+                                              up.get_verticalalignment ()));
+      return true;
 
-      case uicontrol::properties::ID_ENABLE:
-        if (up.enable_is ("inactive"))
-          edit->setReadOnly (true);
-        else
-          {
-            edit->setReadOnly (false);
-            edit->setEnabled (up.enable_is ("on"));
-          }
-        return true;
+    case uicontrol::properties::ID_ENABLE:
+      if (up.enable_is ("inactive"))
+        edit->setReadOnly (true);
+      else
+        {
+          edit->setReadOnly (false);
+          edit->setEnabled (up.enable_is ("on"));
+        }
+      return true;
 
-      case uicontrol::properties::ID_MIN:
-      case uicontrol::properties::ID_MAX:
-        if ((up.get_max () - up.get_min ()) > 1)
-          {
-            QWidget *container = edit->parentWidget ();
+    case uicontrol::properties::ID_MIN:
+    case uicontrol::properties::ID_MAX:
+      if ((up.get_max () - up.get_min ()) > 1)
+        {
+          QWidget *container = edit->parentWidget ();
 
-            delete edit;
-            init (new TextEdit (container), true);
-          }
-        return true;
+          delete edit;
+          init (new TextEdit (container), true);
+        }
+      return true;
 
-      default:
-        break;
-      }
+    default:
+      break;
+    }
 
-    return false;
-  }
+  return false;
+}
 
-  bool
-  EditControl::updateMultiLine (int pId)
-  {
-    uicontrol::properties& up = properties<uicontrol> ();
-    TextEdit *edit = qWidget<TextEdit> ();
+bool
+EditControl::updateMultiLine (int pId)
+{
+  uicontrol::properties& up = properties<uicontrol> ();
+  TextEdit *edit = qWidget<TextEdit> ();
 
-    switch (pId)
-      {
-      case uicontrol::properties::ID_STRING:
-        edit->setPlainText (Utils::fromStringVector
-                            (up.get_string_vector ()).join ("\n"));
-        return true;
+  switch (pId)
+    {
+    case uicontrol::properties::ID_STRING:
+      edit->setPlainText (Utils::fromStringVector
+                          (up.get_string_vector ()).join ("\n"));
+      return true;
 
-      case uicontrol::properties::ID_HORIZONTALALIGNMENT:
-      case uicontrol::properties::ID_VERTICALALIGNMENT:
-        edit->setAlignment (Utils::fromHVAlign (up.get_horizontalalignment (),
-                                                up.get_verticalalignment ()));
-        return true;
+    case uicontrol::properties::ID_HORIZONTALALIGNMENT:
+    case uicontrol::properties::ID_VERTICALALIGNMENT:
+      edit->setAlignment (Utils::fromHVAlign (up.get_horizontalalignment (),
+                                              up.get_verticalalignment ()));
+      return true;
 
-      case uicontrol::properties::ID_ENABLE:
-        if (up.enable_is ("inactive"))
-          edit->setReadOnly (true);
-        else
-          {
-            edit->setReadOnly (false);
-            edit->setEnabled (up.enable_is ("on"));
-          }
-        return true;
+    case uicontrol::properties::ID_ENABLE:
+      if (up.enable_is ("inactive"))
+        edit->setReadOnly (true);
+      else
+        {
+          edit->setReadOnly (false);
+          edit->setEnabled (up.enable_is ("on"));
+        }
+      return true;
 
-      case uicontrol::properties::ID_MIN:
-      case uicontrol::properties::ID_MAX:
-        if ((up.get_max () - up.get_min ()) <= 1)
-          {
-            QWidget *container = edit->parentWidget ();
+    case uicontrol::properties::ID_MIN:
+    case uicontrol::properties::ID_MAX:
+      if ((up.get_max () - up.get_min ()) <= 1)
+        {
+          QWidget *container = edit->parentWidget ();
 
-            delete edit;
-            init (new QLineEdit (container), true);
-          }
-        return true;
+          delete edit;
+          init (new QLineEdit (container), true);
+        }
+      return true;
 
-      default:
-        break;
-      }
+    default:
+      break;
+    }
 
-    return false;
-  }
+  return false;
+}
 
-  void
-  EditControl::textChanged ()
-  {
-    m_textChanged = true;
-  }
+void
+EditControl::textChanged ()
+{
+  m_textChanged = true;
+}
 
-  void
-  EditControl::returnPressed ()
-  {
-    QString txt = (m_multiLine
-                   ? qWidget<TextEdit> ()->toPlainText ()
-                   : qWidget<QLineEdit> ()->text ());
+void
+EditControl::returnPressed ()
+{
+  QString txt = (m_multiLine
+                 ? qWidget<TextEdit> ()->toPlainText ()
+                 : qWidget<QLineEdit> ()->text ());
+
+  if (m_textChanged)
+    {
+      if (m_multiLine)
+        emit gh_set_event (m_handle, "string",
+                           Utils::toCellString (txt.split ("\n")), false);
+      else
+        emit gh_set_event (m_handle, "string",
+                           Utils::toStdString (txt), false);
+
+      m_textChanged = false;
+    }
 
-    if (m_textChanged)
-      {
-        if (m_multiLine)
-          emit gh_set_event (m_handle, "string",
-                             Utils::toCellString (txt.split ("\n")), false);
-        else
-          emit gh_set_event (m_handle, "string",
-                             Utils::toStdString (txt), false);
+  if (txt.length () > 0)
+    emit gh_callback_event (m_handle, "callback");
+}
 
-        m_textChanged = false;
-      }
-
-    if (txt.length () > 0)
+void
+EditControl::editingFinished ()
+{
+  if (m_textChanged)
+    {
+      QString txt = (m_multiLine
+                     ? qWidget<TextEdit> ()->toPlainText ()
+                     : qWidget<QLineEdit> ()->text ());
+      if (m_multiLine)
+        emit gh_set_event (m_handle, "string",
+                           Utils::toCellString (txt.split ("\n")), false);
+      else
+        emit gh_set_event (m_handle, "string", Utils::toStdString (txt),
+                           false);
       emit gh_callback_event (m_handle, "callback");
-  }
 
-  void
-  EditControl::editingFinished ()
-  {
-    if (m_textChanged)
-      {
-        QString txt = (m_multiLine
-                       ? qWidget<TextEdit> ()->toPlainText ()
-                       : qWidget<QLineEdit> ()->text ());
-        if (m_multiLine)
-          emit gh_set_event (m_handle, "string",
-                             Utils::toCellString (txt.split ("\n")), false);
-        else
-          emit gh_set_event (m_handle, "string", Utils::toStdString (txt),
-                             false);
-        emit gh_callback_event (m_handle, "callback");
-
-        m_textChanged = false;
-      }
-  }
+      m_textChanged = false;
+    }
+}
 
 OCTAVE_END_NAMESPACE(octave)
--- a/libgui/graphics/EditControl.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/EditControl.h	Thu Feb 02 12:25:51 2023 -0800
@@ -33,46 +33,46 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class interpreter;
+class interpreter;
 
-  class TextEdit;
+class TextEdit;
 
-  class EditControl : public BaseControl
-  {
-    Q_OBJECT
+class EditControl : public BaseControl
+{
+  Q_OBJECT
 
-  public:
-    EditControl (octave::interpreter& interp,
-                 const graphics_object& go, QLineEdit *edit);
+public:
+  EditControl (octave::interpreter& interp,
+               const graphics_object& go, QLineEdit *edit);
 
-    EditControl (octave::interpreter& interp,
-                 const graphics_object& go, TextEdit *edit);
+  EditControl (octave::interpreter& interp,
+               const graphics_object& go, TextEdit *edit);
 
-    ~EditControl ();
+  ~EditControl ();
 
-    static EditControl *
-    create (octave::interpreter& interp,
-            const graphics_object& go);
+  static EditControl *
+  create (octave::interpreter& interp,
+          const graphics_object& go);
 
-  protected:
-    void update (int pId);
+protected:
+  void update (int pId);
 
-  private:
-    void init (QLineEdit *edit, bool callBase = false);
-    void init (TextEdit *edit, bool callBase = false);
-    void initCommon (QWidget *widget);
-    bool updateSingleLine (int pId);
-    bool updateMultiLine (int pId);
+private:
+  void init (QLineEdit *edit, bool callBase = false);
+  void init (TextEdit *edit, bool callBase = false);
+  void initCommon (QWidget *widget);
+  bool updateSingleLine (int pId);
+  bool updateMultiLine (int pId);
 
-  private slots:
-    void textChanged ();
-    void editingFinished ();
-    void returnPressed ();
+private slots:
+  void textChanged ();
+  void editingFinished ();
+  void returnPressed ();
 
-  private:
-    bool m_multiLine;
-    bool m_textChanged;
-  };
+private:
+  bool m_multiLine;
+  bool m_textChanged;
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/graphics/Figure.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/Figure.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -65,859 +65,859 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  DECLARE_GENERICEVENTNOTIFY_SENDER(MenuBar, QMenuBar);
-
-  static QRect
-  boundingBoxToRect (const Matrix& bb)
-  {
-    QRect r;
-
-    if (bb.numel () == 4)
-      {
-        r = QRect (octave::math::round (bb(0)), octave::math::round (bb(1)),
-                   octave::math::round (bb(2)), octave::math::round (bb(3)));
-        if (! r.isValid ())
-          r = QRect ();
-      }
-
-    return r;
-  }
+DECLARE_GENERICEVENTNOTIFY_SENDER(MenuBar, QMenuBar);
 
-  static QImage
-  pointer_to_qimage (const Matrix& cdata)
-  {
-    QImage retval (cdata.rows (), cdata.columns (), QImage::Format_ARGB32);
-    QColor tmp ("White");
-    QColor black ("Black");
-    QColor white ("White");
-    for (octave_idx_type ii = 0; ii < cdata.rows (); ii++)
-      for (octave_idx_type jj = 0; jj < cdata.columns (); jj++)
-        {
-          if (cdata(ii, jj) == 1.0)
-            tmp = black;
-          else if (cdata(ii, jj) == 2.0)
-            tmp = white;
-          else
-            tmp.setAlpha (0);
-
-          retval.setPixel (jj, ii, tmp.rgba ());
-        }
-
-    return retval;
-  }
-
-  Figure *
-  Figure::create (octave::interpreter& interp,
-                  const graphics_object& go)
-  {
-    return new Figure (interp, go, new FigureWindow ());
-  }
-
-  Figure::Figure (octave::interpreter& interp,
-                  const graphics_object& go, FigureWindow *win)
-    : Object (interp, go, win), m_blockUpdates (false),
-      m_figureToolBar (nullptr), m_menuBar (nullptr), m_innerRect (),
-      m_outerRect (), m_previousHeight (0), m_resizable (true)
-  {
-    m_container = new Container (win, interp);
-    win->setCentralWidget (m_container);
-
-    connect (m_container, QOverload<const octave::fcn_callback&>::of (&Container::interpreter_event),
-             this, QOverload<const octave::fcn_callback&>::of (&Figure::interpreter_event));
-
-    connect (m_container, QOverload<const octave::meth_callback&>::of (&Container::interpreter_event),
-             this, QOverload<const octave::meth_callback&>::of (&Figure::interpreter_event));
-
-    figure::properties& fp = properties<figure> ();
+static QRect
+boundingBoxToRect (const Matrix& bb)
+{
+  QRect r;
 
-    // Adjust figure position
-    m_innerRect = boundingBoxToRect (fp.get_boundingbox (true));
-    m_outerRect = boundingBoxToRect (fp.get_boundingbox (false));
-
-    set_geometry (m_innerRect);
-
-    // Menubar
-    m_menuBar = new MenuBar (win);
-    win->setMenuBar (m_menuBar);
-    m_menuBar->addReceiver (this);
-    m_menuBar->setStyleSheet (m_menuBar->styleSheet () + global_menubar_style);
-
-    // Status bar
-    m_statusBar = win->statusBar ();
-    m_statusBar->setVisible (false);
-
-    if (fp.toolbar_is ("figure")
-        || (fp.toolbar_is ("auto") && fp.menubar_is ("figure")))
-      showFigureStatusBar (true);
-
-    // Enable mouse tracking unconditionally
-    enableMouseTracking ();
-
-    // When this constructor gets called all properties are already
-    // set, even non default.  We force "update" here to get things right.
-
-    // Figure title
-    update (figure::properties::ID_NUMBERTITLE);
+  if (bb.numel () == 4)
+    {
+      r = QRect (octave::math::round (bb(0)), octave::math::round (bb(1)),
+                 octave::math::round (bb(2)), octave::math::round (bb(3)));
+      if (! r.isValid ())
+        r = QRect ();
+    }
 
-    // Decide what keyboard events we listen to
-    Canvas *canvas = m_container->canvas (m_handle);
-    if (canvas)
-      canvas->setEventMask (0);
-    update (figure::properties::ID_KEYPRESSFCN);
-    update (figure::properties::ID_KEYRELEASEFCN);
-
-    // modal style
-    update (figure::properties::ID_WINDOWSTYLE);
-
-    // Handle resizing constraints
-    update (figure::properties::ID_RESIZE);
-
-    // Custom pointer data
-    update (figure::properties::ID_POINTERSHAPECDATA);
-
-    // Visibility
-    update (figure::properties::ID_VISIBLE);
-
-    connect (this, &Figure::asyncUpdate, this, &Figure::updateContainer);
-
-    // Register for the signal that indicates when a window has moved
-    // to a different screen
-    connect (win, &FigureWindow::figureWindowShown,
-             this, &Figure::figureWindowShown);
-
-    win->addReceiver (this);
-    m_container->addReceiver (this);
-  }
-
-  Figure::~Figure ()
-  { }
-
-  QString
-  Figure::fileName ()
-  {
-    gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
-
-    octave::autolock guard (gh_mgr.graphics_lock ());
-
-    const figure::properties& fp = properties<figure> ();
+  return r;
+}
 
-    std::string name = fp.get_filename ();
-
-    return QString::fromStdString (name);
-  }
-
-  void
-  Figure::setFileName (const QString& name)
-  {
-    gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
-
-    octave::autolock guard (gh_mgr.graphics_lock ());
-
-    figure::properties& fp = properties<figure> ();
-
-    fp.set_filename (name.toStdString ());
-  }
-
-  MouseMode
-  Figure::mouseMode ()
-  {
-    gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
-
-    octave::autolock guard (gh_mgr.graphics_lock ());
-
-    const figure::properties& fp = properties<figure> ();
-
-    std::string mode = fp.get___mouse_mode__ ();
-
-    if (mode == "zoom")
+static QImage
+pointer_to_qimage (const Matrix& cdata)
+{
+  QImage retval (cdata.rows (), cdata.columns (), QImage::Format_ARGB32);
+  QColor tmp ("White");
+  QColor black ("Black");
+  QColor white ("White");
+  for (octave_idx_type ii = 0; ii < cdata.rows (); ii++)
+    for (octave_idx_type jj = 0; jj < cdata.columns (); jj++)
       {
-        octave_scalar_map zm = fp.get___zoom_mode__ ().scalar_map_value ();
-
-        std::string direction = zm.getfield ("Direction").string_value ();
-
-        mode += ' ' + direction;
-      }
-
-    if (mode == "rotate")
-      return RotateMode;
-    else if (mode == "zoom in")
-      return ZoomInMode;
-    else if (mode == "zoom out")
-      return ZoomOutMode;
-    else if (mode == "pan")
-      return PanMode;
-    else if (mode == "text")
-      return TextMode;
-
-    return NoMode;
-  }
-
-  void
-  Figure::set_geometry (QRect r)
-  {
-    QMainWindow *win = qWidget<QMainWindow> ();
-
-    if (! m_resizable)
-      {
-        win->setSizePolicy (QSizePolicy::Preferred, QSizePolicy::Preferred);
-        win->setFixedSize (QSize( QWIDGETSIZE_MAX, QWIDGETSIZE_MAX));
-      }
-
-    // Unlock window if it is maximized or full-screen
-    int state = win->windowState ();
-    if (state == Qt::WindowFullScreen || state == Qt::WindowMaximized)
-      win->setWindowState (Qt::WindowNoState);
+        if (cdata(ii, jj) == 1.0)
+          tmp = black;
+        else if (cdata(ii, jj) == 2.0)
+          tmp = white;
+        else
+          tmp.setAlpha (0);
 
-    win->setGeometry (r);
-
-    if (! m_resizable)
-      {
-        win->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed);
-        win->setFixedSize(win->size ());
-      }
-  }
-
-  Container *
-  Figure::innerContainer ()
-  {
-    return m_container;
-  }
-
-  void
-  Figure::redraw ()
-  {
-    Canvas *canvas = m_container->canvas (m_handle);
-
-    if (canvas)
-      canvas->redraw ();
-
-    for (auto *qobj : qWidget<QWidget> ()->findChildren<QObject *> ())
-      {
-        if (qobj->objectName () == "UIPanel"
-            || qobj->objectName () == "UIButtonGroup"
-            || qobj->objectName () == "UIControl"
-            || qobj->objectName () == "UITable")
-          {
-            Object *obj = Object::fromQObject (qobj);
-
-            if (obj)
-              obj->slotRedraw ();
-          }
-      }
-  }
-
-  void
-  Figure::show ()
-  {
-    QWidget *win = qWidget<QWidget> ();
-
-    win->activateWindow ();
-    win->raise ();
-  }
-
-  void
-  Figure::print (const QString& file_cmd, const QString& term)
-  {
-    Canvas *canvas = m_container->canvas (m_handle);
-
-    if (canvas)
-      canvas->print (file_cmd, term);
-  }
-
-  uint8NDArray
-  Figure::slotGetPixels ()
-  {
-    uint8NDArray retval;
-    Canvas *canvas = m_container->canvas (m_handle);
-
-    if (canvas)
-      {
-        gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
-
-        gh_mgr.process_events ();
-        octave::autolock guard (gh_mgr.graphics_lock ());
-        retval = canvas->getPixels ();
+        retval.setPixel (jj, ii, tmp.rgba ());
       }
 
-    return retval;
-  }
+  return retval;
+}
+
+Figure *
+Figure::create (octave::interpreter& interp,
+                const graphics_object& go)
+{
+  return new Figure (interp, go, new FigureWindow ());
+}
 
-  void
-  Figure::beingDeleted ()
-  {
-    Canvas *canvas = m_container->canvas (m_handle.value (), false);
+Figure::Figure (octave::interpreter& interp,
+                const graphics_object& go, FigureWindow *win)
+  : Object (interp, go, win), m_blockUpdates (false),
+    m_figureToolBar (nullptr), m_menuBar (nullptr), m_innerRect (),
+    m_outerRect (), m_previousHeight (0), m_resizable (true)
+{
+  m_container = new Container (win, interp);
+  win->setCentralWidget (m_container);
 
-    if (canvas)
-      canvas->blockRedraw (true);
+  connect (m_container, QOverload<const octave::fcn_callback&>::of (&Container::interpreter_event),
+           this, QOverload<const octave::fcn_callback&>::of (&Figure::interpreter_event));
+
+  connect (m_container, QOverload<const octave::meth_callback&>::of (&Container::interpreter_event),
+           this, QOverload<const octave::meth_callback&>::of (&Figure::interpreter_event));
 
-    m_container->removeReceiver (this);
-    qWidget<FigureWindow> ()->removeReceiver (this);
-  }
+  figure::properties& fp = properties<figure> ();
+
+  // Adjust figure position
+  m_innerRect = boundingBoxToRect (fp.get_boundingbox (true));
+  m_outerRect = boundingBoxToRect (fp.get_boundingbox (false));
+
+  set_geometry (m_innerRect);
 
-  void
-  Figure::update (int pId)
-  {
-    if (m_blockUpdates)
-      return;
+  // Menubar
+  m_menuBar = new MenuBar (win);
+  win->setMenuBar (m_menuBar);
+  m_menuBar->addReceiver (this);
+  m_menuBar->setStyleSheet (m_menuBar->styleSheet () + global_menubar_style);
+
+  // Status bar
+  m_statusBar = win->statusBar ();
+  m_statusBar->setVisible (false);
 
-    figure::properties& fp = properties<figure> ();
+  if (fp.toolbar_is ("figure")
+      || (fp.toolbar_is ("auto") && fp.menubar_is ("figure")))
+    showFigureStatusBar (true);
+
+  // Enable mouse tracking unconditionally
+  enableMouseTracking ();
+
+  // When this constructor gets called all properties are already
+  // set, even non default.  We force "update" here to get things right.
 
-    if (fp.is___printing__ ())
-      return;
+  // Figure title
+  update (figure::properties::ID_NUMBERTITLE);
 
-    QMainWindow *win = qWidget<QMainWindow> ();
+  // Decide what keyboard events we listen to
+  Canvas *canvas = m_container->canvas (m_handle);
+  if (canvas)
+    canvas->setEventMask (0);
+  update (figure::properties::ID_KEYPRESSFCN);
+  update (figure::properties::ID_KEYRELEASEFCN);
 
-    // If the window doesn't exist, there's nothing we can do.
-    if (! win)
-      return;
+  // modal style
+  update (figure::properties::ID_WINDOWSTYLE);
+
+  // Handle resizing constraints
+  update (figure::properties::ID_RESIZE);
 
-    m_blockUpdates = true;
+  // Custom pointer data
+  update (figure::properties::ID_POINTERSHAPECDATA);
+
+  // Visibility
+  update (figure::properties::ID_VISIBLE);
+
+  connect (this, &Figure::asyncUpdate, this, &Figure::updateContainer);
 
-    switch (pId)
-      {
-      case figure::properties::ID_POSITION:
-        {
-          m_innerRect = boundingBoxToRect (fp.get_boundingbox (true));
-          int toffset = 0;
-          int boffset = 0;
+  // Register for the signal that indicates when a window has moved
+  // to a different screen
+  connect (win, &FigureWindow::figureWindowShown,
+           this, &Figure::figureWindowShown);
+
+  win->addReceiver (this);
+  m_container->addReceiver (this);
+}
+
+Figure::~Figure ()
+{ }
+
+QString
+Figure::fileName ()
+{
+  gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+
+  octave::autolock guard (gh_mgr.graphics_lock ());
 
-          for (auto *tb : win->findChildren<QToolBar *> ())
-            if (! tb->isHidden ())
-              toffset += tb->sizeHint ().height ();
+  const figure::properties& fp = properties<figure> ();
+
+  std::string name = fp.get_filename ();
+
+  return QString::fromStdString (name);
+}
 
-          if (! m_menuBar->isHidden ())
-            toffset += m_menuBar->sizeHint ().height ();
+void
+Figure::setFileName (const QString& name)
+{
+  gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
 
-          if (! m_statusBar->isHidden ())
-            boffset += m_statusBar->sizeHint ().height ();
+  octave::autolock guard (gh_mgr.graphics_lock ());
+
+  figure::properties& fp = properties<figure> ();
+
+  fp.set_filename (name.toStdString ());
+}
 
-          set_geometry (m_innerRect.adjusted (0, -toffset, 0, boffset));
-        }
-        break;
+MouseMode
+Figure::mouseMode ()
+{
+  gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+
+  octave::autolock guard (gh_mgr.graphics_lock ());
 
-      case figure::properties::ID_NAME:
-      case figure::properties::ID_NUMBERTITLE:
-        win->setWindowTitle (Utils::fromStdString (fp.get_title ()));
-        break;
+  const figure::properties& fp = properties<figure> ();
+
+  std::string mode = fp.get___mouse_mode__ ();
+
+  if (mode == "zoom")
+    {
+      octave_scalar_map zm = fp.get___zoom_mode__ ().scalar_map_value ();
+
+      std::string direction = zm.getfield ("Direction").string_value ();
 
-      case figure::properties::ID_VISIBLE:
-        if (fp.is_visible ())
-          {
-            QTimer::singleShot (0, win, &QMainWindow::show);
-            if (! fp.is___gl_window__ ())
-              {
-                gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+      mode += ' ' + direction;
+    }
 
-                octave::autolock guard (gh_mgr.graphics_lock ());
-                fp.set ("__gl_window__", "on");
-              }
-          }
-        else
-          win->hide ();
-        break;
+  if (mode == "rotate")
+    return RotateMode;
+  else if (mode == "zoom in")
+    return ZoomInMode;
+  else if (mode == "zoom out")
+    return ZoomOutMode;
+  else if (mode == "pan")
+    return PanMode;
+  else if (mode == "text")
+    return TextMode;
+
+  return NoMode;
+}
+
+void
+Figure::set_geometry (QRect r)
+{
+  QMainWindow *win = qWidget<QMainWindow> ();
 
-      case figure::properties::ID_RESIZE:
-        if (fp.is_resize ())
-          {
-            win->setSizePolicy (QSizePolicy::Preferred, QSizePolicy::Preferred);
-            win->setFixedSize (QSize( QWIDGETSIZE_MAX, QWIDGETSIZE_MAX));
-            m_resizable = true;
-          }
-        else
-          {
-            win->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed);
-            win->setFixedSize(win->size ());
-            m_resizable = false;
-          }
-        break;
+  if (! m_resizable)
+    {
+      win->setSizePolicy (QSizePolicy::Preferred, QSizePolicy::Preferred);
+      win->setFixedSize (QSize( QWIDGETSIZE_MAX, QWIDGETSIZE_MAX));
+    }
+
+  // Unlock window if it is maximized or full-screen
+  int state = win->windowState ();
+  if (state == Qt::WindowFullScreen || state == Qt::WindowMaximized)
+    win->setWindowState (Qt::WindowNoState);
+
+  win->setGeometry (r);
+
+  if (! m_resizable)
+    {
+      win->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed);
+      win->setFixedSize(win->size ());
+    }
+}
+
+Container *
+Figure::innerContainer ()
+{
+  return m_container;
+}
+
+void
+Figure::redraw ()
+{
+  Canvas *canvas = m_container->canvas (m_handle);
+
+  if (canvas)
+    canvas->redraw ();
 
-      case figure::properties::ID_MENUBAR:
-      case figure::properties::ID_TOOLBAR:
-        if (fp.toolbar_is ("none"))
-          showFigureStatusBar (false);
-        else if (fp.toolbar_is ("figure"))
-          showFigureStatusBar (true);
-        else  // "auto"
-          showFigureStatusBar (fp.menubar_is ("figure"));
-        break;
+  for (auto *qobj : qWidget<QWidget> ()->findChildren<QObject *> ())
+    {
+      if (qobj->objectName () == "UIPanel"
+          || qobj->objectName () == "UIButtonGroup"
+          || qobj->objectName () == "UIControl"
+          || qobj->objectName () == "UITable")
+        {
+          Object *obj = Object::fromQObject (qobj);
 
-      case figure::properties::ID_KEYPRESSFCN:
-        {
-          Canvas *canvas = m_container->canvas (m_handle);
+          if (obj)
+            obj->slotRedraw ();
+        }
+    }
+}
+
+void
+Figure::show ()
+{
+  QWidget *win = qWidget<QWidget> ();
 
-          if (canvas)
-            {
-              if (fp.get_keypressfcn ().isempty ())
-                canvas->clearEventMask (Canvas::KeyPress);
-              else
-                canvas->addEventMask (Canvas::KeyPress);
-            }
+  win->activateWindow ();
+  win->raise ();
+}
+
+void
+Figure::print (const QString& file_cmd, const QString& term)
+{
+  Canvas *canvas = m_container->canvas (m_handle);
 
-          // Signal the change to uipanels as well
-          for (auto *qobj : qWidget<QWidget> ()->findChildren<QObject *> ())
-            {
-              if (qobj->objectName () == "UIPanel")
-                {
-                  Object *obj = Object::fromQObject (qobj);
+  if (canvas)
+    canvas->print (file_cmd, term);
+}
+
+uint8NDArray
+Figure::slotGetPixels ()
+{
+  uint8NDArray retval;
+  Canvas *canvas = m_container->canvas (m_handle);
+
+  if (canvas)
+    {
+      gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
 
-                  if (obj)
-                    {
-                      if (fp.get_keypressfcn ().isempty ())
-                        obj->innerContainer ()->canvas (m_handle)->
-                          clearEventMask (Canvas::KeyPress);
-                      else
-                        obj->innerContainer ()->canvas (m_handle)->
-                          addEventMask (Canvas::KeyPress);
-                    }
-                }
-            }
-        }
-        break;
+      gh_mgr.process_events ();
+      octave::autolock guard (gh_mgr.graphics_lock ());
+      retval = canvas->getPixels ();
+    }
+
+  return retval;
+}
+
+void
+Figure::beingDeleted ()
+{
+  Canvas *canvas = m_container->canvas (m_handle.value (), false);
+
+  if (canvas)
+    canvas->blockRedraw (true);
+
+  m_container->removeReceiver (this);
+  qWidget<FigureWindow> ()->removeReceiver (this);
+}
+
+void
+Figure::update (int pId)
+{
+  if (m_blockUpdates)
+    return;
+
+  figure::properties& fp = properties<figure> ();
+
+  if (fp.is___printing__ ())
+    return;
+
+  QMainWindow *win = qWidget<QMainWindow> ();
 
-      case figure::properties::ID_KEYRELEASEFCN:
+  // If the window doesn't exist, there's nothing we can do.
+  if (! win)
+    return;
+
+  m_blockUpdates = true;
+
+  switch (pId)
+    {
+    case figure::properties::ID_POSITION:
+      {
+        m_innerRect = boundingBoxToRect (fp.get_boundingbox (true));
+        int toffset = 0;
+        int boffset = 0;
+
+        for (auto *tb : win->findChildren<QToolBar *> ())
+          if (! tb->isHidden ())
+            toffset += tb->sizeHint ().height ();
+
+        if (! m_menuBar->isHidden ())
+          toffset += m_menuBar->sizeHint ().height ();
+
+        if (! m_statusBar->isHidden ())
+          boffset += m_statusBar->sizeHint ().height ();
+
+        set_geometry (m_innerRect.adjusted (0, -toffset, 0, boffset));
+      }
+      break;
+
+    case figure::properties::ID_NAME:
+    case figure::properties::ID_NUMBERTITLE:
+      win->setWindowTitle (Utils::fromStdString (fp.get_title ()));
+      break;
+
+    case figure::properties::ID_VISIBLE:
+      if (fp.is_visible ())
         {
-          Canvas *canvas = m_container->canvas (m_handle);
-
-          if (canvas)
+          QTimer::singleShot (0, win, &QMainWindow::show);
+          if (! fp.is___gl_window__ ())
             {
-              if (fp.get_keyreleasefcn ().isempty ())
-                canvas->clearEventMask (Canvas::KeyRelease);
-              else
-                canvas->addEventMask (Canvas::KeyRelease);
-            }
-          break;
-          // Signal the change to uipanels as well
-          for (auto *qobj : qWidget<QWidget> ()->findChildren<QObject *> ())
-            {
-              if (qobj->objectName () == "UIPanel")
-                {
-                  Object *obj = Object::fromQObject (qobj);
+              gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
 
-                  if (obj)
-                    {
-                      if (fp.get_keypressfcn ().isempty ())
-                        obj->innerContainer ()->canvas (m_handle)->
-                          clearEventMask (Canvas::KeyRelease);
-                      else
-                        obj->innerContainer ()->canvas (m_handle)->
-                          addEventMask (Canvas::KeyRelease);
-                    }
-                }
+              octave::autolock guard (gh_mgr.graphics_lock ());
+              fp.set ("__gl_window__", "on");
             }
         }
-        break;
-
-      case figure::properties::ID_WINDOWSTYLE:
-        if (fp.windowstyle_is ("modal"))
-          {
-            bool is_visible = win->isVisible ();
-
-            // if window is already visible, need to hide and reshow it in order to
-            // make it use the modal settings
-            if (is_visible)
-              win->setVisible (false);
-
-            win->setWindowModality (Qt::ApplicationModal);
-            win->setVisible (is_visible);
-          }
-        else
-          win->setWindowModality (Qt::NonModal);
-
-        break;
-
-      case figure::properties::ID_POINTERSHAPECDATA:
-        m_pointer_cdata =
-          pointer_to_qimage (fp.get_pointershapecdata ().matrix_value ());
-        if (fp.get_pointer () != "custom")
-          break;
-        OCTAVE_FALLTHROUGH;
-
-      case figure::properties::ID_POINTER:
-      case figure::properties::ID_POINTERSHAPEHOTSPOT:
-      case figure::properties::ID___MOUSE_MODE__:
-      case figure::properties::ID___ZOOM_MODE__:
-        {
-          Canvas *canvas = m_container->canvas (m_handle);
-
-          if (canvas)
-            canvas->setCursor (mouseMode (), fp.get_pointer (),
-                               m_pointer_cdata,
-                               fp.get_pointershapehotspot ().matrix_value());
-        }
-        break;
-
-      default:
-        break;
-      }
+      else
+        win->hide ();
+      break;
 
-    m_blockUpdates = false;
-  }
-
-  void
-  Figure::showFigureStatusBar (bool visible)
-  {
-    if (m_statusBar
-        && (! m_statusBar->isHidden ()) != visible)
-      {
-        int dy = m_statusBar->sizeHint ().height ();
-        QRect r = qWidget<QWidget> ()->geometry ();
-
-        if (! visible)
-          r.adjust (0, 0, 0, -dy);
-        else
-          r.adjust (0, 0, 0, dy);
-
-        m_blockUpdates = true;
-        set_geometry (r);
-        m_statusBar->setVisible (visible);
-        m_blockUpdates = false;
-
-        updateBoundingBox (false);
-      }
-  }
-
-  void
-  Figure::updateFigureHeight (int dh)
-  {
-    gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
-
-    octave::autolock guard (gh_mgr.graphics_lock ());
-    graphics_object go = object ();
-
-    if (go.valid_object () && dh != 0)
-      {
-        QRect r = qWidget<QWidget> ()->geometry ();
-
-        r.adjust (0, dh, 0, 0);
-
-        m_blockUpdates = true;
-        set_geometry (r);
-        m_blockUpdates = false;
-
-        updateBoundingBox (false);
-      }
-  }
+    case figure::properties::ID_RESIZE:
+      if (fp.is_resize ())
+        {
+          win->setSizePolicy (QSizePolicy::Preferred, QSizePolicy::Preferred);
+          win->setFixedSize (QSize( QWIDGETSIZE_MAX, QWIDGETSIZE_MAX));
+          m_resizable = true;
+        }
+      else
+        {
+          win->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed);
+          win->setFixedSize(win->size ());
+          m_resizable = false;
+        }
+      break;
 
-  void
-  Figure::updateStatusBar (ColumnVector pt)
-  {
-    if (! m_statusBar->isHidden ())
-      m_statusBar->showMessage (QString ("(%1, %2)")
-                                .arg (pt(0), 0, 'g', 5)
-                                .arg (pt(1), 0, 'g', 5));
-  }
-
-  void
-  Figure::do_connections (const QObject *receiver, const QObject * /* emitter */)
-  {
-    Object::do_connections (receiver);
-    Object::do_connections (receiver, m_container->canvas (m_handle));
-  }
-
-  QWidget *
-  Figure::menu ()
-  {
-    return qWidget<QMainWindow> ()->menuBar ();
-  }
-
-  void
-  Figure::updateBoundingBox (bool internal, int flags)
-  {
-    QWidget *win = qWidget<QWidget> ();
-    Matrix bb (1, 4);
-    std::string prop;
-
-    if (internal)
-      {
-        prop = "position";
-        QRect r = m_innerRect;
-
-        if (flags & UpdateBoundingBoxPosition)
-          r.moveTopLeft (win->mapToGlobal (m_container->pos ()));
-        if (flags & UpdateBoundingBoxSize)
-          r.setSize (m_container->size ());
-
-        if (r.isValid () && r != m_innerRect)
-          {
-            m_innerRect = r;
+    case figure::properties::ID_MENUBAR:
+    case figure::properties::ID_TOOLBAR:
+      if (fp.toolbar_is ("none"))
+        showFigureStatusBar (false);
+      else if (fp.toolbar_is ("figure"))
+        showFigureStatusBar (true);
+      else  // "auto"
+        showFigureStatusBar (fp.menubar_is ("figure"));
+      break;
 
-            bb(0) = r.x ();
-            bb(1) = r.y ();
-            bb(2) = r.width ();
-            bb(3) = r.height ();
-          }
-        else
-          return;
-      }
-    else
+    case figure::properties::ID_KEYPRESSFCN:
       {
-        prop = "outerposition";
-        QRect r = m_outerRect;
-
-        if (flags & UpdateBoundingBoxPosition)
-          r.moveTopLeft (win->pos ());
-        if (flags & UpdateBoundingBoxSize)
-          r.setSize (win->frameGeometry ().size ());
-
-        if (r.isValid () && r != m_outerRect)
-          {
-            m_outerRect = r;
+        Canvas *canvas = m_container->canvas (m_handle);
 
-            bb(0) = r.x ();
-            bb(1) = r.y ();
-            bb(2) = r.width ();
-            bb(3) = r.height ();
-          }
-        else
-          return;
-      }
-
-    figure::properties& fp = properties<figure> ();
-
-    emit gh_set_event (m_handle, prop, fp.bbox2position (bb), false,
-                       prop == "position");
-  }
-
-  bool
-  Figure::eventNotifyBefore (QObject *obj, QEvent *xevent)
-  {
-    if (! m_blockUpdates)
-      {
-        // Clicking the toolbar or the menubar makes this figure current
-        if (xevent->type () == QEvent::MouseButtonPress)
+        if (canvas)
           {
-            figure::properties& fp = properties<figure> ();
-
-            gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
-
-            graphics_object root = gh_mgr.get_object (0);
-
-            if (fp.get_handlevisibility () == "on")
-              root.set ("currentfigure",
-                        fp.get___myhandle__ ().as_octave_value ());
+            if (fp.get_keypressfcn ().isempty ())
+              canvas->clearEventMask (Canvas::KeyPress);
+            else
+              canvas->addEventMask (Canvas::KeyPress);
           }
 
-        if (obj == m_container)
-          {
-            // Do nothing...
-          }
-        else if (obj == m_menuBar)
+        // Signal the change to uipanels as well
+        for (auto *qobj : qWidget<QWidget> ()->findChildren<QObject *> ())
           {
-            switch (xevent->type ())
+            if (qobj->objectName () == "UIPanel")
               {
-              case QEvent::ActionAdded:
-              case QEvent::ActionChanged:
-              case QEvent::ActionRemoved:
-                m_previousHeight = m_menuBar->sizeHint ().height ();
+                Object *obj = Object::fromQObject (qobj);
 
-              default:
-                break;
-              }
-          }
-        else
-          {
-            switch (xevent->type ())
-              {
-              case QEvent::Close:
-                xevent->ignore ();
-                emit gh_callback_event (m_handle, "closerequestfcn");
-                return true;
-
-              default:
-                break;
+                if (obj)
+                  {
+                    if (fp.get_keypressfcn ().isempty ())
+                      obj->innerContainer ()->canvas (m_handle)->
+                        clearEventMask (Canvas::KeyPress);
+                    else
+                      obj->innerContainer ()->canvas (m_handle)->
+                        addEventMask (Canvas::KeyPress);
+                  }
               }
           }
       }
-
-    return false;
-  }
-
-  void
-  Figure::eventNotifyAfter (QObject *watched, QEvent *xevent)
-  {
-    if (! m_blockUpdates)
-      {
-        if (watched == m_container)
-          {
-            gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
-
-            switch (xevent->type ())
-              {
-              case QEvent::Resize:
-                updateBoundingBox (true, UpdateBoundingBoxSize);
-                break;
+      break;
 
-              case QEvent::ChildAdded:
-                if (dynamic_cast<QChildEvent *> (xevent)->child
-                    ()->isWidgetType())
-                  {
-                    octave::autolock guard (gh_mgr.graphics_lock ());
-                    update (figure::properties::ID_TOOLBAR);
-
-                    enableMouseTracking ();
-                  }
-                break;
-
-              case QEvent::ChildRemoved:
-                if (dynamic_cast<QChildEvent *> (xevent)->child
-                    ()->isWidgetType())
-                  {
-                    octave::autolock guard (gh_mgr.graphics_lock ());
-                    update (figure::properties::ID_TOOLBAR);
-                  }
-                break;
+    case figure::properties::ID_KEYRELEASEFCN:
+      {
+        Canvas *canvas = m_container->canvas (m_handle);
 
-              default:
-                break;
-              }
+        if (canvas)
+          {
+            if (fp.get_keyreleasefcn ().isempty ())
+              canvas->clearEventMask (Canvas::KeyRelease);
+            else
+              canvas->addEventMask (Canvas::KeyRelease);
           }
-        else if (watched == m_menuBar)
+        break;
+        // Signal the change to uipanels as well
+        for (auto *qobj : qWidget<QWidget> ()->findChildren<QObject *> ())
           {
-            switch (xevent->type ())
+            if (qobj->objectName () == "UIPanel")
               {
-              case QEvent::ActionAdded:
-              case QEvent::ActionChanged:
-              case QEvent::ActionRemoved:
-                // The menubar may have been resized if no action is visible
-                {
-                  QAction *a = dynamic_cast<QActionEvent *> (xevent)->action ();
-                  int currentHeight = m_menuBar->sizeHint ().height ();
-                  if (currentHeight != m_previousHeight
-                      && ! a->isSeparator ())
-                    updateFigureHeight (m_previousHeight - currentHeight);
-                }
-                break;
+                Object *obj = Object::fromQObject (qobj);
 
-              default:
-                break;
-              }
-          }
-        else
-          {
-            switch (xevent->type ())
-              {
-              case QEvent::Move:
-                updateBoundingBox (false, UpdateBoundingBoxPosition);
-                updateBoundingBox (true, UpdateBoundingBoxPosition);
-                break;
-
-              case QEvent::Resize:
-                updateBoundingBox (false, UpdateBoundingBoxSize);
-                break;
-
-              default:
-                break;
+                if (obj)
+                  {
+                    if (fp.get_keypressfcn ().isempty ())
+                      obj->innerContainer ()->canvas (m_handle)->
+                        clearEventMask (Canvas::KeyRelease);
+                    else
+                      obj->innerContainer ()->canvas (m_handle)->
+                        addEventMask (Canvas::KeyRelease);
+                  }
               }
           }
       }
-  }
+      break;
+
+    case figure::properties::ID_WINDOWSTYLE:
+      if (fp.windowstyle_is ("modal"))
+        {
+          bool is_visible = win->isVisible ();
+
+          // if window is already visible, need to hide and reshow it in order to
+          // make it use the modal settings
+          if (is_visible)
+            win->setVisible (false);
+
+          win->setWindowModality (Qt::ApplicationModal);
+          win->setVisible (is_visible);
+        }
+      else
+        win->setWindowModality (Qt::NonModal);
+
+      break;
 
-  void
-  Figure::addCustomToolBar (QToolBar *bar, bool visible, bool isdefault)
-  {
-    QMainWindow *win = qWidget<QMainWindow> ();
+    case figure::properties::ID_POINTERSHAPECDATA:
+      m_pointer_cdata =
+        pointer_to_qimage (fp.get_pointershapecdata ().matrix_value ());
+      if (fp.get_pointer () != "custom")
+        break;
+      OCTAVE_FALLTHROUGH;
+
+    case figure::properties::ID_POINTER:
+    case figure::properties::ID_POINTERSHAPEHOTSPOT:
+    case figure::properties::ID___MOUSE_MODE__:
+    case figure::properties::ID___ZOOM_MODE__:
+      {
+        Canvas *canvas = m_container->canvas (m_handle);
 
-    if (isdefault)
-      m_figureToolBar = bar;
+        if (canvas)
+          canvas->setCursor (mouseMode (), fp.get_pointer (),
+                             m_pointer_cdata,
+                             fp.get_pointershapehotspot ().matrix_value());
+      }
+      break;
+
+    default:
+      break;
+    }
+
+  m_blockUpdates = false;
+}
 
-    if (! visible)
-      win->addToolBar (bar);
-    else
-      {
-        QSize sz = bar->sizeHint ();
-        QRect r = win->geometry ();
+void
+Figure::showFigureStatusBar (bool visible)
+{
+  if (m_statusBar
+      && (! m_statusBar->isHidden ()) != visible)
+    {
+      int dy = m_statusBar->sizeHint ().height ();
+      QRect r = qWidget<QWidget> ()->geometry ();
+
+      if (! visible)
+        r.adjust (0, 0, 0, -dy);
+      else
+        r.adjust (0, 0, 0, dy);
+
+      m_blockUpdates = true;
+      set_geometry (r);
+      m_statusBar->setVisible (visible);
+      m_blockUpdates = false;
+
+      updateBoundingBox (false);
+    }
+}
 
-        r.adjust (0, -sz.height (), 0, 0);
+void
+Figure::updateFigureHeight (int dh)
+{
+  gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+
+  octave::autolock guard (gh_mgr.graphics_lock ());
+  graphics_object go = object ();
+
+  if (go.valid_object () && dh != 0)
+    {
+      QRect r = qWidget<QWidget> ()->geometry ();
+
+      r.adjust (0, dh, 0, 0);
 
-        m_blockUpdates = true;
-        set_geometry (r);
-        win->addToolBarBreak ();
-        win->addToolBar (bar);
-        m_blockUpdates = false;
+      m_blockUpdates = true;
+      set_geometry (r);
+      m_blockUpdates = false;
+
+      updateBoundingBox (false);
+    }
+}
+
+void
+Figure::updateStatusBar (ColumnVector pt)
+{
+  if (! m_statusBar->isHidden ())
+    m_statusBar->showMessage (QString ("(%1, %2)")
+                              .arg (pt(0), 0, 'g', 5)
+                              .arg (pt(1), 0, 'g', 5));
+}
 
-        updateBoundingBox (false);
-      }
-  }
+void
+Figure::do_connections (const QObject *receiver, const QObject * /* emitter */)
+{
+  Object::do_connections (receiver);
+  Object::do_connections (receiver, m_container->canvas (m_handle));
+}
+
+QWidget *
+Figure::menu ()
+{
+  return qWidget<QMainWindow> ()->menuBar ();
+}
+
+void
+Figure::updateBoundingBox (bool internal, int flags)
+{
+  QWidget *win = qWidget<QWidget> ();
+  Matrix bb (1, 4);
+  std::string prop;
 
-  void
-  Figure::showCustomToolBar (QToolBar *bar, bool visible)
-  {
-    QMainWindow *win = qWidget<QMainWindow> ();
+  if (internal)
+    {
+      prop = "position";
+      QRect r = m_innerRect;
+
+      if (flags & UpdateBoundingBoxPosition)
+        r.moveTopLeft (win->mapToGlobal (m_container->pos ()));
+      if (flags & UpdateBoundingBoxSize)
+        r.setSize (m_container->size ());
 
-    if ((! bar->isHidden ()) != visible)
-      {
-        QSize sz = bar->sizeHint ();
-        QRect r = win->geometry ();
+      if (r.isValid () && r != m_innerRect)
+        {
+          m_innerRect = r;
+
+          bb(0) = r.x ();
+          bb(1) = r.y ();
+          bb(2) = r.width ();
+          bb(3) = r.height ();
+        }
+      else
+        return;
+    }
+  else
+    {
+      prop = "outerposition";
+      QRect r = m_outerRect;
 
-        if (visible)
-          r.adjust (0, -sz.height (), 0, 0);
-        else
-          r.adjust (0, sz.height (), 0, 0);
+      if (flags & UpdateBoundingBoxPosition)
+        r.moveTopLeft (win->pos ());
+      if (flags & UpdateBoundingBoxSize)
+        r.setSize (win->frameGeometry ().size ());
+
+      if (r.isValid () && r != m_outerRect)
+        {
+          m_outerRect = r;
+
+          bb(0) = r.x ();
+          bb(1) = r.y ();
+          bb(2) = r.width ();
+          bb(3) = r.height ();
+        }
+      else
+        return;
+    }
+
+  figure::properties& fp = properties<figure> ();
+
+  emit gh_set_event (m_handle, prop, fp.bbox2position (bb), false,
+                     prop == "position");
+}
 
-        m_blockUpdates = true;
-        set_geometry (r);
-        bar->setVisible (visible);
-        m_blockUpdates = false;
+bool
+Figure::eventNotifyBefore (QObject *obj, QEvent *xevent)
+{
+  if (! m_blockUpdates)
+    {
+      // Clicking the toolbar or the menubar makes this figure current
+      if (xevent->type () == QEvent::MouseButtonPress)
+        {
+          figure::properties& fp = properties<figure> ();
+
+          gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+
+          graphics_object root = gh_mgr.get_object (0);
 
-        updateBoundingBox (false);
-      }
-  }
+          if (fp.get_handlevisibility () == "on")
+            root.set ("currentfigure",
+                      fp.get___myhandle__ ().as_octave_value ());
+        }
+
+      if (obj == m_container)
+        {
+          // Do nothing...
+        }
+      else if (obj == m_menuBar)
+        {
+          switch (xevent->type ())
+            {
+            case QEvent::ActionAdded:
+            case QEvent::ActionChanged:
+            case QEvent::ActionRemoved:
+              m_previousHeight = m_menuBar->sizeHint ().height ();
 
-  void
-  Figure::updateContainer ()
-  {
-    redraw ();
-  }
+            default:
+              break;
+            }
+        }
+      else
+        {
+          switch (xevent->type ())
+            {
+            case QEvent::Close:
+              xevent->ignore ();
+              emit gh_callback_event (m_handle, "closerequestfcn");
+              return true;
+
+            default:
+              break;
+            }
+        }
+    }
+
+  return false;
+}
 
-  void
-  Figure::figureWindowShown ()
-  {
-    QWindow *window = qWidget<QMainWindow> ()->windowHandle ();
-    QScreen *screen = window->screen ();
+void
+Figure::eventNotifyAfter (QObject *watched, QEvent *xevent)
+{
+  if (! m_blockUpdates)
+    {
+      if (watched == m_container)
+        {
+          gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+
+          switch (xevent->type ())
+            {
+            case QEvent::Resize:
+              updateBoundingBox (true, UpdateBoundingBoxSize);
+              break;
+
+            case QEvent::ChildAdded:
+              if (dynamic_cast<QChildEvent *> (xevent)->child
+                  ()->isWidgetType())
+                {
+                  octave::autolock guard (gh_mgr.graphics_lock ());
+                  update (figure::properties::ID_TOOLBAR);
+
+                  enableMouseTracking ();
+                }
+              break;
 
-    gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
-
-    octave::autolock guard (gh_mgr.graphics_lock ());
-
-    figure::properties& fp = properties<figure> ();
-    fp.set___device_pixel_ratio__ (screen->devicePixelRatio ());
+            case QEvent::ChildRemoved:
+              if (dynamic_cast<QChildEvent *> (xevent)->child
+                  ()->isWidgetType())
+                {
+                  octave::autolock guard (gh_mgr.graphics_lock ());
+                  update (figure::properties::ID_TOOLBAR);
+                }
+              break;
 
-    connect (window, &QWindow::screenChanged, this, &Figure::screenChanged);
-  }
+            default:
+              break;
+            }
+        }
+      else if (watched == m_menuBar)
+        {
+          switch (xevent->type ())
+            {
+            case QEvent::ActionAdded:
+            case QEvent::ActionChanged:
+            case QEvent::ActionRemoved:
+              // The menubar may have been resized if no action is visible
+              {
+                QAction *a = dynamic_cast<QActionEvent *> (xevent)->action ();
+                int currentHeight = m_menuBar->sizeHint ().height ();
+                if (currentHeight != m_previousHeight
+                    && ! a->isSeparator ())
+                  updateFigureHeight (m_previousHeight - currentHeight);
+              }
+              break;
 
-  void
-  Figure::screenChanged (QScreen *screen)
-  {
-    gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+            default:
+              break;
+            }
+        }
+      else
+        {
+          switch (xevent->type ())
+            {
+            case QEvent::Move:
+              updateBoundingBox (false, UpdateBoundingBoxPosition);
+              updateBoundingBox (true, UpdateBoundingBoxPosition);
+              break;
+
+            case QEvent::Resize:
+              updateBoundingBox (false, UpdateBoundingBoxSize);
+              break;
+
+            default:
+              break;
+            }
+        }
+    }
+}
 
-    octave::autolock guard (gh_mgr.graphics_lock ());
+void
+Figure::addCustomToolBar (QToolBar *bar, bool visible, bool isdefault)
+{
+  QMainWindow *win = qWidget<QMainWindow> ();
+
+  if (isdefault)
+    m_figureToolBar = bar;
+
+  if (! visible)
+    win->addToolBar (bar);
+  else
+    {
+      QSize sz = bar->sizeHint ();
+      QRect r = win->geometry ();
+
+      r.adjust (0, -sz.height (), 0, 0);
+
+      m_blockUpdates = true;
+      set_geometry (r);
+      win->addToolBarBreak ();
+      win->addToolBar (bar);
+      m_blockUpdates = false;
 
-    figure::properties& fp = properties<figure> ();
-    double old_dpr = fp.get___device_pixel_ratio__ ();
-    double new_dpr = screen->devicePixelRatio ();
-    if (old_dpr != new_dpr)
-      {
-        fp.set___device_pixel_ratio__ (new_dpr);
+      updateBoundingBox (false);
+    }
+}
+
+void
+Figure::showCustomToolBar (QToolBar *bar, bool visible)
+{
+  QMainWindow *win = qWidget<QMainWindow> ();
+
+  if ((! bar->isHidden ()) != visible)
+    {
+      QSize sz = bar->sizeHint ();
+      QRect r = win->geometry ();
 
-        // For some obscure reason, changing the __device_pixel_ratio__ property
-        // from the GUI thread does not necessarily trigger a redraw.  Force it.
-        redraw ();
-      }
-  }
+      if (visible)
+        r.adjust (0, -sz.height (), 0, 0);
+      else
+        r.adjust (0, sz.height (), 0, 0);
+
+      m_blockUpdates = true;
+      set_geometry (r);
+      bar->setVisible (visible);
+      m_blockUpdates = false;
+
+      updateBoundingBox (false);
+    }
+}
 
-  void
-  Figure::enableMouseTracking ()
-  {
-    // Enable mouse tracking on every widgets
-    m_container->setMouseTracking (true);
+void
+Figure::updateContainer ()
+{
+  redraw ();
+}
+
+void
+Figure::figureWindowShown ()
+{
+  QWindow *window = qWidget<QMainWindow> ()->windowHandle ();
+  QScreen *screen = window->screen ();
+
+  gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+
+  octave::autolock guard (gh_mgr.graphics_lock ());
+
+  figure::properties& fp = properties<figure> ();
+  fp.set___device_pixel_ratio__ (screen->devicePixelRatio ());
+
+  connect (window, &QWindow::screenChanged, this, &Figure::screenChanged);
+}
+
+void
+Figure::screenChanged (QScreen *screen)
+{
+  gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
 
-    Canvas *canvas = m_container->canvas (m_handle);
+  octave::autolock guard (gh_mgr.graphics_lock ());
+
+  figure::properties& fp = properties<figure> ();
+  double old_dpr = fp.get___device_pixel_ratio__ ();
+  double new_dpr = screen->devicePixelRatio ();
+  if (old_dpr != new_dpr)
+    {
+      fp.set___device_pixel_ratio__ (new_dpr);
+
+      // For some obscure reason, changing the __device_pixel_ratio__ property
+      // from the GUI thread does not necessarily trigger a redraw.  Force it.
+      redraw ();
+    }
+}
 
-    if (canvas)
-      canvas->qWidget ()->setMouseTracking (true);
+void
+Figure::enableMouseTracking ()
+{
+  // Enable mouse tracking on every widgets
+  m_container->setMouseTracking (true);
 
-    for (auto *w : m_container->findChildren<QWidget *> ())
-      w->setMouseTracking (true);
-  }
+  Canvas *canvas = m_container->canvas (m_handle);
+
+  if (canvas)
+    canvas->qWidget ()->setMouseTracking (true);
+
+  for (auto *w : m_container->findChildren<QWidget *> ())
+    w->setMouseTracking (true);
+}
 
 OCTAVE_END_NAMESPACE(octave)
--- a/libgui/graphics/Figure.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/Figure.h	Thu Feb 02 12:25:51 2023 -0800
@@ -39,107 +39,107 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class interpreter;
+class interpreter;
+
+enum MouseMode
+{
+  NoMode,
+  RotateMode,
+  ZoomInMode,
+  ZoomOutMode,
+  PanMode,
+  SelectMode,
+  TextMode
+};
+
+class Container;
+class FigureWindow;
+class MenuBar;
+class ToolBar;
+
+class Figure :
+  public Object,
+  public MenuContainer,
+  public GenericEventNotifyReceiver
+{
+  Q_OBJECT
+
+  friend class ToolBar;
 
-  enum MouseMode
+public:
+  Figure (octave::interpreter& interp,
+          const graphics_object& go, FigureWindow *win);
+  ~Figure ();
+
+  static Figure *
+  create (octave::interpreter& interp,
+          const graphics_object& go);
+
+  QString fileName ();
+  void setFileName (const QString& name);
+
+  MouseMode mouseMode ();
+
+  Container * innerContainer ();
+  QWidget * menu ();
+  void updateStatusBar (ColumnVector pt);
+
+  void do_connections (const QObject *receiver,
+                       const QObject *emitter = nullptr);
+
+  bool eventNotifyBefore (QObject *watched, QEvent *event);
+  void eventNotifyAfter (QObject *watched, QEvent *event);
+
+protected:
+  enum UpdateBoundingBoxFlag
   {
-    NoMode,
-    RotateMode,
-    ZoomInMode,
-    ZoomOutMode,
-    PanMode,
-    SelectMode,
-    TextMode
+    UpdateBoundingBoxPosition = 0x1,
+    UpdateBoundingBoxSize     = 0x2,
+    UpdateBoundingBoxAll      = 0x3
   };
 
-  class Container;
-  class FigureWindow;
-  class MenuBar;
-  class ToolBar;
-
-  class Figure :
-    public Object,
-    public MenuContainer,
-    public GenericEventNotifyReceiver
-  {
-    Q_OBJECT
-
-    friend class ToolBar;
-
-  public:
-    Figure (octave::interpreter& interp,
-            const graphics_object& go, FigureWindow *win);
-    ~Figure ();
+protected:
+  void redraw ();
+  void show ();
+  void print (const QString& file_cmd, const QString& term);
+  void update (int pId);
+  void updateBoundingBox (bool internal = false, int flags = 0);
+  void beingDeleted ();
 
-    static Figure *
-    create (octave::interpreter& interp,
-            const graphics_object& go);
-
-    QString fileName ();
-    void setFileName (const QString& name);
-
-    MouseMode mouseMode ();
+private:
+  void showFigureStatusBar (bool visible);
+  void addCustomToolBar (QToolBar *bar, bool visible, bool isdefault);
+  void showCustomToolBar (QToolBar *bar, bool visible);
+  void set_geometry (QRect r);
 
-    Container * innerContainer ();
-    QWidget * menu ();
-    void updateStatusBar (ColumnVector pt);
-
-    void do_connections (const QObject *receiver,
-                         const QObject *emitter = nullptr);
-
-    bool eventNotifyBefore (QObject *watched, QEvent *event);
-    void eventNotifyAfter (QObject *watched, QEvent *event);
+  void enableMouseTracking ();
 
-  protected:
-    enum UpdateBoundingBoxFlag
-    {
-      UpdateBoundingBoxPosition = 0x1,
-      UpdateBoundingBoxSize     = 0x2,
-      UpdateBoundingBoxAll      = 0x3
-    };
+private slots:
+  void updateFigureHeight (int delta_h);
+  void updateContainer ();
+  void figureWindowShown ();
+  void screenChanged (QScreen *);
 
-  protected:
-    void redraw ();
-    void show ();
-    void print (const QString& file_cmd, const QString& term);
-    void update (int pId);
-    void updateBoundingBox (bool internal = false, int flags = 0);
-    void beingDeleted ();
-
-  private:
-    void showFigureStatusBar (bool visible);
-    void addCustomToolBar (QToolBar *bar, bool visible, bool isdefault);
-    void showCustomToolBar (QToolBar *bar, bool visible);
-    void set_geometry (QRect r);
-
-    void enableMouseTracking ();
+public slots:
+  uint8NDArray slotGetPixels ();
 
-  private slots:
-    void updateFigureHeight (int delta_h);
-    void updateContainer ();
-    void figureWindowShown ();
-    void screenChanged (QScreen *);
-
-  public slots:
-    uint8NDArray slotGetPixels ();
+signals:
+  void asyncUpdate ();
+  void interpreter_event (const octave::fcn_callback& fcn);
+  void interpreter_event (const octave::meth_callback& meth);
 
-  signals:
-    void asyncUpdate ();
-    void interpreter_event (const octave::fcn_callback& fcn);
-    void interpreter_event (const octave::meth_callback& meth);
-
-  private:
-    Container *m_container;
-    bool m_blockUpdates;
-    QToolBar *m_figureToolBar;
-    MenuBar *m_menuBar;
-    QStatusBar *m_statusBar;
-    QRect m_innerRect;
-    QRect m_outerRect;
-    QImage m_pointer_cdata;
-    int m_previousHeight;
-    bool m_resizable;
-  };
+private:
+  Container *m_container;
+  bool m_blockUpdates;
+  QToolBar *m_figureToolBar;
+  MenuBar *m_menuBar;
+  QStatusBar *m_statusBar;
+  QRect m_innerRect;
+  QRect m_outerRect;
+  QImage m_pointer_cdata;
+  int m_previousHeight;
+  bool m_resizable;
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/graphics/GLCanvas.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/GLCanvas.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -37,345 +37,345 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  GLWidget::GLWidget (Canvas& parent_canvas, QWidget *parent)
-    : QOpenGLWidget (parent), m_parent_canvas (parent_canvas),
-      m_glfcns (), m_renderer (m_glfcns)
-  {
-    setFocusPolicy (Qt::ClickFocus);
-    setFocus ();
-  }
+GLWidget::GLWidget (Canvas& parent_canvas, QWidget *parent)
+  : QOpenGLWidget (parent), m_parent_canvas (parent_canvas),
+    m_glfcns (), m_renderer (m_glfcns)
+{
+  setFocusPolicy (Qt::ClickFocus);
+  setFocus ();
+}
+
+GLWidget::~GLWidget () { }
 
-  GLWidget::~GLWidget () { }
+void
+GLWidget::initializeGL ()
+{
+  // The qopengl_functions object (part of Octave, not Qt) is just
+  // wrapper around QOpenGLFunctions_1_1.  Does initialization really
+  // need to be deferred until initializeGL is called?
 
-  void
-  GLWidget::initializeGL ()
-  {
-    // The qopengl_functions object (part of Octave, not Qt) is just
-    // wrapper around QOpenGLFunctions_1_1.  Does initialization really
-    // need to be deferred until initializeGL is called?
+  m_glfcns.init ();
 
-    m_glfcns.init ();
+  // All other resources we need are currently (supposed to be)
+  // managed by the QOpenGLWidget object so there is else nothing to
+  // do here.  If we used custom shader programs, then we would need
+  // to initialize them here.
+}
 
-    // All other resources we need are currently (supposed to be)
-    // managed by the QOpenGLWidget object so there is else nothing to
-    // do here.  If we used custom shader programs, then we would need
-    // to initialize them here.
-  }
+void
+GLWidget::draw (graphics_object go)
+{
+  if (go)
+    {
+      begin_rendering ();
 
-  void
-  GLWidget::draw (graphics_object go)
-  {
-    if (go)
-      {
-        begin_rendering ();
+      unwind_action reset_current ([=] () { end_rendering (); });
+
+      graphics_object fig = go.get_ancestor ("figure");
+      double dpr = fig.get ("__device_pixel_ratio__").double_value ();
+      m_renderer.set_viewport (dpr * width (), dpr * height ());
+      m_renderer.set_device_pixel_ratio (dpr);
 
-        unwind_action reset_current ([=] () { end_rendering (); });
+      m_renderer.draw (go);
+    }
+}
 
-        graphics_object fig = go.get_ancestor ("figure");
-        double dpr = fig.get ("__device_pixel_ratio__").double_value ();
-        m_renderer.set_viewport (dpr * width (), dpr * height ());
-        m_renderer.set_device_pixel_ratio (dpr);
+uint8NDArray
+GLWidget::do_getPixels (graphics_object go)
+{
+  uint8NDArray retval;
 
-        m_renderer.draw (go);
-      }
-  }
+  if (go && go.isa ("figure"))
+    {
+      Matrix pos = go.get ("position").matrix_value ();
+      double dpr = go.get ("__device_pixel_ratio__").double_value ();
+      pos(2) *= dpr;
+      pos(3) *= dpr;
 
-  uint8NDArray
-  GLWidget::do_getPixels (graphics_object go)
-  {
-    uint8NDArray retval;
+      begin_rendering ();
+
+      unwind_action reset_current ([=] () { end_rendering (); });
 
-    if (go && go.isa ("figure"))
-      {
-        Matrix pos = go.get ("position").matrix_value ();
-        double dpr = go.get ("__device_pixel_ratio__").double_value ();
-        pos(2) *= dpr;
-        pos(3) *= dpr;
+      // When the figure is not visible or its size is frozen for printing,
+      // we use a framebuffer object to make sure we are rendering on a
+      // suitably large frame.
+      if (go.get ("visible").string_value () == "off"
+          || go.get ("__printing__").string_value () == "on")
+        {
+          QOpenGLFramebufferObject
+            fbo (pos(2), pos(3),
+                 QOpenGLFramebufferObject::Attachment::Depth);
 
-        begin_rendering ();
+          fbo.bind ();
 
-        unwind_action reset_current ([=] () { end_rendering (); });
+          unwind_action release_fbo ([&] () { fbo.release (); });
 
-        // When the figure is not visible or its size is frozen for printing,
-        // we use a framebuffer object to make sure we are rendering on a
-        // suitably large frame.
-        if (go.get ("visible").string_value () == "off"
-            || go.get ("__printing__").string_value () == "on")
-          {
-            QOpenGLFramebufferObject
-              fbo (pos(2), pos(3),
-                   QOpenGLFramebufferObject::Attachment::Depth);
+          m_renderer.set_viewport (pos(2), pos(3));
+          m_renderer.set_device_pixel_ratio (dpr);
+          m_renderer.draw (go);
 
-            fbo.bind ();
-
-            unwind_action release_fbo ([&] () { fbo.release (); });
+          retval = m_renderer.get_pixels (pos(2), pos(3));
+        }
+      else
+        {
+          m_renderer.set_viewport (pos(2), pos(3));
+          m_renderer.set_device_pixel_ratio (dpr);
+          m_renderer.draw (go);
 
-            m_renderer.set_viewport (pos(2), pos(3));
-            m_renderer.set_device_pixel_ratio (dpr);
-            m_renderer.draw (go);
+          retval = m_renderer.get_pixels (pos(2), pos(3));
+        }
+    }
+
+  return retval;
+}
 
-            retval = m_renderer.get_pixels (pos(2), pos(3));
-          }
-        else
-          {
-            m_renderer.set_viewport (pos(2), pos(3));
-            m_renderer.set_device_pixel_ratio (dpr);
-            m_renderer.draw (go);
+void
+GLWidget::do_print (const QString& file_cmd, const QString& term,
+                    graphics_object go)
+{
+  if (go.valid_object ())
+    {
+      begin_rendering ();
 
-            retval = m_renderer.get_pixels (pos(2), pos(3));
-          }
-      }
+      unwind_action reset_current ([=] () { end_rendering (); });
+
+      graphics_object fig (go.get_ancestor ("figure"));
 
-    return retval;
-  }
+      if (fig.get ("visible").string_value () == "on")
+        octave::gl2ps_print (m_glfcns, fig, file_cmd.toStdString (),
+                             term.toStdString ());
+      else
+        {
+          // When the figure is not visible, we use a framebuffer object
+          // to make sure we are rendering on a suitably large frame.
+          Matrix pos = fig.get ("position").matrix_value ();
+          double dpr = fig.get ("__device_pixel_ratio__").double_value ();
+          pos(2) *= dpr;
+          pos(3) *= dpr;
 
-  void
-  GLWidget::do_print (const QString& file_cmd, const QString& term,
-                      graphics_object go)
-  {
-    if (go.valid_object ())
-      {
-        begin_rendering ();
+          QOpenGLFramebufferObject
+            fbo (pos(2), pos(3),
+                 QOpenGLFramebufferObject::Attachment::Depth);
 
-        unwind_action reset_current ([=] () { end_rendering (); });
+          fbo.bind ();
 
-        graphics_object fig (go.get_ancestor ("figure"));
+          unwind_action release_fbo ([&] () { fbo.release (); });
 
-        if (fig.get ("visible").string_value () == "on")
           octave::gl2ps_print (m_glfcns, fig, file_cmd.toStdString (),
                                term.toStdString ());
-        else
-          {
-            // When the figure is not visible, we use a framebuffer object
-            // to make sure we are rendering on a suitably large frame.
-            Matrix pos = fig.get ("position").matrix_value ();
-            double dpr = fig.get ("__device_pixel_ratio__").double_value ();
-            pos(2) *= dpr;
-            pos(3) *= dpr;
+        }
+    }
+}
+
+graphics_object
+GLWidget::selectFromAxes (const graphics_object& ax, const QPoint& pt)
+{
+  if (ax)
+    {
+      begin_rendering ();
 
-            QOpenGLFramebufferObject
-              fbo (pos(2), pos(3),
-                   QOpenGLFramebufferObject::Attachment::Depth);
+      unwind_action reset_current ([=] () { end_rendering (); });
+
+      octave::opengl_selector s (m_glfcns);
+
+      s.set_viewport (width (), height ());
 
-            fbo.bind ();
+      graphics_object go = s.select (ax, pt.x (), height () - pt.y (),
+                                     octave::select_ignore_hittest);
 
-            unwind_action release_fbo ([&] () { fbo.release (); });
+      doneCurrent ();
+    }
 
-            octave::gl2ps_print (m_glfcns, fig, file_cmd.toStdString (),
-                                 term.toStdString ());
-          }
-      }
-  }
-
-  graphics_object
-  GLWidget::selectFromAxes (const graphics_object& ax, const QPoint& pt)
-  {
-    if (ax)
-      {
-        begin_rendering ();
+  return graphics_object ();
+}
 
-        unwind_action reset_current ([=] () { end_rendering (); });
-
-        octave::opengl_selector s (m_glfcns);
-
-        s.set_viewport (width (), height ());
+void
+GLWidget::drawZoomBox (const QPoint& p1, const QPoint& p2)
+{
+  Matrix overlaycolor (3, 1);
+  overlaycolor(0) = 0.45;
+  overlaycolor(1) = 0.62;
+  overlaycolor(2) = 0.81;
+  double overlayalpha = 0.1;
+  Matrix bordercolor = overlaycolor;
+  double borderalpha = 0.9;
+  double borderwidth = 1.5;
 
-        graphics_object go = s.select (ax, pt.x (), height () - pt.y (),
-                                       octave::select_ignore_hittest);
+  m_renderer.draw_zoom_box (width (), height (),
+                            p1.x (), p1.y (), p2.x (), p2.y (),
+                            overlaycolor, overlayalpha,
+                            bordercolor, borderalpha, borderwidth);
+}
 
-        doneCurrent ();
-      }
-
-    return graphics_object ();
-  }
+void
+GLWidget::paintGL ()
+{
+  m_parent_canvas.canvasPaintEvent ();
+}
 
-  void
-  GLWidget::drawZoomBox (const QPoint& p1, const QPoint& p2)
-  {
-    Matrix overlaycolor (3, 1);
-    overlaycolor(0) = 0.45;
-    overlaycolor(1) = 0.62;
-    overlaycolor(2) = 0.81;
-    double overlayalpha = 0.1;
-    Matrix bordercolor = overlaycolor;
-    double borderalpha = 0.9;
-    double borderwidth = 1.5;
+void
+GLWidget::mouseDoubleClickEvent (QMouseEvent *xevent)
+{
+  m_parent_canvas.canvasMouseDoubleClickEvent (xevent);
+}
+
+void
+GLWidget::mouseMoveEvent (QMouseEvent *xevent)
+{
+  m_parent_canvas.canvasMouseMoveEvent (xevent);
+}
 
-    m_renderer.draw_zoom_box (width (), height (),
-                              p1.x (), p1.y (), p2.x (), p2.y (),
-                              overlaycolor, overlayalpha,
-                              bordercolor, borderalpha, borderwidth);
-  }
+void
+GLWidget::mousePressEvent (QMouseEvent *xevent)
+{
+  m_parent_canvas.canvasMousePressEvent (xevent);
+}
 
-  void
-  GLWidget::paintGL ()
-  {
-    m_parent_canvas.canvasPaintEvent ();
-  }
-
-  void
-  GLWidget::mouseDoubleClickEvent (QMouseEvent *xevent)
-  {
-    m_parent_canvas.canvasMouseDoubleClickEvent (xevent);
-  }
+void
+GLWidget::mouseReleaseEvent (QMouseEvent *xevent)
+{
+  m_parent_canvas.canvasMouseReleaseEvent (xevent);
+}
 
-  void
-  GLWidget::mouseMoveEvent (QMouseEvent *xevent)
-  {
-    m_parent_canvas.canvasMouseMoveEvent (xevent);
-  }
+void
+GLWidget::wheelEvent (QWheelEvent *xevent)
+{
+  m_parent_canvas.canvasWheelEvent (xevent);
+}
 
-  void
-  GLWidget::mousePressEvent (QMouseEvent *xevent)
-  {
-    m_parent_canvas.canvasMousePressEvent (xevent);
-  }
-
-  void
-  GLWidget::mouseReleaseEvent (QMouseEvent *xevent)
-  {
-    m_parent_canvas.canvasMouseReleaseEvent (xevent);
-  }
+void
+GLWidget::keyPressEvent (QKeyEvent *xevent)
+{
+  if (! m_parent_canvas.canvasKeyPressEvent (xevent))
+    QOpenGLWidget::keyPressEvent (xevent);
+}
 
-  void
-  GLWidget::wheelEvent (QWheelEvent *xevent)
-  {
-    m_parent_canvas.canvasWheelEvent (xevent);
-  }
+void
+GLWidget::keyReleaseEvent (QKeyEvent *xevent)
+{
+  if (! m_parent_canvas.canvasKeyReleaseEvent (xevent))
+    QOpenGLWidget::keyReleaseEvent (xevent);
+}
 
-  void
-  GLWidget::keyPressEvent (QKeyEvent *xevent)
-  {
-    if (! m_parent_canvas.canvasKeyPressEvent (xevent))
-      QOpenGLWidget::keyPressEvent (xevent);
-  }
+bool
+GLWidget::begin_rendering ()
+{
+  bool retval = true;
 
-  void
-  GLWidget::keyReleaseEvent (QKeyEvent *xevent)
-  {
-    if (! m_parent_canvas.canvasKeyReleaseEvent (xevent))
-      QOpenGLWidget::keyReleaseEvent (xevent);
-  }
+  if (! isValid ())
+    {
+      // FIXME: Is this really the right way to manager offscreen
+      // rendering for printing?
+
+      static bool os_ctx_ok = true;
 
-  bool
-  GLWidget::begin_rendering ()
-  {
-    bool retval = true;
+      if (os_ctx_ok && ! m_os_context.isValid ())
+        {
+          // Try to initialize offscreen context
+          m_os_surface.create ();
 
-    if (! isValid ())
-      {
-        // FIXME: Is this really the right way to manager offscreen
-        // rendering for printing?
-
-        static bool os_ctx_ok = true;
+          if (! m_os_context.create ())
+            {
+              os_ctx_ok = false;
+              return false;
+            }
+        }
 
-        if (os_ctx_ok && ! m_os_context.isValid ())
-          {
-            // Try to initialize offscreen context
-            m_os_surface.create ();
+      retval = m_os_context.makeCurrent (&m_os_surface);
+    }
+  else
+    makeCurrent ();
 
-            if (! m_os_context.create ())
-              {
-                os_ctx_ok = false;
-                return false;
-              }
-          }
+  return retval;
+}
 
-        retval = m_os_context.makeCurrent (&m_os_surface);
-      }
-    else
-      makeCurrent ();
+void
+GLWidget::end_rendering ()
+{
+  doneCurrent ();
+}
 
-    return retval;
-  }
+GLCanvas::GLCanvas (octave::interpreter& interp,
+                    const graphics_handle& gh, QWidget *parent)
+  : Canvas (interp, gh), m_glwidget (new GLWidget (*this, parent))
+{ }
 
-  void
-  GLWidget::end_rendering ()
-  {
-    doneCurrent ();
-  }
-
-  GLCanvas::GLCanvas (octave::interpreter& interp,
-                      const graphics_handle& gh, QWidget *parent)
-    : Canvas (interp, gh), m_glwidget (new GLWidget (*this, parent))
-  { }
+GLCanvas::~GLCanvas ()
+{
+  delete m_glwidget;
+}
 
-  GLCanvas::~GLCanvas ()
-  {
-    delete m_glwidget;
-  }
+void
+GLCanvas::draw (const graphics_handle& gh)
+{
+  gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+
+  octave::autolock guard  (gh_mgr.graphics_lock ());
 
-  void
-  GLCanvas::draw (const graphics_handle& gh)
-  {
-    gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+  graphics_object go = gh_mgr.get_object (gh);
+
+  m_glwidget->draw (go);
+}
 
-    octave::autolock guard  (gh_mgr.graphics_lock ());
-
-    graphics_object go = gh_mgr.get_object (gh);
-
-    m_glwidget->draw (go);
-  }
+uint8NDArray
+GLCanvas::do_getPixels (const graphics_handle& gh)
+{
+  uint8NDArray retval;
 
-  uint8NDArray
-  GLCanvas::do_getPixels (const graphics_handle& gh)
-  {
-    uint8NDArray retval;
+  gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
 
-    gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+  graphics_object go = gh_mgr.get_object (gh);
 
-    graphics_object go = gh_mgr.get_object (gh);
+  return m_glwidget->do_getPixels (go);
+}
 
-    return m_glwidget->do_getPixels (go);
-  }
+void
+GLCanvas::do_print (const QString& file_cmd, const QString& term,
+                    const graphics_handle& handle)
+{
+  gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
 
-  void
-  GLCanvas::do_print (const QString& file_cmd, const QString& term,
-                      const graphics_handle& handle)
-  {
-    gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+  octave::autolock guard  (gh_mgr.graphics_lock ());
 
-    octave::autolock guard  (gh_mgr.graphics_lock ());
-
-    graphics_object go = gh_mgr.get_object (handle);
+  graphics_object go = gh_mgr.get_object (handle);
 
-    try
-      {
-        m_glwidget->do_print (file_cmd, term, go);
-      }
-    catch (octave::execution_exception& ee)
-      {
-        emit interpreter_event
-          ([=] ()
-          {
-            // INTERPRETER THREAD
-            throw ee;
-          });
-      }
-  }
+  try
+    {
+      m_glwidget->do_print (file_cmd, term, go);
+    }
+  catch (octave::execution_exception& ee)
+    {
+      emit interpreter_event
+        ([=] ()
+        {
+          // INTERPRETER THREAD
+          throw ee;
+        });
+    }
+}
 
-  graphics_object
-  GLCanvas::selectFromAxes (const graphics_object& ax, const QPoint& pt)
-  {
-    return m_glwidget->selectFromAxes (ax, pt);
-  }
+graphics_object
+GLCanvas::selectFromAxes (const graphics_object& ax, const QPoint& pt)
+{
+  return m_glwidget->selectFromAxes (ax, pt);
+}
 
-  void
-  GLCanvas::drawZoomBox (const QPoint& p1, const QPoint& p2)
-  {
-    m_glwidget->drawZoomBox (p1, p2);
-  }
+void
+GLCanvas::drawZoomBox (const QPoint& p1, const QPoint& p2)
+{
+  m_glwidget->drawZoomBox (p1, p2);
+}
 
-  bool
-  GLCanvas::begin_rendering ()
-  {
-    return m_glwidget->begin_rendering ();
-  }
+bool
+GLCanvas::begin_rendering ()
+{
+  return m_glwidget->begin_rendering ();
+}
 
-  void
-  GLCanvas::end_rendering ()
-  {
-    m_glwidget->end_rendering ();
-  }
+void
+GLCanvas::end_rendering ()
+{
+  m_glwidget->end_rendering ();
+}
 
 OCTAVE_END_NAMESPACE(octave)
--- a/libgui/graphics/GLCanvas.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/GLCanvas.h	Thu Feb 02 12:25:51 2023 -0800
@@ -38,81 +38,81 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class GLWidget : public QOpenGLWidget
-  {
-    Q_OBJECT
+class GLWidget : public QOpenGLWidget
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    GLWidget (Canvas& parent_canvas, QWidget *parent);
+  GLWidget (Canvas& parent_canvas, QWidget *parent);
 
-    ~GLWidget ();
+  ~GLWidget ();
 
-    void initializeGL ();
+  void initializeGL ();
 
-    void draw (graphics_object go);
-    uint8NDArray  do_getPixels (graphics_object go);
-    void do_print (const QString& file_cmd, const QString& term,
-                   graphics_object go);
-    void drawZoomBox (const QPoint& p1, const QPoint& p2);
-    void resize (int /* x */, int /* y */,
-                 int /* width */, int /* height */) { }
-    graphics_object selectFromAxes (const graphics_object& ax,
-                                    const QPoint& pt);
+  void draw (graphics_object go);
+  uint8NDArray  do_getPixels (graphics_object go);
+  void do_print (const QString& file_cmd, const QString& term,
+                 graphics_object go);
+  void drawZoomBox (const QPoint& p1, const QPoint& p2);
+  void resize (int /* x */, int /* y */,
+               int /* width */, int /* height */) { }
+  graphics_object selectFromAxes (const graphics_object& ax,
+                                  const QPoint& pt);
 
-    bool begin_rendering ();
-    void end_rendering ();
+  bool begin_rendering ();
+  void end_rendering ();
 
-  protected:
+protected:
 
-    void paintGL ();
-    void mouseDoubleClickEvent (QMouseEvent *event);
-    void mouseMoveEvent (QMouseEvent *event);
-    void mousePressEvent (QMouseEvent *event);
-    void mouseReleaseEvent (QMouseEvent *event);
-    void wheelEvent (QWheelEvent *event);
-    void keyPressEvent (QKeyEvent *event);
-    void keyReleaseEvent (QKeyEvent *event);
+  void paintGL ();
+  void mouseDoubleClickEvent (QMouseEvent *event);
+  void mouseMoveEvent (QMouseEvent *event);
+  void mousePressEvent (QMouseEvent *event);
+  void mouseReleaseEvent (QMouseEvent *event);
+  void wheelEvent (QWheelEvent *event);
+  void keyPressEvent (QKeyEvent *event);
+  void keyReleaseEvent (QKeyEvent *event);
 
-  private:
+private:
 
-    Canvas& m_parent_canvas;
+  Canvas& m_parent_canvas;
 
-    qopengl_functions m_glfcns;
-    opengl_renderer m_renderer;
+  qopengl_functions m_glfcns;
+  opengl_renderer m_renderer;
 
-    QOpenGLContext m_os_context;
-    QOffscreenSurface m_os_surface;
-  };
+  QOpenGLContext m_os_context;
+  QOffscreenSurface m_os_surface;
+};
 
-  class GLCanvas : public Canvas
-  {
-  public:
+class GLCanvas : public Canvas
+{
+public:
 
-    GLCanvas (octave::interpreter& interp, const graphics_handle& handle,
-              QWidget *parent);
+  GLCanvas (octave::interpreter& interp, const graphics_handle& handle,
+            QWidget *parent);
 
-    ~GLCanvas ();
+  ~GLCanvas ();
 
-    void draw (const graphics_handle& handle);
-    uint8NDArray  do_getPixels (const graphics_handle& handle);
-    void do_print (const QString& file_cmd, const QString& term,
-                   const graphics_handle& handle);
-    void drawZoomBox (const QPoint& p1, const QPoint& p2);
-    void resize (int /* x */, int /* y */,
-                 int /* width */, int /* height */) { }
-    graphics_object selectFromAxes (const graphics_object& ax,
-                                    const QPoint& pt);
+  void draw (const graphics_handle& handle);
+  uint8NDArray  do_getPixels (const graphics_handle& handle);
+  void do_print (const QString& file_cmd, const QString& term,
+                 const graphics_handle& handle);
+  void drawZoomBox (const QPoint& p1, const QPoint& p2);
+  void resize (int /* x */, int /* y */,
+               int /* width */, int /* height */) { }
+  graphics_object selectFromAxes (const graphics_object& ax,
+                                  const QPoint& pt);
 
-    QWidget * qWidget () { return m_glwidget; }
+  QWidget * qWidget () { return m_glwidget; }
 
-  private:
+private:
 
-    GLWidget *m_glwidget;
+  GLWidget *m_glwidget;
 
-    bool begin_rendering ();
-    void end_rendering ();
-  };
+  bool begin_rendering ();
+  void end_rendering ();
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/graphics/ListBoxControl.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/ListBoxControl.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -37,250 +37,250 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  static void
-  updateSelection (QListWidget *list, const Matrix& value)
-  {
-    octave_idx_type n = value.numel ();
-    int lc = list->count ();
+static void
+updateSelection (QListWidget *list, const Matrix& value)
+{
+  octave_idx_type n = value.numel ();
+  int lc = list->count ();
+
+  list->clearSelection ();
+
+  for (octave_idx_type i = 0; i < n; i++)
+    {
+      int idx = octave::math::round (value(i));
 
-    list->clearSelection ();
+      if (1 <= idx && idx <= lc)
+        {
+          list->item (idx-1)->setSelected (true);
+          list->scrollToItem (list->item (idx-1));
+          if (i == 0
+              && list->selectionMode () == QAbstractItemView::SingleSelection)
+            break;
+        }
+      else
+        {
+          // Invalid selection.
+          list->clearSelection ();
+          break;
+        }
+    }
+}
 
-    for (octave_idx_type i = 0; i < n; i++)
-      {
-        int idx = octave::math::round (value(i));
+ListBoxControl *
+ListBoxControl::create (octave::interpreter& interp,
+                        const graphics_object& go)
+{
+  Object *parent = parentObject (interp, go);
+
+  if (parent)
+    {
+      Container *container = parent->innerContainer ();
+
+      if (container)
+        return new ListBoxControl (interp, go,
+                                   new QListWidget (container));
+    }
+
+  return nullptr;
+}
+
+ListBoxControl::ListBoxControl (octave::interpreter& interp,
+                                const graphics_object& go, QListWidget *list)
+  : BaseControl (interp, go, list), m_blockCallback (false),
+    m_selectionChanged (false)
+{
+  uicontrol::properties& up = properties<uicontrol> ();
 
-        if (1 <= idx && idx <= lc)
-          {
-            list->item (idx-1)->setSelected (true);
-            list->scrollToItem (list->item (idx-1));
-            if (i == 0
-                && list->selectionMode () == QAbstractItemView::SingleSelection)
-              break;
-          }
-        else
-          {
-            // Invalid selection.
-            list->clearSelection ();
-            break;
-          }
-      }
-  }
+  list->addItems (Utils::fromStringVector (up.get_string_vector ()));
+  if ((up.get_max () - up.get_min ()) > 1)
+    list->setSelectionMode (QAbstractItemView::ExtendedSelection);
+  else
+    list->setSelectionMode (QAbstractItemView::SingleSelection);
+  Matrix value = up.get_value ().matrix_value ();
+  if (value.numel () > 0)
+    {
+      octave_idx_type n = value.numel ();
+      int lc = list->count ();
+
+      for (octave_idx_type i = 0; i < n; i++)
+        {
+          int idx = octave::math::round (value(i));
+
+          if (1 <= idx && idx <= lc)
+            {
+              list->item (idx-1)->setSelected (true);
+              list->scrollToItem (list->item (idx-1));
+              if (i == 0 && (list->selectionMode ()
+                             == QAbstractItemView::SingleSelection))
+                break;
+            }
+        }
+    }
+
+  list->viewport ()->installEventFilter (this);
 
-  ListBoxControl *
-  ListBoxControl::create (octave::interpreter& interp,
-                          const graphics_object& go)
-  {
-    Object *parent = parentObject (interp, go);
+  connect (list, &QListWidget::itemSelectionChanged,
+           this, &ListBoxControl::itemSelectionChanged);
+  connect (list, &QListWidget::activated,
+           this, &ListBoxControl::itemActivated);
+  connect (list, &QListWidget::itemPressed,
+           this, &ListBoxControl::itemPressed);
+}
+
+ListBoxControl::~ListBoxControl ()
+{ }
+
+void
+ListBoxControl::update (int pId)
+{
+  uicontrol::properties& up = properties<uicontrol> ();
+  QListWidget *list = qWidget<QListWidget> ();
 
-    if (parent)
-      {
-        Container *container = parent->innerContainer ();
+  switch (pId)
+    {
+    case uicontrol::properties::ID_STRING:
+      m_blockCallback = true;
+      list->clear ();
+      list->addItems (Utils::fromStringVector (up.get_string_vector ()));
+      updateSelection (list, up.get_value ().matrix_value ());
+      m_blockCallback = false;
+      break;
 
-        if (container)
-          return new ListBoxControl (interp, go,
-                                     new QListWidget (container));
+    case uicontrol::properties::ID_MIN:
+    case uicontrol::properties::ID_MAX:
+      if ((up.get_max () - up.get_min ()) > 1)
+        list->setSelectionMode (QAbstractItemView::ExtendedSelection);
+      else
+        list->setSelectionMode (QAbstractItemView::SingleSelection);
+      break;
+
+    case uicontrol::properties::ID_LISTBOXTOP:
+      {
+        int idx = octave::math::fix (up.get_listboxtop ());
+        if (idx > 0)
+          list->scrollToItem (list->item (idx-1),
+                              QAbstractItemView::PositionAtTop);
+        break;
       }
 
-    return nullptr;
-  }
+    case uicontrol::properties::ID_VALUE:
+      m_blockCallback = true;
+      updateSelection (list, up.get_value ().matrix_value ());
+      m_blockCallback = false;
+      break;
 
-  ListBoxControl::ListBoxControl (octave::interpreter& interp,
-                                  const graphics_object& go, QListWidget *list)
-    : BaseControl (interp, go, list), m_blockCallback (false),
-      m_selectionChanged (false)
-  {
-    uicontrol::properties& up = properties<uicontrol> ();
+    default:
+      BaseControl::update (pId);
+      break;
+    }
+}
 
-    list->addItems (Utils::fromStringVector (up.get_string_vector ()));
-    if ((up.get_max () - up.get_min ()) > 1)
-      list->setSelectionMode (QAbstractItemView::ExtendedSelection);
-    else
-      list->setSelectionMode (QAbstractItemView::SingleSelection);
-    Matrix value = up.get_value ().matrix_value ();
-    if (value.numel () > 0)
-      {
-        octave_idx_type n = value.numel ();
-        int lc = list->count ();
+void
+ListBoxControl::sendSelectionChange ()
+{
+  if (! m_blockCallback)
+    {
+      QListWidget *list = qWidget<QListWidget> ();
 
-        for (octave_idx_type i = 0; i < n; i++)
-          {
-            int idx = octave::math::round (value(i));
+      QModelIndexList l = list->selectionModel ()->selectedIndexes ();
+      Matrix value (dim_vector (1, l.size ()));
+      int i = 0;
+
+      for (const auto& idx : l)
+        value(i++) = idx.row () + 1;
 
-            if (1 <= idx && idx <= lc)
-              {
-                list->item (idx-1)->setSelected (true);
-                list->scrollToItem (list->item (idx-1));
-                if (i == 0 && (list->selectionMode ()
-                               == QAbstractItemView::SingleSelection))
-                  break;
-              }
-          }
-      }
+      emit gh_set_event (m_handle, "value", octave_value (value), false);
+      emit gh_callback_event (m_handle, "callback");
+    }
 
-    list->viewport ()->installEventFilter (this);
+  m_selectionChanged = false;
+}
 
-    connect (list, &QListWidget::itemSelectionChanged,
-             this, &ListBoxControl::itemSelectionChanged);
-    connect (list, &QListWidget::activated,
-             this, &ListBoxControl::itemActivated);
-    connect (list, &QListWidget::itemPressed,
-             this, &ListBoxControl::itemPressed);
-  }
-
-  ListBoxControl::~ListBoxControl ()
-  { }
-
-  void
-  ListBoxControl::update (int pId)
-  {
-    uicontrol::properties& up = properties<uicontrol> ();
-    QListWidget *list = qWidget<QListWidget> ();
+void
+ListBoxControl::itemSelectionChanged ()
+{
+  if (! m_blockCallback)
+    m_selectionChanged = true;
+}
 
-    switch (pId)
-      {
-      case uicontrol::properties::ID_STRING:
-        m_blockCallback = true;
-        list->clear ();
-        list->addItems (Utils::fromStringVector (up.get_string_vector ()));
-        updateSelection (list, up.get_value ().matrix_value ());
-        m_blockCallback = false;
-        break;
+void
+ListBoxControl::itemActivated (const QModelIndex&)
+{
+  m_selectionChanged = true;
+}
+void
+ListBoxControl::itemPressed (QListWidgetItem *)
+{
+  m_selectionChanged = true;
+}
 
-      case uicontrol::properties::ID_MIN:
-      case uicontrol::properties::ID_MAX:
-        if ((up.get_max () - up.get_min ()) > 1)
-          list->setSelectionMode (QAbstractItemView::ExtendedSelection);
-        else
-          list->setSelectionMode (QAbstractItemView::SingleSelection);
-        break;
+bool
+ListBoxControl::eventFilter (QObject *watched, QEvent *e)
+{
+  // listbox change
+  if (watched == m_qobject)
+    {
+      switch (e->type ())
+        {
+        case QEvent::KeyRelease:
+          if (m_selectionChanged)
+            sendSelectionChange ();
+          m_selectionChanged = false;
+          break;
 
-      case uicontrol::properties::ID_LISTBOXTOP:
-        {
-          int idx = octave::math::fix (up.get_listboxtop ());
-          if (idx > 0)
-            list->scrollToItem (list->item (idx-1),
-                                QAbstractItemView::PositionAtTop);
+        default:
           break;
         }
 
-      case uicontrol::properties::ID_VALUE:
-        m_blockCallback = true;
-        updateSelection (list, up.get_value ().matrix_value ());
-        m_blockCallback = false;
-        break;
-
-      default:
-        BaseControl::update (pId);
-        break;
-      }
-  }
+      return Object::eventFilter (watched, e);
+    }
+  // listbox viewport
+  else
+    {
+      bool override_return = false;
+      QListWidget *list = qWidget<QListWidget> ();
 
-  void
-  ListBoxControl::sendSelectionChange ()
-  {
-    if (! m_blockCallback)
-      {
-        QListWidget *list = qWidget<QListWidget> ();
-
-        QModelIndexList l = list->selectionModel ()->selectedIndexes ();
-        Matrix value (dim_vector (1, l.size ()));
-        int i = 0;
-
-        for (const auto& idx : l)
-          value(i++) = idx.row () + 1;
-
-        emit gh_set_event (m_handle, "value", octave_value (value), false);
-        emit gh_callback_event (m_handle, "callback");
-      }
+      switch (e->type ())
+        {
+        case QEvent::MouseButtonPress:
+          {
+            QMouseEvent *m = dynamic_cast<QMouseEvent *> (e);
 
-    m_selectionChanged = false;
-  }
-
-  void
-  ListBoxControl::itemSelectionChanged ()
-  {
-    if (! m_blockCallback)
-      m_selectionChanged = true;
-  }
+            if (m->button () & Qt::RightButton)
+              override_return = true;
+            else
+              {
+                if (! list->indexAt (m->pos ()).isValid ())
+                  override_return = true;
+                m_selectionChanged = true;
+              }
+            break;
+          }
+        case QEvent::MouseButtonRelease:
+          {
+            QMouseEvent *m = dynamic_cast<QMouseEvent *> (e);
 
-  void
-  ListBoxControl::itemActivated (const QModelIndex&)
-  {
-    m_selectionChanged = true;
-  }
-  void
-  ListBoxControl::itemPressed (QListWidgetItem *)
-  {
-    m_selectionChanged = true;
-  }
+            if (m->button () & Qt::RightButton)
+              override_return = true;
 
-  bool
-  ListBoxControl::eventFilter (QObject *watched, QEvent *e)
-  {
-    // listbox change
-    if (watched == m_qobject)
-      {
-        switch (e->type ())
-          {
-          case QEvent::KeyRelease:
+            else if (! list->indexAt (m->pos ()).isValid ())
+              {
+                list->setCurrentRow (list->count () - 1);
+                override_return = true;
+              }
+
             if (m_selectionChanged)
               sendSelectionChange ();
             m_selectionChanged = false;
-            break;
 
-          default:
             break;
           }
-
-        return Object::eventFilter (watched, e);
-      }
-    // listbox viewport
-    else
-      {
-        bool override_return = false;
-        QListWidget *list = qWidget<QListWidget> ();
-
-        switch (e->type ())
-          {
-          case QEvent::MouseButtonPress:
-            {
-              QMouseEvent *m = dynamic_cast<QMouseEvent *> (e);
+        default:
+          break;
 
-              if (m->button () & Qt::RightButton)
-                override_return = true;
-              else
-                {
-                  if (! list->indexAt (m->pos ()).isValid ())
-                    override_return = true;
-                  m_selectionChanged = true;
-                }
-              break;
-            }
-          case QEvent::MouseButtonRelease:
-            {
-              QMouseEvent *m = dynamic_cast<QMouseEvent *> (e);
-
-              if (m->button () & Qt::RightButton)
-                override_return = true;
-
-              else if (! list->indexAt (m->pos ()).isValid ())
-                {
-                  list->setCurrentRow (list->count () - 1);
-                  override_return = true;
-                }
-
-              if (m_selectionChanged)
-                sendSelectionChange ();
-              m_selectionChanged = false;
-
-              break;
-            }
-          default:
-            break;
-
-          }
-        return BaseControl::eventFilter (watched, e) || override_return;
-      }
-  }
+        }
+      return BaseControl::eventFilter (watched, e) || override_return;
+    }
+}
 
 OCTAVE_END_NAMESPACE(octave)
--- a/libgui/graphics/ListBoxControl.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/ListBoxControl.h	Thu Feb 02 12:25:51 2023 -0800
@@ -34,35 +34,35 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class interpreter;
+class interpreter;
 
-  class ListBoxControl : public BaseControl
-  {
-    Q_OBJECT
+class ListBoxControl : public BaseControl
+{
+  Q_OBJECT
 
-  public:
-    ListBoxControl (octave::interpreter& interp, const graphics_object& go,
-                    QListWidget *list);
-    ~ListBoxControl ();
+public:
+  ListBoxControl (octave::interpreter& interp, const graphics_object& go,
+                  QListWidget *list);
+  ~ListBoxControl ();
 
-    static ListBoxControl *
-    create (octave::interpreter& interp,
-            const graphics_object& go);
+  static ListBoxControl *
+  create (octave::interpreter& interp,
+          const graphics_object& go);
 
-  protected:
-    void update (int pId);
-    bool eventFilter (QObject *watched, QEvent *e);
-    void sendSelectionChange ();
+protected:
+  void update (int pId);
+  bool eventFilter (QObject *watched, QEvent *e);
+  void sendSelectionChange ();
 
-  private slots:
-    void itemSelectionChanged ();
-    void itemActivated (const QModelIndex&);
-    void itemPressed (QListWidgetItem *);
+private slots:
+  void itemSelectionChanged ();
+  void itemActivated (const QModelIndex&);
+  void itemPressed (QListWidgetItem *);
 
-  private:
-    bool m_blockCallback;
-    bool m_selectionChanged;
-  };
+private:
+  bool m_blockCallback;
+  bool m_selectionChanged;
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/graphics/Menu.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/Menu.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -38,100 +38,205 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  static QKeySequence
-  accelSequence (const uimenu::properties& up)
-  {
-    std::string s (up.get_accelerator ());
+static QKeySequence
+accelSequence (const uimenu::properties& up)
+{
+  std::string s (up.get_accelerator ());
+
+  if (! s.empty ())
+    {
+      char c = s[0];
+      int keyMod = Qt::CTRL;
 
-    if (! s.empty ())
-      {
-        char c = s[0];
-        int keyMod = Qt::CTRL;
+      if (c >= 'A' && c <= 'Z')
+        keyMod |= Qt::SHIFT;
+      if (c >= 'a' && c <= 'z')
+        c -= ('a' - 'A');
+      if (c >= 'A' && c <= 'Z')
+        return QKeySequence (keyMod | static_cast<int> (c));
+    }
+
+  return QKeySequence ();
+}
 
-        if (c >= 'A' && c <= 'Z')
-          keyMod |= Qt::SHIFT;
-        if (c >= 'a' && c <= 'z')
-          c -= ('a' - 'A');
-        if (c >= 'A' && c <= 'Z')
-          return QKeySequence (keyMod | static_cast<int> (c));
-      }
+Menu *
+Menu::create (octave::interpreter& interp,
+              const graphics_object& go)
+{
+  Object *parent_obj = parentObject (interp, go);
+
+  if (parent_obj)
+    {
+      QObject *qObj = parent_obj->qObject ();
 
-    return QKeySequence ();
-  }
+      if (qObj)
+        return new Menu (interp, go, new QAction (qObj),
+                         parent_obj);
+    }
+
+  return nullptr;
+}
+
+Menu::Menu (octave::interpreter& interp,
+            const graphics_object& go, QAction *action, Object *xparent)
+  : Object (interp, go, action), m_parent (nullptr),
+    m_separator (nullptr)
+{
+  uimenu::properties& up = properties<uimenu> ();
 
-  Menu *
-  Menu::create (octave::interpreter& interp,
-                const graphics_object& go)
-  {
-    Object *parent_obj = parentObject (interp, go);
+  action->setText (Utils::fromStdString (up.get_text ()));
+
+  if (up.is_checked ())
+    {
+      action->setCheckable (true);
+      action->setChecked (up.is_checked ());
+    }
+
+  action->setEnabled (up.is_enable ());
+  action->setShortcut (accelSequence (up));
+  action->setVisible (up.is_visible ());
 
-    if (parent_obj)
-      {
-        QObject *qObj = parent_obj->qObject ();
+  if (up.is_separator ())
+    {
+      m_separator = new QAction (action);
+      m_separator->setSeparator (true);
+      m_separator->setVisible (up.is_visible ());
+    }
+
+  MenuContainer *menuContainer = dynamic_cast<MenuContainer *> (xparent);
+
+  if (menuContainer)
+    m_parent = menuContainer->menu ();
 
-        if (qObj)
-          return new Menu (interp, go, new QAction (qObj),
-                           parent_obj);
-      }
+  if (m_parent)
+    {
+      int pos = static_cast<int> (up.get_position ());
+
+      if (pos <= 0)
+        {
+          if (m_separator)
+            m_parent->insertAction (nullptr, m_separator);
+          m_parent->insertAction (nullptr, action);
+
+          int count = 0;
 
-    return nullptr;
-  }
+          for (auto *a : m_parent->actions ())
+            if (! a->isSeparator ())
+              count++;
 
-  Menu::Menu (octave::interpreter& interp,
-              const graphics_object& go, QAction *action, Object *xparent)
-    : Object (interp, go, action), m_parent (nullptr),
-      m_separator (nullptr)
-  {
-    uimenu::properties& up = properties<uimenu> ();
+          up.get_property ("position").set
+          (octave_value (static_cast<double> (count)), true, false);
+        }
+      else
+        {
+
+          int count = 0;
+          QAction *before = nullptr;
 
-    action->setText (Utils::fromStdString (up.get_text ()));
+          for (auto *a : m_parent->actions ())
+            {
+              if (! a->isSeparator ())
+                {
+                  count++;
+                  if (pos <= count)
+                    {
+                      before = a;
+                      break;
+                    }
+                }
+            }
 
-    if (up.is_checked ())
-      {
-        action->setCheckable (true);
-        action->setChecked (up.is_checked ());
-      }
-
-    action->setEnabled (up.is_enable ());
-    action->setShortcut (accelSequence (up));
-    action->setVisible (up.is_visible ());
+          if (m_separator)
+            m_parent->insertAction (before, m_separator);
+          m_parent->insertAction (before, action);
 
-    if (up.is_separator ())
-      {
-        m_separator = new QAction (action);
-        m_separator->setSeparator (true);
-        m_separator->setVisible (up.is_visible ());
-      }
+          if (before)
+            updateSiblingPositions ();
+          else
+            up.get_property ("position").set
+            (octave_value (static_cast<double> (count+1)), true, false);
+        }
+    }
+
+  connect (action, &QAction::triggered, this, &Menu::actionTriggered);
+}
 
-    MenuContainer *menuContainer = dynamic_cast<MenuContainer *> (xparent);
+Menu::~Menu ()
+{ }
 
-    if (menuContainer)
-      m_parent = menuContainer->menu ();
+void
+Menu::update (int pId)
+{
+  uimenu::properties& up = properties<uimenu> ();
+  QAction *action = qWidget<QAction> ();
+
+  switch (pId)
+    {
+    case uimenu::properties::ID_TEXT:
+      action->setText (Utils::fromStdString (up.get_text ()));
+      break;
 
-    if (m_parent)
-      {
-        int pos = static_cast<int> (up.get_position ());
+    case uimenu::properties::ID_CHECKED:
+      if (up.is_checked ())
+        {
+          action->setCheckable (true);
+          action->setChecked (up.is_checked ());
+        }
+      else
+        {
+          action->setChecked (false);
+          action->setCheckable (false);
+        }
+      break;
 
-        if (pos <= 0)
-          {
-            if (m_separator)
-              m_parent->insertAction (nullptr, m_separator);
-            m_parent->insertAction (nullptr, action);
+    case uimenu::properties::ID_ENABLE:
+      action->setEnabled (up.is_enable ());
+      break;
 
-            int count = 0;
+    case uimenu::properties::ID_ACCELERATOR:
+      if (! action->menu ())
+        action->setShortcut (accelSequence (up));
+      break;
 
-            for (auto *a : m_parent->actions ())
-              if (! a->isSeparator ())
-                count++;
+    case uimenu::properties::ID_SEPARATOR:
+      if (up.is_separator ())
+        {
+          if (! m_separator)
+            {
+              m_separator = new QAction (action);
+              m_separator->setSeparator (true);
+              m_separator->setVisible (up.is_visible ());
+              if (m_parent)
+                m_parent->insertAction (action, m_separator);
+            }
+        }
+      else
+        {
+          if (m_separator)
+            delete m_separator;
+          m_separator = nullptr;
+        }
+      break;
 
-            up.get_property ("position").set
-            (octave_value (static_cast<double> (count)), true, false);
-          }
-        else
+    case uimenu::properties::ID_VISIBLE:
+      action->setVisible (up.is_visible ());
+      if (m_separator)
+        m_separator->setVisible (up.is_visible ());
+      break;
+
+    case uimenu::properties::ID_POSITION:
+      {
+        if (m_separator)
+          m_parent->removeAction (m_separator);
+
+        m_parent->removeAction (action);
+
+        int pos = static_cast<int> (up.get_position ());
+        QAction *before = nullptr;
+
+        if (pos > 0)
           {
-
             int count = 0;
-            QAction *before = nullptr;
 
             for (auto *a : m_parent->actions ())
               {
@@ -145,193 +250,88 @@
                       }
                   }
               }
+          }
 
-            if (m_separator)
-              m_parent->insertAction (before, m_separator);
-            m_parent->insertAction (before, action);
+        if (m_separator)
+          m_parent->insertAction (before, m_separator);
+
+        m_parent->insertAction (before, action);
 
-            if (before)
-              updateSiblingPositions ();
-            else
-              up.get_property ("position").set
-              (octave_value (static_cast<double> (count+1)), true, false);
-          }
+        updateSiblingPositions ();
       }
+      break;
 
-    connect (action, &QAction::triggered, this, &Menu::actionTriggered);
-  }
-
-  Menu::~Menu ()
-  { }
+    default:
+      Object::update (pId);
+      break;
+    }
+}
 
-  void
-  Menu::update (int pId)
-  {
-    uimenu::properties& up = properties<uimenu> ();
-    QAction *action = qWidget<QAction> ();
-
-    switch (pId)
-      {
-      case uimenu::properties::ID_TEXT:
-        action->setText (Utils::fromStdString (up.get_text ()));
-        break;
+QWidget *
+Menu::menu ()
+{
+  QAction *action = qWidget<QAction> ();
+  QMenu *action_menu = action->menu ();
 
-      case uimenu::properties::ID_CHECKED:
-        if (up.is_checked ())
-          {
-            action->setCheckable (true);
-            action->setChecked (up.is_checked ());
-          }
-        else
-          {
-            action->setChecked (false);
-            action->setCheckable (false);
-          }
-        break;
+  if (! action_menu)
+    {
+      action_menu = new QMenu (action->parentWidget ());
+      action->setMenu (action_menu);
+      action->setShortcut (QKeySequence ());
+      connect (action_menu, &QMenu::aboutToShow, this, &Menu::actionHovered);
+    }
 
-      case uimenu::properties::ID_ENABLE:
-        action->setEnabled (up.is_enable ());
-        break;
+  return action_menu;
+}
 
-      case uimenu::properties::ID_ACCELERATOR:
-        if (! action->menu ())
-          action->setShortcut (accelSequence (up));
-        break;
+void
+Menu::actionTriggered ()
+{
+  QAction *action = qWidget<QAction> ();
 
-      case uimenu::properties::ID_SEPARATOR:
-        if (up.is_separator ())
-          {
-            if (! m_separator)
-              {
-                m_separator = new QAction (action);
-                m_separator->setSeparator (true);
-                m_separator->setVisible (up.is_visible ());
-                if (m_parent)
-                  m_parent->insertAction (action, m_separator);
-              }
-          }
-        else
-          {
-            if (m_separator)
-              delete m_separator;
-            m_separator = nullptr;
-          }
-        break;
+  if (action->isCheckable ())
+    action->setChecked (! action->isChecked ());
+  emit gh_callback_event (m_handle, "menuselectedfcn");
+}
+
+void
+Menu::actionHovered ()
+{
+  emit gh_callback_event (m_handle, "menuselectedfcn");
+}
 
-      case uimenu::properties::ID_VISIBLE:
-        action->setVisible (up.is_visible ());
-        if (m_separator)
-          m_separator->setVisible (up.is_visible ());
-        break;
+void
+Menu::updateSiblingPositions ()
+{
+  if (m_parent)
+    {
+      double count = 1.0;
 
-      case uimenu::properties::ID_POSITION:
+      for (auto *a : m_parent->actions ())
         {
-          if (m_separator)
-            m_parent->removeAction (m_separator);
-
-          m_parent->removeAction (action);
+          if (! a->isSeparator ())
+            {
+              Object *aObj = Object::fromQObject (a);
 
-          int pos = static_cast<int> (up.get_position ());
-          QAction *before = nullptr;
-
-          if (pos > 0)
-            {
-              int count = 0;
-
-              for (auto *a : m_parent->actions ())
+              if (aObj)
                 {
-                  if (! a->isSeparator ())
+                  graphics_object go = aObj->object ();
+
+                  // Probably overkill as a uimenu child can only be another
+                  // uimenu object.
+                  if (go.isa ("uimenu"))
                     {
-                      count++;
-                      if (pos <= count)
-                        {
-                          before = a;
-                          break;
-                        }
+                      uimenu::properties& up = Utils::properties<uimenu> (go);
+
+                      up.get_property ("position").set
+                      (octave_value (count), true, false);
                     }
                 }
+
+              count++;
             }
-
-          if (m_separator)
-            m_parent->insertAction (before, m_separator);
-
-          m_parent->insertAction (before, action);
-
-          updateSiblingPositions ();
         }
-        break;
-
-      default:
-        Object::update (pId);
-        break;
-      }
-  }
-
-  QWidget *
-  Menu::menu ()
-  {
-    QAction *action = qWidget<QAction> ();
-    QMenu *action_menu = action->menu ();
-
-    if (! action_menu)
-      {
-        action_menu = new QMenu (action->parentWidget ());
-        action->setMenu (action_menu);
-        action->setShortcut (QKeySequence ());
-        connect (action_menu, &QMenu::aboutToShow, this, &Menu::actionHovered);
-      }
-
-    return action_menu;
-  }
-
-  void
-  Menu::actionTriggered ()
-  {
-    QAction *action = qWidget<QAction> ();
-
-    if (action->isCheckable ())
-      action->setChecked (! action->isChecked ());
-    emit gh_callback_event (m_handle, "menuselectedfcn");
-  }
-
-  void
-  Menu::actionHovered ()
-  {
-    emit gh_callback_event (m_handle, "menuselectedfcn");
-  }
-
-  void
-  Menu::updateSiblingPositions ()
-  {
-    if (m_parent)
-      {
-        double count = 1.0;
-
-        for (auto *a : m_parent->actions ())
-          {
-            if (! a->isSeparator ())
-              {
-                Object *aObj = Object::fromQObject (a);
-
-                if (aObj)
-                  {
-                    graphics_object go = aObj->object ();
-
-                    // Probably overkill as a uimenu child can only be another
-                    // uimenu object.
-                    if (go.isa ("uimenu"))
-                      {
-                        uimenu::properties& up = Utils::properties<uimenu> (go);
-
-                        up.get_property ("position").set
-                        (octave_value (count), true, false);
-                      }
-                  }
-
-                count++;
-              }
-          }
-      }
-  }
+    }
+}
 
 OCTAVE_END_NAMESPACE(octave)
--- a/libgui/graphics/Menu.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/Menu.h	Thu Feb 02 12:25:51 2023 -0800
@@ -35,39 +35,39 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class interpreter;
+class interpreter;
 
-  class Menu : public Object, public MenuContainer
-  {
-    Q_OBJECT
+class Menu : public Object, public MenuContainer
+{
+  Q_OBJECT
 
-  public:
-    Menu (octave::interpreter& interp,
-          const graphics_object& go, QAction *action, Object *parent);
-    ~Menu ();
+public:
+  Menu (octave::interpreter& interp,
+        const graphics_object& go, QAction *action, Object *parent);
+  ~Menu ();
 
-    static Menu *
-    create (octave::interpreter& interp,
-            const graphics_object& go);
+  static Menu *
+  create (octave::interpreter& interp,
+          const graphics_object& go);
 
-    Container * innerContainer () { return nullptr; }
+  Container * innerContainer () { return nullptr; }
 
-    QWidget * menu ();
+  QWidget * menu ();
 
-  protected:
-    void update (int pId);
+protected:
+  void update (int pId);
 
-  private slots:
-    void actionTriggered ();
-    void actionHovered ();
+private slots:
+  void actionTriggered ();
+  void actionHovered ();
 
-  private:
-    void updateSiblingPositions ();
+private:
+  void updateSiblingPositions ();
 
-  private:
-    QWidget *m_parent;
-    QAction *m_separator;
-  };
+private:
+  QWidget *m_parent;
+  QAction *m_separator;
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/graphics/Object.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/Object.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -39,246 +39,246 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  Object::Object (octave::interpreter& interp,
-                  const graphics_object& go, QObject *obj)
-    : QObject (), m_interpreter (interp), m_go (go),
-      m_handle (go.get_handle ()), m_qobject (nullptr)
-  {
-    gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+Object::Object (octave::interpreter& interp,
+                const graphics_object& go, QObject *obj)
+  : QObject (), m_interpreter (interp), m_go (go),
+    m_handle (go.get_handle ()), m_qobject (nullptr)
+{
+  gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
 
-    octave::autolock guard (gh_mgr.graphics_lock ());
+  octave::autolock guard (gh_mgr.graphics_lock ());
 
-    if (! guard)
-      qCritical ("octave::Object::Object: "
-                 "creating Object (h=%g) without a valid lock!!!",
-                 m_handle.value ());
+  if (! guard)
+    qCritical ("octave::Object::Object: "
+               "creating Object (h=%g) without a valid lock!!!",
+               m_handle.value ());
 
-    init (obj);
-  }
+  init (obj);
+}
 
-  void
-  Object::init (QObject *obj, bool)
-  {
-    if (m_qobject)
-      qCritical ("octave::Object::init: "
-                 "resetting QObject while in invalid state");
+void
+Object::init (QObject *obj, bool)
+{
+  if (m_qobject)
+    qCritical ("octave::Object::init: "
+               "resetting QObject while in invalid state");
 
-    m_qobject = obj;
+  m_qobject = obj;
 
-    if (m_qobject)
-      {
-        m_qobject->setProperty ("octave::Object",
-                                QVariant::fromValue<void *> (this));
-        connect (m_qobject, &QObject::destroyed,
-                 this, &Object::objectDestroyed);
-      }
-  }
+  if (m_qobject)
+    {
+      m_qobject->setProperty ("octave::Object",
+                              QVariant::fromValue<void *> (this));
+      connect (m_qobject, &QObject::destroyed,
+               this, &Object::objectDestroyed);
+    }
+}
 
-  Object::~Object ()
-  { }
+Object::~Object ()
+{ }
 
-  graphics_object
-  Object::object () const
-  {
-    gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+graphics_object
+Object::object () const
+{
+  gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
 
-    octave::autolock guard (gh_mgr.graphics_lock (), false);
+  octave::autolock guard (gh_mgr.graphics_lock (), false);
 
-    if (! guard)
-      qCritical ("octave::Object::object: "
-                 "accessing graphics object (h=%g) without a valid lock!!!",
-                 m_handle.value ());
+  if (! guard)
+    qCritical ("octave::Object::object: "
+               "accessing graphics object (h=%g) without a valid lock!!!",
+               m_handle.value ());
 
-    return m_go;
-  }
-
-  void
-  Object::slotUpdate (int pId)
-  {
-    gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+  return m_go;
+}
 
-    octave::autolock guard (gh_mgr.graphics_lock ());
+void
+Object::slotUpdate (int pId)
+{
+  gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
 
-    switch (pId)
-      {
-      // Special case for objects being deleted, as it's very likely
-      // that the graphics_object already has been destroyed when this
-      // is executed (because of the async behavior).
-      case base_properties::ID_BEINGDELETED:
-        beingDeleted ();
-        break;
+  octave::autolock guard (gh_mgr.graphics_lock ());
 
-      default:
-        if (object ().valid_object ())
-          update (pId);
-        break;
-      }
-  }
+  switch (pId)
+    {
+    // Special case for objects being deleted, as it's very likely
+    // that the graphics_object already has been destroyed when this
+    // is executed (because of the async behavior).
+    case base_properties::ID_BEINGDELETED:
+      beingDeleted ();
+      break;
 
-  void
-  Object::slotFinalize ()
-  {
-    gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+    default:
+      if (object ().valid_object ())
+        update (pId);
+      break;
+    }
+}
 
-    octave::autolock guard (gh_mgr.graphics_lock ());
+void
+Object::slotFinalize ()
+{
+  gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
 
-    finalize ();
-  }
+  octave::autolock guard (gh_mgr.graphics_lock ());
 
-  void
-  Object::slotRedraw ()
-  {
-    gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
-
-    octave::autolock guard (gh_mgr.graphics_lock ());
+  finalize ();
+}
 
-    if (object ().valid_object ())
-      redraw ();
-  }
+void
+Object::slotRedraw ()
+{
+  gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
 
-  void
-  Object::slotShow ()
-  {
-    gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+  octave::autolock guard (gh_mgr.graphics_lock ());
+
+  if (object ().valid_object ())
+    redraw ();
+}
 
-    octave::autolock guard (gh_mgr.graphics_lock ());
+void
+Object::slotShow ()
+{
+  gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
 
-    if (object ().valid_object ())
-      show ();
-  }
+  octave::autolock guard (gh_mgr.graphics_lock ());
 
-  void
-  Object::slotPrint (const QString& file_cmd, const QString& term)
-  {
-    gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+  if (object ().valid_object ())
+    show ();
+}
 
-    octave::autolock guard (gh_mgr.graphics_lock ());
+void
+Object::slotPrint (const QString& file_cmd, const QString& term)
+{
+  gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
 
-    if (object ().valid_object ())
-      print (file_cmd, term);
-  }
+  octave::autolock guard (gh_mgr.graphics_lock ());
 
-  void
-  Object::update (int /* pId */)
-  { }
+  if (object ().valid_object ())
+    print (file_cmd, term);
+}
+
+void
+Object::update (int /* pId */)
+{ }
 
-  void
-  Object::finalize ()
-  {
-    if (m_qobject)
-      {
-        delete m_qobject;
-        m_qobject = nullptr;
-      }
-    deleteLater ();
-  }
+void
+Object::finalize ()
+{
+  if (m_qobject)
+    {
+      delete m_qobject;
+      m_qobject = nullptr;
+    }
+  deleteLater ();
+}
 
-  void
-  Object::redraw ()
-  { }
+void
+Object::redraw ()
+{ }
 
-  void
-  Object::show ()
-  { }
-
-  void
-  Object::print (const QString& /* file_cmd */, const QString& /* term */)
-  { }
+void
+Object::show ()
+{ }
 
-  void
-  Object::beingDeleted ()
-  { }
+void
+Object::print (const QString& /* file_cmd */, const QString& /* term */)
+{ }
 
-  void Object::objectDestroyed (QObject *obj)
-  {
-    if (obj && obj == m_qobject)
-      m_qobject = nullptr;
-  }
+void
+Object::beingDeleted ()
+{ }
 
-  Object *
-  Object::parentObject (octave::interpreter& interp, const graphics_object& go)
-  {
-    gh_manager& gh_mgr = interp.get_gh_manager ();
+void Object::objectDestroyed (QObject *obj)
+{
+  if (obj && obj == m_qobject)
+    m_qobject = nullptr;
+}
 
-    octave::autolock guard (gh_mgr.graphics_lock ());
+Object *
+Object::parentObject (octave::interpreter& interp, const graphics_object& go)
+{
+  gh_manager& gh_mgr = interp.get_gh_manager ();
 
-    Object *parent = qt_graphics_toolkit::toolkitObject
-                     (gh_mgr.get_object (go.get_parent ()));
-
-    return parent;
-  }
+  octave::autolock guard (gh_mgr.graphics_lock ());
 
-  Object *
-  Object::fromQObject (QObject *obj)
-  {
-    QVariant v = obj->property ("octave::Object");
+  Object *parent = qt_graphics_toolkit::toolkitObject
+                   (gh_mgr.get_object (go.get_parent ()));
 
-    if (v.isValid ())
-      return reinterpret_cast<Object *> (qvariant_cast<void *> (v));
+  return parent;
+}
+
+Object *
+Object::fromQObject (QObject *obj)
+{
+  QVariant v = obj->property ("octave::Object");
 
-    return nullptr;
-  }
+  if (v.isValid ())
+    return reinterpret_cast<Object *> (qvariant_cast<void *> (v));
+
+  return nullptr;
+}
 
-  void
-  Object::do_connections (const QObject *receiver, const QObject *emitter)
-  {
-    if (! emitter)
-      emitter = this;
+void
+Object::do_connections (const QObject *receiver, const QObject *emitter)
+{
+  if (! emitter)
+    emitter = this;
 
-    connect (emitter,
-             SIGNAL (interpreter_event (const octave::fcn_callback&)),
-             receiver,
-             SLOT (interpreter_event (const octave::fcn_callback&)));
+  connect (emitter,
+           SIGNAL (interpreter_event (const octave::fcn_callback&)),
+           receiver,
+           SLOT (interpreter_event (const octave::fcn_callback&)));
 
-    connect (emitter,
-             SIGNAL (interpreter_event (const octave::meth_callback&)),
-             receiver,
-             SLOT (interpreter_event (const octave::meth_callback&)));
+  connect (emitter,
+           SIGNAL (interpreter_event (const octave::meth_callback&)),
+           receiver,
+           SLOT (interpreter_event (const octave::meth_callback&)));
 
-    connect (emitter,
-             SIGNAL (gh_callback_event (const graphics_handle&,
-                                        const std::string&)),
-             receiver,
-             SLOT (gh_callback_event (const graphics_handle&,
-                                      const std::string&)));
+  connect (emitter,
+           SIGNAL (gh_callback_event (const graphics_handle&,
+                                      const std::string&)),
+           receiver,
+           SLOT (gh_callback_event (const graphics_handle&,
+                                    const std::string&)));
 
-    connect (emitter,
-             SIGNAL (gh_callback_event (const graphics_handle&,
-                                        const std::string&,
-                                        const octave_value&)),
-             receiver,
-             SLOT (gh_callback_event (const graphics_handle&,
+  connect (emitter,
+           SIGNAL (gh_callback_event (const graphics_handle&,
                                       const std::string&,
-                                      const octave_value&)));
+                                      const octave_value&)),
+           receiver,
+           SLOT (gh_callback_event (const graphics_handle&,
+                                    const std::string&,
+                                    const octave_value&)));
 
-    connect (emitter,
-             SIGNAL (gh_set_event (const graphics_handle&,
-                                   const std::string&,
-                                   const octave_value&)),
-             receiver,
-             SLOT (gh_set_event (const graphics_handle&,
+  connect (emitter,
+           SIGNAL (gh_set_event (const graphics_handle&,
                                  const std::string&,
-                                 const octave_value&)));
+                                 const octave_value&)),
+           receiver,
+           SLOT (gh_set_event (const graphics_handle&,
+                               const std::string&,
+                               const octave_value&)));
 
-    connect (emitter,
-             SIGNAL (gh_set_event (const graphics_handle&,
-                                   const std::string&,
-                                   const octave_value&, bool)),
-             receiver,
-             SLOT (gh_set_event (const graphics_handle&,
+  connect (emitter,
+           SIGNAL (gh_set_event (const graphics_handle&,
                                  const std::string&,
-                                 const octave_value&, bool)));
+                                 const octave_value&, bool)),
+           receiver,
+           SLOT (gh_set_event (const graphics_handle&,
+                               const std::string&,
+                               const octave_value&, bool)));
 
-    connect (emitter,
-             SIGNAL (gh_set_event (const graphics_handle&,
-                                   const std::string&,
-                                   const octave_value&,
-                                   bool, bool)),
-             receiver,
-             SLOT (gh_set_event (const graphics_handle&,
+  connect (emitter,
+           SIGNAL (gh_set_event (const graphics_handle&,
                                  const std::string&,
                                  const octave_value&,
-                                 bool, bool)));
-  }
+                                 bool, bool)),
+           receiver,
+           SLOT (gh_set_event (const graphics_handle&,
+                               const std::string&,
+                               const octave_value&,
+                               bool, bool)));
+}
 
 OCTAVE_END_NAMESPACE(octave)
--- a/libgui/graphics/Object.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/Object.h	Thu Feb 02 12:25:51 2023 -0800
@@ -37,121 +37,121 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class interpreter;
+class interpreter;
 
-  class Container;
-  class ObjectProxy;
+class Container;
+class ObjectProxy;
 
-  class Object : public QObject
-  {
-    Q_OBJECT
+class Object : public QObject
+{
+  Q_OBJECT
 
-  public:
-    Object (octave::interpreter& interp, const graphics_object& go,
-            QObject *obj = nullptr);
+public:
+  Object (octave::interpreter& interp, const graphics_object& go,
+          QObject *obj = nullptr);
 
-    virtual ~Object ();
+  virtual ~Object ();
 
-    base_properties& properties ()
-    { return object ().get_properties (); }
+  base_properties& properties ()
+  { return object ().get_properties (); }
 
-    const base_properties& properties () const
-    { return object ().get_properties (); }
+  const base_properties& properties () const
+  { return object ().get_properties (); }
 
-    template <typename T>
-    typename T::properties& properties ()
-    {
-      return dynamic_cast<typename T::properties&>
-             (object ().get_properties ());
-    }
+  template <typename T>
+  typename T::properties& properties ()
+  {
+    return dynamic_cast<typename T::properties&>
+           (object ().get_properties ());
+  }
 
-    template <typename T>
-    const typename T::properties& properties () const
-    {
-      return dynamic_cast<const typename T::properties&>
-             (object ().get_properties ());
-    }
+  template <typename T>
+  const typename T::properties& properties () const
+  {
+    return dynamic_cast<const typename T::properties&>
+           (object ().get_properties ());
+  }
 
-    graphics_object object () const;
+  graphics_object object () const;
 
-    virtual QObject * qObject () { return m_qobject; }
+  virtual QObject * qObject () { return m_qobject; }
 
-    template <typename T>
-    T * qWidget () { return qobject_cast<T *>(qObject ()); }
+  template <typename T>
+  T * qWidget () { return qobject_cast<T *>(qObject ()); }
 
-    virtual Container * innerContainer () = 0;
+  virtual Container * innerContainer () = 0;
 
-    static Object * fromQObject (QObject *obj);
+  static Object * fromQObject (QObject *obj);
 
-    virtual void do_connections (const QObject *receiver,
-                                 const QObject *emitter = nullptr);
+  virtual void do_connections (const QObject *receiver,
+                               const QObject *emitter = nullptr);
 
-  signals:
+signals:
 
-    void interpreter_event (const octave::fcn_callback& fcn);
-    void interpreter_event (const octave::meth_callback& meth);
+  void interpreter_event (const octave::fcn_callback& fcn);
+  void interpreter_event (const octave::meth_callback& meth);
 
-    void gh_callback_event (const graphics_handle& h, const std::string& name);
+  void gh_callback_event (const graphics_handle& h, const std::string& name);
 
-    void gh_callback_event (const graphics_handle& h, const std::string& name,
-                            const octave_value& data);
+  void gh_callback_event (const graphics_handle& h, const std::string& name,
+                          const octave_value& data);
 
-    void gh_set_event (const graphics_handle& h, const std::string& name,
-                       const octave_value& value);
+  void gh_set_event (const graphics_handle& h, const std::string& name,
+                     const octave_value& value);
 
-    void gh_set_event (const graphics_handle& h, const std::string& name,
-                       const octave_value& value, bool notify_toolkit);
+  void gh_set_event (const graphics_handle& h, const std::string& name,
+                     const octave_value& value, bool notify_toolkit);
 
-    void gh_set_event (const graphics_handle& h, const std::string& name,
-                       const octave_value& value, bool notify_toolkit,
-                       bool redraw_figure);
+  void gh_set_event (const graphics_handle& h, const std::string& name,
+                     const octave_value& value, bool notify_toolkit,
+                     bool redraw_figure);
 
-  public slots:
-    void slotUpdate (int pId);
-    void slotFinalize ();
-    void slotRedraw ();
-    void slotShow ();
-    void slotPrint (const QString& file_cmd, const QString& term);
+public slots:
+  void slotUpdate (int pId);
+  void slotFinalize ();
+  void slotRedraw ();
+  void slotShow ();
+  void slotPrint (const QString& file_cmd, const QString& term);
 
-    void objectDestroyed (QObject *obj = nullptr);
+  void objectDestroyed (QObject *obj = nullptr);
 
-  protected:
-    static Object *
-    parentObject (octave::interpreter& interp, const graphics_object& go);
+protected:
+  static Object *
+  parentObject (octave::interpreter& interp, const graphics_object& go);
 
-    void init (QObject *obj, bool callBase = false);
+  void init (QObject *obj, bool callBase = false);
 
-    virtual void update (int pId);
-    virtual void finalize ();
-    virtual void redraw ();
-    virtual void show ();
-    virtual void print (const QString& file_cmd, const QString& term);
+  virtual void update (int pId);
+  virtual void finalize ();
+  virtual void redraw ();
+  virtual void show ();
+  virtual void print (const QString& file_cmd, const QString& term);
 
-    virtual void beingDeleted ();
+  virtual void beingDeleted ();
 
-  protected:
+protected:
 
-    octave::interpreter& m_interpreter;
+  octave::interpreter& m_interpreter;
 
-    // Store the graphics object directly so that it will exist when
-    // we need it.  Previously, it was possible for the graphics
-    // toolkit to get a handle to a figure, then have the interpreter
-    // thread delete the corresponding object before the graphics
-    // toolkit (GUI) thread had a chance to display it.  It should be OK
-    // to store this object and use it in both threads (graphics_object
-    // uses a std::shared_ptr) provided that we protect access with
-    // mutex locks.
-    graphics_object m_go;
+  // Store the graphics object directly so that it will exist when
+  // we need it.  Previously, it was possible for the graphics
+  // toolkit to get a handle to a figure, then have the interpreter
+  // thread delete the corresponding object before the graphics
+  // toolkit (GUI) thread had a chance to display it.  It should be OK
+  // to store this object and use it in both threads (graphics_object
+  // uses a std::shared_ptr) provided that we protect access with
+  // mutex locks.
+  graphics_object m_go;
 
-    // Handle to the graphics object.  This may be redundant now.
-    // Also, the whole ObjectProxy thing may not need to store a
-    // pointer now?  Maybe we can just have a lookup table from figure
-    // handle to Object?  What does the FLTK toolkit do?  Why does
-    // this seem to be so complicated?
-    graphics_handle m_handle;
+  // Handle to the graphics object.  This may be redundant now.
+  // Also, the whole ObjectProxy thing may not need to store a
+  // pointer now?  Maybe we can just have a lookup table from figure
+  // handle to Object?  What does the FLTK toolkit do?  Why does
+  // this seem to be so complicated?
+  graphics_handle m_handle;
 
-    QObject *m_qobject;
-  };
+  QObject *m_qobject;
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/graphics/Panel.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/Panel.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -44,384 +44,384 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  static int
-  frameStyleFromProperties (const uipanel::properties& pp)
-  {
-    if (pp.bordertype_is ("none"))
-      return QFrame::NoFrame;
-    else if (pp.bordertype_is ("etchedin"))
-      return (QFrame::Box | QFrame::Sunken);
-    else if (pp.bordertype_is ("etchedout"))
-      return (QFrame::Box | QFrame::Raised);
-    else if (pp.bordertype_is ("beveledin"))
-      return (QFrame::Panel | QFrame::Sunken);
-    else if (pp.bordertype_is ("beveledout"))
-      return (QFrame::Panel | QFrame::Raised);
-    else
-      return (QFrame::Panel | QFrame::Plain);
-  }
+static int
+frameStyleFromProperties (const uipanel::properties& pp)
+{
+  if (pp.bordertype_is ("none"))
+    return QFrame::NoFrame;
+  else if (pp.bordertype_is ("etchedin"))
+    return (QFrame::Box | QFrame::Sunken);
+  else if (pp.bordertype_is ("etchedout"))
+    return (QFrame::Box | QFrame::Raised);
+  else if (pp.bordertype_is ("beveledin"))
+    return (QFrame::Panel | QFrame::Sunken);
+  else if (pp.bordertype_is ("beveledout"))
+    return (QFrame::Panel | QFrame::Raised);
+  else
+    return (QFrame::Panel | QFrame::Plain);
+}
 
-  static void
-  setupPalette (const uipanel::properties& pp, QPalette& p)
-  {
-    p.setColor (QPalette::Window,
-                Utils::fromRgb (pp.get_backgroundcolor_rgb ()));
-    p.setColor (QPalette::WindowText,
-                Utils::fromRgb (pp.get_foregroundcolor_rgb ()));
-    p.setColor (QPalette::Light,
-                Utils::fromRgb (pp.get_highlightcolor_rgb ()));
-    p.setColor (QPalette::Dark,
-                Utils::fromRgb (pp.get_shadowcolor_rgb ()));
-  }
+static void
+setupPalette (const uipanel::properties& pp, QPalette& p)
+{
+  p.setColor (QPalette::Window,
+              Utils::fromRgb (pp.get_backgroundcolor_rgb ()));
+  p.setColor (QPalette::WindowText,
+              Utils::fromRgb (pp.get_foregroundcolor_rgb ()));
+  p.setColor (QPalette::Light,
+              Utils::fromRgb (pp.get_highlightcolor_rgb ()));
+  p.setColor (QPalette::Dark,
+              Utils::fromRgb (pp.get_shadowcolor_rgb ()));
+}
+
+static int
+borderWidthFromProperties (const uipanel::properties& pp)
+{
+  int bw = 0;
+
+  if (! pp.bordertype_is ("none"))
+    {
+      bw = octave::math::round (pp.get_borderwidth ());
+      if (pp.bordertype_is ("etchedin") || pp.bordertype_is ("etchedout"))
+        bw *= 2;
+    }
+
+  return bw;
+}
 
-  static int
-  borderWidthFromProperties (const uipanel::properties& pp)
-  {
-    int bw = 0;
+Panel *
+Panel::create (octave::interpreter& interp,
+               const graphics_object& go)
+{
+  Object *parent = parentObject (interp, go);
+
+  if (parent)
+    {
+      Container *container = parent->innerContainer ();
 
-    if (! pp.bordertype_is ("none"))
-      {
-        bw = octave::math::round (pp.get_borderwidth ());
-        if (pp.bordertype_is ("etchedin") || pp.bordertype_is ("etchedout"))
-          bw *= 2;
-      }
+      if (container)
+        return new Panel (interp, go, new QFrame (container));
+    }
+
+  return nullptr;
+}
 
-    return bw;
-  }
+Panel::Panel (octave::interpreter& interp,
+              const graphics_object& go, QFrame *frame)
+  : Object (interp, go, frame), m_container (nullptr),
+    m_title (nullptr), m_blockUpdates (false),
+    m_previous_bbox (Matrix (1, 4, 0))
+{
+  uipanel::properties& pp = properties<uipanel> ();
 
-  Panel *
-  Panel::create (octave::interpreter& interp,
-                 const graphics_object& go)
-  {
-    Object *parent = parentObject (interp, go);
+  frame->setObjectName ("UIPanel");
+  frame->setAutoFillBackground (true);
+  Matrix bb = pp.get_boundingbox (false);
+  frame->setGeometry (octave::math::round (bb(0)), octave::math::round (bb(1)),
+                      octave::math::round (bb(2)), octave::math::round (bb(3)));
+  frame->setFrameStyle (frameStyleFromProperties (pp));
+  frame->setLineWidth (octave::math::round (pp.get_borderwidth ()));
+  QPalette pal = frame->palette ();
+  setupPalette (pp, pal);
+  frame->setPalette (pal);
 
-    if (parent)
-      {
-        Container *container = parent->innerContainer ();
+  m_container = new Container (frame, interp);
+  m_container->canvas (m_handle);
+
+  connect (m_container, SIGNAL (interpeter_event (const fcn_callback&)),
+           this, SIGNAL (interpeter_event (const fcn_callback&)));
 
-        if (container)
-          return new Panel (interp, go, new QFrame (container));
-      }
+  connect (m_container, SIGNAL (interpeter_event (const meth_callback&)),
+           this, SIGNAL (interpeter_event (const meth_callback&)));
 
-    return nullptr;
-  }
+  if (frame->hasMouseTracking ())
+    {
+      for (auto *w : frame->findChildren<QWidget *> ())
+        w->setMouseTracking (true);
+    }
 
-  Panel::Panel (octave::interpreter& interp,
-                const graphics_object& go, QFrame *frame)
-    : Object (interp, go, frame), m_container (nullptr),
-      m_title (nullptr), m_blockUpdates (false),
-      m_previous_bbox (Matrix (1, 4, 0))
-  {
-    uipanel::properties& pp = properties<uipanel> ();
+  QString title = Utils::fromStdString (pp.get_title ());
+  if (! title.isEmpty ())
+    {
+      m_title = new QLabel (title, frame);
+      m_title->setAutoFillBackground (true);
+      m_title->setContentsMargins (4, 0, 4, 0);
+      m_title->setPalette (pal);
+      m_title->setFont (Utils::computeFont<uipanel> (pp, bb(3)));
+    }
+
+  frame->installEventFilter (this);
+  m_container->installEventFilter (this);
+
+  graphics_object fig (go.get_ancestor ("figure"));
+  if (! fig.get ("keypressfcn").isempty ())
+    m_container->canvas (m_handle)->addEventMask (Canvas::KeyPress);
+
+  if (! fig.get ("keyreleasefcn").isempty ())
+    m_container->canvas (m_handle)->addEventMask (Canvas::KeyRelease);
 
-    frame->setObjectName ("UIPanel");
-    frame->setAutoFillBackground (true);
-    Matrix bb = pp.get_boundingbox (false);
-    frame->setGeometry (octave::math::round (bb(0)), octave::math::round (bb(1)),
-                        octave::math::round (bb(2)), octave::math::round (bb(3)));
-    frame->setFrameStyle (frameStyleFromProperties (pp));
-    frame->setLineWidth (octave::math::round (pp.get_borderwidth ()));
-    QPalette pal = frame->palette ();
-    setupPalette (pp, pal);
-    frame->setPalette (pal);
+  if (pp.is_visible ())
+    QTimer::singleShot (0, frame, &QFrame::show);
+  else
+    frame->hide ();
+}
+
+Panel::~Panel ()
+{ }
 
-    m_container = new Container (frame, interp);
-    m_container->canvas (m_handle);
-
-    connect (m_container, SIGNAL (interpeter_event (const fcn_callback&)),
-             this, SIGNAL (interpeter_event (const fcn_callback&)));
+bool
+Panel::eventFilter (QObject *watched, QEvent *xevent)
+{
+  if (! m_blockUpdates)
+    {
+      gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
 
-    connect (m_container, SIGNAL (interpeter_event (const meth_callback&)),
-             this, SIGNAL (interpeter_event (const meth_callback&)));
+      if (watched == qObject ())
+        {
+          switch (xevent->type ())
+            {
+            case QEvent::Resize:
+              {
+                octave::autolock guard (gh_mgr.graphics_lock ());
 
-    if (frame->hasMouseTracking ())
-      {
-        for (auto *w : frame->findChildren<QWidget *> ())
-          w->setMouseTracking (true);
-      }
+                graphics_object go = object ();
 
-    QString title = Utils::fromStdString (pp.get_title ());
-    if (! title.isEmpty ())
-      {
-        m_title = new QLabel (title, frame);
-        m_title->setAutoFillBackground (true);
-        m_title->setContentsMargins (4, 0, 4, 0);
-        m_title->setPalette (pal);
-        m_title->setFont (Utils::computeFont<uipanel> (pp, bb(3)));
-      }
+                if (go.valid_object ())
+                  {
+                    if (m_title)
+                      {
+                        const uipanel::properties& pp =
+                          Utils::properties<uipanel> (go);
+
+                        if (pp.fontunits_is ("normalized"))
+                          {
+                            QFrame *frame = qWidget<QFrame> ();
 
-    frame->installEventFilter (this);
-    m_container->installEventFilter (this);
+                            m_title->setFont (Utils::computeFont<uipanel>
+                                              (pp, frame->height ()));
+                            m_title->resize (m_title->sizeHint ());
+                          }
+                      }
+                    updateLayout ();
+                  }
+              }
+              break;
 
-    graphics_object fig (go.get_ancestor ("figure"));
-    if (! fig.get ("keypressfcn").isempty ())
-      m_container->canvas (m_handle)->addEventMask (Canvas::KeyPress);
-
-    if (! fig.get ("keyreleasefcn").isempty ())
-      m_container->canvas (m_handle)->addEventMask (Canvas::KeyRelease);
+            case QEvent::MouseButtonPress:
+              {
+                QMouseEvent *m = dynamic_cast<QMouseEvent *> (xevent);
 
-    if (pp.is_visible ())
-      QTimer::singleShot (0, frame, &QFrame::show);
-    else
-      frame->hide ();
-  }
+                if (m->button () == Qt::RightButton)
+                  {
+                    octave::autolock guard (gh_mgr.graphics_lock ());
 
-  Panel::~Panel ()
-  { }
+                    graphics_object go = object ();
 
-  bool
-  Panel::eventFilter (QObject *watched, QEvent *xevent)
-  {
-    if (! m_blockUpdates)
-      {
-        gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+                    if (go.valid_object ())
+                      ContextMenu::executeAt (m_interpreter,
+                                              go.get_properties (),
+                                              m->globalPos ());
+                  }
+              }
+              break;
 
-        if (watched == qObject ())
-          {
-            switch (xevent->type ())
-              {
-              case QEvent::Resize:
+            default:
+              break;
+            }
+        }
+      else if (watched == m_container)
+        {
+          switch (xevent->type ())
+            {
+            case QEvent::Resize:
+              if (qWidget<QWidget> ()->isVisible ())
                 {
                   octave::autolock guard (gh_mgr.graphics_lock ());
 
                   graphics_object go = object ();
 
                   if (go.valid_object ())
-                    {
-                      if (m_title)
-                        {
-                          const uipanel::properties& pp =
-                            Utils::properties<uipanel> (go);
+                    go.get_properties ().update_boundingbox ();
+                }
+              break;
 
-                          if (pp.fontunits_is ("normalized"))
-                            {
-                              QFrame *frame = qWidget<QFrame> ();
+            default:
+              break;
+            }
+        }
+    }
+
+  return false;
+}
+
+void
+Panel::update (int pId)
+{
+  uipanel::properties& pp = properties<uipanel> ();
+  QFrame *frame = qWidget<QFrame> ();
 
-                              m_title->setFont (Utils::computeFont<uipanel>
-                                                (pp, frame->height ()));
-                              m_title->resize (m_title->sizeHint ());
-                            }
-                        }
-                      updateLayout ();
-                    }
-                }
-                break;
+  m_blockUpdates = true;
 
-              case QEvent::MouseButtonPress:
-                {
-                  QMouseEvent *m = dynamic_cast<QMouseEvent *> (xevent);
-
-                  if (m->button () == Qt::RightButton)
-                    {
-                      octave::autolock guard (gh_mgr.graphics_lock ());
-
-                      graphics_object go = object ();
+  switch (pId)
+    {
+    case uipanel::properties::ID_POSITION:
+      {
+        Matrix bb = pp.get_boundingbox (false);
+        if (m_previous_bbox(0) != bb(0) || m_previous_bbox(1) != bb(1)
+            || m_previous_bbox(2) != bb(2) || m_previous_bbox(3) != bb(3))
+          {
+            frame->setGeometry (octave::math::round (bb(0)),
+                                octave::math::round (bb(1)),
+                                octave::math::round (bb(2)),
+                                octave::math::round (bb(3)));
+            updateLayout ();
+          }
+        m_previous_bbox = bb;
+      }
+      break;
 
-                      if (go.valid_object ())
-                        ContextMenu::executeAt (m_interpreter,
-                                                go.get_properties (),
-                                                m->globalPos ());
-                    }
-                }
-                break;
+    case uipanel::properties::ID_BORDERWIDTH:
+      frame->setLineWidth (octave::math::round (pp.get_borderwidth ()));
+      updateLayout ();
+      break;
+
+    case uipanel::properties::ID_BACKGROUNDCOLOR:
+    case uipanel::properties::ID_FOREGROUNDCOLOR:
+    case uipanel::properties::ID_HIGHLIGHTCOLOR:
+    case uipanel::properties::ID_SHADOWCOLOR:
+      {
+        QPalette pal = frame->palette ();
 
-              default:
-                break;
-              }
-          }
-        else if (watched == m_container)
+        setupPalette (pp, pal);
+        frame->setPalette (pal);
+        if (m_title)
+          m_title->setPalette (pal);
+      }
+      break;
+
+    case uipanel::properties::ID_TITLE:
+      {
+        QString title = Utils::fromStdString (pp.get_title ());
+
+        if (title.isEmpty ())
           {
-            switch (xevent->type ())
+            if (m_title)
+              delete m_title;
+            m_title = nullptr;
+          }
+        else
+          {
+            if (! m_title)
               {
-              case QEvent::Resize:
-                if (qWidget<QWidget> ()->isVisible ())
-                  {
-                    octave::autolock guard (gh_mgr.graphics_lock ());
+                QPalette pal = frame->palette ();
 
-                    graphics_object go = object ();
-
-                    if (go.valid_object ())
-                      go.get_properties ().update_boundingbox ();
-                  }
-                break;
-
-              default:
-                break;
+                m_title = new QLabel (title, frame);
+                m_title->setAutoFillBackground (true);
+                m_title->setContentsMargins (4, 0, 4, 0);
+                m_title->setPalette (pal);
+                m_title->setFont (Utils::computeFont<uipanel> (pp));
+                m_title->show ();
+              }
+            else
+              {
+                m_title->setText (title);
+                m_title->resize (m_title->sizeHint ());
               }
           }
+        updateLayout ();
       }
-
-    return false;
-  }
-
-  void
-  Panel::update (int pId)
-  {
-    uipanel::properties& pp = properties<uipanel> ();
-    QFrame *frame = qWidget<QFrame> ();
-
-    m_blockUpdates = true;
+      break;
 
-    switch (pId)
-      {
-      case uipanel::properties::ID_POSITION:
-        {
-          Matrix bb = pp.get_boundingbox (false);
-          if (m_previous_bbox(0) != bb(0) || m_previous_bbox(1) != bb(1)
-              || m_previous_bbox(2) != bb(2) || m_previous_bbox(3) != bb(3))
-            {
-              frame->setGeometry (octave::math::round (bb(0)),
-                                  octave::math::round (bb(1)),
-                                  octave::math::round (bb(2)),
-                                  octave::math::round (bb(3)));
-              updateLayout ();
-            }
-          m_previous_bbox = bb;
-        }
-        break;
-
-      case uipanel::properties::ID_BORDERWIDTH:
-        frame->setLineWidth (octave::math::round (pp.get_borderwidth ()));
-        updateLayout ();
-        break;
+    case uipanel::properties::ID_TITLEPOSITION:
+      updateLayout ();
+      break;
 
-      case uipanel::properties::ID_BACKGROUNDCOLOR:
-      case uipanel::properties::ID_FOREGROUNDCOLOR:
-      case uipanel::properties::ID_HIGHLIGHTCOLOR:
-      case uipanel::properties::ID_SHADOWCOLOR:
-        {
-          QPalette pal = frame->palette ();
-
-          setupPalette (pp, pal);
-          frame->setPalette (pal);
-          if (m_title)
-            m_title->setPalette (pal);
-        }
-        break;
-
-      case uipanel::properties::ID_TITLE:
-        {
-          QString title = Utils::fromStdString (pp.get_title ());
+    case uipanel::properties::ID_BORDERTYPE:
+      frame->setFrameStyle (frameStyleFromProperties (pp));
+      updateLayout ();
+      break;
 
-          if (title.isEmpty ())
-            {
-              if (m_title)
-                delete m_title;
-              m_title = nullptr;
-            }
-          else
-            {
-              if (! m_title)
-                {
-                  QPalette pal = frame->palette ();
-
-                  m_title = new QLabel (title, frame);
-                  m_title->setAutoFillBackground (true);
-                  m_title->setContentsMargins (4, 0, 4, 0);
-                  m_title->setPalette (pal);
-                  m_title->setFont (Utils::computeFont<uipanel> (pp));
-                  m_title->show ();
-                }
-              else
-                {
-                  m_title->setText (title);
-                  m_title->resize (m_title->sizeHint ());
-                }
-            }
+    case uipanel::properties::ID_FONTNAME:
+    case uipanel::properties::ID_FONTSIZE:
+    case uipanel::properties::ID_FONTWEIGHT:
+    case uipanel::properties::ID_FONTANGLE:
+      if (m_title)
+        {
+          m_title->setFont (Utils::computeFont<uipanel> (pp));
+          m_title->resize (m_title->sizeHint ());
           updateLayout ();
         }
-        break;
+      break;
 
-      case uipanel::properties::ID_TITLEPOSITION:
-        updateLayout ();
-        break;
-
-      case uipanel::properties::ID_BORDERTYPE:
-        frame->setFrameStyle (frameStyleFromProperties (pp));
-        updateLayout ();
-        break;
+    case uipanel::properties::ID_VISIBLE:
+      frame->setVisible (pp.is_visible ());
+      updateLayout ();
+      break;
 
-      case uipanel::properties::ID_FONTNAME:
-      case uipanel::properties::ID_FONTSIZE:
-      case uipanel::properties::ID_FONTWEIGHT:
-      case uipanel::properties::ID_FONTANGLE:
-        if (m_title)
-          {
-            m_title->setFont (Utils::computeFont<uipanel> (pp));
-            m_title->resize (m_title->sizeHint ());
-            updateLayout ();
-          }
-        break;
+    default:
+      break;
+    }
+
+  m_blockUpdates = false;
+}
 
-      case uipanel::properties::ID_VISIBLE:
-        frame->setVisible (pp.is_visible ());
-        updateLayout ();
-        break;
+void
+Panel::redraw ()
+{
+  update (uipanel::properties::ID_POSITION);
 
-      default:
-        break;
-      }
+  Canvas *canvas = m_container->canvas (m_handle);
 
-    m_blockUpdates = false;
-  }
+  if (canvas)
+    canvas->redraw ();
+}
 
-  void
-  Panel::redraw ()
-  {
-    update (uipanel::properties::ID_POSITION);
+void
+Panel::updateLayout ()
+{
+  uipanel::properties& pp = properties<uipanel> ();
+  QFrame *frame = qWidget<QFrame> ();
 
-    Canvas *canvas = m_container->canvas (m_handle);
-
-    if (canvas)
-      canvas->redraw ();
-  }
+  Matrix bb = pp.get_boundingbox (true);
+  int bw = borderWidthFromProperties (pp);
 
-  void
-  Panel::updateLayout ()
-  {
-    uipanel::properties& pp = properties<uipanel> ();
-    QFrame *frame = qWidget<QFrame> ();
-
-    Matrix bb = pp.get_boundingbox (true);
-    int bw = borderWidthFromProperties (pp);
+  frame->setFrameRect (QRect (octave::math::round (bb(0)) - bw,
+                              octave::math::round (bb(1)) - bw,
+                              octave::math::round (bb(2)) + 2*bw, octave::math::round (bb(3)) + 2*bw));
+  m_container->setGeometry (octave::math::round (bb(0)),
+                            octave::math::round (bb(1)),
+                            octave::math::round (bb(2)), octave::math::round (bb(3)));
 
-    frame->setFrameRect (QRect (octave::math::round (bb(0)) - bw,
-                                octave::math::round (bb(1)) - bw,
-                                octave::math::round (bb(2)) + 2*bw, octave::math::round (bb(3)) + 2*bw));
-    m_container->setGeometry (octave::math::round (bb(0)),
-                              octave::math::round (bb(1)),
-                              octave::math::round (bb(2)), octave::math::round (bb(3)));
+  if (m_blockUpdates)
+    pp.update_boundingbox ();
 
-    if (m_blockUpdates)
-      pp.update_boundingbox ();
-
-    if (m_title)
-      {
-        QSize sz = m_title->sizeHint ();
-        int offset = 5;
+  if (m_title)
+    {
+      QSize sz = m_title->sizeHint ();
+      int offset = 5;
 
-        if (pp.titleposition_is ("lefttop"))
-          m_title->move (bw+offset, 0);
-        else if (pp.titleposition_is ("righttop"))
-          m_title->move (frame->width () - bw - offset - sz.width (), 0);
-        else if (pp.titleposition_is ("leftbottom"))
-          m_title->move (bw+offset, frame->height () - sz.height ());
-        else if (pp.titleposition_is ("rightbottom"))
-          m_title->move (frame->width () - bw - offset - sz.width (),
-                         frame->height () - sz.height ());
-        else if (pp.titleposition_is ("centertop"))
-          m_title->move (frame->width () / 2 - sz.width () / 2, 0);
-        else if (pp.titleposition_is ("centerbottom"))
-          m_title->move (frame->width () / 2 - sz.width () / 2,
-                         frame->height () - sz.height ());
-      }
-  }
+      if (pp.titleposition_is ("lefttop"))
+        m_title->move (bw+offset, 0);
+      else if (pp.titleposition_is ("righttop"))
+        m_title->move (frame->width () - bw - offset - sz.width (), 0);
+      else if (pp.titleposition_is ("leftbottom"))
+        m_title->move (bw+offset, frame->height () - sz.height ());
+      else if (pp.titleposition_is ("rightbottom"))
+        m_title->move (frame->width () - bw - offset - sz.width (),
+                       frame->height () - sz.height ());
+      else if (pp.titleposition_is ("centertop"))
+        m_title->move (frame->width () / 2 - sz.width () / 2, 0);
+      else if (pp.titleposition_is ("centerbottom"))
+        m_title->move (frame->width () / 2 - sz.width () / 2,
+                       frame->height () - sz.height ());
+    }
+}
 
-  void
-  Panel::do_connections (const QObject *receiver, const QObject * /* emitter */)
-  {
-    Object::do_connections (receiver);
-    Object::do_connections (receiver, m_container->canvas (m_handle));
-  }
+void
+Panel::do_connections (const QObject *receiver, const QObject * /* emitter */)
+{
+  Object::do_connections (receiver);
+  Object::do_connections (receiver, m_container->canvas (m_handle));
+}
 
 OCTAVE_END_NAMESPACE(octave);
--- a/libgui/graphics/Panel.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/Panel.h	Thu Feb 02 12:25:51 2023 -0800
@@ -33,41 +33,41 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class interpreter;
+class interpreter;
 
-  class Container;
+class Container;
 
-  class Panel : public Object
-  {
-  public:
-    Panel (octave::interpreter& interp,
-           const graphics_object& go, QFrame *frame);
-    ~Panel ();
+class Panel : public Object
+{
+public:
+  Panel (octave::interpreter& interp,
+         const graphics_object& go, QFrame *frame);
+  ~Panel ();
 
-    Container * innerContainer () { return m_container; }
+  Container * innerContainer () { return m_container; }
 
-    bool eventFilter (QObject *watched, QEvent *event);
+  bool eventFilter (QObject *watched, QEvent *event);
 
-    static Panel *
-    create (octave::interpreter& interp,
-            const graphics_object& go);
+  static Panel *
+  create (octave::interpreter& interp,
+          const graphics_object& go);
 
-    void do_connections (const QObject *receiver,
-                         const QObject *emitter = nullptr);
+  void do_connections (const QObject *receiver,
+                       const QObject *emitter = nullptr);
 
-  protected:
-    void update (int pId);
-    void redraw ();
+protected:
+  void update (int pId);
+  void redraw ();
 
-  private:
-    void updateLayout ();
+private:
+  void updateLayout ();
 
-  private:
-    Container *m_container;
-    QLabel *m_title;
-    bool m_blockUpdates;
-    Matrix m_previous_bbox;
-  };
+private:
+  Container *m_container;
+  QLabel *m_title;
+  bool m_blockUpdates;
+  Matrix m_previous_bbox;
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/graphics/PopupMenuControl.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/PopupMenuControl.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -35,114 +35,114 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  PopupMenuControl *
-  PopupMenuControl::create (octave::interpreter& interp,
-                            const graphics_object& go)
-  {
-    Object *parent = parentObject (interp, go);
+PopupMenuControl *
+PopupMenuControl::create (octave::interpreter& interp,
+                          const graphics_object& go)
+{
+  Object *parent = parentObject (interp, go);
 
-    if (parent)
-      {
-        Container *container = parent->innerContainer ();
+  if (parent)
+    {
+      Container *container = parent->innerContainer ();
 
-        if (container)
-          return new PopupMenuControl (interp, go,
-                                       new QComboBox (container));
-      }
+      if (container)
+        return new PopupMenuControl (interp, go,
+                                     new QComboBox (container));
+    }
 
-    return nullptr;
-  }
+  return nullptr;
+}
 
-  PopupMenuControl::PopupMenuControl (octave::interpreter& interp,
-                                      const graphics_object& go,
-                                      QComboBox *box)
-    : BaseControl (interp, go, box), m_blockUpdate (false)
-  {
-    uicontrol::properties& up = properties<uicontrol> ();
+PopupMenuControl::PopupMenuControl (octave::interpreter& interp,
+                                    const graphics_object& go,
+                                    QComboBox *box)
+  : BaseControl (interp, go, box), m_blockUpdate (false)
+{
+  uicontrol::properties& up = properties<uicontrol> ();
 
-    box->addItems (Utils::fromStdString (up.get_string_string ()).split ('|'));
+  box->addItems (Utils::fromStdString (up.get_string_string ()).split ('|'));
 
-    update (uicontrol::properties::ID_VALUE);
+  update (uicontrol::properties::ID_VALUE);
 
-    connect (box, QOverload<int>::of (&QComboBox::activated),
-             this, &PopupMenuControl::currentIndexChanged);
-  }
+  connect (box, QOverload<int>::of (&QComboBox::activated),
+           this, &PopupMenuControl::currentIndexChanged);
+}
 
-  PopupMenuControl::~PopupMenuControl ()
-  { }
+PopupMenuControl::~PopupMenuControl ()
+{ }
 
-  void PopupMenuControl::update (int pId)
-  {
-    uicontrol::properties& up = properties<uicontrol> ();
-    QComboBox *box = qWidget<QComboBox> ();
+void PopupMenuControl::update (int pId)
+{
+  uicontrol::properties& up = properties<uicontrol> ();
+  QComboBox *box = qWidget<QComboBox> ();
 
-    switch (pId)
+  switch (pId)
+    {
+    case uicontrol::properties::ID_STRING:
+      m_blockUpdate = true;
       {
-      case uicontrol::properties::ID_STRING:
-        m_blockUpdate = true;
-        {
-          int oldCurrent = box->currentIndex ();
+        int oldCurrent = box->currentIndex ();
 
-          box->clear ();
-          box->addItems (Utils::fromStdString
-                         (up.get_string_string ()).split ('|'));
-          if (box->count () > 0
-              && oldCurrent >= 0
-              && oldCurrent < box->count ())
-            {
-              box->setCurrentIndex (oldCurrent);
-            }
-          else
-            {
-              emit gh_set_event (m_handle, "value",
-                                 octave_value (box->count () > 0 ? 1.0 : 0.0),
-                                 false);
-            }
-        }
-        m_blockUpdate = false;
-        break;
+        box->clear ();
+        box->addItems (Utils::fromStdString
+                       (up.get_string_string ()).split ('|'));
+        if (box->count () > 0
+            && oldCurrent >= 0
+            && oldCurrent < box->count ())
+          {
+            box->setCurrentIndex (oldCurrent);
+          }
+        else
+          {
+            emit gh_set_event (m_handle, "value",
+                               octave_value (box->count () > 0 ? 1.0 : 0.0),
+                               false);
+          }
+      }
+      m_blockUpdate = false;
+      break;
 
-      case uicontrol::properties::ID_VALUE:
-        m_blockUpdate = true;
-        {
-          Matrix value = up.get_value ().matrix_value ();
+    case uicontrol::properties::ID_VALUE:
+      m_blockUpdate = true;
+      {
+        Matrix value = up.get_value ().matrix_value ();
 
-          if (value.numel () > 0)
-            {
-              if (value(0) != static_cast<int> (value(0)))
-                warning ("popupmenu value should be integer");
-              else
-                {
-                  int newIndex = int (value(0)) - 1;
+        if (value.numel () > 0)
+          {
+            if (value(0) != static_cast<int> (value(0)))
+              warning ("popupmenu value should be integer");
+            else
+              {
+                int newIndex = int (value(0)) - 1;
 
-                  if (newIndex >= 0 && newIndex < box->count ())
-                    {
-                      if (newIndex != box->currentIndex ())
-                        box->setCurrentIndex (newIndex);
-                    }
-                  else
-                    warning ("popupmenu value not within valid display range");
-                }
-            }
-        }
-        m_blockUpdate = false;
-        break;
+                if (newIndex >= 0 && newIndex < box->count ())
+                  {
+                    if (newIndex != box->currentIndex ())
+                      box->setCurrentIndex (newIndex);
+                  }
+                else
+                  warning ("popupmenu value not within valid display range");
+              }
+          }
+      }
+      m_blockUpdate = false;
+      break;
 
-      default:
-        BaseControl::update (pId);
-        break;
-      }
-  }
+    default:
+      BaseControl::update (pId);
+      break;
+    }
+}
 
-  void
-  PopupMenuControl::currentIndexChanged (int index)
-  {
-    if (! m_blockUpdate)
-      {
-        emit gh_set_event (m_handle, "value", octave_value (double (index + 1)),
-                           false);
-        emit gh_callback_event (m_handle, "callback");
-      }
-  }
+void
+PopupMenuControl::currentIndexChanged (int index)
+{
+  if (! m_blockUpdate)
+    {
+      emit gh_set_event (m_handle, "value", octave_value (double (index + 1)),
+                         false);
+      emit gh_callback_event (m_handle, "callback");
+    }
+}
 
 OCTAVE_END_NAMESPACE(octave)
--- a/libgui/graphics/PopupMenuControl.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/PopupMenuControl.h	Thu Feb 02 12:25:51 2023 -0800
@@ -32,30 +32,30 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class interpreter;
+class interpreter;
 
-  class PopupMenuControl : public BaseControl
-  {
-    Q_OBJECT
+class PopupMenuControl : public BaseControl
+{
+  Q_OBJECT
 
-  public:
-    PopupMenuControl (octave::interpreter& interp, const graphics_object& go,
-                      QComboBox *box);
-    ~PopupMenuControl ();
+public:
+  PopupMenuControl (octave::interpreter& interp, const graphics_object& go,
+                    QComboBox *box);
+  ~PopupMenuControl ();
 
-    static PopupMenuControl *
-    create (octave::interpreter& interp,
-            const graphics_object& go);
+  static PopupMenuControl *
+  create (octave::interpreter& interp,
+          const graphics_object& go);
 
-  protected:
-    void update (int pId);
+protected:
+  void update (int pId);
 
-  private slots:
-    void currentIndexChanged (int index);
+private slots:
+  void currentIndexChanged (int index);
 
-  private:
-    bool m_blockUpdate;
-  };
+private:
+  bool m_blockUpdate;
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/graphics/PushButtonControl.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/PushButtonControl.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -36,65 +36,65 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  PushButtonControl *
-  PushButtonControl::create (octave::interpreter& interp,
-                             const graphics_object& go)
-  {
-    Object *parent = parentObject (interp, go);
+PushButtonControl *
+PushButtonControl::create (octave::interpreter& interp,
+                           const graphics_object& go)
+{
+  Object *parent = parentObject (interp, go);
 
-    if (parent)
-      {
-        Container *container = parent->innerContainer ();
+  if (parent)
+    {
+      Container *container = parent->innerContainer ();
 
-        if (container)
-          return new PushButtonControl (interp, go,
-                                        new QPushButton (container));
-      }
+      if (container)
+        return new PushButtonControl (interp, go,
+                                      new QPushButton (container));
+    }
 
-    return nullptr;
-  }
+  return nullptr;
+}
 
-  PushButtonControl::PushButtonControl (octave::interpreter& interp,
-                                        const graphics_object& go,
-                                        QPushButton *btn)
-    : ButtonControl (interp, go, btn)
-  {
-    uicontrol::properties& up = properties<uicontrol> ();
+PushButtonControl::PushButtonControl (octave::interpreter& interp,
+                                      const graphics_object& go,
+                                      QPushButton *btn)
+  : ButtonControl (interp, go, btn)
+{
+  uicontrol::properties& up = properties<uicontrol> ();
 
-    btn->setAutoFillBackground (true);
-    octave_value cdat = up.get_cdata ();
-    QImage img = Utils::makeImageFromCData (cdat,
-                                            cdat.columns (), cdat.rows ());
-    btn->setIcon (QIcon (QPixmap::fromImage (img)));
-    btn->setIconSize (QSize (cdat.columns (), cdat.rows ()));
-  }
+  btn->setAutoFillBackground (true);
+  octave_value cdat = up.get_cdata ();
+  QImage img = Utils::makeImageFromCData (cdat,
+                                          cdat.columns (), cdat.rows ());
+  btn->setIcon (QIcon (QPixmap::fromImage (img)));
+  btn->setIconSize (QSize (cdat.columns (), cdat.rows ()));
+}
 
-  PushButtonControl::~PushButtonControl ()
-  { }
+PushButtonControl::~PushButtonControl ()
+{ }
 
-  void
-  PushButtonControl::update (int pId)
-  {
-    uicontrol::properties& up = properties<uicontrol> ();
-    QPushButton *btn = qWidget<QPushButton> ();
+void
+PushButtonControl::update (int pId)
+{
+  uicontrol::properties& up = properties<uicontrol> ();
+  QPushButton *btn = qWidget<QPushButton> ();
 
-    switch (pId)
+  switch (pId)
+    {
+    case uicontrol::properties::ID_CDATA:
       {
-      case uicontrol::properties::ID_CDATA:
-        {
-          octave_value cdat = up.get_cdata ();
-          QImage img = Utils::makeImageFromCData (cdat,
-                                                  cdat.rows (),
-                                                  cdat.columns ());
-          btn->setIcon (QIcon (QPixmap::fromImage (img)));
-          btn->setIconSize (QSize (cdat.columns (), cdat.rows ()));
-        }
-        break;
+        octave_value cdat = up.get_cdata ();
+        QImage img = Utils::makeImageFromCData (cdat,
+                                                cdat.rows (),
+                                                cdat.columns ());
+        btn->setIcon (QIcon (QPixmap::fromImage (img)));
+        btn->setIconSize (QSize (cdat.columns (), cdat.rows ()));
+      }
+      break;
 
-      default:
-        ButtonControl::update (pId);
-        break;
-      }
-  }
+    default:
+      ButtonControl::update (pId);
+      break;
+    }
+}
 
 OCTAVE_END_NAMESPACE(octave)
--- a/libgui/graphics/PushButtonControl.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/PushButtonControl.h	Thu Feb 02 12:25:51 2023 -0800
@@ -32,22 +32,22 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class interpreter;
+class interpreter;
 
-  class PushButtonControl : public ButtonControl
-  {
-  public:
-    PushButtonControl (octave::interpreter& interp, const graphics_object& go,
-                       QPushButton *btn);
-    ~PushButtonControl ();
+class PushButtonControl : public ButtonControl
+{
+public:
+  PushButtonControl (octave::interpreter& interp, const graphics_object& go,
+                     QPushButton *btn);
+  ~PushButtonControl ();
 
-    static PushButtonControl *
-    create (octave::interpreter& interp,
-            const graphics_object& go);
+  static PushButtonControl *
+  create (octave::interpreter& interp,
+          const graphics_object& go);
 
-  protected:
-    void update (int pId);
-  };
+protected:
+  void update (int pId);
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/graphics/PushTool.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/PushTool.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -33,48 +33,48 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  PushTool *
-  PushTool::create (octave::interpreter& interp, const graphics_object& go)
-  {
-    Object *parent = parentObject (interp, go);
+PushTool *
+PushTool::create (octave::interpreter& interp, const graphics_object& go)
+{
+  Object *parent = parentObject (interp, go);
 
-    if (parent)
-      {
-        QWidget *parentWidget = parent->qWidget<QWidget> ();
+  if (parent)
+    {
+      QWidget *parentWidget = parent->qWidget<QWidget> ();
 
-        if (parentWidget)
-          return new PushTool (interp, go,
-                               new QAction (parentWidget));
-      }
+      if (parentWidget)
+        return new PushTool (interp, go,
+                             new QAction (parentWidget));
+    }
 
-    return nullptr;
-  }
+  return nullptr;
+}
 
-  PushTool::PushTool (octave::interpreter& interp,
-                      const graphics_object& go, QAction *action)
-    : ToolBarButton<uipushtool> (interp, go, action)
-  {
-    connect (action, &QAction::triggered, this, &PushTool::clicked);
-  }
+PushTool::PushTool (octave::interpreter& interp,
+                    const graphics_object& go, QAction *action)
+  : ToolBarButton<uipushtool> (interp, go, action)
+{
+  connect (action, &QAction::triggered, this, &PushTool::clicked);
+}
 
-  PushTool::~PushTool ()
-  { }
+PushTool::~PushTool ()
+{ }
 
-  void
-  PushTool::update (int pId)
-  {
-    switch (pId)
-      {
-      default:
-        ToolBarButton<uipushtool>::update (pId);
-        break;
-      }
-  }
+void
+PushTool::update (int pId)
+{
+  switch (pId)
+    {
+    default:
+      ToolBarButton<uipushtool>::update (pId);
+      break;
+    }
+}
 
-  void
-  PushTool::clicked ()
-  {
-    emit gh_callback_event (m_handle, "clickedcallback");
-  }
+void
+PushTool::clicked ()
+{
+  emit gh_callback_event (m_handle, "clickedcallback");
+}
 
 OCTAVE_END_NAMESPACE(octave);
--- a/libgui/graphics/PushTool.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/PushTool.h	Thu Feb 02 12:25:51 2023 -0800
@@ -30,27 +30,27 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class interpreter;
+class interpreter;
 
-  class PushTool : public ToolBarButton<uipushtool>
-  {
-    Q_OBJECT
+class PushTool : public ToolBarButton<uipushtool>
+{
+  Q_OBJECT
 
-  public:
-    PushTool (octave::interpreter& interp,
-              const graphics_object& go, QAction *action);
-    ~PushTool ();
+public:
+  PushTool (octave::interpreter& interp,
+            const graphics_object& go, QAction *action);
+  ~PushTool ();
 
-    static PushTool *
-    create (octave::interpreter& interp,
-            const graphics_object& go);
+  static PushTool *
+  create (octave::interpreter& interp,
+          const graphics_object& go);
 
-  protected:
-    void update (int pId);
+protected:
+  void update (int pId);
 
-  private slots:
-    void clicked ();
-  };
+private slots:
+  void clicked ();
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/graphics/RadioButtonControl.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/RadioButtonControl.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -36,67 +36,67 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  RadioButtonControl *
-  RadioButtonControl::create (octave::interpreter& interp,
-                              const graphics_object& go)
-  {
-    Object *parent = parentObject (interp, go);
+RadioButtonControl *
+RadioButtonControl::create (octave::interpreter& interp,
+                            const graphics_object& go)
+{
+  Object *parent = parentObject (interp, go);
 
-    if (parent)
-      {
-        Container *container = parent->innerContainer ();
+  if (parent)
+    {
+      Container *container = parent->innerContainer ();
 
-        if (container)
-          return new RadioButtonControl (interp, go,
-                                         new QRadioButton (container));
-      }
+      if (container)
+        return new RadioButtonControl (interp, go,
+                                       new QRadioButton (container));
+    }
 
-    return nullptr;
-  }
+  return nullptr;
+}
 
-  RadioButtonControl::RadioButtonControl (octave::interpreter& interp,
-                                          const graphics_object& go,
-                                          QRadioButton *radio)
-    : ButtonControl (interp, go, radio)
-  {
-    Object *parent = parentObject (interp, go);
-    ButtonGroup *btnGroup = dynamic_cast<ButtonGroup *>(parent);
-    if (btnGroup)
-      btnGroup->addButton (radio);
+RadioButtonControl::RadioButtonControl (octave::interpreter& interp,
+                                        const graphics_object& go,
+                                        QRadioButton *radio)
+  : ButtonControl (interp, go, radio)
+{
+  Object *parent = parentObject (interp, go);
+  ButtonGroup *btnGroup = dynamic_cast<ButtonGroup *>(parent);
+  if (btnGroup)
+    btnGroup->addButton (radio);
 
-    uicontrol::properties& up = properties<uicontrol> ();
+  uicontrol::properties& up = properties<uicontrol> ();
 
-    radio->setAutoFillBackground (true);
-    radio->setAutoExclusive (false);
-    if (up.enable_is ("inactive"))
-      radio->setCheckable (false);
-  }
+  radio->setAutoFillBackground (true);
+  radio->setAutoExclusive (false);
+  if (up.enable_is ("inactive"))
+    radio->setCheckable (false);
+}
 
-  RadioButtonControl::~RadioButtonControl ()
-  { }
+RadioButtonControl::~RadioButtonControl ()
+{ }
 
-  void
-  RadioButtonControl::update (int pId)
-  {
-    uicontrol::properties& up = properties<uicontrol> ();
-    QRadioButton *btn = qWidget<QRadioButton> ();
+void
+RadioButtonControl::update (int pId)
+{
+  uicontrol::properties& up = properties<uicontrol> ();
+  QRadioButton *btn = qWidget<QRadioButton> ();
 
-    switch (pId)
+  switch (pId)
+    {
+    case uicontrol::properties::ID_ENABLE:
       {
-      case uicontrol::properties::ID_ENABLE:
-        {
-          if (up.enable_is ("inactive"))
-            btn->setCheckable (false);
-          else
-            btn->setCheckable (true);
-          ButtonControl::update (pId);
-        }
-        break;
+        if (up.enable_is ("inactive"))
+          btn->setCheckable (false);
+        else
+          btn->setCheckable (true);
+        ButtonControl::update (pId);
+      }
+      break;
 
-      default:
-        ButtonControl::update (pId);
-        break;
-      }
-  }
+    default:
+      ButtonControl::update (pId);
+      break;
+    }
+}
 
 OCTAVE_END_NAMESPACE(octave);
--- a/libgui/graphics/RadioButtonControl.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/RadioButtonControl.h	Thu Feb 02 12:25:51 2023 -0800
@@ -32,21 +32,21 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class interpreter;
+class interpreter;
 
-  class RadioButtonControl : public ButtonControl
-  {
-  public:
-    RadioButtonControl (octave::interpreter& interp, const graphics_object& go,
-                        QRadioButton *box);
-    ~RadioButtonControl ();
+class RadioButtonControl : public ButtonControl
+{
+public:
+  RadioButtonControl (octave::interpreter& interp, const graphics_object& go,
+                      QRadioButton *box);
+  ~RadioButtonControl ();
 
-    static RadioButtonControl * create (octave::interpreter& interp,
-                                        const graphics_object& go);
+  static RadioButtonControl * create (octave::interpreter& interp,
+                                      const graphics_object& go);
 
-  protected:
-    void update (int pId);
-  };
+protected:
+  void update (int pId);
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/graphics/SliderControl.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/SliderControl.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -40,130 +40,130 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  SliderControl *
-  SliderControl::create (octave::interpreter& interp,
-                         const graphics_object& go)
-  {
-    Object *parent = parentObject (interp, go);
+SliderControl *
+SliderControl::create (octave::interpreter& interp,
+                       const graphics_object& go)
+{
+  Object *parent = parentObject (interp, go);
+
+  if (parent)
+    {
+      Container *container = parent->innerContainer ();
 
-    if (parent)
-      {
-        Container *container = parent->innerContainer ();
+      if (container)
+        return new SliderControl (interp, go,
+                                  new QScrollBar (container));
+    }
 
-        if (container)
-          return new SliderControl (interp, go,
-                                    new QScrollBar (container));
-      }
+  return nullptr;
+}
 
-    return nullptr;
-  }
+SliderControl::SliderControl (octave::interpreter& interp,
+                              const graphics_object& go,
+                              QAbstractSlider *slider)
+  : BaseControl (interp, go, slider), m_blockUpdates (false)
+{
+  uicontrol::properties& up = properties<uicontrol> ();
 
-  SliderControl::SliderControl (octave::interpreter& interp,
-                                const graphics_object& go,
-                                QAbstractSlider *slider)
-    : BaseControl (interp, go, slider), m_blockUpdates (false)
-  {
-    uicontrol::properties& up = properties<uicontrol> ();
+  slider->setTracking (false);
+  Matrix bb = up.get_boundingbox ();
+  bool vertical_slider = ( bb(2) < bb(3) );
+  slider->setOrientation (vertical_slider ? Qt::Vertical : Qt::Horizontal);
+  if (vertical_slider)
+    slider->setInvertedAppearance (true);  // Matlab compatibility
+  Matrix steps = up.get_sliderstep ().matrix_value ();
+  slider->setMinimum (0);
+  slider->setMaximum (RANGE_INT_MAX);
+  slider->setSingleStep (octave::math::round (steps(0) * RANGE_INT_MAX));
+  slider->setPageStep (octave::math::round (steps(1) * RANGE_INT_MAX));
+  Matrix value = up.get_value ().matrix_value ();
+  if (value.numel () > 0)
+    {
+      double dmin = up.get_min (), dmax = up.get_max ();
 
-    slider->setTracking (false);
-    Matrix bb = up.get_boundingbox ();
-    bool vertical_slider = ( bb(2) < bb(3) );
-    slider->setOrientation (vertical_slider ? Qt::Vertical : Qt::Horizontal);
-    if (vertical_slider)
-      slider->setInvertedAppearance (true);  // Matlab compatibility
-    Matrix steps = up.get_sliderstep ().matrix_value ();
-    slider->setMinimum (0);
-    slider->setMaximum (RANGE_INT_MAX);
-    slider->setSingleStep (octave::math::round (steps(0) * RANGE_INT_MAX));
-    slider->setPageStep (octave::math::round (steps(1) * RANGE_INT_MAX));
-    Matrix value = up.get_value ().matrix_value ();
-    if (value.numel () > 0)
-      {
-        double dmin = up.get_min (), dmax = up.get_max ();
+      slider->setValue (octave::math::round (((value(0) - dmin) / (dmax - dmin))
+                                             * RANGE_INT_MAX));
+    }
+
+  connect (slider, &QAbstractSlider::valueChanged,
+           this, &SliderControl::valueChanged);
+}
+
+SliderControl::~SliderControl ()
+{ }
+
+void
+SliderControl::update (int pId)
+{
+  uicontrol::properties& up = properties<uicontrol> ();
+  QScrollBar *slider = qWidget<QScrollBar> ();
 
-        slider->setValue (octave::math::round (((value(0) - dmin) / (dmax - dmin))
-                                               * RANGE_INT_MAX));
-      }
+  switch (pId)
+    {
+    case uicontrol::properties::ID_SLIDERSTEP:
+      {
+        Matrix steps = up.get_sliderstep ().matrix_value ();
 
-    connect (slider, &QAbstractSlider::valueChanged,
-             this, &SliderControl::valueChanged);
-  }
+        slider->setSingleStep (octave::math::round (steps(0) * RANGE_INT_MAX));
+        slider->setPageStep (octave::math::round (steps(1) * RANGE_INT_MAX));
+      }
+      break;
+
+    case uicontrol::properties::ID_VALUE:
+      {
+        Matrix value = up.get_value ().matrix_value ();
+        double dmax = up.get_max (), dmin = up.get_min ();
+
+        if (value.numel () > 0)
+          {
+            int ival = octave::math::round (((value(0) - dmin) / (dmax - dmin))
+                                            * RANGE_INT_MAX);
 
-  SliderControl::~SliderControl ()
-  { }
+            m_blockUpdates = true;
+            slider->setValue (ival);
+            m_blockUpdates = false;
+          }
+      }
+      break;
+
+    default:
+      BaseControl::update (pId);
+      break;
+    }
+}
 
-  void
-  SliderControl::update (int pId)
-  {
-    uicontrol::properties& up = properties<uicontrol> ();
-    QScrollBar *slider = qWidget<QScrollBar> ();
+void
+SliderControl::valueChanged (int ival)
+{
+  if (! m_blockUpdates)
+    {
+      gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
 
-    switch (pId)
-      {
-      case uicontrol::properties::ID_SLIDERSTEP:
+      octave::autolock guard (gh_mgr.graphics_lock ());
+
+      graphics_object go = object ();
+
+      if (go.valid_object ())
         {
-          Matrix steps = up.get_sliderstep ().matrix_value ();
+          uicontrol::properties& up = Utils::properties<uicontrol> (go);
 
-          slider->setSingleStep (octave::math::round (steps(0) * RANGE_INT_MAX));
-          slider->setPageStep (octave::math::round (steps(1) * RANGE_INT_MAX));
-        }
-        break;
-
-      case uicontrol::properties::ID_VALUE:
-        {
           Matrix value = up.get_value ().matrix_value ();
-          double dmax = up.get_max (), dmin = up.get_min ();
+          double dmin = up.get_min (), dmax = up.get_max ();
 
-          if (value.numel () > 0)
+          int ival_tmp = (value.numel () > 0 ?
+                          octave::math::round (((value(0) - dmin) / (dmax - dmin))
+                                               * RANGE_INT_MAX) :
+                          0);
+
+          if (ival != ival_tmp || value.numel () > 0)
             {
-              int ival = octave::math::round (((value(0) - dmin) / (dmax - dmin))
-                                              * RANGE_INT_MAX);
+              double dval = dmin + (ival * (dmax - dmin) / RANGE_INT_MAX);
 
-              m_blockUpdates = true;
-              slider->setValue (ival);
-              m_blockUpdates = false;
+              emit gh_set_event (m_handle, "value", octave_value (dval));
+              emit gh_callback_event (m_handle, "callback");
             }
         }
-        break;
-
-      default:
-        BaseControl::update (pId);
-        break;
-      }
-  }
-
-  void
-  SliderControl::valueChanged (int ival)
-  {
-    if (! m_blockUpdates)
-      {
-        gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
-
-        octave::autolock guard (gh_mgr.graphics_lock ());
-
-        graphics_object go = object ();
-
-        if (go.valid_object ())
-          {
-            uicontrol::properties& up = Utils::properties<uicontrol> (go);
-
-            Matrix value = up.get_value ().matrix_value ();
-            double dmin = up.get_min (), dmax = up.get_max ();
-
-            int ival_tmp = (value.numel () > 0 ?
-                            octave::math::round (((value(0) - dmin) / (dmax - dmin))
-                                                 * RANGE_INT_MAX) :
-                            0);
-
-            if (ival != ival_tmp || value.numel () > 0)
-              {
-                double dval = dmin + (ival * (dmax - dmin) / RANGE_INT_MAX);
-
-                emit gh_set_event (m_handle, "value", octave_value (dval));
-                emit gh_callback_event (m_handle, "callback");
-              }
-          }
-      }
-  }
+    }
+}
 
 OCTAVE_END_NAMESPACE(octave)
--- a/libgui/graphics/SliderControl.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/SliderControl.h	Thu Feb 02 12:25:51 2023 -0800
@@ -32,30 +32,30 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class interpreter;
+class interpreter;
 
-  class SliderControl : public BaseControl
-  {
-    Q_OBJECT
+class SliderControl : public BaseControl
+{
+  Q_OBJECT
 
-  public:
-    SliderControl (octave::interpreter& interp,
-                   const graphics_object& go, QAbstractSlider *slider);
-    ~SliderControl ();
+public:
+  SliderControl (octave::interpreter& interp,
+                 const graphics_object& go, QAbstractSlider *slider);
+  ~SliderControl ();
 
-    static SliderControl *
-    create (octave::interpreter& interp,
-            const graphics_object& go);
+  static SliderControl *
+  create (octave::interpreter& interp,
+          const graphics_object& go);
 
-  protected:
-    void update (int pId);
+protected:
+  void update (int pId);
 
-  private slots:
-    void valueChanged (int ival);
+private slots:
+  void valueChanged (int ival);
 
-  private:
-    bool m_blockUpdates;
-  };
+private:
+  bool m_blockUpdates;
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/graphics/Table.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/Table.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -57,1035 +57,1070 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  static const int AUTO_WIDTH = 75;
+static const int AUTO_WIDTH = 75;
 
 #define AUTO_HEIGHT (tp.get_fontsize () * 2 - 1)
 
-  static QSize realQSizeForTable (QTableWidget *t)
-  {
-    int w = t->verticalHeader ()->width () + 4;
-    for (int i = 0; i < t->columnCount (); i++)
-      w += t->columnWidth (i);
-    int h = t->horizontalHeader ()->height () + 4;
-    for (int i = 0; i < t->rowCount (); i++)
-      h += t->rowHeight (i);
-    return QSize (w, h);
-  }
+static QSize realQSizeForTable (QTableWidget *t)
+{
+  int w = t->verticalHeader ()->width () + 4;
+  for (int i = 0; i < t->columnCount (); i++)
+    w += t->columnWidth (i);
+  int h = t->horizontalHeader ()->height () + 4;
+  for (int i = 0; i < t->rowCount (); i++)
+    h += t->rowHeight (i);
+  return QSize (w, h);
+}
 
 #define FORMATNUMBER(type)                                                    \
-  static QString formatNumber (type d,                                        \
-                               char format = 'f',                             \
-                               int precision = 4)                             \
-  {                                                                           \
-    type ten = 10;                                                            \
-    if (format == 'n')                                                        \
-      {                                                                       \
-        if (d == floor (d))                                                   \
-          return QString::number (d, 'g', precision);                         \
-        else if (d <= pow (ten, precision - 1)                                \
-                 && d > pow (ten, 1 - precision))                             \
-          return QString::number (d, 'f', precision);                         \
-        else                                                                  \
-          return QString::number (d, 'e', precision);                         \
-      }                                                                       \
-    else if (format == 'F')                                                   \
-      {                                                                       \
-        int exponent = floor (log10 (d) / 3) * 3;                             \
-        d *= pow (ten, -exponent);                                            \
-        return QString::number (d, 'f', precision) + "e" +                    \
-          (exponent < 0 ? "-" : "+") +                                        \
-          QString ("%1").arg (abs (exponent), 3, 10, QChar ('0'));            \
-      }                                                                       \
-    else if (format == 'E')                                                   \
-      {                                                                       \
-        int exponent = floor (log10 (d) / 3) * 3;                             \
-        d *=  pow (ten, -exponent);                                           \
-        return QString::number (d,                                            \
-                                'f',                                          \
-                                precision - floor (log10 (d)) - 1) +          \
-               "e" + (exponent < 0 ? "-" : "+") +                             \
-               QString ("%1").arg (abs (exponent), 3, 10, QChar ('0'));       \
-      }                                                                       \
-    else                                                                      \
-      return QString::number (d, format, precision);                          \
-  }
+static QString formatNumber (type d,                                        \
+                             char format = 'f',                             \
+                             int precision = 4)                             \
+{                                                                           \
+  type ten = 10;                                                            \
+  if (format == 'n')                                                        \
+    {                                                                       \
+      if (d == floor (d))                                                   \
+        return QString::number (d, 'g', precision);                         \
+      else if (d <= pow (ten, precision - 1)                                \
+               && d > pow (ten, 1 - precision))                             \
+        return QString::number (d, 'f', precision);                         \
+      else                                                                  \
+        return QString::number (d, 'e', precision);                         \
+    }                                                                       \
+  else if (format == 'F')                                                   \
+    {                                                                       \
+      int exponent = floor (log10 (d) / 3) * 3;                             \
+      d *= pow (ten, -exponent);                                            \
+      return QString::number (d, 'f', precision) + "e" +                    \
+        (exponent < 0 ? "-" : "+") +                                        \
+        QString ("%1").arg (abs (exponent), 3, 10, QChar ('0'));            \
+    }                                                                       \
+  else if (format == 'E')                                                   \
+    {                                                                       \
+      int exponent = floor (log10 (d) / 3) * 3;                             \
+      d *=  pow (ten, -exponent);                                           \
+      return QString::number (d,                                            \
+                              'f',                                          \
+                              precision - floor (log10 (d)) - 1) +          \
+             "e" + (exponent < 0 ? "-" : "+") +                             \
+             QString ("%1").arg (abs (exponent), 3, 10, QChar ('0'));       \
+    }                                                                       \
+  else                                                                      \
+    return QString::number (d, format, precision);                          \
+}
 
-  FORMATNUMBER(double)
-  FORMATNUMBER(float)
+FORMATNUMBER(double)
+FORMATNUMBER(float)
 
 #undef FORMATNUMBER
 
-  static QString formatComplex (Complex c, char format = 'f', int precision = 4)
-  {
-    return formatNumber (c.real (), format, precision) + " + "
-           + formatNumber (c.imag (), format, precision) + "i";
-  }
+static QString formatComplex (Complex c, char format = 'f', int precision = 4)
+{
+  return formatNumber (c.real (), format, precision) + " + "
+         + formatNumber (c.imag (), format, precision) + "i";
+}
 
 #define FORMAT_VALUE_EXCEPT_RAT(f,l)                      \
-  if (format == "numeric" || format == "short")           \
-    text = formatNumber (value, 'n', f);                  \
-  else if (format == "short f" || format == "shortf")     \
-    text = formatNumber (value, 'f', f);                  \
-  else if (format == "short e" || format == "shorte")     \
-    text = formatNumber (value, 'e', f);                  \
-  else if (format == "short eng" || format == "shorteng") \
-    text = formatNumber (value, 'F', f);                  \
-  else if (format == "short g" || format == "shortg")     \
-    text = formatNumber (value, 'g', f + 1);              \
-  else if (format == "long")                              \
-    text = formatNumber (value, 'n', l);                  \
-  else if (format == "long f" || format == "longf")       \
-    text = formatNumber (value, 'f', l);                  \
-  else if (format == "long e" || format == "longe")       \
-    text = formatNumber (value, 'e', l);                  \
-  else if (format == "long eng" || format == "longeng")   \
-    text = formatNumber (value, 'E', l);                  \
-  else if (format == "long g" || format == "longg")       \
-    text = formatNumber (value, 'g', l + 1);              \
-  else if (format == "bank")                              \
-    text = QString::number (value, 'f', 2);               \
-  else if (format == "+")                                 \
-    if (value > 0)                                        \
-      text = Utils::fromStdString ("+");                  \
-    else if (value < 0)                                   \
-      text = Utils::fromStdString ("-");                  \
-    else                                                  \
-      text = Utils::fromStdString ("");
+if (format == "numeric" || format == "short")           \
+  text = formatNumber (value, 'n', f);                  \
+else if (format == "short f" || format == "shortf")     \
+  text = formatNumber (value, 'f', f);                  \
+else if (format == "short e" || format == "shorte")     \
+  text = formatNumber (value, 'e', f);                  \
+else if (format == "short eng" || format == "shorteng") \
+  text = formatNumber (value, 'F', f);                  \
+else if (format == "short g" || format == "shortg")     \
+  text = formatNumber (value, 'g', f + 1);              \
+else if (format == "long")                              \
+  text = formatNumber (value, 'n', l);                  \
+else if (format == "long f" || format == "longf")       \
+  text = formatNumber (value, 'f', l);                  \
+else if (format == "long e" || format == "longe")       \
+  text = formatNumber (value, 'e', l);                  \
+else if (format == "long eng" || format == "longeng")   \
+  text = formatNumber (value, 'E', l);                  \
+else if (format == "long g" || format == "longg")       \
+  text = formatNumber (value, 'g', l + 1);              \
+else if (format == "bank")                              \
+  text = QString::number (value, 'f', 2);               \
+else if (format == "+")                                 \
+  if (value > 0)                                        \
+    text = Utils::fromStdString ("+");                  \
+  else if (value < 0)                                   \
+    text = Utils::fromStdString ("-");                  \
+  else                                                  \
+    text = Utils::fromStdString ("");
 
 #define FORMAT_VALUE(f,l)                                               \
-  FORMAT_VALUE_EXCEPT_RAT(f,l)                                          \
-  else if (format == "rat")                                             \
-    text = Utils::fromStdString (rational_approx (double (value), 0));  \
-  else                                                                  \
-    {                                                                   \
-      text = formatNumber (value, 'n', f);                              \
-      flag = Qt::AlignLeft ;                                            \
-    }
+FORMAT_VALUE_EXCEPT_RAT(f,l)                                          \
+else if (format == "rat")                                             \
+  text = Utils::fromStdString (rational_approx (double (value), 0));  \
+else                                                                  \
+  {                                                                   \
+    text = formatNumber (value, 'n', f);                              \
+    flag = Qt::AlignLeft ;                                            \
+  }
 
 #define FORMAT_UINT_VALUE()                    \
-  text = QString::number (value);              \
-  if (format == "char"  || format == "popup")  \
-    flag = Qt::AlignLeft;                      \
-  else if (format == "+")                      \
-    {                                          \
-      if (value > 0)                           \
-        text = Utils::fromStdString ("+");     \
-      else                                     \
-        text = Utils::fromStdString ("");      \
-    }
+text = QString::number (value);              \
+if (format == "char"  || format == "popup")  \
+  flag = Qt::AlignLeft;                      \
+else if (format == "+")                      \
+  {                                          \
+    if (value > 0)                           \
+      text = Utils::fromStdString ("+");     \
+    else                                     \
+      text = Utils::fromStdString ("");      \
+  }
 
 #define FORMAT_INT_VALUE()                     \
-  text = QString::number (value);              \
-  if (format == "char" || format == "popup")   \
-    flag = Qt::AlignLeft ;                     \
-  else if (format == "+")                      \
-    {                                          \
-      if (value > 0)                           \
-        text = Utils::fromStdString ("+");     \
-      else if (value < 0)                      \
-        text = Utils::fromStdString ("-");     \
-      else                                     \
-        text = Utils::fromStdString ("");      \
+text = QString::number (value);              \
+if (format == "char" || format == "popup")   \
+  flag = Qt::AlignLeft ;                     \
+else if (format == "+")                      \
+  {                                          \
+    if (value > 0)                           \
+      text = Utils::fromStdString ("+");     \
+    else if (value < 0)                      \
+      text = Utils::fromStdString ("-");     \
+    else                                     \
+      text = Utils::fromStdString ("");      \
+  }
+
+static std::pair<Qt::AlignmentFlag, QString>
+qStringValueFor (octave_value val, std::string format = "")
+{
+  Qt::AlignmentFlag flag = Qt::AlignRight;
+  QString text;
+  if (val.isempty ())
+    {
+      text = "";
+      flag = Qt::AlignLeft;
+    }
+  else if (val.is_string ())
+    {
+      text = octave::Utils::fromStdString (val.string_value ());
+      flag = Qt::AlignLeft;
+    }
+  else if (val.iscomplex ())
+    {
+      // Matlab has multiple complex types, we only have double.
+      Complex c = val.complex_value ();
+      if (format == "short")
+        text = formatComplex (c, 'f', 4);
+      else if (format == "short e" || format == "shorte")
+        text = formatComplex (c, 'e', 4);
+      else if (format == "short eng" || format == "shorteng")
+        text = formatComplex (c, 'E', 4);
+      else if (format == "short g" || format == "shortg")
+        text = formatComplex (c, 'g', 5);
+      else if (format == "long")
+        text = formatComplex (c, 'f', 15);
+      else if (format == "long e" || format == "longe")
+        text = formatComplex (c, 'e', 15);
+      else if (format == "long eng" || format == "longeng")
+        text = formatComplex (c, 'E', 15);
+      else if (format == "long g" || format == "longg")
+        text = formatComplex (c, 'g', 16);
+      else if (format == "bank")
+        text = QString::number (c.real (), 'f', 2);
+      else if (format == "+")
+        {
+          if (c.real () > 0)
+            text = Utils::fromStdString ("+");
+          else if (c.real () < 0)
+            text = Utils::fromStdString ("-");
+          else
+            text = Utils::fromStdString ("");
+        }
+      else if (format == "rat")
+        text = Utils::fromStdString (rational_approx (c.real (), 0)) + " + "
+               + Utils::fromStdString (rational_approx (c.imag (), 0)) + "i";
+      else if (format == "numeric")
+        text = QString::number (c.real (), 'g', 5) + " + "
+               + QString::number (c.imag (), 'g', 5) + "i";
+      else
+        {
+          text = QString::number (c.real (), 'g', 5) + " + "
+                 + QString::number (c.imag (), 'g', 5) + "i";
+          flag = Qt::AlignLeft;
+        }
+    }
+  else if (val.is_double_type () )
+    {
+      double value = val.double_value ();
+      FORMAT_VALUE(4, 15)
+    }
+  else if (val.is_single_type ())
+    {
+      float value = val.float_value ();
+      FORMAT_VALUE(4, 7)
+    }
+  else if (val.is_int8_type ())
+    {
+      short int value = val.short_value ();
+      FORMAT_INT_VALUE()
+    }
+  else if (val.is_uint8_type ())
+    {
+      unsigned short int value = val.ushort_value ();
+      FORMAT_UINT_VALUE()
+    }
+  else if (val.is_int16_type ())
+    {
+      int value = val.int_value ();
+      FORMAT_INT_VALUE()
+    }
+  else if (val.is_uint16_type ())
+    {
+      unsigned int value = val.uint_value ();
+      FORMAT_UINT_VALUE()
+    }
+  else if (val.is_int32_type ())
+    {
+      long int value = val.long_value ();
+      FORMAT_INT_VALUE()
+    }
+  else if (val.is_uint32_type ())
+    {
+      unsigned long int value = val.ulong_value ();
+      FORMAT_UINT_VALUE()
+    }
+  else if (val.is_int64_type ())
+    {
+      int64_t value = val.int64_value ();
+      FORMAT_INT_VALUE()
+    }
+  else if (val.is_uint64_type ())
+    {
+      uint64_t value = val.uint64_value ();
+      FORMAT_UINT_VALUE()
+    }
+  else if (val.islogical ())
+    {
+      bool b = val.bool_value ();
+      if (format == "char" || format == "popup" || format == "")
+        {
+          text = Utils::fromStdString (b ? "true" : "false");
+          flag = Qt::AlignLeft;
+        }
+      else if (format == "+")
+        {
+          text = Utils::fromStdString (b ? "+" : "");
+          flag = Qt::AlignLeft;
+        }
+      else
+        text = Utils::fromStdString (b ? "1" : "0");
+    }
+  else
+    {
+      // FIXME: Should we warn about the unknown conversion?  If so,
+      // how?  We can't just call Octave's warning function here.
+
+      text = Utils::fromStdString (val.string_value (true));
     }
 
-  static std::pair<Qt::AlignmentFlag, QString>
-  qStringValueFor (octave_value val, std::string format = "")
-  {
-    Qt::AlignmentFlag flag = Qt::AlignRight;
-    QString text;
-    if (val.isempty ())
-      {
-        text = "";
-        flag = Qt::AlignLeft;
-      }
-    else if (val.is_string ())
-      {
-        text = octave::Utils::fromStdString (val.string_value ());
-        flag = Qt::AlignLeft;
-      }
-    else if (val.iscomplex ())
-      {
-        // Matlab has multiple complex types, we only have double.
-        Complex c = val.complex_value ();
-        if (format == "short")
-          text = formatComplex (c, 'f', 4);
-        else if (format == "short e" || format == "shorte")
-          text = formatComplex (c, 'e', 4);
-        else if (format == "short eng" || format == "shorteng")
-          text = formatComplex (c, 'E', 4);
-        else if (format == "short g" || format == "shortg")
-          text = formatComplex (c, 'g', 5);
-        else if (format == "long")
-          text = formatComplex (c, 'f', 15);
-        else if (format == "long e" || format == "longe")
-          text = formatComplex (c, 'e', 15);
-        else if (format == "long eng" || format == "longeng")
-          text = formatComplex (c, 'E', 15);
-        else if (format == "long g" || format == "longg")
-          text = formatComplex (c, 'g', 16);
-        else if (format == "bank")
-          text = QString::number (c.real (), 'f', 2);
-        else if (format == "+")
-          {
-            if (c.real () > 0)
-              text = Utils::fromStdString ("+");
-            else if (c.real () < 0)
-              text = Utils::fromStdString ("-");
-            else
-              text = Utils::fromStdString ("");
-          }
-        else if (format == "rat")
-          text = Utils::fromStdString (rational_approx (c.real (), 0)) + " + "
-                 + Utils::fromStdString (rational_approx (c.imag (), 0)) + "i";
-        else if (format == "numeric")
-          text = QString::number (c.real (), 'g', 5) + " + "
-                 + QString::number (c.imag (), 'g', 5) + "i";
-        else
-          {
-            text = QString::number (c.real (), 'g', 5) + " + "
-                   + QString::number (c.imag (), 'g', 5) + "i";
-            flag = Qt::AlignLeft;
-          }
-      }
-    else if (val.is_double_type () )
-      {
-        double value = val.double_value ();
-        FORMAT_VALUE(4, 15)
-      }
-    else if (val.is_single_type ())
-      {
-        float value = val.float_value ();
-        FORMAT_VALUE(4, 7)
-      }
-    else if (val.is_int8_type ())
-      {
-        short int value = val.short_value ();
-        FORMAT_INT_VALUE()
-      }
-    else if (val.is_uint8_type ())
-      {
-        unsigned short int value = val.ushort_value ();
-        FORMAT_UINT_VALUE()
-      }
-    else if (val.is_int16_type ())
-      {
-        int value = val.int_value ();
-        FORMAT_INT_VALUE()
-      }
-    else if (val.is_uint16_type ())
-      {
-        unsigned int value = val.uint_value ();
-        FORMAT_UINT_VALUE()
-      }
-    else if (val.is_int32_type ())
-      {
-        long int value = val.long_value ();
-        FORMAT_INT_VALUE()
-      }
-    else if (val.is_uint32_type ())
-      {
-        unsigned long int value = val.ulong_value ();
-        FORMAT_UINT_VALUE()
-      }
-    else if (val.is_int64_type ())
-      {
-        int64_t value = val.int64_value ();
-        FORMAT_INT_VALUE()
-      }
-    else if (val.is_uint64_type ())
-      {
-        uint64_t value = val.uint64_value ();
-        FORMAT_UINT_VALUE()
-      }
-    else if (val.islogical ())
-      {
-        bool b = val.bool_value ();
-        if (format == "char" || format == "popup" || format == "")
-          {
-            text = Utils::fromStdString (b ? "true" : "false");
-            flag = Qt::AlignLeft;
-          }
-        else if (format == "+")
-          {
-            text = Utils::fromStdString (b ? "+" : "");
-            flag = Qt::AlignLeft;
-          }
-        else
-          text = Utils::fromStdString (b ? "1" : "0");
-      }
-    else
-      {
-        // FIXME: Should we warn about the unknown conversion?  If so,
-        // how?  We can't just call Octave's warning function here.
-
-        text = Utils::fromStdString (val.string_value (true));
-      }
-
-    return std::make_pair (flag, text);
-  }
+  return std::make_pair (flag, text);
+}
 
 #undef FORMAT_VALUE
 #undef FORMAT_VALUE_EXCEPT_RAT
 #undef FORMAT_UINT_VALUE
 #undef FORMAT_INT_VALUE
 
-  static QTableWidgetItem * itemFor (octave_value val, std::string format = "",
-                                     bool enabled = false)
-  {
-    QTableWidgetItem *retval = new QTableWidgetItem ();
-    std::pair<Qt::AlignmentFlag, QString> flag_and_text =
-      qStringValueFor (val, format);
-    retval->setTextAlignment (flag_and_text.first);
-    retval->setText (flag_and_text.second);
+static QTableWidgetItem * itemFor (octave_value val, std::string format = "",
+                                   bool enabled = false)
+{
+  QTableWidgetItem *retval = new QTableWidgetItem ();
+  std::pair<Qt::AlignmentFlag, QString> flag_and_text =
+    qStringValueFor (val, format);
+  retval->setTextAlignment (flag_and_text.first);
+  retval->setText (flag_and_text.second);
+
+  if (enabled)
+    retval->setFlags (retval->flags () | Qt::ItemIsEditable);
+  else
+    retval->setFlags (retval->flags () & ~Qt::ItemIsEditable);
+
+  return retval;
+}
 
-    if (enabled)
-      retval->setFlags (retval->flags () | Qt::ItemIsEditable);
-    else
-      retval->setFlags (retval->flags () & ~Qt::ItemIsEditable);
+static octave_value
+attempt_type_conversion (const octave_value& ov,
+                         const octave_value& old_value)
+{
+  octave_value retval;
 
-    return retval;
+  // Define a macro to help with the conversion of strings to integers
+  // FIXME: these will happily integer overflow in the (u)int64 case
+  // - this probably doesn't matter.
+#define SCANF_AND_CONVERT(name,ctype,format)           \
+else if (old_value.is_ ## name ## _type ())          \
+  {                                                  \
+    ctype val;                                       \
+    int n;                                           \
+    const std::string cxx_str = ov.string_value ();  \
+    const char *c_str = cxx_str.c_str ();            \
+    int error = sscanf (c_str, format, &val, &n);    \
+    if (error != 1 || c_str[n])                      \
+      {                                              \
+        val = 0;                                     \
+      }                                              \
+    retval = octave_value ( octave_ ## name (val));  \
   }
 
-  static octave_value
-  attempt_type_conversion (const octave_value& ov,
-                           const octave_value& old_value)
-  {
-    octave_value retval;
-
-    // Define a macro to help with the conversion of strings to integers
-    // FIXME: these will happily integer overflow in the (u)int64 case
-    // - this probably doesn't matter.
-#define SCANF_AND_CONVERT(name,ctype,format)           \
-  else if (old_value.is_ ## name ## _type ())          \
-    {                                                  \
-      ctype val;                                       \
-      int n;                                           \
-      const std::string cxx_str = ov.string_value ();  \
-      const char *c_str = cxx_str.c_str ();            \
-      int error = sscanf (c_str, format, &val, &n);    \
-      if (error != 1 || c_str[n])                      \
-        {                                              \
-          val = 0;                                     \
-        }                                              \
-      retval = octave_value ( octave_ ## name (val));  \
-    }
-
-    if (old_value.is_string ())
-      retval = ov;
-    SCANF_AND_CONVERT(int8, int64_t, "%" PRId64 " %n")
-    SCANF_AND_CONVERT(uint8, uint64_t, "%" PRIu64 " %n")
-    SCANF_AND_CONVERT(int16, int64_t, "%" PRId64 " %n")
-    SCANF_AND_CONVERT(uint16, uint64_t, "%" PRIu64 " %n")
-    SCANF_AND_CONVERT(int32, int64_t, "%" PRId64 " %n")
-    SCANF_AND_CONVERT(uint32, uint64_t, "%" PRIu64 " %n")
-    SCANF_AND_CONVERT(int64, int64_t, "%" PRId64 " %n")
-    SCANF_AND_CONVERT(uint64, uint64_t, "%" PRIu64 " %n")
+  if (old_value.is_string ())
+    retval = ov;
+  SCANF_AND_CONVERT(int8, int64_t, "%" PRId64 " %n")
+  SCANF_AND_CONVERT(uint8, uint64_t, "%" PRIu64 " %n")
+  SCANF_AND_CONVERT(int16, int64_t, "%" PRId64 " %n")
+  SCANF_AND_CONVERT(uint16, uint64_t, "%" PRIu64 " %n")
+  SCANF_AND_CONVERT(int32, int64_t, "%" PRId64 " %n")
+  SCANF_AND_CONVERT(uint32, uint64_t, "%" PRIu64 " %n")
+  SCANF_AND_CONVERT(int64, int64_t, "%" PRId64 " %n")
+  SCANF_AND_CONVERT(uint64, uint64_t, "%" PRIu64 " %n")
 
 #undef SCANF_AND_CONVERT
 
-    else if (old_value.isnumeric () && ! old_value.isinteger ())
-      {
-        // Basically need to do str2double
-        Complex complex = octave::string::str2double (ov.string_value ());
-        if (old_value.is_single_type ())
-          retval = octave_value (FloatComplex (complex));
-        else
-          retval = octave_value (complex);
-      }
-    else if (old_value.islogical ())
-      {
-        // Right: Matlab basically needs this to be true or false, we should
-        // accept 1 too.
-        if (ov.string_value ()  == "true" || ov.string_value () == "1")
-          retval = octave_value (true);
-        else
-          retval = octave_value (false);
-      }
-    else
-      retval = octave_value (octave::string::str2double (ov.string_value ()));
-    return retval;
-  }
+  else if (old_value.isnumeric () && ! old_value.isinteger ())
+    {
+      // Basically need to do str2double
+      Complex complex = octave::string::str2double (ov.string_value ());
+      if (old_value.is_single_type ())
+        retval = octave_value (FloatComplex (complex));
+      else
+        retval = octave_value (complex);
+    }
+  else if (old_value.islogical ())
+    {
+      // Right: Matlab basically needs this to be true or false, we should
+      // accept 1 too.
+      if (ov.string_value ()  == "true" || ov.string_value () == "1")
+        retval = octave_value (true);
+      else
+        retval = octave_value (false);
+    }
+  else
+    retval = octave_value (octave::string::str2double (ov.string_value ()));
+  return retval;
+}
 
-  QWidget *
-  Table::checkBoxForLogical (octave_value val, bool enabled = false)
-  {
-    QWidget *retval = new QWidget (m_tableWidget);
-    QCheckBox *checkBox = new QCheckBox ();
-    QHBoxLayout *layout = new QHBoxLayout (retval);
-    layout->addWidget (checkBox);
-    layout->setAlignment (Qt::AlignCenter);
-    layout->setContentsMargins (0, 0, 0, 0);
-    retval->setLayout (layout);
+QWidget *
+Table::checkBoxForLogical (octave_value val, bool enabled = false)
+{
+  QWidget *retval = new QWidget (m_tableWidget);
+  QCheckBox *checkBox = new QCheckBox ();
+  QHBoxLayout *layout = new QHBoxLayout (retval);
+  layout->addWidget (checkBox);
+  layout->setAlignment (Qt::AlignCenter);
+  layout->setContentsMargins (0, 0, 0, 0);
+  retval->setLayout (layout);
+
+  if ((val.islogical () || val.is_bool_scalar ()) && val.bool_value ())
+    checkBox->setCheckState (Qt::Checked);
+  else
+    checkBox->setCheckState (Qt::Unchecked);
+
+  checkBox->setAttribute (Qt::WA_TransparentForMouseEvents, true);
+  checkBox->setFocusPolicy (Qt::NoFocus);
+  checkBox->setProperty ("Enabled", QVariant (enabled));
+
+  return retval;
+}
+
+Table *
+Table::create (octave::interpreter& interp,
+               const graphics_object& go)
+{
+  Object *parent = parentObject (interp, go);
+
+  if (parent)
+    {
+      Container *container = parent->innerContainer ();
+
+      if (container)
+        return new Table (interp, go, new QTableWidget (container));
+    }
+
+  return 0;
+}
 
-    if ((val.islogical () || val.is_bool_scalar ()) && val.bool_value ())
-      checkBox->setCheckState (Qt::Checked);
-    else
-      checkBox->setCheckState (Qt::Unchecked);
-
-    checkBox->setAttribute (Qt::WA_TransparentForMouseEvents, true);
-    checkBox->setFocusPolicy (Qt::NoFocus);
-    checkBox->setProperty ("Enabled", QVariant (enabled));
+Table::Table (octave::interpreter& interp,
+              const graphics_object& go, QTableWidget *tableWidget)
+  : Object (interp, go, tableWidget), m_tableWidget (tableWidget),
+    m_curData (), m_blockUpdates (false)
+{
+  qObject ()->setObjectName ("UItable");
+  uitable::properties& tp = properties<uitable> ();
 
-    return retval;
-  }
-
-  Table *
-  Table::create (octave::interpreter& interp,
-                 const graphics_object& go)
-  {
-    Object *parent = parentObject (interp, go);
+  m_curData = octave_value (tp.get_data ());
+  Matrix bb = tp.get_boundingbox (false);
+  m_tableWidget->setObjectName ("UITable");
+  m_tableWidget->setAutoFillBackground (true);
+  m_tableWidget->setGeometry (octave::math::round (bb(0)),
+                              octave::math::round (bb(1)),
+                              octave::math::round (bb(2)),
+                              octave::math::round (bb(3)));
+  m_tableWidget->setFont (Utils::computeFont<uitable> (tp)) ;
+  m_tableWidget->setSelectionBehavior (QAbstractItemView::SelectItems);
+  updatePalette ();
+  m_keyPressHandlerDefined = ! tp.get_keypressfcn ().isempty ();
+  m_keyReleaseHandlerDefined = ! tp.get_keyreleasefcn ().isempty ();
+  updateData ();
+  updateRowname ();
+  updateColumnname ();
+  updateColumnwidth ();
+  updateEnable ();  // Also does rearrangeableColumns
+  m_tableWidget->setToolTip (Utils::fromStdString (tp.get_tooltipstring ()));
+  m_tableWidget->setVisible (tp.is_visible ());
+  updateExtent ();
+  m_tableWidget->installEventFilter (this);
 
-    if (parent)
-      {
-        Container *container = parent->innerContainer ();
+  connect (m_tableWidget, &QTableWidget::itemChanged,
+           this, &Table::itemChanged);
+  connect (m_tableWidget, &QTableWidget::cellClicked,
+           this, &Table::cellClicked);
+  connect (m_tableWidget, &QTableWidget::itemSelectionChanged,
+           this, &Table::itemSelectionChanged);
+}
 
-        if (container)
-          return new Table (interp, go, new QTableWidget (container));
-      }
+Table::~Table () { }
 
-    return 0;
-  }
+void
+Table::itemSelectionChanged ()
+{
+  if (! (properties<uitable> ().get_cellselectioncallback ().isempty ()))
+    {
+      QModelIndexList modelIndexList =
+        m_tableWidget->selectionModel ()->selectedIndexes ();
+      int length = modelIndexList.size ();
+      Matrix indices = Matrix (length, 2);
+      for (int i = 0; i < length; i++)
+        {
+          indices(i, 0) = modelIndexList.value (i).row () + 1;
+          indices(i, 1) = modelIndexList.value (i).column () + 1;
+        }
+      octave_scalar_map eventData;
+      eventData.setfield ("Indices", indices);
+      octave_value cellSelectionCallbackEventObject (eventData);
+      emit gh_callback_event (m_handle, "cellselectioncallback",
+                              cellSelectionCallbackEventObject);
+    }
+}
 
-  Table::Table (octave::interpreter& interp,
-                const graphics_object& go, QTableWidget *tableWidget)
-    : Object (interp, go, tableWidget), m_tableWidget (tableWidget),
-      m_curData (), m_blockUpdates (false)
-  {
-    qObject ()->setObjectName ("UItable");
-    uitable::properties& tp = properties<uitable> ();
+void
+Table::cellClicked (int row, int col)
+{
+  QCheckBox *checkBox = nullptr;
+  QWidget *widget
+    = qobject_cast<QWidget *> (m_tableWidget->cellWidget (row, col));
+  if (widget && ! widget->children ().isEmpty ())
+    {
+      QHBoxLayout *layout
+        = qobject_cast<QHBoxLayout *> (widget->children ().first ());
 
-    m_curData = octave_value (tp.get_data ());
-    Matrix bb = tp.get_boundingbox (false);
-    m_tableWidget->setObjectName ("UITable");
-    m_tableWidget->setAutoFillBackground (true);
-    m_tableWidget->setGeometry (octave::math::round (bb(0)),
-                                octave::math::round (bb(1)),
-                                octave::math::round (bb(2)),
-                                octave::math::round (bb(3)));
-    m_tableWidget->setFont (Utils::computeFont<uitable> (tp)) ;
-    m_tableWidget->setSelectionBehavior (QAbstractItemView::SelectItems);
-    updatePalette ();
-    m_keyPressHandlerDefined = ! tp.get_keypressfcn ().isempty ();
-    m_keyReleaseHandlerDefined = ! tp.get_keyreleasefcn ().isempty ();
-    updateData ();
-    updateRowname ();
-    updateColumnname ();
-    updateColumnwidth ();
-    updateEnable ();  // Also does rearrangeableColumns
-    m_tableWidget->setToolTip (Utils::fromStdString (tp.get_tooltipstring ()));
-    m_tableWidget->setVisible (tp.is_visible ());
-    updateExtent ();
-    m_tableWidget->installEventFilter (this);
+      if (layout && layout->count () > 0)
+        checkBox = qobject_cast<QCheckBox *> (layout->itemAt (0)-> widget ());
+    }
+
+  if (checkBox && checkBox->property ("Enabled").toBool ())
+    checkBoxClicked (row, col, checkBox);
+}
+
+void
+Table::sendCellEditCallback (int row,
+                             int col,
+                             octave_value old_value,
+                             octave_value new_value,
+                             octave_value edit_data,
+                             octave_value error)
+{
+  if (!(properties<uitable> ().get_celleditcallback ().isempty ()))
+    {
+      Matrix indices = Matrix (1, 2);
+      indices(0, 0) = row + 1;
+      indices(0, 1) = col + 1;
 
-    connect (m_tableWidget, &QTableWidget::itemChanged,
-             this, &Table::itemChanged);
-    connect (m_tableWidget, &QTableWidget::cellClicked,
-             this, &Table::cellClicked);
-    connect (m_tableWidget, &QTableWidget::itemSelectionChanged,
-             this, &Table::itemSelectionChanged);
-  }
+      octave_scalar_map eventData;
+      eventData.setfield ("Indices", indices);
+      eventData.setfield ("PreviousData", old_value);
+      eventData.setfield ("NewData", new_value);
+      eventData.setfield ("EditData", edit_data);
+      eventData.setfield ("Error", error);
+
+      octave_value cellEditCallbackEventObject (eventData);
+
+      emit gh_callback_event (m_handle, "celleditcallback",
+                              cellEditCallbackEventObject);
+    }
+}
 
-  Table::~Table () { }
+void
+Table::comboBoxCurrentIndexChanged (const QString& value)
+{
+  if (m_blockUpdates)
+    return;
+
+  m_blockUpdates = true;
+
+  gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+
+  octave::autolock guard (gh_mgr.graphics_lock ());
+
+  octave_value data = octave_value (m_curData);
+  bool ok = false;
+
+  QComboBox *comboBox = qobject_cast<QComboBox *> (sender ());
+  int row = comboBox->property ("row").toInt ();
+  int col = comboBox->property ("col").toInt ();
+
+  octave_value edit_data = octave_value (Utils::toStdString (value));
 
-  void
-  Table::itemSelectionChanged ()
-  {
-    if (! (properties<uitable> ().get_cellselectioncallback ().isempty ()))
-      {
-        QModelIndexList modelIndexList =
-          m_tableWidget->selectionModel ()->selectedIndexes ();
-        int length = modelIndexList.size ();
-        Matrix indices = Matrix (length, 2);
-        for (int i = 0; i < length; i++)
-          {
-            indices(i, 0) = modelIndexList.value (i).row () + 1;
-            indices(i, 1) = modelIndexList.value (i).column () + 1;
-          }
-        octave_scalar_map eventData;
-        eventData.setfield ("Indices", indices);
-        octave_value cellSelectionCallbackEventObject (eventData);
-        emit gh_callback_event (m_handle, "cellselectioncallback",
-                                cellSelectionCallbackEventObject);
-      }
-  }
+  if (row < data.rows () && col < data.columns ())
+    {
+      if (data.iscell ())
+        {
+          Cell cell = data.cell_value ();
+          octave_value old_data = cell(row, col);
+          if (cell(row, col).is_string ())
+            {
+              cell(row, col) = edit_data;
+              if (edit_data.string_value () != old_data.string_value ())
+                {
+                  m_curData = octave_value (cell);
+                  emit gh_set_event (m_handle, "data", octave_value (cell),
+                                     false);
+                }
+
+              octave_value error = octave_value ("");
+              sendCellEditCallback (row, col,
+                                    old_data,
+                                    edit_data,
+                                    edit_data,
+                                    error);
+              ok = true;
+            }
+          else
+            {
+              cell(row, col) = attempt_type_conversion (edit_data, old_data);
+
+              // Inform the QTableWidget of our change
+              updateData (row, col, cell(row, col),
+                          columnformat (col), columneditable (col));
+
+              m_curData = octave_value (cell);
+              emit gh_set_event (m_handle, "data", octave_value (cell),
+                                 false);
 
-  void
-  Table::cellClicked (int row, int col)
-  {
-    QCheckBox *checkBox = nullptr;
-    QWidget *widget
-      = qobject_cast<QWidget *> (m_tableWidget->cellWidget (row, col));
-    if (widget && ! widget->children ().isEmpty ())
-      {
-        QHBoxLayout *layout
-          = qobject_cast<QHBoxLayout *> (widget->children ().first ());
-
-        if (layout && layout->count () > 0)
-          checkBox = qobject_cast<QCheckBox *> (layout->itemAt (0)-> widget ());
-      }
-
-    if (checkBox && checkBox->property ("Enabled").toBool ())
-      checkBoxClicked (row, col, checkBox);
-  }
+              octave_value error = octave_value ("");
+              sendCellEditCallback (row,
+                                    col,
+                                    old_data,
+                                    cell(row, col),
+                                    edit_data,
+                                    error);
+              ok = true;
+            }
+        }
+      else
+        {
+          octave_value old_data = data.is_matrix_type ()
+                                  ? data.fast_elem_extract (row + col * data.rows ())
+                                  : octave_value ();
+          data.fast_elem_insert (row + col * data.rows (),
+                                 attempt_type_conversion (edit_data, old_data));
 
-  void
-  Table::sendCellEditCallback (int row,
-                               int col,
-                               octave_value old_value,
-                               octave_value new_value,
-                               octave_value edit_data,
-                               octave_value error)
-  {
-    if (!(properties<uitable> ().get_celleditcallback ().isempty ()))
-      {
-        Matrix indices = Matrix (1, 2);
-        indices(0, 0) = row + 1;
-        indices(0, 1) = col + 1;
+          // Inform the QTableWidget of our change
+          updateData (row,
+                      col,
+                      data.fast_elem_extract (row + col * data.rows ()),
+                      columnformat (col),
+                      columneditable (col));
+
+          m_curData = octave_value (data);
+          emit gh_set_event (m_handle, "data", data, false);
 
-        octave_scalar_map eventData;
-        eventData.setfield ("Indices", indices);
-        eventData.setfield ("PreviousData", old_value);
-        eventData.setfield ("NewData", new_value);
-        eventData.setfield ("EditData", edit_data);
-        eventData.setfield ("Error", error);
-
-        octave_value cellEditCallbackEventObject (eventData);
+          octave_value error = octave_value ("");
+          sendCellEditCallback (row,
+                                col,
+                                old_data,
+                                data.fast_elem_extract (row + col * data.rows ()),
+                                edit_data,
+                                error);
+          ok = true;
+        }
+    }
+  else
+    {
+      // Reset the QTableWidgetItem
+      updateData (row, col, octave_value (""), columnformat (col),
+                  columneditable (col));
 
-        emit gh_callback_event (m_handle, "celleditcallback",
-                                cellEditCallbackEventObject);
-      }
-  }
+      octave_value error =
+        octave_value ("Table data is not editable at this location.");
+      sendCellEditCallback (row,
+                            col,
+                            octave_value (),
+                            octave_value (),
+                            edit_data,
+                            error);
+    }
 
-  void
-  Table::comboBoxCurrentIndexChanged (const QString& value)
-  {
-    if (m_blockUpdates)
-      return;
+  if (! ok)
+    {
+      comboBox->setCurrentIndex (-1);
+      comboBox->setEditable (true);
+      comboBox->setEditText (comboBox->property ("original_value").toString ());
+      comboBox->lineEdit ()->setReadOnly (true);
+    }
+  m_blockUpdates = false;
+}
 
-    m_blockUpdates = true;
-
-    gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
-
-    octave::autolock guard (gh_mgr.graphics_lock ());
-
-    octave_value data = octave_value (m_curData);
-    bool ok = false;
+void
+Table::checkBoxClicked (int row, int col, QCheckBox *checkBox)
+{
+  if (m_blockUpdates)
+    return;
+  m_blockUpdates = true;
 
-    QComboBox *comboBox = qobject_cast<QComboBox *> (sender ());
-    int row = comboBox->property ("row").toInt ();
-    int col = comboBox->property ("col").toInt ();
+  gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
 
-    octave_value edit_data = octave_value (Utils::toStdString (value));
+  octave::autolock guard (gh_mgr.graphics_lock ());
+
+  bool new_value = ! checkBox->isChecked ();
 
-    if (row < data.rows () && col < data.columns ())
-      {
-        if (data.iscell ())
-          {
-            Cell cell = data.cell_value ();
-            octave_value old_data = cell(row, col);
-            if (cell(row, col).is_string ())
-              {
-                cell(row, col) = edit_data;
-                if (edit_data.string_value () != old_data.string_value ())
-                  {
-                    m_curData = octave_value (cell);
-                    emit gh_set_event (m_handle, "data", octave_value (cell),
-                                       false);
-                  }
+  octave_value data = octave_value (m_curData);
+  if (data.islogical ())
+    {
+      // EASY WE JUST CONVERT
+      boolMatrix matrix = data.bool_matrix_value ();
+      if (row < matrix.rows () && col < matrix.columns ())
+        {
+          bool old_value = matrix(row, col);
+          matrix(row, col) = new_value;
+          checkBox->setChecked (new_value);
+          if (new_value != old_value)
+            {
+              m_curData = octave_value (matrix);
+              emit gh_set_event (m_handle, "data", octave_value (matrix),
+                                 false);
+            }
+
+          sendCellEditCallback (row, col,
+                                octave_value (old_value),
+                                octave_value (new_value),
+                                octave_value (new_value),
+                                octave_value (""));
 
-                octave_value error = octave_value ("");
-                sendCellEditCallback (row, col,
-                                      old_data,
-                                      edit_data,
-                                      edit_data,
-                                      error);
-                ok = true;
-              }
-            else
-              {
-                cell(row, col) = attempt_type_conversion (edit_data, old_data);
-
-                // Inform the QTableWidget of our change
-                updateData (row, col, cell(row, col),
-                            columnformat (col), columneditable (col));
-
-                m_curData = octave_value (cell);
-                emit gh_set_event (m_handle, "data", octave_value (cell),
-                                   false);
+        }
+      else
+        {
+          sendCellEditCallback (row,
+                                col,
+                                octave_value (),
+                                octave_value (),
+                                octave_value (new_value),
+                                octave_value ("Table data is not editable at this location."));
+        }
+    }
+  else if (data.iscell ())
+    {
+      Cell cell = data.cell_value ();
+      if (row < cell.rows () && col < cell.columns ())
+        {
+          if (cell(row, col).islogical ())
+            {
+              bool old_value = cell(row, col).bool_value ();
+              cell(row, col) = octave_value (new_value);
+              checkBox->setChecked (new_value);
+              if (new_value != old_value)
+                {
+                  m_curData = octave_value (cell);
+                  emit gh_set_event (m_handle, "data", octave_value (cell),
+                                     false);
+                }
 
-                octave_value error = octave_value ("");
-                sendCellEditCallback (row,
-                                      col,
-                                      old_data,
-                                      cell(row, col),
-                                      edit_data,
-                                      error);
-                ok = true;
-              }
-          }
-        else
-          {
-            octave_value old_data = data.is_matrix_type ()
-                                    ? data.fast_elem_extract (row + col * data.rows ())
-                                    : octave_value ();
-            data.fast_elem_insert (row + col * data.rows (),
-                                   attempt_type_conversion (edit_data, old_data));
+              sendCellEditCallback (row,
+                                    col,
+                                    octave_value (old_value),
+                                    octave_value (new_value),
+                                    octave_value (new_value),
+                                    octave_value (""));
+            }
+          else
+            {
+              sendCellEditCallback (row,
+                                    col,
+                                    cell(row, col),
+                                    octave_value (),
+                                    octave_value (new_value),
+                                    octave_value ("Cannot convert logical edit to other type."));
+            }
+        }
+      else
+        {
+          sendCellEditCallback (row,
+                                col,
+                                cell(row, col),
+                                octave_value (),
+                                octave_value (new_value),
+                                octave_value ("Table data is not editable at this location."));
+        }
+    }
+  else if (data.is_matrix_type ())
+    {
+      if (row < data.rows () && col < data.columns ())
+        {
+          sendCellEditCallback (row,
+                                col,
+                                data.fast_elem_extract (row + col * data.rows ()),
+                                octave_value (),
+                                octave_value (new_value),
+                                octave_value ("Cannot convert logical edit to other type."));
+        }
+      else
+        {
+          sendCellEditCallback (row,
+                                col,
+                                data.fast_elem_extract (row + col * data.rows ()),
+                                octave_value (),
+                                octave_value (new_value),
+                                octave_value ("Table data is not editable at this location."));
+        }
+    }
+  m_blockUpdates = false;
+}
 
-            // Inform the QTableWidget of our change
-            updateData (row,
-                        col,
-                        data.fast_elem_extract (row + col * data.rows ()),
-                        columnformat (col),
-                        columneditable (col));
+void
+Table::itemChanged (QTableWidgetItem *item)
+{
+  if (m_blockUpdates)
+    return;
+  m_blockUpdates = true;
 
-            m_curData = octave_value (data);
-            emit gh_set_event (m_handle, "data", data, false);
+  gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+
+  octave::autolock guard (gh_mgr.graphics_lock ());
+
+  octave_value data = octave_value (m_curData);
 
-            octave_value error = octave_value ("");
-            sendCellEditCallback (row,
-                                  col,
-                                  old_data,
-                                  data.fast_elem_extract (row + col * data.rows ()),
-                                  edit_data,
-                                  error);
-            ok = true;
-          }
-      }
-    else
-      {
-        // Reset the QTableWidgetItem
-        updateData (row, col, octave_value (""), columnformat (col),
-                    columneditable (col));
+  int row = item->row ();
+  int col = item->column ();
+  octave_value edit_data = octave_value (Utils::toStdString (item->text ()));
+  octave_value new_value;
+  octave_value old_value;
+  octave_value new_data;
+
+  if (row < data.rows () && col < data.columns ())
+    {
+      if (data.iscell ())
+        {
+          old_value = data.cell_value () (row, col);
+        }
+      else if (data.is_matrix_type ())
+        {
+          old_value = data.fast_elem_extract (row + col * data.rows ());
+        }
 
-        octave_value error =
-          octave_value ("Table data is not editable at this location.");
-        sendCellEditCallback (row,
-                              col,
-                              octave_value (),
-                              octave_value (),
-                              edit_data,
-                              error);
-      }
+      // Now we need to coerce the new_value in to the type of the old_value
+      if (old_value.is_string ())
+        new_value = edit_data;
+      else
+        {
+          new_value = attempt_type_conversion (edit_data, old_value);
+          std::pair<Qt::AlignmentFlag, QString> flag_and_text =
+            qStringValueFor (new_value, columnformat (col));
+          item->setTextAlignment (flag_and_text.first);
+          item->setText (flag_and_text.second);
+        }
 
-    if (! ok)
-      {
-        comboBox->setCurrentIndex (-1);
-        comboBox->setEditable (true);
-        comboBox->setEditText (comboBox->property ("original_value").toString ());
-        comboBox->lineEdit ()->setReadOnly (true);
-      }
-    m_blockUpdates = false;
-  }
+      if (data.iscell ())
+        {
+          Cell cell = data.cell_value ();
+          cell(row, col) = new_value;
+          new_data = octave_value (cell);
+        }
+      else
+        {
+          data.fast_elem_insert (row + col * data.rows (), new_value);
+          new_data = data;
+        }
+      m_curData = octave_value (new_data);
+      emit gh_set_event (m_handle, "data", new_data, false);
+
+      sendCellEditCallback (row,
+                            col,
+                            octave_value (old_value),
+                            octave_value (new_value),
+                            octave_value (new_value),
+                            octave_value (""));
+    }
+  else
+    {
+      item->setText ("");
+
+      octave_value error =
+        octave_value ("Table data is not editable at this location.");
+      sendCellEditCallback (row,
+                            col,
+                            octave_value (),
+                            octave_value (),
+                            edit_data,
+                            error);
+    }
 
-  void
-  Table::checkBoxClicked (int row, int col, QCheckBox *checkBox)
-  {
-    if (m_blockUpdates)
-      return;
-    m_blockUpdates = true;
+  m_blockUpdates = false;
+}
+
+void
+Table::redraw ()
+{
+  update (uitable::properties::ID_POSITION);
+}
+
+void
+Table::update (int pId)
+{
+  uitable::properties& tp = properties<uitable> ();
 
-    gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+  switch (pId)
+    {
+    case uitable::properties::ID_BACKGROUNDCOLOR:
+    case uitable::properties::ID_FOREGROUNDCOLOR:
+      updatePalette ();
+      break;
 
-    octave::autolock guard (gh_mgr.graphics_lock ());
+    case uitable::properties::ID_COLUMNNAME:
+      updateColumnname ();
+      updateColumnwidth ();
+      break;
 
-    bool new_value = ! checkBox->isChecked ();
+    case uitable::properties::ID_COLUMNWIDTH:
+      updateColumnwidth ();
+      break;
 
-    octave_value data = octave_value (m_curData);
-    if (data.islogical ())
-      {
-        // EASY WE JUST CONVERT
-        boolMatrix matrix = data.bool_matrix_value ();
-        if (row < matrix.rows () && col < matrix.columns ())
-          {
-            bool old_value = matrix(row, col);
-            matrix(row, col) = new_value;
-            checkBox->setChecked (new_value);
-            if (new_value != old_value)
-              {
-                m_curData = octave_value (matrix);
-                emit gh_set_event (m_handle, "data", octave_value (matrix),
-                                   false);
-              }
+    case uitable::properties::ID_COLUMNEDITABLE:
+    case uitable::properties::ID_COLUMNFORMAT:
+    case uitable::properties::ID_DATA:
+      m_blockUpdates = true;
+      m_curData = octave_value (tp.get_data ());
+      updateData ();
+      updateRowname ();
+      updateColumnname ();
+      updateColumnwidth ();
+      updateEnable ();
+      m_blockUpdates = false;
+      break;
+
+    case uitable::properties::ID_ENABLE:
+      updateEnable ();
+      break;
 
-            sendCellEditCallback (row, col,
-                                  octave_value (old_value),
-                                  octave_value (new_value),
-                                  octave_value (new_value),
-                                  octave_value (""));
+    case uitable::properties::ID_KEYPRESSFCN:
+      m_keyPressHandlerDefined = ! tp.get_keypressfcn ().isempty ();
+      break;
+
+    case uitable::properties::ID_KEYRELEASEFCN:
+      m_keyReleaseHandlerDefined = ! tp.get_keyreleasefcn ().isempty ();
+      break;
 
-          }
-        else
-          {
-            sendCellEditCallback (row,
-                                  col,
-                                  octave_value (),
-                                  octave_value (),
-                                  octave_value (new_value),
-                                  octave_value ("Table data is not editable at this location."));
-          }
-      }
-    else if (data.iscell ())
+    case uitable::properties::ID_FONTNAME:
+    case uitable::properties::ID_FONTSIZE:
+    case uitable::properties::ID_FONTWEIGHT:
+    case uitable::properties::ID_FONTANGLE:
+      if (m_tableWidget)
+        {
+          m_tableWidget->setFont (Utils::computeFont<uitable> (tp));
+          for (int row = 0; row < m_tableWidget->rowCount (); row++)
+            {
+              m_tableWidget->setRowHeight (row, AUTO_HEIGHT);
+            }
+        }
+      break;
+
+    case uitable::properties::ID_POSITION:
       {
-        Cell cell = data.cell_value ();
-        if (row < cell.rows () && col < cell.columns ())
-          {
-            if (cell(row, col).islogical ())
-              {
-                bool old_value = cell(row, col).bool_value ();
-                cell(row, col) = octave_value (new_value);
-                checkBox->setChecked (new_value);
-                if (new_value != old_value)
-                  {
-                    m_curData = octave_value (cell);
-                    emit gh_set_event (m_handle, "data", octave_value (cell),
-                                       false);
-                  }
-
-                sendCellEditCallback (row,
-                                      col,
-                                      octave_value (old_value),
-                                      octave_value (new_value),
-                                      octave_value (new_value),
-                                      octave_value (""));
-              }
-            else
-              {
-                sendCellEditCallback (row,
-                                      col,
-                                      cell(row, col),
-                                      octave_value (),
-                                      octave_value (new_value),
-                                      octave_value ("Cannot convert logical edit to other type."));
-              }
-          }
-        else
-          {
-            sendCellEditCallback (row,
-                                  col,
-                                  cell(row, col),
-                                  octave_value (),
-                                  octave_value (new_value),
-                                  octave_value ("Table data is not editable at this location."));
-          }
+        Matrix bb = tp.get_boundingbox (false);
+        m_tableWidget->setGeometry (octave::math::round (bb(0)),
+                                    octave::math::round (bb(1)),
+                                    octave::math::round (bb(2)),
+                                    octave::math::round (bb(3)));
+        updateExtent ();
       }
-    else if (data.is_matrix_type ())
-      {
-        if (row < data.rows () && col < data.columns ())
-          {
-            sendCellEditCallback (row,
-                                  col,
-                                  data.fast_elem_extract (row + col * data.rows ()),
-                                  octave_value (),
-                                  octave_value (new_value),
-                                  octave_value ("Cannot convert logical edit to other type."));
-          }
-        else
-          {
-            sendCellEditCallback (row,
-                                  col,
-                                  data.fast_elem_extract (row + col * data.rows ()),
-                                  octave_value (),
-                                  octave_value (new_value),
-                                  octave_value ("Table data is not editable at this location."));
-          }
-      }
-    m_blockUpdates = false;
-  }
+      break;
+
+    case uitable::properties::ID_REARRANGEABLECOLUMNS:
+      updateRearrangeableColumns ();
+      break;
+
+    case uitable::properties::ID_ROWNAME:
+      updateRowname ();
+      break;
+
+    case uitable::properties::ID_ROWSTRIPING:
+      updatePalette ();
+      break;
 
-  void
-  Table::itemChanged (QTableWidgetItem *item)
-  {
-    if (m_blockUpdates)
-      return;
-    m_blockUpdates = true;
-
-    gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+    case uitable::properties::ID_TOOLTIPSTRING:
+      m_tableWidget->setToolTip (Utils::fromStdString (tp.get_tooltipstring ()));
+      break;
 
-    octave::autolock guard (gh_mgr.graphics_lock ());
-
-    octave_value data = octave_value (m_curData);
+    case base_properties::ID_VISIBLE:
+      m_tableWidget->setVisible (tp.is_visible ());
+      break;
 
-    int row = item->row ();
-    int col = item->column ();
-    octave_value edit_data = octave_value (Utils::toStdString (item->text ()));
-    octave_value new_value;
-    octave_value old_value;
-    octave_value new_data;
+    default:
+      break;
+
+    }
+}
 
-    if (row < data.rows () && col < data.columns ())
-      {
-        if (data.iscell ())
-          {
-            old_value = data.cell_value () (row, col);
-          }
-        else if (data.is_matrix_type ())
-          {
-            old_value = data.fast_elem_extract (row + col * data.rows ());
-          }
+void
+Table::updateColumnname ()
+{
+  uitable::properties& tp = properties<uitable> ();
 
-        // Now we need to coerce the new_value in to the type of the old_value
-        if (old_value.is_string ())
-          new_value = edit_data;
-        else
-          {
-            new_value = attempt_type_conversion (edit_data, old_value);
-            std::pair<Qt::AlignmentFlag, QString> flag_and_text =
-              qStringValueFor (new_value, columnformat (col));
-            item->setTextAlignment (flag_and_text.first);
-            item->setText (flag_and_text.second);
-          }
+  // Reset the Column Count
+  m_tableWidget->setColumnCount (tp.get_data ().columns ());
 
-        if (data.iscell ())
-          {
-            Cell cell = data.cell_value ();
-            cell(row, col) = new_value;
-            new_data = octave_value (cell);
-          }
-        else
-          {
-            data.fast_elem_insert (row + col * data.rows (), new_value);
-            new_data = data;
-          }
-        m_curData = octave_value (new_data);
-        emit gh_set_event (m_handle, "data", new_data, false);
+  octave_value columnname = tp.get_columnname ();
+  QStringList l;
+  bool visible = true;
 
-        sendCellEditCallback (row,
-                              col,
-                              octave_value (old_value),
-                              octave_value (new_value),
-                              octave_value (new_value),
-                              octave_value (""));
-      }
-    else
-      {
-        item->setText ("");
-
-        octave_value error =
-          octave_value ("Table data is not editable at this location.");
-        sendCellEditCallback (row,
-                              col,
-                              octave_value (),
-                              octave_value (),
-                              edit_data,
-                              error);
-      }
-
-    m_blockUpdates = false;
-  }
+  if (columnname.is_string () && columnname.string_value (false) == "numbered")
+    for (int i = 0; i < m_tableWidget->columnCount (); i++)
+      l << QString::number (i + 1);
+  else if (columnname.is_string ())
+    {
+      if (m_tableWidget->columnCount () > 0)
+        l << Utils::fromStdString (columnname.string_value ());
+      for (int i = 1; i < m_tableWidget->columnCount (); i++)
+        l << "";
+    }
+  else if (columnname.isempty ())
+    {
+      for (int i = 0; i < m_tableWidget->columnCount (); i++)
+        l << "";
 
-  void
-  Table::redraw ()
-  {
-    update (uitable::properties::ID_POSITION);
-  }
-
-  void
-  Table::update (int pId)
-  {
-    uitable::properties& tp = properties<uitable> ();
+      visible = false;
+    }
+  else if (columnname.iscell ())
+    {
+      octave_idx_type n = columnname.numel ();
+      Cell cell_value = columnname.cell_value ();
 
-    switch (pId)
-      {
-      case uitable::properties::ID_BACKGROUNDCOLOR:
-      case uitable::properties::ID_FOREGROUNDCOLOR:
-        updatePalette ();
-        break;
-
-      case uitable::properties::ID_COLUMNNAME:
-        updateColumnname ();
-        updateColumnwidth ();
-        break;
-
-      case uitable::properties::ID_COLUMNWIDTH:
-        updateColumnwidth ();
-        break;
+      for (octave_idx_type i = 0; i < n; i++)
+        {
+          octave_value v = cell_value (i);
+          if (v.is_string ())
+            l << Utils::fromStdString (v.string_value (true));
+          else if (v.is_matrix_type ())
+            {
+              Matrix data = v.matrix_value ();
 
-      case uitable::properties::ID_COLUMNEDITABLE:
-      case uitable::properties::ID_COLUMNFORMAT:
-      case uitable::properties::ID_DATA:
-        m_blockUpdates = true;
-        m_curData = octave_value (tp.get_data ());
-        updateData ();
-        updateRowname ();
-        updateColumnname ();
-        updateColumnwidth ();
-        updateEnable ();
-        m_blockUpdates = false;
-        break;
-
-      case uitable::properties::ID_ENABLE:
-        updateEnable ();
-        break;
+              /* Now Matlab does something very strange here:
+               * If data is a row or column matrix,
+               * then each datapoint is added.
+               * Otherwise, nothing is set.
+               */
+              if (data.rows () > 1 && data.cols () > 1)
+                l << "";
+              else
+                for (octave_idx_type j = 0; j < data.numel (); j++)
+                  l << QString::number (data(j));
+            }
+          else if (v.isnumeric ())
+            l << QString::number (v.double_value ());
+          else
+            l << QString::number (v.double_value ());
+        }
+    }
+  else if (columnname.is_matrix_type ())
+    {
+      octave_idx_type n = columnname.numel ();
+      Matrix matrix_value = columnname.matrix_value ();
 
-      case uitable::properties::ID_KEYPRESSFCN:
-        m_keyPressHandlerDefined = ! tp.get_keypressfcn ().isempty ();
-        break;
-
-      case uitable::properties::ID_KEYRELEASEFCN:
-        m_keyReleaseHandlerDefined = ! tp.get_keyreleasefcn ().isempty ();
-        break;
+      for (octave_idx_type i = 0; i < n; i++)
+        l << QString::number (matrix_value(i));
+    }
+  else
+    {
+      for (int i = 0; i < m_tableWidget->columnCount (); i++)
+        l << "";
+      visible = false;
+    }
 
-      case uitable::properties::ID_FONTNAME:
-      case uitable::properties::ID_FONTSIZE:
-      case uitable::properties::ID_FONTWEIGHT:
-      case uitable::properties::ID_FONTANGLE:
-        if (m_tableWidget)
-          {
-            m_tableWidget->setFont (Utils::computeFont<uitable> (tp));
-            for (int row = 0; row < m_tableWidget->rowCount (); row++)
-              {
-                m_tableWidget->setRowHeight (row, AUTO_HEIGHT);
-              }
-          }
-        break;
+  l.replaceInStrings ("|", "\n");
 
-      case uitable::properties::ID_POSITION:
+  // Now add the columns as required
+  if (m_tableWidget->columnCount () < l.length ())
+    {
+      int oldColumnCount = m_tableWidget->columnCount ();
+      m_tableWidget->setColumnCount (l.length ());
+      for (int col = oldColumnCount; col < l.length (); col++)
         {
-          Matrix bb = tp.get_boundingbox (false);
-          m_tableWidget->setGeometry (octave::math::round (bb(0)),
-                                      octave::math::round (bb(1)),
-                                      octave::math::round (bb(2)),
-                                      octave::math::round (bb(3)));
-          updateExtent ();
-        }
-        break;
+          std::string format = columnformat (col);
+          bool enabled = columneditable (col);
 
-      case uitable::properties::ID_REARRANGEABLECOLUMNS:
-        updateRearrangeableColumns ();
-        break;
-
-      case uitable::properties::ID_ROWNAME:
-        updateRowname ();
-        break;
+          for (int row = 0; row < m_tableWidget->rowCount (); row++)
+            updateData (row, col, octave_value (""), format, enabled);
+        }
+    }
 
-      case uitable::properties::ID_ROWSTRIPING:
-        updatePalette ();
-        break;
-
-      case uitable::properties::ID_TOOLTIPSTRING:
-        m_tableWidget->setToolTip (Utils::fromStdString (tp.get_tooltipstring ()));
-        break;
+  m_tableWidget->setHorizontalHeaderLabels (l);
+  m_tableWidget->horizontalHeader ()->setVisible (visible);
+}
 
-      case base_properties::ID_VISIBLE:
-        m_tableWidget->setVisible (tp.is_visible ());
-        break;
-
-      default:
-        break;
-
-      }
-  }
+void
+Table::updateColumnwidth ()
+{
+  uitable::properties& tp = properties<uitable> ();
 
-  void
-  Table::updateColumnname ()
-  {
-    uitable::properties& tp = properties<uitable> ();
-
-    // Reset the Column Count
-    m_tableWidget->setColumnCount (tp.get_data ().columns ());
-
-    octave_value columnname = tp.get_columnname ();
-    QStringList l;
-    bool visible = true;
-
-    if (columnname.is_string () && columnname.string_value (false) == "numbered")
-      for (int i = 0; i < m_tableWidget->columnCount (); i++)
-        l << QString::number (i + 1);
-    else if (columnname.is_string ())
+  octave_value columnwidth = tp.get_columnwidth ();
+  if (columnwidth.isempty ()
+      || (columnwidth.is_string ()
+          && columnwidth.string_value (false) == "auto"))
+    for (int i = 0; i < m_tableWidget->columnCount (); i++)
+      m_tableWidget->setColumnWidth (i, AUTO_WIDTH);
+  else if (columnwidth.is_string ()
+           && columnwidth.string_value (false) == "preferred")
+    for (int i = 0; i < m_tableWidget->columnCount (); i++)
       {
-        if (m_tableWidget->columnCount () > 0)
-          l << Utils::fromStdString (columnname.string_value ());
-        for (int i = 1; i < m_tableWidget->columnCount (); i++)
-          l << "";
-      }
-    else if (columnname.isempty ())
-      {
-        for (int i = 0; i < m_tableWidget->columnCount (); i++)
-          l << "";
-
-        visible = false;
-      }
-    else if (columnname.iscell ())
-      {
-        octave_idx_type n = columnname.numel ();
-        Cell cell_value = columnname.cell_value ();
+        int column_size =
+          (qobject_cast<QAbstractItemView *> (m_tableWidget))->sizeHintForColumn (i);
+        int header_size = m_tableWidget->horizontalHeader ()->sectionSizeHint (i);
 
-        for (octave_idx_type i = 0; i < n; i++)
-          {
-            octave_value v = cell_value (i);
-            if (v.is_string ())
-              l << Utils::fromStdString (v.string_value (true));
-            else if (v.is_matrix_type ())
-              {
-                Matrix data = v.matrix_value ();
-
-                /* Now Matlab does something very strange here:
-                 * If data is a row or column matrix,
-                 * then each datapoint is added.
-                 * Otherwise, nothing is set.
-                 */
-                if (data.rows () > 1 && data.cols () > 1)
-                  l << "";
-                else
-                  for (octave_idx_type j = 0; j < data.numel (); j++)
-                    l << QString::number (data(j));
-              }
-            else if (v.isnumeric ())
-              l << QString::number (v.double_value ());
-            else
-              l << QString::number (v.double_value ());
-          }
+        if (column_size > header_size)
+          header_size = column_size;
+        m_tableWidget->setColumnWidth (i, header_size);
       }
-    else if (columnname.is_matrix_type ())
-      {
-        octave_idx_type n = columnname.numel ();
-        Matrix matrix_value = columnname.matrix_value ();
-
-        for (octave_idx_type i = 0; i < n; i++)
-          l << QString::number (matrix_value(i));
-      }
-    else
-      {
-        for (int i = 0; i < m_tableWidget->columnCount (); i++)
-          l << "";
-        visible = false;
-      }
-
-    l.replaceInStrings ("|", "\n");
+  else if (columnwidth.iscell ())
+    {
+      Cell cell_value = columnwidth.cell_value ();
+      int i = 0;
+      for (; i < m_tableWidget->columnCount () && i < cell_value.numel (); i++)
+        {
+          octave_value v = cell_value (i);
+          if (v.is_string ()  && v.string_value (false) == "auto")
+            m_tableWidget->setColumnWidth (i, AUTO_WIDTH);
+          else if (v.is_string () && v.string_value (false) == "preferred")
+            {
+              int column_size =
+                (qobject_cast<QAbstractItemView *> (m_tableWidget))->sizeHintForColumn (i);
+              int header_size = m_tableWidget->horizontalHeader ()->sectionSizeHint (i);
 
-    // Now add the columns as required
-    if (m_tableWidget->columnCount () < l.length ())
-      {
-        int oldColumnCount = m_tableWidget->columnCount ();
-        m_tableWidget->setColumnCount (l.length ());
-        for (int col = oldColumnCount; col < l.length (); col++)
-          {
-            std::string format = columnformat (col);
-            bool enabled = columneditable (col);
-
-            for (int row = 0; row < m_tableWidget->rowCount (); row++)
-              updateData (row, col, octave_value (""), format, enabled);
-          }
-      }
-
-    m_tableWidget->setHorizontalHeaderLabels (l);
-    m_tableWidget->horizontalHeader ()->setVisible (visible);
-  }
-
-  void
-  Table::updateColumnwidth ()
-  {
-    uitable::properties& tp = properties<uitable> ();
-
-    octave_value columnwidth = tp.get_columnwidth ();
-    if (columnwidth.isempty ()
-        || (columnwidth.is_string ()
-            && columnwidth.string_value (false) == "auto"))
-      for (int i = 0; i < m_tableWidget->columnCount (); i++)
-        m_tableWidget->setColumnWidth (i, AUTO_WIDTH);
-    else if (columnwidth.is_string ()
-             && columnwidth.string_value (false) == "preferred")
-      for (int i = 0; i < m_tableWidget->columnCount (); i++)
+              if (column_size > header_size)
+                header_size = column_size;
+              m_tableWidget->setColumnWidth (i, header_size);
+            }
+          else
+            {
+              int w = int (v.double_value ());
+              m_tableWidget->setColumnWidth (i, w);
+            }
+        }
+      for (; i < m_tableWidget->columnCount (); i++)
         {
           int column_size =
             (qobject_cast<QAbstractItemView *> (m_tableWidget))->sizeHintForColumn (i);
@@ -1095,629 +1130,594 @@
             header_size = column_size;
           m_tableWidget->setColumnWidth (i, header_size);
         }
-    else if (columnwidth.iscell ())
-      {
-        Cell cell_value = columnwidth.cell_value ();
-        int i = 0;
-        for (; i < m_tableWidget->columnCount () && i < cell_value.numel (); i++)
-          {
-            octave_value v = cell_value (i);
-            if (v.is_string ()  && v.string_value (false) == "auto")
-              m_tableWidget->setColumnWidth (i, AUTO_WIDTH);
-            else if (v.is_string () && v.string_value (false) == "preferred")
-              {
-                int column_size =
-                  (qobject_cast<QAbstractItemView *> (m_tableWidget))->sizeHintForColumn (i);
-                int header_size = m_tableWidget->horizontalHeader ()->sectionSizeHint (i);
+    }
+  else if (columnwidth.is_matrix_type ())
+    {
+      Matrix matrix_value = columnwidth.matrix_value ();
+      int i = 0;
+      for (; i < m_tableWidget->columnCount () && i < matrix_value.numel (); i++)
+        {
+          octave_value v = matrix_value(i);
+          int w = int (v.double_value ());
+          m_tableWidget->setColumnWidth (i, w);
+        }
+      for (; i < m_tableWidget->columnCount (); i++)
+        m_tableWidget->setColumnWidth (i, AUTO_WIDTH);
+    }
+}
 
-                if (column_size > header_size)
-                  header_size = column_size;
-                m_tableWidget->setColumnWidth (i, header_size);
-              }
-            else
-              {
-                int w = int (v.double_value ());
-                m_tableWidget->setColumnWidth (i, w);
-              }
-          }
-        for (; i < m_tableWidget->columnCount (); i++)
-          {
-            int column_size =
-              (qobject_cast<QAbstractItemView *> (m_tableWidget))->sizeHintForColumn (i);
-            int header_size = m_tableWidget->horizontalHeader ()->sectionSizeHint (i);
+bool inline
+Table::columneditable (int col)
+{
+  uitable::properties& tp = properties<uitable> ();
+  boolNDArray columneditable = tp.get_columneditable ().bool_array_value ();
+  bool editable = false;
 
-            if (column_size > header_size)
-              header_size = column_size;
-            m_tableWidget->setColumnWidth (i, header_size);
-          }
-      }
-    else if (columnwidth.is_matrix_type ())
-      {
-        Matrix matrix_value = columnwidth.matrix_value ();
-        int i = 0;
-        for (; i < m_tableWidget->columnCount () && i < matrix_value.numel (); i++)
-          {
-            octave_value v = matrix_value(i);
-            int w = int (v.double_value ());
-            m_tableWidget->setColumnWidth (i, w);
-          }
-        for (; i < m_tableWidget->columnCount (); i++)
-          m_tableWidget->setColumnWidth (i, AUTO_WIDTH);
-      }
-  }
+  if (! columneditable.isempty () && col < columneditable.numel ())
+    editable = columneditable.xelem (col);
+  else if (! columneditable.isempty () && columneditable.numel () == 1)
+    editable = columneditable.xelem (0);
 
-  bool inline
-  Table::columneditable (int col)
-  {
-    uitable::properties& tp = properties<uitable> ();
-    boolNDArray columneditable = tp.get_columneditable ().bool_array_value ();
-    bool editable = false;
+  return editable;
+}
 
-    if (! columneditable.isempty () && col < columneditable.numel ())
-      editable = columneditable.xelem (col);
-    else if (! columneditable.isempty () && columneditable.numel () == 1)
-      editable = columneditable.xelem (0);
-
-    return editable;
-  }
+std::string inline
+Table::columnformat (int col)
+{
+  uitable::properties& tp = properties<uitable> ();
+  std::string format = "";
+  octave_value ov_columnformat = tp.get_columnformat ();
 
-  std::string inline
-  Table::columnformat (int col)
-  {
-    uitable::properties& tp = properties<uitable> ();
-    std::string format = "";
-    octave_value ov_columnformat = tp.get_columnformat ();
-
-    if (ov_columnformat.iscell ())
-      {
-        Cell columnformat = ov_columnformat.cell_value ();
-        if (! columnformat.isempty () && col < columnformat.numel ())
-          {
-            octave_value format_value = columnformat.xelem (col);
+  if (ov_columnformat.iscell ())
+    {
+      Cell columnformat = ov_columnformat.cell_value ();
+      if (! columnformat.isempty () && col < columnformat.numel ())
+        {
+          octave_value format_value = columnformat.xelem (col);
 
-            if (! format_value.isempty () && format_value.is_string ())
-              format = format_value.string_value ();
-            else if (! format_value.isempty () && format_value.iscell ())
-              format = "popup";
-          }
-      }
-    else if (ov_columnformat.is_string ())
-      {
-        format = ov_columnformat.string_value ();
-      }
-    return format;
-  }
-
-  void inline
-  Table::updateDataColumn (int col)
-  {
-    octave_value data = properties<uitable> ().get_data ();
+          if (! format_value.isempty () && format_value.is_string ())
+            format = format_value.string_value ();
+          else if (! format_value.isempty () && format_value.iscell ())
+            format = "popup";
+        }
+    }
+  else if (ov_columnformat.is_string ())
+    {
+      format = ov_columnformat.string_value ();
+    }
+  return format;
+}
 
-    std::string format = columnformat (col);
-    bool is_editable = columneditable (col);
+void inline
+Table::updateDataColumn (int col)
+{
+  octave_value data = properties<uitable> ().get_data ();
 
-    for (octave_idx_type row = 0; row < data.rows (); row++)
-      updateData (row,
-                  col,
-                  data.iscell ()
-                  ? data.cell_value () (row, col)
-                  : data.fast_elem_extract (row + col * data.rows ()),
-                  format,
-                  is_editable);
-  }
+  std::string format = columnformat (col);
+  bool is_editable = columneditable (col);
 
-  void inline
-  Table::updateData (int row, int col)
-  {
-    octave_value data = properties<uitable> ().get_data ();
+  for (octave_idx_type row = 0; row < data.rows (); row++)
     updateData (row,
                 col,
                 data.iscell ()
                 ? data.cell_value () (row, col)
                 : data.fast_elem_extract (row + col * data.rows ()),
-                columnformat (col),
-                columneditable (col));
-  }
-
-  void inline
-  Table::updateData (int row, int col, octave_value value,
-                     std::string format = "", bool enabled = false)
-  {
-    if (format == "logical" || (format == "" && value.islogical ()))
-      {
-        if (m_tableWidget->item (row, col))
-          delete m_tableWidget->item (row, col);
-
-        m_tableWidget->setCellWidget (row, col, checkBoxForLogical (value, enabled));
-        m_tableWidget->cellWidget (row, col)->setProperty ("row", QVariant (row));
-        m_tableWidget->cellWidget (row, col)->setProperty ("col", QVariant (col));
-      }
-    else if (format == "popup" && enabled)
-      {
-        if (m_tableWidget->item (row, col))
-          delete m_tableWidget->item (row, col);
-
-        QString string_value = qStringValueFor (value, format).second;
-        uitable::properties& tp = properties<uitable> ();
-        octave_value format_value = tp.get_columnformat ().cell_value ().xelem (col);
-
-        QComboBox *comboBox = new QComboBox ();
-        comboBox->setProperty ("row", QVariant (row));
-        comboBox->setProperty ("col", QVariant (col));
+                format,
+                is_editable);
+}
 
-        int index = -1;
-        for (int k = 0; k < format_value.numel (); k++)
-          {
-            QString popup_item
-              = Utils::fromStdString (format_value.fast_elem_extract (k).string_value ());
-
-            comboBox->addItem (popup_item);
-
-            if (popup_item == string_value)
-              index = k;
-          }
-        comboBox->setCurrentIndex (index);
+void inline
+Table::updateData (int row, int col)
+{
+  octave_value data = properties<uitable> ().get_data ();
+  updateData (row,
+              col,
+              data.iscell ()
+              ? data.cell_value () (row, col)
+              : data.fast_elem_extract (row + col * data.rows ()),
+              columnformat (col),
+              columneditable (col));
+}
 
-        if (index < 0)
-          {
-            comboBox->setEditable (true);
-            comboBox->setEditText (string_value);
-            comboBox->lineEdit ()->setReadOnly (true);
-          }
-
-        comboBox->setProperty ("original_value", QVariant (string_value));
-
-        comboBox->installEventFilter (this);
-        m_tableWidget->setCellWidget (row, col, comboBox);
-        connect (comboBox, SIGNAL(currentIndexChanged (const QString&)),
-                 this, SLOT(comboBoxCurrentIndexChanged (const QString&)));
-      }
-    else
-      {
-        if (m_tableWidget->cellWidget (row, col))
-          delete m_tableWidget->cellWidget (row, col);
-        m_tableWidget->setItem (row, col, itemFor (value, format, enabled));
-      }
-  }
+void inline
+Table::updateData (int row, int col, octave_value value,
+                   std::string format = "", bool enabled = false)
+{
+  if (format == "logical" || (format == "" && value.islogical ()))
+    {
+      if (m_tableWidget->item (row, col))
+        delete m_tableWidget->item (row, col);
 
-  void
-  Table::updateData ()
-  {
-    uitable::properties& tp = properties<uitable> ();
-
-    octave_value data = tp.get_data ();
-
-    if (data.iscell () || data.is_matrix_type ())
-      {
-        m_tableWidget->setRowCount (data.rows ());
-        m_tableWidget->setColumnCount (data.columns ());
+      m_tableWidget->setCellWidget (row, col, checkBoxForLogical (value, enabled));
+      m_tableWidget->cellWidget (row, col)->setProperty ("row", QVariant (row));
+      m_tableWidget->cellWidget (row, col)->setProperty ("col", QVariant (col));
+    }
+  else if (format == "popup" && enabled)
+    {
+      if (m_tableWidget->item (row, col))
+        delete m_tableWidget->item (row, col);
 
-        for (octave_idx_type col = 0; col < data.columns (); col++)
-          updateDataColumn (col);
-      }
-
-    for (octave_idx_type row = 0; row < m_tableWidget->rowCount (); row++)
-      m_tableWidget->setRowHeight (row, AUTO_HEIGHT);
-  }
+      QString string_value = qStringValueFor (value, format).second;
+      uitable::properties& tp = properties<uitable> ();
+      octave_value format_value = tp.get_columnformat ().cell_value ().xelem (col);
 
-  void
-  Table::updateEnable ()
-  {
-    uitable::properties& tp = properties<uitable> ();
-    bool enabled = tp.is_enable ();
-    m_tableWidget->setEnabled (enabled);
-
-    bool rearrangeableColumns = tp.is_rearrangeablecolumns ();
+      QComboBox *comboBox = new QComboBox ();
+      comboBox->setProperty ("row", QVariant (row));
+      comboBox->setProperty ("col", QVariant (col));
 
-    // Set selection mode
-    m_tableWidget->setSelectionMode (enabled
-                                     ? QAbstractItemView::ExtendedSelection
-                                     : QAbstractItemView::NoSelection);
+      int index = -1;
+      for (int k = 0; k < format_value.numel (); k++)
+        {
+          QString popup_item
+            = Utils::fromStdString (format_value.fast_elem_extract (k).string_value ());
 
-    // Set rearrangeablecolumns
-    m_tableWidget->horizontalHeader ()->setSectionsMovable (enabled && rearrangeableColumns);
-    m_tableWidget->horizontalHeader ()->setDragEnabled (enabled && rearrangeableColumns);
-    m_tableWidget->horizontalHeader ()->setDragDropMode (QAbstractItemView::InternalMove);
-
-    // Turn off column editable
-    for (int col = 0; col < m_tableWidget->columnCount (); col++)
-      {
-        bool editable = columneditable (col);
+          comboBox->addItem (popup_item);
 
-        for (int row = 0; row < m_tableWidget->rowCount (); row++)
-          if (QTableWidgetItem *item = m_tableWidget->item (row, col))
-            {
-              Qt::ItemFlags flags = item->flags ();
-              if (enabled && editable)
-                item->setFlags (flags | Qt::ItemIsEditable);
-              else
-                item->setFlags (flags & ~Qt::ItemIsEditable);
-            }
-          else if (QWidget *widget = m_tableWidget->cellWidget (row, col))
-            {
-              QCheckBox *checkBox = nullptr;
-              if (widget && ! widget->children ().isEmpty ())
-                {
-                  QHBoxLayout *layout
-                    = qobject_cast<QHBoxLayout *> (widget->children ().first ());
+          if (popup_item == string_value)
+            index = k;
+        }
+      comboBox->setCurrentIndex (index);
 
-                  if (layout && layout->count () > 0)
-                    checkBox = qobject_cast<QCheckBox *> (layout->itemAt (0)-> widget ());
-                }
+      if (index < 0)
+        {
+          comboBox->setEditable (true);
+          comboBox->setEditText (string_value);
+          comboBox->lineEdit ()->setReadOnly (true);
+        }
+
+      comboBox->setProperty ("original_value", QVariant (string_value));
 
-              if (checkBox)
-                widget->setProperty ("Enabled", QVariant (enabled & editable));
-              else
-                {
-                  widget->setAttribute (Qt::WA_TransparentForMouseEvents,
-                                        !(editable & enabled));
-
-                  widget->setFocusPolicy (Qt::NoFocus);
-                }
-            }
-      }
-  }
+      comboBox->installEventFilter (this);
+      m_tableWidget->setCellWidget (row, col, comboBox);
+      connect (comboBox, SIGNAL(currentIndexChanged (const QString&)),
+               this, SLOT(comboBoxCurrentIndexChanged (const QString&)));
+    }
+  else
+    {
+      if (m_tableWidget->cellWidget (row, col))
+        delete m_tableWidget->cellWidget (row, col);
+      m_tableWidget->setItem (row, col, itemFor (value, format, enabled));
+    }
+}
 
-  void
-  Table::updateExtent ()
-  {
-    QSize s = realQSizeForTable (m_tableWidget);
-    Matrix extent = Matrix (1, 4);
-    extent(0, 0) = 0;
-    extent(0, 1) = 0;
-    extent(0, 2) = s.width ();
-    extent(0, 3) = s.height () ;
-    graphics_object go = object ();
-    emit gh_set_event (go.get_handle (), "extent", extent, false);
-  }
+void
+Table::updateData ()
+{
+  uitable::properties& tp = properties<uitable> ();
+
+  octave_value data = tp.get_data ();
 
-  void
-  Table::updatePalette ()
-  {
-    uitable::properties& tp = properties<uitable> ();
+  if (data.iscell () || data.is_matrix_type ())
+    {
+      m_tableWidget->setRowCount (data.rows ());
+      m_tableWidget->setColumnCount (data.columns ());
+
+      for (octave_idx_type col = 0; col < data.columns (); col++)
+        updateDataColumn (col);
+    }
 
-    QPalette p = m_tableWidget->palette ();
-    p.setColor (QPalette::Text,
-                Utils::fromRgb (tp.get_foregroundcolor_rgb ()));
-    p.setColor (QPalette::Base,
-                Utils::fromRgb (tp.get_backgroundcolor_rgb ()));
-    p.setColor (QPalette::AlternateBase,
-                Utils::fromRgb (tp.get_alternatebackgroundcolor_rgb ()));
-    m_tableWidget->setPalette (p);
-    m_tableWidget->setAlternatingRowColors (tp.is_rowstriping ());
-    // FIXME: Handle multiple alternating background colors
-  }
+  for (octave_idx_type row = 0; row < m_tableWidget->rowCount (); row++)
+    m_tableWidget->setRowHeight (row, AUTO_HEIGHT);
+}
 
-  void
-  Table::updateRowname ()
-  {
-    uitable::properties& tp = properties<uitable> ();
+void
+Table::updateEnable ()
+{
+  uitable::properties& tp = properties<uitable> ();
+  bool enabled = tp.is_enable ();
+  m_tableWidget->setEnabled (enabled);
 
-    // Reset the row count
-    m_tableWidget->setRowCount (tp.get_data ().rows ());
-
-    octave_value rowname = tp.get_rowname ();
-    QStringList l;
-    bool visible = true;
+  bool rearrangeableColumns = tp.is_rearrangeablecolumns ();
 
-    if (rowname.is_string () && rowname.string_value (false) == "numbered")
-      for (int i = 0; i < m_tableWidget->rowCount (); i++)
-        l << QString::number (i + 1);
-    else if (rowname.is_string ())
-      {
-        if (m_tableWidget->rowCount () > 0)
-          l << Utils::fromStdString (rowname.string_value ());
-        for (int i = 1; i < m_tableWidget->rowCount (); i++)
-          l << "";
-      }
-    else if (rowname.isempty ())
-      {
-        for (int i = 0; i < m_tableWidget->rowCount (); i++)
-          l << "";
-        visible = false;
-      }
-    else if (rowname.iscell ())
-      {
-        octave_idx_type n = rowname.numel ();
-        Cell cell_value = rowname.cell_value ();
+  // Set selection mode
+  m_tableWidget->setSelectionMode (enabled
+                                   ? QAbstractItemView::ExtendedSelection
+                                   : QAbstractItemView::NoSelection);
 
-        for (octave_idx_type i = 0; i < n; i++)
-          {
-            octave_value v = cell_value (i);
-            if (v.is_string ())
-              l << Utils::fromStdString (v.string_value (true));
-            else if (v.is_matrix_type ())
-              {
-                Matrix data = v.matrix_value ();
+  // Set rearrangeablecolumns
+  m_tableWidget->horizontalHeader ()->setSectionsMovable (enabled && rearrangeableColumns);
+  m_tableWidget->horizontalHeader ()->setDragEnabled (enabled && rearrangeableColumns);
+  m_tableWidget->horizontalHeader ()->setDragDropMode (QAbstractItemView::InternalMove);
+
+  // Turn off column editable
+  for (int col = 0; col < m_tableWidget->columnCount (); col++)
+    {
+      bool editable = columneditable (col);
 
-                /* Now Matlab does something very strange here:
-                 * If data is a row or column matrix,
-                 * then each datapoint is added.
-                 * Otherwise, nothing is set.
-                 */
-                if (data.rows () > 1 && data.cols () > 1)
-                  l << "";
-                else
-                  for (octave_idx_type j = 0; j < data.numel (); j++)
-                    l << QString::number (data(j));
-              }
-            else if (v.isnumeric ())
-              l << QString::number (v.double_value (true));
+      for (int row = 0; row < m_tableWidget->rowCount (); row++)
+        if (QTableWidgetItem *item = m_tableWidget->item (row, col))
+          {
+            Qt::ItemFlags flags = item->flags ();
+            if (enabled && editable)
+              item->setFlags (flags | Qt::ItemIsEditable);
             else
-              l << QString::number (v.double_value (true));
+              item->setFlags (flags & ~Qt::ItemIsEditable);
           }
-      }
-    else if (rowname.is_matrix_type ())
-      {
-        octave_idx_type n = rowname.numel ();
-        Matrix matrix_value = rowname.matrix_value ();
+        else if (QWidget *widget = m_tableWidget->cellWidget (row, col))
+          {
+            QCheckBox *checkBox = nullptr;
+            if (widget && ! widget->children ().isEmpty ())
+              {
+                QHBoxLayout *layout
+                  = qobject_cast<QHBoxLayout *> (widget->children ().first ());
 
-        for (octave_idx_type i = 0; i < n; i++)
-          l << QString::number (matrix_value(i));
-      }
-    else
-      {
-        for (int i = 0; i < m_tableWidget->columnCount (); i++)
-          l << "";
-        visible = false;
-      }
+                if (layout && layout->count () > 0)
+                  checkBox = qobject_cast<QCheckBox *> (layout->itemAt (0)-> widget ());
+              }
 
-    // Add dummy rows as required
-    if (m_tableWidget->rowCount () < l.length ())
-      {
-        int oldRowCount = m_tableWidget->rowCount ();
-        m_tableWidget->setRowCount (l.length ());
+            if (checkBox)
+              widget->setProperty ("Enabled", QVariant (enabled & editable));
+            else
+              {
+                widget->setAttribute (Qt::WA_TransparentForMouseEvents,
+                                      !(editable & enabled));
 
-        for (int col = 0; col < m_tableWidget->columnCount (); col++)
-          {
-            std::string format = columnformat (col);
-            bool enabled = columneditable (col);
-
-            for (int row = oldRowCount; row < l.length (); row++)
-              {
-                m_tableWidget->setRowHeight (row, AUTO_HEIGHT);
-
-                updateData (row, col, octave_value (""), format, enabled);
+                widget->setFocusPolicy (Qt::NoFocus);
               }
           }
-      }
+    }
+}
 
-    m_tableWidget->setVerticalHeaderLabels (l);
-    m_tableWidget->verticalHeader ()->setVisible (visible);
-  }
-
-  void
-  Table::updateRearrangeableColumns ()
-  {
-    uitable::properties& tp = properties<uitable> ();
+void
+Table::updateExtent ()
+{
+  QSize s = realQSizeForTable (m_tableWidget);
+  Matrix extent = Matrix (1, 4);
+  extent(0, 0) = 0;
+  extent(0, 1) = 0;
+  extent(0, 2) = s.width ();
+  extent(0, 3) = s.height () ;
+  graphics_object go = object ();
+  emit gh_set_event (go.get_handle (), "extent", extent, false);
+}
 
-    bool rearrangeableColumns = tp.is_rearrangeablecolumns ();
-    bool enabled = tp.is_enable ();
+void
+Table::updatePalette ()
+{
+  uitable::properties& tp = properties<uitable> ();
 
-    m_tableWidget->horizontalHeader ()->setSectionsMovable (enabled && rearrangeableColumns);
-    m_tableWidget->horizontalHeader ()->setDragEnabled (enabled && rearrangeableColumns);
-    m_tableWidget->horizontalHeader ()->setDragDropMode (QAbstractItemView::InternalMove);
-  }
-
-  bool
-  Table::eventFilter (QObject *watched, QEvent *xevent)
-  {
-    gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+  QPalette p = m_tableWidget->palette ();
+  p.setColor (QPalette::Text,
+              Utils::fromRgb (tp.get_foregroundcolor_rgb ()));
+  p.setColor (QPalette::Base,
+              Utils::fromRgb (tp.get_backgroundcolor_rgb ()));
+  p.setColor (QPalette::AlternateBase,
+              Utils::fromRgb (tp.get_alternatebackgroundcolor_rgb ()));
+  m_tableWidget->setPalette (p);
+  m_tableWidget->setAlternatingRowColors (tp.is_rowstriping ());
+  // FIXME: Handle multiple alternating background colors
+}
 
-    //uitable::properties& tp = properties<uitable> ();
-    if (qobject_cast<QTableWidget *> (watched))
-      {
-        switch (xevent->type ())
-          {
-          case QEvent::Resize:
-            {
-              octave::autolock guard (gh_mgr.graphics_lock ());
+void
+Table::updateRowname ()
+{
+  uitable::properties& tp = properties<uitable> ();
+
+  // Reset the row count
+  m_tableWidget->setRowCount (tp.get_data ().rows ());
+
+  octave_value rowname = tp.get_rowname ();
+  QStringList l;
+  bool visible = true;
 
-              graphics_object go = object ();
-              if (go.valid_object ())
-                {
-                  const uitable::properties& tp =
-                    Utils::properties<uitable> (go);
-                  if (tp.fontunits_is ("normalized"))
-                    m_tableWidget->setFont (Utils::computeFont<uitable> (tp));
-                }
-            }
-            break;
-
-          case QEvent::MouseButtonPress:
-            {
-              octave::autolock guard (gh_mgr.graphics_lock ());
-
-              QMouseEvent *m = dynamic_cast<QMouseEvent *> (xevent);
-              graphics_object go = object ();
-              const uitable::properties& tp =
-                Utils::properties<uitable> (go);
-              graphics_object fig = go.get_ancestor ("figure");
+  if (rowname.is_string () && rowname.string_value (false) == "numbered")
+    for (int i = 0; i < m_tableWidget->rowCount (); i++)
+      l << QString::number (i + 1);
+  else if (rowname.is_string ())
+    {
+      if (m_tableWidget->rowCount () > 0)
+        l << Utils::fromStdString (rowname.string_value ());
+      for (int i = 1; i < m_tableWidget->rowCount (); i++)
+        l << "";
+    }
+  else if (rowname.isempty ())
+    {
+      for (int i = 0; i < m_tableWidget->rowCount (); i++)
+        l << "";
+      visible = false;
+    }
+  else if (rowname.iscell ())
+    {
+      octave_idx_type n = rowname.numel ();
+      Cell cell_value = rowname.cell_value ();
 
-              if (m->button () != Qt::LeftButton || ! tp.is_enable ())
-                {
-                  emit gh_set_event (fig.get_handle (), "selectiontype",
-                                     Utils::figureSelectionType (m), false);
-                  emit gh_set_event (fig.get_handle (), "currentpoint",
-                                     Utils::figureCurrentPoint (fig, m),
-                                     false);
-                  emit gh_callback_event (fig.get_handle (),
-                                          "windowbuttondownfcn");
-                  emit gh_callback_event (m_handle, "buttondownfcn");
-
-                  if (m->button () == Qt::RightButton)
-                    ContextMenu::executeAt (m_interpreter, properties (),
-                                            m->globalPos ());
-                }
-              else
-                {
-                  emit gh_set_event (fig.get_handle (), "selectiontype",
-                                     octave_value ("normal"), false);
-                }
-            }
-            break;
-
-          case QEvent::KeyPress:
+      for (octave_idx_type i = 0; i < n; i++)
+        {
+          octave_value v = cell_value (i);
+          if (v.is_string ())
+            l << Utils::fromStdString (v.string_value (true));
+          else if (v.is_matrix_type ())
             {
-              QKeyEvent *k = dynamic_cast<QKeyEvent *> (xevent);
-              if (m_keyPressHandlerDefined)
-                {
-                  octave::autolock guard (gh_mgr.graphics_lock ());
+              Matrix data = v.matrix_value ();
 
-                  octave_scalar_map keyData = Utils::makeKeyEventStruct (k);
-                  graphics_object fig = object ().get_ancestor ("figure");
+              /* Now Matlab does something very strange here:
+               * If data is a row or column matrix,
+               * then each datapoint is added.
+               * Otherwise, nothing is set.
+               */
+              if (data.rows () > 1 && data.cols () > 1)
+                l << "";
+              else
+                for (octave_idx_type j = 0; j < data.numel (); j++)
+                  l << QString::number (data(j));
+            }
+          else if (v.isnumeric ())
+            l << QString::number (v.double_value (true));
+          else
+            l << QString::number (v.double_value (true));
+        }
+    }
+  else if (rowname.is_matrix_type ())
+    {
+      octave_idx_type n = rowname.numel ();
+      Matrix matrix_value = rowname.matrix_value ();
 
-                  emit gh_set_event (fig.get_handle (), "currentcharacter",
-                                     keyData.getfield ("Character"), false);
-                  emit gh_callback_event (m_handle, "keypressfcn", keyData);
-                }
-              int row = m_tableWidget->currentRow ();
-              int col = m_tableWidget->currentColumn ();
-              switch (k->key ())
-                {
-                case Qt::Key_Space:
-                  {
-                    QCheckBox *checkBox = nullptr;
+      for (octave_idx_type i = 0; i < n; i++)
+        l << QString::number (matrix_value(i));
+    }
+  else
+    {
+      for (int i = 0; i < m_tableWidget->columnCount (); i++)
+        l << "";
+      visible = false;
+    }
+
+  // Add dummy rows as required
+  if (m_tableWidget->rowCount () < l.length ())
+    {
+      int oldRowCount = m_tableWidget->rowCount ();
+      m_tableWidget->setRowCount (l.length ());
 
-                    QWidget *widget
-                      = qobject_cast<QWidget *> (m_tableWidget->cellWidget (row, col));
+      for (int col = 0; col < m_tableWidget->columnCount (); col++)
+        {
+          std::string format = columnformat (col);
+          bool enabled = columneditable (col);
+
+          for (int row = oldRowCount; row < l.length (); row++)
+            {
+              m_tableWidget->setRowHeight (row, AUTO_HEIGHT);
 
-                    if (widget && ! widget->children ().isEmpty ())
-                      {
-                        QHBoxLayout *layout
-                          = qobject_cast<QHBoxLayout *> (widget->children ().first ());
+              updateData (row, col, octave_value (""), format, enabled);
+            }
+        }
+    }
 
-                        if (layout && layout->count () > 0)
-                          checkBox = qobject_cast<QCheckBox *> (layout->itemAt (0)-> widget ());
-                      }
+  m_tableWidget->setVerticalHeaderLabels (l);
+  m_tableWidget->verticalHeader ()->setVisible (visible);
+}
+
+void
+Table::updateRearrangeableColumns ()
+{
+  uitable::properties& tp = properties<uitable> ();
 
-                    if (checkBox && checkBox->property ("Enabled").toBool ())
-                      checkBoxClicked (row, col, checkBox);
+  bool rearrangeableColumns = tp.is_rearrangeablecolumns ();
+  bool enabled = tp.is_enable ();
+
+  m_tableWidget->horizontalHeader ()->setSectionsMovable (enabled && rearrangeableColumns);
+  m_tableWidget->horizontalHeader ()->setDragEnabled (enabled && rearrangeableColumns);
+  m_tableWidget->horizontalHeader ()->setDragDropMode (QAbstractItemView::InternalMove);
+}
+
+bool
+Table::eventFilter (QObject *watched, QEvent *xevent)
+{
+  gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
 
-                    QComboBox *comboBox
-                      = qobject_cast<QComboBox *> (m_tableWidget->cellWidget (row, col));
+  //uitable::properties& tp = properties<uitable> ();
+  if (qobject_cast<QTableWidget *> (watched))
+    {
+      switch (xevent->type ())
+        {
+        case QEvent::Resize:
+          {
+            octave::autolock guard (gh_mgr.graphics_lock ());
 
-                    if (comboBox)
-                      comboBox->showPopup ();
-                  }
-                  break;
+            graphics_object go = object ();
+            if (go.valid_object ())
+              {
+                const uitable::properties& tp =
+                  Utils::properties<uitable> (go);
+                if (tp.fontunits_is ("normalized"))
+                  m_tableWidget->setFont (Utils::computeFont<uitable> (tp));
+              }
+          }
+          break;
 
-                case Qt::Key_Return:
-                case Qt::Key_Enter:
-                  {
-                    if (k->modifiers () == Qt::NoModifier)
-                      {
-                        if (row + 1 < m_tableWidget->rowCount ())
-                          m_tableWidget->setCurrentCell (row + 1, col);
-                        else
-                          {
-                            if (col + 1 < m_tableWidget->columnCount ())
-                              m_tableWidget->setCurrentCell (0, col + 1);
-                            else
-                              m_tableWidget->setCurrentCell (0, 0);
-                          }
-                      }
-                    else if (k->modifiers () == Qt::ShiftModifier)
-                      {
-                        if (row - 1 >= 0)
-                          m_tableWidget->setCurrentCell (row - 1, col);
-                        else
-                          {
-                            if (col - 1 >= 0)
-                              m_tableWidget->setCurrentCell
-                              (m_tableWidget->rowCount () - 1,
-                               col - 1);
-                            else
-                              m_tableWidget->setCurrentCell
-                              (m_tableWidget->rowCount () - 1,
-                               m_tableWidget->columnCount () - 1);
-                          }
-                      }
-                  }
-                  break;
+        case QEvent::MouseButtonPress:
+          {
+            octave::autolock guard (gh_mgr.graphics_lock ());
+
+            QMouseEvent *m = dynamic_cast<QMouseEvent *> (xevent);
+            graphics_object go = object ();
+            const uitable::properties& tp =
+              Utils::properties<uitable> (go);
+            graphics_object fig = go.get_ancestor ("figure");
 
-                default:
-                  break;
-                }
-            }
-            break;
+            if (m->button () != Qt::LeftButton || ! tp.is_enable ())
+              {
+                emit gh_set_event (fig.get_handle (), "selectiontype",
+                                   Utils::figureSelectionType (m), false);
+                emit gh_set_event (fig.get_handle (), "currentpoint",
+                                   Utils::figureCurrentPoint (fig, m),
+                                   false);
+                emit gh_callback_event (fig.get_handle (),
+                                        "windowbuttondownfcn");
+                emit gh_callback_event (m_handle, "buttondownfcn");
 
-          case QEvent::KeyRelease:
-            {
-              if (m_keyReleaseHandlerDefined)
-                {
-                  octave::autolock guard (gh_mgr.graphics_lock ());
+                if (m->button () == Qt::RightButton)
+                  ContextMenu::executeAt (m_interpreter, properties (),
+                                          m->globalPos ());
+              }
+            else
+              {
+                emit gh_set_event (fig.get_handle (), "selectiontype",
+                                   octave_value ("normal"), false);
+              }
+          }
+          break;
 
-                  QKeyEvent *k = dynamic_cast<QKeyEvent *> (xevent);
-
-                  octave_scalar_map keyData = Utils::makeKeyEventStruct (k);
-                  graphics_object fig = object ().get_ancestor ("figure");
+        case QEvent::KeyPress:
+          {
+            QKeyEvent *k = dynamic_cast<QKeyEvent *> (xevent);
+            if (m_keyPressHandlerDefined)
+              {
+                octave::autolock guard (gh_mgr.graphics_lock ());
 
-                  emit gh_set_event (fig.get_handle (), "currentcharacter",
-                                     keyData.getfield ("Character"), false);
-                  emit gh_callback_event (m_handle, "keyreleasefcn", keyData);
-                }
-            }
-            break;
+                octave_scalar_map keyData = Utils::makeKeyEventStruct (k);
+                graphics_object fig = object ().get_ancestor ("figure");
 
-          default:
-            break;
-          }
-      }
-    else if (qobject_cast<QComboBox *> (watched))
-      {
-        switch (xevent->type ())
-          {
-          case QEvent::MouseButtonPress:
-            {
-              octave::autolock guard (gh_mgr.graphics_lock ());
+                emit gh_set_event (fig.get_handle (), "currentcharacter",
+                                   keyData.getfield ("Character"), false);
+                emit gh_callback_event (m_handle, "keypressfcn", keyData);
+              }
+            int row = m_tableWidget->currentRow ();
+            int col = m_tableWidget->currentColumn ();
+            switch (k->key ())
+              {
+              case Qt::Key_Space:
+                {
+                  QCheckBox *checkBox = nullptr;
 
-              QMouseEvent *m = dynamic_cast<QMouseEvent *> (xevent);
-              graphics_object go = object ();
-              const uitable::properties& tp = Utils::properties<uitable> (go);
-              graphics_object fig = go.get_ancestor ("figure");
+                  QWidget *widget
+                    = qobject_cast<QWidget *> (m_tableWidget->cellWidget (row, col));
+
+                  if (widget && ! widget->children ().isEmpty ())
+                    {
+                      QHBoxLayout *layout
+                        = qobject_cast<QHBoxLayout *> (widget->children ().first ());
+
+                      if (layout && layout->count () > 0)
+                        checkBox = qobject_cast<QCheckBox *> (layout->itemAt (0)-> widget ());
+                    }
+
+                  if (checkBox && checkBox->property ("Enabled").toBool ())
+                    checkBoxClicked (row, col, checkBox);
 
-              if (m->button () != Qt::LeftButton || ! tp.is_enable ())
-                {
-                  emit gh_set_event (fig.get_handle (), "selectiontype",
-                                     Utils::figureSelectionType (m), false);
-                  emit gh_set_event (fig.get_handle (), "currentpoint",
-                                     Utils::figureCurrentPoint (fig, m),
-                                     false);
-                  emit gh_callback_event (fig.get_handle (),
-                                          "windowbuttondownfcn");
-                  emit gh_callback_event (m_handle, "buttondownfcn");
+                  QComboBox *comboBox
+                    = qobject_cast<QComboBox *> (m_tableWidget->cellWidget (row, col));
 
-                  if (m->button () == Qt::RightButton)
-                    ContextMenu::executeAt (m_interpreter, tp, m->globalPos ());
+                  if (comboBox)
+                    comboBox->showPopup ();
                 }
-              else
+                break;
+
+              case Qt::Key_Return:
+              case Qt::Key_Enter:
                 {
-                  emit gh_set_event (fig.get_handle (), "selectiontype",
-                                     Utils::figureSelectionType (m), false);
-
-                  QComboBox *comboBox_0 = qobject_cast<QComboBox *> (watched);
-                  for (int row = 0; row < m_tableWidget->rowCount (); row++)
+                  if (k->modifiers () == Qt::NoModifier)
                     {
-                      for (int col = 0; col < m_tableWidget->columnCount (); col++)
+                      if (row + 1 < m_tableWidget->rowCount ())
+                        m_tableWidget->setCurrentCell (row + 1, col);
+                      else
                         {
-                          QComboBox *comboBox_1
-                            = qobject_cast<QComboBox *> (m_tableWidget->cellWidget (row, col));
-
-                          if (comboBox_0 == comboBox_1)
-                            m_tableWidget->setCurrentCell (row, col);
+                          if (col + 1 < m_tableWidget->columnCount ())
+                            m_tableWidget->setCurrentCell (0, col + 1);
+                          else
+                            m_tableWidget->setCurrentCell (0, 0);
+                        }
+                    }
+                  else if (k->modifiers () == Qt::ShiftModifier)
+                    {
+                      if (row - 1 >= 0)
+                        m_tableWidget->setCurrentCell (row - 1, col);
+                      else
+                        {
+                          if (col - 1 >= 0)
+                            m_tableWidget->setCurrentCell
+                            (m_tableWidget->rowCount () - 1,
+                             col - 1);
+                          else
+                            m_tableWidget->setCurrentCell
+                            (m_tableWidget->rowCount () - 1,
+                             m_tableWidget->columnCount () - 1);
                         }
                     }
                 }
-            }
-            break;
+                break;
+
+              default:
+                break;
+              }
+          }
+          break;
+
+        case QEvent::KeyRelease:
+          {
+            if (m_keyReleaseHandlerDefined)
+              {
+                octave::autolock guard (gh_mgr.graphics_lock ());
+
+                QKeyEvent *k = dynamic_cast<QKeyEvent *> (xevent);
+
+                octave_scalar_map keyData = Utils::makeKeyEventStruct (k);
+                graphics_object fig = object ().get_ancestor ("figure");
+
+                emit gh_set_event (fig.get_handle (), "currentcharacter",
+                                   keyData.getfield ("Character"), false);
+                emit gh_callback_event (m_handle, "keyreleasefcn", keyData);
+              }
+          }
+          break;
+
+        default:
+          break;
+        }
+    }
+  else if (qobject_cast<QComboBox *> (watched))
+    {
+      switch (xevent->type ())
+        {
+        case QEvent::MouseButtonPress:
+          {
+            octave::autolock guard (gh_mgr.graphics_lock ());
 
-          default:
-            break;
+            QMouseEvent *m = dynamic_cast<QMouseEvent *> (xevent);
+            graphics_object go = object ();
+            const uitable::properties& tp = Utils::properties<uitable> (go);
+            graphics_object fig = go.get_ancestor ("figure");
+
+            if (m->button () != Qt::LeftButton || ! tp.is_enable ())
+              {
+                emit gh_set_event (fig.get_handle (), "selectiontype",
+                                   Utils::figureSelectionType (m), false);
+                emit gh_set_event (fig.get_handle (), "currentpoint",
+                                   Utils::figureCurrentPoint (fig, m),
+                                   false);
+                emit gh_callback_event (fig.get_handle (),
+                                        "windowbuttondownfcn");
+                emit gh_callback_event (m_handle, "buttondownfcn");
+
+                if (m->button () == Qt::RightButton)
+                  ContextMenu::executeAt (m_interpreter, tp, m->globalPos ());
+              }
+            else
+              {
+                emit gh_set_event (fig.get_handle (), "selectiontype",
+                                   Utils::figureSelectionType (m), false);
+
+                QComboBox *comboBox_0 = qobject_cast<QComboBox *> (watched);
+                for (int row = 0; row < m_tableWidget->rowCount (); row++)
+                  {
+                    for (int col = 0; col < m_tableWidget->columnCount (); col++)
+                      {
+                        QComboBox *comboBox_1
+                          = qobject_cast<QComboBox *> (m_tableWidget->cellWidget (row, col));
+
+                        if (comboBox_0 == comboBox_1)
+                          m_tableWidget->setCurrentCell (row, col);
+                      }
+                  }
+              }
           }
-      }
-    return false;
-  }
+          break;
+
+        default:
+          break;
+        }
+    }
+  return false;
+}
 
 #undef AUTO_HEIGHT
 
--- a/libgui/graphics/Table.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/Table.h	Thu Feb 02 12:25:51 2023 -0800
@@ -34,64 +34,64 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class interpreter;
+class interpreter;
 
-  class Container;
+class Container;
 
-  class Table : public Object
-  {
-    Q_OBJECT
+class Table : public Object
+{
+  Q_OBJECT
 
-  public:
-    Table (octave::interpreter& interp,
-           const graphics_object& go, QTableWidget *tableWidget);
-    ~Table ();
+public:
+  Table (octave::interpreter& interp,
+         const graphics_object& go, QTableWidget *tableWidget);
+  ~Table ();
 
-    Container * innerContainer () { return m_container; }
+  Container * innerContainer () { return m_container; }
 
-    bool eventFilter (QObject *watched, QEvent *event);
+  bool eventFilter (QObject *watched, QEvent *event);
 
-    static Table *
-    create (octave::interpreter& interp,
-            const graphics_object& go);
+  static Table *
+  create (octave::interpreter& interp,
+          const graphics_object& go);
 
-  protected:
-    void update (int pId);
-    void redraw ();
-    void updateColumnname ();
-    void updateColumnwidth ();
-    void updateData ();
-    void updateEnable ();
-    void updateExtent ();
-    void updatePalette ();
-    void updateRearrangeableColumns ();
-    void updateRowname ();
+protected:
+  void update (int pId);
+  void redraw ();
+  void updateColumnname ();
+  void updateColumnwidth ();
+  void updateData ();
+  void updateEnable ();
+  void updateExtent ();
+  void updatePalette ();
+  void updateRearrangeableColumns ();
+  void updateRowname ();
 
-  private slots:
-    void itemChanged (QTableWidgetItem *item);
-    void comboBoxCurrentIndexChanged (const QString& value);
-    void cellClicked (int row, int col);
-    void itemSelectionChanged ();
+private slots:
+  void itemChanged (QTableWidgetItem *item);
+  void comboBoxCurrentIndexChanged (const QString& value);
+  void cellClicked (int row, int col);
+  void itemSelectionChanged ();
 
-  private:
-    Container *m_container;
-    QTableWidget *m_tableWidget;
-    octave_value m_curData;
-    bool m_blockUpdates;
-    bool m_keyPressHandlerDefined;
-    bool m_keyReleaseHandlerDefined;
-    QWidget * checkBoxForLogical(octave_value cal, bool enabled);
-    void updateData (int row, int col, octave_value value, std::string format,
-                     bool enabled);
-    void updateData (int row, int col);
-    void updateDataColumn (int col);
-    std::string columnformat (int column);
-    bool columneditable (int column);
-    void sendCellEditCallback (int row, int col, octave_value old_value,
-                               octave_value new_value, octave_value edit_data, octave_value error);
-    void checkBoxClicked (int row, int col, QCheckBox* checkBox);
+private:
+  Container *m_container;
+  QTableWidget *m_tableWidget;
+  octave_value m_curData;
+  bool m_blockUpdates;
+  bool m_keyPressHandlerDefined;
+  bool m_keyReleaseHandlerDefined;
+  QWidget * checkBoxForLogical(octave_value cal, bool enabled);
+  void updateData (int row, int col, octave_value value, std::string format,
+                   bool enabled);
+  void updateData (int row, int col);
+  void updateDataColumn (int col);
+  std::string columnformat (int column);
+  bool columneditable (int column);
+  void sendCellEditCallback (int row, int col, octave_value old_value,
+                             octave_value new_value, octave_value edit_data, octave_value error);
+  void checkBoxClicked (int row, int col, QCheckBox* checkBox);
 
-  };
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/graphics/TextControl.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/TextControl.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -35,61 +35,61 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  TextControl *
-  TextControl::create (octave::interpreter& interp, const graphics_object& go)
-  {
-    Object *parent = parentObject (interp, go);
+TextControl *
+TextControl::create (octave::interpreter& interp, const graphics_object& go)
+{
+  Object *parent = parentObject (interp, go);
 
-    if (parent)
-      {
-        Container *container = parent->innerContainer ();
+  if (parent)
+    {
+      Container *container = parent->innerContainer ();
 
-        if (container)
-          return new TextControl (interp, go, new QLabel (container));
-      }
+      if (container)
+        return new TextControl (interp, go, new QLabel (container));
+    }
 
-    return nullptr;
-  }
+  return nullptr;
+}
 
-  TextControl::TextControl (octave::interpreter& interp,
-                            const graphics_object& go, QLabel *label)
-    : BaseControl (interp, go, label)
-  {
-    uicontrol::properties& up = properties<uicontrol> ();
+TextControl::TextControl (octave::interpreter& interp,
+                          const graphics_object& go, QLabel *label)
+  : BaseControl (interp, go, label)
+{
+  uicontrol::properties& up = properties<uicontrol> ();
 
-    label->setAutoFillBackground (true);
-    label->setTextFormat (Qt::PlainText);
-    label->setWordWrap (false);
-    label->setAlignment (Utils::fromHVAlign (up.get_horizontalalignment (),
-                         up.get_verticalalignment ()));
-    label->setText (Utils::fromStringVector (up.get_string_vector ()).join ("\n"));
-  }
+  label->setAutoFillBackground (true);
+  label->setTextFormat (Qt::PlainText);
+  label->setWordWrap (false);
+  label->setAlignment (Utils::fromHVAlign (up.get_horizontalalignment (),
+                       up.get_verticalalignment ()));
+  label->setText (Utils::fromStringVector (up.get_string_vector ()).join ("\n"));
+}
 
-  TextControl::~TextControl ()
-  { }
+TextControl::~TextControl ()
+{ }
 
-  void
-  TextControl::update (int pId)
-  {
-    uicontrol::properties& up = properties<uicontrol> ();
-    QLabel *label = qWidget<QLabel> ();
+void
+TextControl::update (int pId)
+{
+  uicontrol::properties& up = properties<uicontrol> ();
+  QLabel *label = qWidget<QLabel> ();
 
-    switch (pId)
-      {
-      case uicontrol::properties::ID_STRING:
-        label->setText (Utils::fromStringVector (up.get_string_vector ()).join ("\n"));
-        break;
+  switch (pId)
+    {
+    case uicontrol::properties::ID_STRING:
+      label->setText (Utils::fromStringVector (up.get_string_vector ()).join ("\n"));
+      break;
 
-      case uicontrol::properties::ID_HORIZONTALALIGNMENT:
-      case uicontrol::properties::ID_VERTICALALIGNMENT:
-        label->setAlignment (Utils::fromHVAlign (up.get_horizontalalignment (),
-                             up.get_verticalalignment ()));
-        break;
+    case uicontrol::properties::ID_HORIZONTALALIGNMENT:
+    case uicontrol::properties::ID_VERTICALALIGNMENT:
+      label->setAlignment (Utils::fromHVAlign (up.get_horizontalalignment (),
+                           up.get_verticalalignment ()));
+      break;
 
-      default:
-        BaseControl::update (pId);
-        break;
-      }
-  }
+    default:
+      BaseControl::update (pId);
+      break;
+    }
+}
 
 OCTAVE_END_NAMESPACE(octave)
--- a/libgui/graphics/TextControl.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/TextControl.h	Thu Feb 02 12:25:51 2023 -0800
@@ -32,22 +32,22 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class interpreter;
+class interpreter;
 
-  class TextControl : public BaseControl
-  {
-  public:
-    TextControl (octave::interpreter& interp,
-                 const graphics_object& go, QLabel *label);
-    ~TextControl ();
+class TextControl : public BaseControl
+{
+public:
+  TextControl (octave::interpreter& interp,
+               const graphics_object& go, QLabel *label);
+  ~TextControl ();
 
-    static TextControl *
-    create (octave::interpreter& interp,
-            const graphics_object& go);
+  static TextControl *
+  create (octave::interpreter& interp,
+          const graphics_object& go);
 
-  protected:
-    void update (int pId);
-  };
+protected:
+  void update (int pId);
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/graphics/ToggleButtonControl.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/ToggleButtonControl.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -36,71 +36,71 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  ToggleButtonControl *
-  ToggleButtonControl::create (octave::interpreter& interp,
-                               const graphics_object& go)
-  {
-    Object *parent = parentObject (interp, go);
+ToggleButtonControl *
+ToggleButtonControl::create (octave::interpreter& interp,
+                             const graphics_object& go)
+{
+  Object *parent = parentObject (interp, go);
 
-    if (parent)
-      {
-        Container *container = parent->innerContainer ();
+  if (parent)
+    {
+      Container *container = parent->innerContainer ();
 
-        if (container)
-          return new ToggleButtonControl (interp, go,
-                                          new QPushButton (container));
-      }
+      if (container)
+        return new ToggleButtonControl (interp, go,
+                                        new QPushButton (container));
+    }
 
-    return nullptr;
-  }
+  return nullptr;
+}
 
-  ToggleButtonControl::ToggleButtonControl (octave::interpreter& interp,
-                                            const graphics_object& go,
-                                            QPushButton *btn)
-    : ButtonControl (interp, go, btn)
-  {
-    Object *parent = parentObject (interp, go);
-    ButtonGroup *btnGroup = dynamic_cast<ButtonGroup *>(parent);
-    if (btnGroup)
-      btnGroup->addButton (btn);
+ToggleButtonControl::ToggleButtonControl (octave::interpreter& interp,
+                                          const graphics_object& go,
+                                          QPushButton *btn)
+  : ButtonControl (interp, go, btn)
+{
+  Object *parent = parentObject (interp, go);
+  ButtonGroup *btnGroup = dynamic_cast<ButtonGroup *>(parent);
+  if (btnGroup)
+    btnGroup->addButton (btn);
 
-    uicontrol::properties& up = properties<uicontrol> ();
+  uicontrol::properties& up = properties<uicontrol> ();
 
-    btn->setCheckable (true);
-    btn->setAutoFillBackground (true);
-    octave_value cdat = up.get_cdata ();
-    QImage img = Utils::makeImageFromCData (cdat,
-                                            cdat.columns (), cdat.rows ());
-    btn->setIcon (QIcon (QPixmap::fromImage (img)));
-    btn->setIconSize (QSize (cdat.columns (), cdat.rows ()));
-  }
+  btn->setCheckable (true);
+  btn->setAutoFillBackground (true);
+  octave_value cdat = up.get_cdata ();
+  QImage img = Utils::makeImageFromCData (cdat,
+                                          cdat.columns (), cdat.rows ());
+  btn->setIcon (QIcon (QPixmap::fromImage (img)));
+  btn->setIconSize (QSize (cdat.columns (), cdat.rows ()));
+}
 
-  ToggleButtonControl::~ToggleButtonControl ()
-  { }
+ToggleButtonControl::~ToggleButtonControl ()
+{ }
 
-  void
-  ToggleButtonControl::update (int pId)
-  {
-    uicontrol::properties& up = properties<uicontrol> ();
-    QPushButton *btn = qWidget<QPushButton> ();
+void
+ToggleButtonControl::update (int pId)
+{
+  uicontrol::properties& up = properties<uicontrol> ();
+  QPushButton *btn = qWidget<QPushButton> ();
 
-    switch (pId)
+  switch (pId)
+    {
+    case uicontrol::properties::ID_CDATA:
       {
-      case uicontrol::properties::ID_CDATA:
-        {
-          octave_value cdat = up.get_cdata ();
-          QImage img = Utils::makeImageFromCData (cdat,
-                                                  cdat.rows (),
-                                                  cdat.columns ());
-          btn->setIcon (QIcon (QPixmap::fromImage (img)));
-          btn->setIconSize (QSize (cdat.columns (), cdat.rows ()));
-        }
-        break;
+        octave_value cdat = up.get_cdata ();
+        QImage img = Utils::makeImageFromCData (cdat,
+                                                cdat.rows (),
+                                                cdat.columns ());
+        btn->setIcon (QIcon (QPixmap::fromImage (img)));
+        btn->setIconSize (QSize (cdat.columns (), cdat.rows ()));
+      }
+      break;
 
-      default:
-        ButtonControl::update (pId);
-        break;
-      }
-  }
+    default:
+      ButtonControl::update (pId);
+      break;
+    }
+}
 
 OCTAVE_END_NAMESPACE(octave);
--- a/libgui/graphics/ToggleButtonControl.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/ToggleButtonControl.h	Thu Feb 02 12:25:51 2023 -0800
@@ -32,22 +32,22 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class interpreter;
+class interpreter;
 
-  class ToggleButtonControl : public ButtonControl
-  {
-  public:
-    ToggleButtonControl (octave::interpreter& interp,
-                         const graphics_object& go, QPushButton *box);
-    ~ToggleButtonControl ();
+class ToggleButtonControl : public ButtonControl
+{
+public:
+  ToggleButtonControl (octave::interpreter& interp,
+                       const graphics_object& go, QPushButton *box);
+  ~ToggleButtonControl ();
 
-    static ToggleButtonControl *
-    create (octave::interpreter& interp,
-            const graphics_object& go);
+  static ToggleButtonControl *
+  create (octave::interpreter& interp,
+          const graphics_object& go);
 
-  protected:
-    void update (int pId);
-  };
+protected:
+  void update (int pId);
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/graphics/ToggleTool.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/ToggleTool.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -33,62 +33,62 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  ToggleTool *
-  ToggleTool::create (octave::interpreter& interp, const graphics_object& go)
-  {
-    Object *parent = parentObject (interp, go);
+ToggleTool *
+ToggleTool::create (octave::interpreter& interp, const graphics_object& go)
+{
+  Object *parent = parentObject (interp, go);
 
-    if (parent)
-      {
-        QWidget *parentWidget = parent->qWidget<QWidget> ();
+  if (parent)
+    {
+      QWidget *parentWidget = parent->qWidget<QWidget> ();
 
-        if (parentWidget)
-          return new ToggleTool (interp, go,
-                                 new QAction (parentWidget));
-      }
+      if (parentWidget)
+        return new ToggleTool (interp, go,
+                               new QAction (parentWidget));
+    }
 
-    return nullptr;
-  }
+  return nullptr;
+}
 
-  ToggleTool::ToggleTool (octave::interpreter& interp,
-                          const graphics_object& go, QAction *action)
-    : ToolBarButton<uitoggletool> (interp, go, action)
-  {
-    uitoggletool::properties& tp = properties<uitoggletool> ();
+ToggleTool::ToggleTool (octave::interpreter& interp,
+                        const graphics_object& go, QAction *action)
+  : ToolBarButton<uitoggletool> (interp, go, action)
+{
+  uitoggletool::properties& tp = properties<uitoggletool> ();
 
-    action->setCheckable (true);
-    action->setChecked (tp.is_state ());
+  action->setCheckable (true);
+  action->setChecked (tp.is_state ());
 
-    connect (action, &QAction::toggled, this, &ToggleTool::triggered);
-  }
+  connect (action, &QAction::toggled, this, &ToggleTool::triggered);
+}
 
-  ToggleTool::~ToggleTool ()
-  { }
+ToggleTool::~ToggleTool ()
+{ }
 
-  void
-  ToggleTool::update (int pId)
-  {
-    uitoggletool::properties& tp = properties<uitoggletool> ();
-    QAction *action = qWidget<QAction> ();
+void
+ToggleTool::update (int pId)
+{
+  uitoggletool::properties& tp = properties<uitoggletool> ();
+  QAction *action = qWidget<QAction> ();
 
-    switch (pId)
-      {
-      case uitoggletool::properties::ID_STATE:
-        action->setChecked (tp.is_state ());
-        break;
+  switch (pId)
+    {
+    case uitoggletool::properties::ID_STATE:
+      action->setChecked (tp.is_state ());
+      break;
 
-      default:
-        ToolBarButton<uitoggletool>::update (pId);
-        break;
-      }
-  }
+    default:
+      ToolBarButton<uitoggletool>::update (pId);
+      break;
+    }
+}
 
-  void
-  ToggleTool::triggered (bool checked)
-  {
-    emit gh_set_event (m_handle, "state", checked, false);
-    emit gh_callback_event (m_handle, checked ? "oncallback" : "offcallback");
-    emit gh_callback_event (m_handle, "clickedcallback");
-  }
+void
+ToggleTool::triggered (bool checked)
+{
+  emit gh_set_event (m_handle, "state", checked, false);
+  emit gh_callback_event (m_handle, checked ? "oncallback" : "offcallback");
+  emit gh_callback_event (m_handle, "clickedcallback");
+}
 
 OCTAVE_END_NAMESPACE(octave);
--- a/libgui/graphics/ToggleTool.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/ToggleTool.h	Thu Feb 02 12:25:51 2023 -0800
@@ -30,28 +30,28 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class interpreter;
+class interpreter;
 
-  class ToggleTool : public ToolBarButton<uitoggletool>
-  {
-    Q_OBJECT
+class ToggleTool : public ToolBarButton<uitoggletool>
+{
+  Q_OBJECT
 
-  public:
-    ToggleTool (octave::interpreter& interp,
-                const graphics_object& go,
-                QAction *action);
-    ~ToggleTool ();
+public:
+  ToggleTool (octave::interpreter& interp,
+              const graphics_object& go,
+              QAction *action);
+  ~ToggleTool ();
 
-    static ToggleTool *
-    create (octave::interpreter& interp,
-            const graphics_object& go);
+  static ToggleTool *
+  create (octave::interpreter& interp,
+          const graphics_object& go);
 
-  protected:
-    void update (int pId);
+protected:
+  void update (int pId);
 
-  private slots:
-    void triggered (bool checked);
-  };
+private slots:
+  void triggered (bool checked);
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/graphics/ToolBar.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/ToolBar.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -45,144 +45,144 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  static QIcon makeEmptyIcon ()
-  {
-    QPixmap pix (16, 16);
+static QIcon makeEmptyIcon ()
+{
+  QPixmap pix (16, 16);
 
-    pix.fill (Qt::transparent);
+  pix.fill (Qt::transparent);
 
-    return QIcon (pix);
-  }
+  return QIcon (pix);
+}
 
-  static QAction *
-  addEmptyAction (QToolBar *bar)
-  {
-    static const QIcon empty_icon = makeEmptyIcon ();
+static QAction *
+addEmptyAction (QToolBar *bar)
+{
+  static const QIcon empty_icon = makeEmptyIcon ();
 
-    QAction *a = bar->addAction (empty_icon, "Empty Toolbar");
+  QAction *a = bar->addAction (empty_icon, "Empty Toolbar");
 
-    a->setEnabled (false);
-    a->setToolTip ("");
+  a->setEnabled (false);
+  a->setToolTip ("");
 
-    return a;
-  }
+  return a;
+}
 
-  ToolBar *
-  ToolBar::create (octave::interpreter& interp,
-                   const graphics_object& go)
-  {
-    Object *parent = parentObject (interp, go);
+ToolBar *
+ToolBar::create (octave::interpreter& interp,
+                 const graphics_object& go)
+{
+  Object *parent = parentObject (interp, go);
 
-    if (parent)
-      {
-        QWidget *parentWidget = parent->qWidget<QWidget> ();
+  if (parent)
+    {
+      QWidget *parentWidget = parent->qWidget<QWidget> ();
 
-        if (parentWidget)
-          return new ToolBar (interp, go,
-                              new QToolBar (parentWidget));
-      }
+      if (parentWidget)
+        return new ToolBar (interp, go,
+                            new QToolBar (parentWidget));
+    }
 
-    return nullptr;
-  }
+  return nullptr;
+}
 
-  ToolBar::ToolBar (octave::interpreter& interp,
-                    const graphics_object& go, QToolBar *bar)
-    : Object (interp, go, bar), m_empty (nullptr), m_figure (nullptr)
-  {
-    uitoolbar::properties& tp = properties<uitoolbar> ();
+ToolBar::ToolBar (octave::interpreter& interp,
+                  const graphics_object& go, QToolBar *bar)
+  : Object (interp, go, bar), m_empty (nullptr), m_figure (nullptr)
+{
+  uitoolbar::properties& tp = properties<uitoolbar> ();
 
-    bar->setFloatable (false);
-    bar->setMovable (false);
-    bar->setVisible (tp.is_visible ());
-    bar->setStyleSheet (bar->styleSheet () + global_toolbar_style);
+  bar->setFloatable (false);
+  bar->setMovable (false);
+  bar->setVisible (tp.is_visible ());
+  bar->setStyleSheet (bar->styleSheet () + global_toolbar_style);
 
-    m_empty = addEmptyAction (bar);
+  m_empty = addEmptyAction (bar);
 
-    m_figure =
-      dynamic_cast<Figure *> (Object::fromQObject (bar->parentWidget ()));
+  m_figure =
+    dynamic_cast<Figure *> (Object::fromQObject (bar->parentWidget ()));
 
-    if (m_figure)
-      m_figure->addCustomToolBar (bar, tp.is_visible (),
-                                  tp.get_tag () == "__default_toolbar__");
+  if (m_figure)
+    m_figure->addCustomToolBar (bar, tp.is_visible (),
+                                tp.get_tag () == "__default_toolbar__");
 
-    bar->installEventFilter (this);
-  }
+  bar->installEventFilter (this);
+}
 
-  ToolBar::~ToolBar ()
-  { }
+ToolBar::~ToolBar ()
+{ }
 
-  void
-  ToolBar::update (int pId)
-  {
-    uitoolbar::properties& tp = properties<uitoolbar> ();
-    QToolBar *bar = qWidget<QToolBar> ();
+void
+ToolBar::update (int pId)
+{
+  uitoolbar::properties& tp = properties<uitoolbar> ();
+  QToolBar *bar = qWidget<QToolBar> ();
 
-    switch (pId)
-      {
-      case base_properties::ID_VISIBLE:
-        if (m_figure)
-          m_figure->showCustomToolBar (bar, tp.is_visible ());
-        break;
+  switch (pId)
+    {
+    case base_properties::ID_VISIBLE:
+      if (m_figure)
+        m_figure->showCustomToolBar (bar, tp.is_visible ());
+      break;
 
-      default:
-        Object::update (pId);
-        break;
-      }
-  }
+    default:
+      Object::update (pId);
+      break;
+    }
+}
 
-  bool
-  ToolBar::eventFilter (QObject *watched, QEvent *xevent)
-  {
-    if (watched == qObject ())
-      {
-        switch (xevent->type ())
+bool
+ToolBar::eventFilter (QObject *watched, QEvent *xevent)
+{
+  if (watched == qObject ())
+    {
+      switch (xevent->type ())
+        {
+        case QEvent::ActionAdded:
+        case QEvent::ActionRemoved:
           {
-          case QEvent::ActionAdded:
-          case QEvent::ActionRemoved:
-            {
-              QActionEvent *ae = dynamic_cast<QActionEvent *> (xevent);
-              QToolBar *bar = qWidget<QToolBar> ();
+            QActionEvent *ae = dynamic_cast<QActionEvent *> (xevent);
+            QToolBar *bar = qWidget<QToolBar> ();
 
-              if (ae->action () != m_empty)
-                {
-                  if (xevent->type () == QEvent::ActionAdded)
-                    {
-                      if (bar->actions ().size () == 2)
-                        QTimer::singleShot (0, this, &ToolBar::hideEmpty);
-                    }
-                  else
-                    {
-                      if (bar->actions ().size () == 1)
-                        m_empty->setVisible (true);
-                    }
-                }
-            }
-            break;
+            if (ae->action () != m_empty)
+              {
+                if (xevent->type () == QEvent::ActionAdded)
+                  {
+                    if (bar->actions ().size () == 2)
+                      QTimer::singleShot (0, this, &ToolBar::hideEmpty);
+                  }
+                else
+                  {
+                    if (bar->actions ().size () == 1)
+                      m_empty->setVisible (true);
+                  }
+              }
+          }
+          break;
 
-          default:
-            break;
-          }
-      }
+        default:
+          break;
+        }
+    }
 
-    return false;
-  }
+  return false;
+}
 
-  void
-  ToolBar::hideEmpty ()
-  {
-    m_empty->setVisible (false);
-  }
+void
+ToolBar::hideEmpty ()
+{
+  m_empty->setVisible (false);
+}
 
-  void
-  ToolBar::beingDeleted ()
-  {
-    if (m_figure)
-      {
-        QToolBar *bar = qWidget<QToolBar> ();
+void
+ToolBar::beingDeleted ()
+{
+  if (m_figure)
+    {
+      QToolBar *bar = qWidget<QToolBar> ();
 
-        if (bar)
-          m_figure->showCustomToolBar (bar, false);
-      }
-  }
+      if (bar)
+        m_figure->showCustomToolBar (bar, false);
+    }
+}
 
 OCTAVE_END_NAMESPACE(octave)
--- a/libgui/graphics/ToolBar.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/ToolBar.h	Thu Feb 02 12:25:51 2023 -0800
@@ -33,38 +33,38 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class interpreter;
+class interpreter;
 
-  class Figure;
+class Figure;
 
-  class ToolBar : public Object
-  {
-    Q_OBJECT
+class ToolBar : public Object
+{
+  Q_OBJECT
 
-  public:
-    ToolBar (octave::interpreter& interp,
-             const graphics_object& go, QToolBar *bar);
-    ~ToolBar ();
+public:
+  ToolBar (octave::interpreter& interp,
+           const graphics_object& go, QToolBar *bar);
+  ~ToolBar ();
 
-    static ToolBar *
-    create (octave::interpreter& interp,
-            const graphics_object& go);
+  static ToolBar *
+  create (octave::interpreter& interp,
+          const graphics_object& go);
 
-    Container * innerContainer () { return nullptr; }
+  Container * innerContainer () { return nullptr; }
 
-    bool eventFilter (QObject *watched, QEvent *event);
+  bool eventFilter (QObject *watched, QEvent *event);
 
-  protected:
-    void update (int pId);
-    void beingDeleted ();
+protected:
+  void update (int pId);
+  void beingDeleted ();
 
-  private slots:
-    void hideEmpty ();
+private slots:
+  void hideEmpty ();
 
-  private:
-    QAction *m_empty;
-    Figure *m_figure;
-  };
+private:
+  QAction *m_empty;
+  Figure *m_figure;
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/graphics/ToolBarButton.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/ToolBarButton.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -38,124 +38,124 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  template <typename T>
-  ToolBarButton<T>::ToolBarButton (octave::interpreter& interp,
-                                   const graphics_object& go, QAction *action)
-    : Object (interp, go, action), m_separator (nullptr)
-  {
-    typename T::properties& tp = properties<T> ();
-
-    action->setToolTip (Utils::fromStdString (tp.get_tooltipstring ()));
-    action->setVisible (tp.is_visible ());
+template <typename T>
+ToolBarButton<T>::ToolBarButton (octave::interpreter& interp,
+                                 const graphics_object& go, QAction *action)
+  : Object (interp, go, action), m_separator (nullptr)
+{
+  typename T::properties& tp = properties<T> ();
 
-    // Get the icon data from cdata or as a named icon
-    QImage img = Utils::makeImageFromCData (tp.get_cdata (), 24, 24);
+  action->setToolTip (Utils::fromStdString (tp.get_tooltipstring ()));
+  action->setVisible (tp.is_visible ());
 
-    if (img.width () == 0)
-      {
-        QIcon ico;
-        std::string name = tp.get___named_icon__ ();
-        if (! name.empty ())
-          ico = get_icon (name);
+  // Get the icon data from cdata or as a named icon
+  QImage img = Utils::makeImageFromCData (tp.get_cdata (), 24, 24);
 
-        action->setIcon (ico);
-      }
-    else
-      action->setIcon (QIcon (QPixmap::fromImage (img)));
+  if (img.width () == 0)
+    {
+      QIcon ico;
+      std::string name = tp.get___named_icon__ ();
+      if (! name.empty ())
+        ico = get_icon (name);
 
-    if (tp.is_separator ())
-      {
-        m_separator = new QAction (action);
-        m_separator->setSeparator (true);
-        m_separator->setVisible (tp.is_visible ());
-      }
-    action->setEnabled (tp.is_enable ());
+      action->setIcon (ico);
+    }
+  else
+    action->setIcon (QIcon (QPixmap::fromImage (img)));
 
-    QWidget *w = qobject_cast<QWidget *> (action->parent ());
+  if (tp.is_separator ())
+    {
+      m_separator = new QAction (action);
+      m_separator->setSeparator (true);
+      m_separator->setVisible (tp.is_visible ());
+    }
+  action->setEnabled (tp.is_enable ());
 
-    w->insertAction (w->actions ().back (), action);
-    if (m_separator)
-      w->insertAction (action, m_separator);
-  }
-
-  template <typename T>
-  ToolBarButton<T>::~ToolBarButton ()
-  { }
+  QWidget *w = qobject_cast<QWidget *> (action->parent ());
 
-  template <typename T>
-  void
-  ToolBarButton<T>::update (int pId)
-  {
-    typename T::properties& tp = properties<T> ();
-    QAction *action = qWidget<QAction> ();
+  w->insertAction (w->actions ().back (), action);
+  if (m_separator)
+    w->insertAction (action, m_separator);
+}
 
-    switch (pId)
-      {
-      case base_properties::ID_VISIBLE:
-        action->setVisible (tp.is_visible ());
-        if (m_separator)
-          m_separator->setVisible (tp.is_visible ());
-        break;
+template <typename T>
+ToolBarButton<T>::~ToolBarButton ()
+{ }
 
-      case T::properties::ID_TOOLTIPSTRING:
-        action->setToolTip (Utils::fromStdString (tp.get_tooltipstring ()));
-        break;
-
-      case T::properties::ID_CDATA:
-        {
-          // Get the icon data from cdata or as a named icon
-          QImage img = Utils::makeImageFromCData (tp.get_cdata (), 24, 24);
+template <typename T>
+void
+ToolBarButton<T>::update (int pId)
+{
+  typename T::properties& tp = properties<T> ();
+  QAction *action = qWidget<QAction> ();
 
-          if (img.width () == 0)
-            {
-              QIcon ico;
-              std::string name = tp.get___named_icon__ ();
-              if (! name.empty ())
-                ico = get_icon (name);
+  switch (pId)
+    {
+    case base_properties::ID_VISIBLE:
+      action->setVisible (tp.is_visible ());
+      if (m_separator)
+        m_separator->setVisible (tp.is_visible ());
+      break;
 
-              action->setIcon (ico);
-            }
-          else
-            action->setIcon (QIcon (QPixmap::fromImage (img)));
-        }
-        break;
+    case T::properties::ID_TOOLTIPSTRING:
+      action->setToolTip (Utils::fromStdString (tp.get_tooltipstring ()));
+      break;
 
-      case T::properties::ID_SEPARATOR:
-        if (tp.is_separator ())
+    case T::properties::ID_CDATA:
+      {
+        // Get the icon data from cdata or as a named icon
+        QImage img = Utils::makeImageFromCData (tp.get_cdata (), 24, 24);
+
+        if (img.width () == 0)
           {
-            if (! m_separator)
-              {
-                m_separator = new QAction (action);
-                m_separator->setSeparator (true);
-                m_separator->setVisible (tp.is_visible ());
+            QIcon ico;
+            std::string name = tp.get___named_icon__ ();
+            if (! name.empty ())
+              ico = get_icon (name);
 
-                QWidget *w = qobject_cast<QWidget *> (action->parent ());
-
-                w->insertAction (action, m_separator);
-              }
+            action->setIcon (ico);
           }
         else
-          {
-            if (m_separator)
-              delete m_separator;
-            m_separator = nullptr;
-          }
-        break;
+          action->setIcon (QIcon (QPixmap::fromImage (img)));
+      }
+      break;
 
-      case T::properties::ID_ENABLE:
-        action->setEnabled (tp.is_enable ());
-        break;
+    case T::properties::ID_SEPARATOR:
+      if (tp.is_separator ())
+        {
+          if (! m_separator)
+            {
+              m_separator = new QAction (action);
+              m_separator->setSeparator (true);
+              m_separator->setVisible (tp.is_visible ());
+
+              QWidget *w = qobject_cast<QWidget *> (action->parent ());
 
-      default:
-        Object::update (pId);
-        break;
-      }
-  }
+              w->insertAction (action, m_separator);
+            }
+        }
+      else
+        {
+          if (m_separator)
+            delete m_separator;
+          m_separator = nullptr;
+        }
+      break;
 
-  template <typename T>
-  QIcon ToolBarButton<T>::get_icon (const std::string& name)
-  {
-    return QIcon (global_icon_paths.at (ICON_THEME_OCTAVE) + QString::fromStdString (name) + ".png");
-  }
+    case T::properties::ID_ENABLE:
+      action->setEnabled (tp.is_enable ());
+      break;
+
+    default:
+      Object::update (pId);
+      break;
+    }
+}
+
+template <typename T>
+QIcon ToolBarButton<T>::get_icon (const std::string& name)
+{
+  return QIcon (global_icon_paths.at (ICON_THEME_OCTAVE) + QString::fromStdString (name) + ".png");
+}
 
 OCTAVE_END_NAMESPACE(octave)
--- a/libgui/graphics/ToolBarButton.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/ToolBarButton.h	Thu Feb 02 12:25:51 2023 -0800
@@ -33,28 +33,28 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class interpreter;
+class interpreter;
 
-  class Container;
+class Container;
 
-  template <typename T>
-  class ToolBarButton : public Object
-  {
-  public:
-    ToolBarButton (octave::interpreter& interp,
-                   const graphics_object& go, QAction *action);
-    ~ToolBarButton ();
+template <typename T>
+class ToolBarButton : public Object
+{
+public:
+  ToolBarButton (octave::interpreter& interp,
+                 const graphics_object& go, QAction *action);
+  ~ToolBarButton ();
 
-    Container * innerContainer () { return nullptr; }
+  Container * innerContainer () { return nullptr; }
 
-  protected:
-    void update (int pId);
+protected:
+  void update (int pId);
 
-  private:
-    QAction *m_separator;
+private:
+  QAction *m_separator;
 
-    QIcon get_icon (const std::string& name);
-  };
+  QIcon get_icon (const std::string& name);
+};
 
 OCTAVE_END_NAMESPACE(octave);
 
--- a/libgui/graphics/qt-graphics-toolkit.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/qt-graphics-toolkit.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -73,437 +73,437 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  static std::string
-  toolkitObjectProperty (const graphics_object& go)
-  {
-    if (go.isa ("figure"))
-      return "__plot_stream__";
-    else if (go.isa ("uicontrol")
-             || go.isa ("uipanel")
-             || go.isa ("uibuttongroup")
-             || go.isa ("uimenu")
-             || go.isa ("uicontextmenu")
-             || go.isa ("uitable")
-             || go.isa ("uitoolbar")
-             || go.isa ("uipushtool")
-             || go.isa ("uitoggletool"))
-      return "__object__";
-    else
-      qCritical ("octave::qt_graphics_toolkit: no __object__ property known for object "
-                 "of type %s", go.type ().c_str ());
+static std::string
+toolkitObjectProperty (const graphics_object& go)
+{
+  if (go.isa ("figure"))
+    return "__plot_stream__";
+  else if (go.isa ("uicontrol")
+           || go.isa ("uipanel")
+           || go.isa ("uibuttongroup")
+           || go.isa ("uimenu")
+           || go.isa ("uicontextmenu")
+           || go.isa ("uitable")
+           || go.isa ("uitoolbar")
+           || go.isa ("uipushtool")
+           || go.isa ("uitoggletool"))
+    return "__object__";
+  else
+    qCritical ("octave::qt_graphics_toolkit: no __object__ property known for object "
+               "of type %s", go.type ().c_str ());
 
-    return "";
-  }
+  return "";
+}
 
-  qt_graphics_toolkit::qt_graphics_toolkit (octave::interpreter& interp)
-    : QObject (), base_graphics_toolkit ("qt"), m_interpreter (interp)
-  {
-    // Implemented with a signal/slot connection in order to properly
-    // cross from the interpreter thread (where requests to create
-    // graphics object are initiated) to the GUI application thread
-    // (where they are actually created and displayed).
-    // We need to make sure the GUI Object and its proxy are properly
-    // created before the initialize method returns, so we use a
-    // BlockingQueuedConnection. After the signal is emitted, the interpreter
-    // thread is locked until the slot has returned.
+qt_graphics_toolkit::qt_graphics_toolkit (octave::interpreter& interp)
+  : QObject (), base_graphics_toolkit ("qt"), m_interpreter (interp)
+{
+  // Implemented with a signal/slot connection in order to properly
+  // cross from the interpreter thread (where requests to create
+  // graphics object are initiated) to the GUI application thread
+  // (where they are actually created and displayed).
+  // We need to make sure the GUI Object and its proxy are properly
+  // created before the initialize method returns, so we use a
+  // BlockingQueuedConnection. After the signal is emitted, the interpreter
+  // thread is locked until the slot has returned.
 
-    connect (this, &qt_graphics_toolkit::create_object_signal,
-             this, &qt_graphics_toolkit::create_object,
-             Qt::BlockingQueuedConnection);
-  }
+  connect (this, &qt_graphics_toolkit::create_object_signal,
+           this, &qt_graphics_toolkit::create_object,
+           Qt::BlockingQueuedConnection);
+}
 
-  bool
-  qt_graphics_toolkit::initialize (const graphics_object& go)
-  {
-    if (go.isa ("figure")
-        || (go.isa ("uicontrol") && go.get ("style").string_value () != "frame")
-        || go.isa ("uipanel")
-        || go.isa ("uibuttongroup")
-        || go.isa ("uimenu")
-        || go.isa ("uicontextmenu")
-        || go.isa ("uitable")
-        || go.isa ("uitoolbar")
-        || go.isa ("uipushtool")
-        || go.isa ("uitoggletool"))
-      {
-        // FIXME: We need to unlock the mutex here but we have no way to know
-        // if it was previously locked by this thread, and thus if we should
-        // re-lock it.
+bool
+qt_graphics_toolkit::initialize (const graphics_object& go)
+{
+  if (go.isa ("figure")
+      || (go.isa ("uicontrol") && go.get ("style").string_value () != "frame")
+      || go.isa ("uipanel")
+      || go.isa ("uibuttongroup")
+      || go.isa ("uimenu")
+      || go.isa ("uicontextmenu")
+      || go.isa ("uitable")
+      || go.isa ("uitoolbar")
+      || go.isa ("uipushtool")
+      || go.isa ("uitoggletool"))
+    {
+      // FIXME: We need to unlock the mutex here but we have no way to know
+      // if it was previously locked by this thread, and thus if we should
+      // re-lock it.
 
-        gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+      gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
 
-        gh_mgr.unlock ();
+      gh_mgr.unlock ();
 
-        Logger::debug ("qt_graphics_toolkit::initialize %s from thread %p",
-                       go.type ().c_str (), QThread::currentThreadId ());
+      Logger::debug ("qt_graphics_toolkit::initialize %s from thread %p",
+                     go.type ().c_str (), QThread::currentThreadId ());
 
-        ObjectProxy *proxy = new ObjectProxy ();
-        graphics_object gObj (go);
+      ObjectProxy *proxy = new ObjectProxy ();
+      graphics_object gObj (go);
 
-        OCTAVE_PTR_TYPE tmp (reinterpret_cast<OCTAVE_INTPTR_TYPE> (proxy));
-        gObj.get_properties ().set (toolkitObjectProperty (go), tmp);
+      OCTAVE_PTR_TYPE tmp (reinterpret_cast<OCTAVE_INTPTR_TYPE> (proxy));
+      gObj.get_properties ().set (toolkitObjectProperty (go), tmp);
 
-        emit create_object_signal (go.get_handle ().value ());
+      emit create_object_signal (go.get_handle ().value ());
 
-        return true;
-      }
+      return true;
+    }
 
-    return false;
-  }
+  return false;
+}
 
-  void
-  qt_graphics_toolkit::update (const graphics_object& go, int pId)
-  {
-    // Rule out obvious properties we want to ignore.
-    if (pId == figure::properties::ID___PLOT_STREAM__
-        || pId == uicontrol::properties::ID___OBJECT__
-        || pId == uipanel::properties::ID___OBJECT__
-        || pId == uibuttongroup::properties::ID___OBJECT__
-        || pId == uimenu::properties::ID___OBJECT__
-        || pId == uicontextmenu::properties::ID___OBJECT__
-        || pId == uitable::properties::ID___OBJECT__
-        || pId == uitoolbar::properties::ID___OBJECT__
-        || pId == uipushtool::properties::ID___OBJECT__
-        || pId == uitoggletool::properties::ID___OBJECT__
-        || pId == base_properties::ID___MODIFIED__)
-      return;
+void
+qt_graphics_toolkit::update (const graphics_object& go, int pId)
+{
+  // Rule out obvious properties we want to ignore.
+  if (pId == figure::properties::ID___PLOT_STREAM__
+      || pId == uicontrol::properties::ID___OBJECT__
+      || pId == uipanel::properties::ID___OBJECT__
+      || pId == uibuttongroup::properties::ID___OBJECT__
+      || pId == uimenu::properties::ID___OBJECT__
+      || pId == uicontextmenu::properties::ID___OBJECT__
+      || pId == uitable::properties::ID___OBJECT__
+      || pId == uitoolbar::properties::ID___OBJECT__
+      || pId == uipushtool::properties::ID___OBJECT__
+      || pId == uitoggletool::properties::ID___OBJECT__
+      || pId == base_properties::ID___MODIFIED__)
+    return;
 
-    Logger::debug ("qt_graphics_toolkit::update %s(%d) from thread %p",
-                   go.type ().c_str (), pId, QThread::currentThreadId ());
+  Logger::debug ("qt_graphics_toolkit::update %s(%d) from thread %p",
+                 go.type ().c_str (), pId, QThread::currentThreadId ());
 
-    ObjectProxy *proxy = toolkitObjectProxy (go);
+  ObjectProxy *proxy = toolkitObjectProxy (go);
 
-    if (proxy)
-      {
-        if ((go.isa ("uicontrol")
-             && pId == uicontrol::properties::ID_STYLE)
-            || (go.isa ("uitable")
-                && pId == uitable::properties::ID_DATA))
-          {
-            // Special case: we need to recreate the control widget
-            // associated with the octave graphics_object
-            // FIXME: For uitable, it would only be necessary to recreate
-            // the table widget if the type of the displayed values changes
-            // between Boolean and non-Boolean (bug #63388).
+  if (proxy)
+    {
+      if ((go.isa ("uicontrol")
+           && pId == uicontrol::properties::ID_STYLE)
+          || (go.isa ("uitable")
+              && pId == uitable::properties::ID_DATA))
+        {
+          // Special case: we need to recreate the control widget
+          // associated with the octave graphics_object
+          // FIXME: For uitable, it would only be necessary to recreate
+          // the table widget if the type of the displayed values changes
+          // between Boolean and non-Boolean (bug #63388).
 
-            finalize (go);
-            initialize (go);
-          }
-        else
-          proxy->update (pId);
-      }
-  }
+          finalize (go);
+          initialize (go);
+        }
+      else
+        proxy->update (pId);
+    }
+}
 
-  void
-  qt_graphics_toolkit::finalize (const graphics_object& go)
-  {
-    // FIXME: We need to unlock the mutex here but we have no way to know if
-    // if it was previously locked by this thread, and thus if we should
-    // re-lock it.
+void
+qt_graphics_toolkit::finalize (const graphics_object& go)
+{
+  // FIXME: We need to unlock the mutex here but we have no way to know if
+  // if it was previously locked by this thread, and thus if we should
+  // re-lock it.
 
-    gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+  gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
 
-    gh_mgr.unlock ();
+  gh_mgr.unlock ();
 
-    Logger::debug ("qt_graphics_toolkit::finalize %s from thread %p",
-                   go.type ().c_str (), QThread::currentThreadId ());
+  Logger::debug ("qt_graphics_toolkit::finalize %s from thread %p",
+                 go.type ().c_str (), QThread::currentThreadId ());
 
-    ObjectProxy *proxy = toolkitObjectProxy (go);
+  ObjectProxy *proxy = toolkitObjectProxy (go);
 
-    if (proxy)
-      {
-        proxy->finalize ();
-        delete proxy;
+  if (proxy)
+    {
+      proxy->finalize ();
+      delete proxy;
 
-        graphics_object gObj (go);
+      graphics_object gObj (go);
 
-        gObj.get_properties ().set (toolkitObjectProperty (go), Matrix ());
-      }
-  }
+      gObj.get_properties ().set (toolkitObjectProperty (go), Matrix ());
+    }
+}
 
-  void
-  qt_graphics_toolkit::redraw_figure (const graphics_object& go) const
-  {
-    if (go.get_properties ().is_visible ())
-      {
-        ObjectProxy *proxy = toolkitObjectProxy (go);
+void
+qt_graphics_toolkit::redraw_figure (const graphics_object& go) const
+{
+  if (go.get_properties ().is_visible ())
+    {
+      ObjectProxy *proxy = toolkitObjectProxy (go);
 
-        if (proxy)
-          proxy->redraw ();
-      }
-  }
+      if (proxy)
+        proxy->redraw ();
+    }
+}
 
-  void
-  qt_graphics_toolkit::show_figure (const graphics_object& go) const
-  {
-    if (go.get_properties ().is_visible ())
-      {
-        ObjectProxy *proxy = toolkitObjectProxy (go);
+void
+qt_graphics_toolkit::show_figure (const graphics_object& go) const
+{
+  if (go.get_properties ().is_visible ())
+    {
+      ObjectProxy *proxy = toolkitObjectProxy (go);
 
-        if (proxy)
-          proxy->show ();
-      }
-  }
+      if (proxy)
+        proxy->show ();
+    }
+}
 
-  void
-  qt_graphics_toolkit::print_figure (const graphics_object& go,
-                                     const std::string& term,
-                                     const std::string& file_cmd,
-                                     const std::string& /*debug_file*/) const
-  {
-    ObjectProxy *proxy = toolkitObjectProxy (go);
+void
+qt_graphics_toolkit::print_figure (const graphics_object& go,
+                                   const std::string& term,
+                                   const std::string& file_cmd,
+                                   const std::string& /*debug_file*/) const
+{
+  ObjectProxy *proxy = toolkitObjectProxy (go);
 
-    if (proxy)
-      proxy->print (QString::fromStdString (file_cmd),
-                    QString::fromStdString (term));
-  }
+  if (proxy)
+    proxy->print (QString::fromStdString (file_cmd),
+                  QString::fromStdString (term));
+}
 
-  uint8NDArray
-  qt_graphics_toolkit::get_pixels (const graphics_object& go) const
-  {
-    uint8NDArray retval;
+uint8NDArray
+qt_graphics_toolkit::get_pixels (const graphics_object& go) const
+{
+  uint8NDArray retval;
 
-    if (go.isa ("figure"))
-      {
-        ObjectProxy *proxy = toolkitObjectProxy (go);
+  if (go.isa ("figure"))
+    {
+      ObjectProxy *proxy = toolkitObjectProxy (go);
 
-        if (proxy)
-          retval = proxy->get_pixels ();
-      }
+      if (proxy)
+        retval = proxy->get_pixels ();
+    }
 
-    return retval;
-  }
+  return retval;
+}
 
-  Matrix
-  qt_graphics_toolkit::get_text_extent (const graphics_object& go) const
-  {
-    Matrix ext (1, 4, 0.0);
+Matrix
+qt_graphics_toolkit::get_text_extent (const graphics_object& go) const
+{
+  Matrix ext (1, 4, 0.0);
 
-    if (go.isa ("uicontrol"))
-      {
-        octave_value str = go.get ("string");
-        if (! str.isempty ())
-          {
-            const uicontrol::properties& up =
-              dynamic_cast<const uicontrol::properties&> (go.get_properties ());
-            Matrix bb = up.get_boundingbox (false);
-            QFont font = Utils::computeFont<uicontrol> (up, bb(3));
-            QFontMetrics fm (font);
+  if (go.isa ("uicontrol"))
+    {
+      octave_value str = go.get ("string");
+      if (! str.isempty ())
+        {
+          const uicontrol::properties& up =
+            dynamic_cast<const uicontrol::properties&> (go.get_properties ());
+          Matrix bb = up.get_boundingbox (false);
+          QFont font = Utils::computeFont<uicontrol> (up, bb(3));
+          QFontMetrics fm (font);
 
-            QString s;
-            QSize sz;
+          QString s;
+          QSize sz;
 
-            if (str.is_string ())
-              {
-                s = QString::fromStdString (str.string_value ());
-                sz = fm.size (Qt::TextSingleLine, s);
-                ext(2) = sz.width ();
-                ext(3) = sz.height ();
-              }
-            else if (str.iscellstr ())
-              {
-                string_vector sv = str.string_vector_value ();
-                double wd = 0.0;
-                double hg = 0.0;
-                for (octave_idx_type ii = 0; ii < sv.numel (); ii++)
-                  {
-                    s = QString::fromStdString (sv(ii));
-                    sz = fm.size (Qt::TextSingleLine, s);
-                    wd = std::max (wd, static_cast<double> (sz.width ()));
-                    hg = std::max (hg, static_cast<double> (sz.height ()));
-                  }
+          if (str.is_string ())
+            {
+              s = QString::fromStdString (str.string_value ());
+              sz = fm.size (Qt::TextSingleLine, s);
+              ext(2) = sz.width ();
+              ext(3) = sz.height ();
+            }
+          else if (str.iscellstr ())
+            {
+              string_vector sv = str.string_vector_value ();
+              double wd = 0.0;
+              double hg = 0.0;
+              for (octave_idx_type ii = 0; ii < sv.numel (); ii++)
+                {
+                  s = QString::fromStdString (sv(ii));
+                  sz = fm.size (Qt::TextSingleLine, s);
+                  wd = std::max (wd, static_cast<double> (sz.width ()));
+                  hg = std::max (hg, static_cast<double> (sz.height ()));
+                }
 
-                ext(2) = wd;
-                // FIXME: Find a better way to determine the height of e.g.
-                // listbox uicontrol objects
-                ext(3) = hg * sv.numel ();
-              }
-          }
-      }
+              ext(2) = wd;
+              // FIXME: Find a better way to determine the height of e.g.
+              // listbox uicontrol objects
+              ext(3) = hg * sv.numel ();
+            }
+        }
+    }
 
-    return ext;
-  }
+  return ext;
+}
 
-  Object *
-  qt_graphics_toolkit::toolkitObject (const graphics_object& go)
-  {
-    ObjectProxy *proxy = toolkitObjectProxy (go);
+Object *
+qt_graphics_toolkit::toolkitObject (const graphics_object& go)
+{
+  ObjectProxy *proxy = toolkitObjectProxy (go);
 
-    if (proxy)
-      return proxy->object ();
+  if (proxy)
+    return proxy->object ();
 
-    return nullptr;
-  }
+  return nullptr;
+}
 
-  ObjectProxy *
-  qt_graphics_toolkit::toolkitObjectProxy (const graphics_object& go)
-  {
-    if (go)
-      {
-        octave_value ov = go.get (toolkitObjectProperty (go));
+ObjectProxy *
+qt_graphics_toolkit::toolkitObjectProxy (const graphics_object& go)
+{
+  if (go)
+    {
+      octave_value ov = go.get (toolkitObjectProperty (go));
 
-        if (ov.is_defined () && ! ov.isempty ())
-          {
-            OCTAVE_INTPTR_TYPE ptr = ov.OCTAVE_PTR_SCALAR ().value ();
+      if (ov.is_defined () && ! ov.isempty ())
+        {
+          OCTAVE_INTPTR_TYPE ptr = ov.OCTAVE_PTR_SCALAR ().value ();
 
-            return reinterpret_cast<ObjectProxy *> (ptr);
-          }
-      }
+          return reinterpret_cast<ObjectProxy *> (ptr);
+        }
+    }
 
-    return nullptr;
-  }
+  return nullptr;
+}
 
-  void
-  qt_graphics_toolkit::interpreter_event (const octave::fcn_callback& fcn)
-  {
-    octave::event_manager& evmgr = m_interpreter.get_event_manager ();
+void
+qt_graphics_toolkit::interpreter_event (const octave::fcn_callback& fcn)
+{
+  octave::event_manager& evmgr = m_interpreter.get_event_manager ();
 
-    evmgr.post_event (fcn);
-  }
+  evmgr.post_event (fcn);
+}
 
-  void
-  qt_graphics_toolkit::interpreter_event (const octave::meth_callback& meth)
-  {
-    octave::event_manager& evmgr = m_interpreter.get_event_manager ();
+void
+qt_graphics_toolkit::interpreter_event (const octave::meth_callback& meth)
+{
+  octave::event_manager& evmgr = m_interpreter.get_event_manager ();
 
-    evmgr.post_event (meth);
-  }
+  evmgr.post_event (meth);
+}
 
-  void
-  qt_graphics_toolkit::create_object (double handle)
-  {
-    gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+void
+qt_graphics_toolkit::create_object (double handle)
+{
+  gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
 
-    octave::autolock guard (gh_mgr.graphics_lock ());
+  octave::autolock guard (gh_mgr.graphics_lock ());
 
-    graphics_object go (gh_mgr.get_object (graphics_handle (handle)));
+  graphics_object go (gh_mgr.get_object (graphics_handle (handle)));
 
-    if (! go.valid_object ())
-      {
-        qWarning ("qt_graphics_toolkit::create_object: invalid object for handle %g",
-                  handle);
-        return;
-      }
+  if (! go.valid_object ())
+    {
+      qWarning ("qt_graphics_toolkit::create_object: invalid object for handle %g",
+                handle);
+      return;
+    }
 
-    if (go.get_properties ().is_beingdeleted ())
-      {
-        qWarning ("qt_graphics_toolkit::create_object: object is being deleted");
-        return;
-      }
+  if (go.get_properties ().is_beingdeleted ())
+    {
+      qWarning ("qt_graphics_toolkit::create_object: object is being deleted");
+      return;
+    }
 
-    ObjectProxy *proxy = qt_graphics_toolkit::toolkitObjectProxy (go);
+  ObjectProxy *proxy = qt_graphics_toolkit::toolkitObjectProxy (go);
 
-    if (! proxy)
-      {
-        qWarning ("qt_graphics_toolkit::create_object: no proxy for handle %g",
-                  handle);
-        return;
-      }
+  if (! proxy)
+    {
+      qWarning ("qt_graphics_toolkit::create_object: no proxy for handle %g",
+                handle);
+      return;
+    }
 
-    Logger::debug ("qt_graphics_toolkit::create_object: "
-                   "create %s from thread %p",
-                   go.type ().c_str (), QThread::currentThreadId ());
+  Logger::debug ("qt_graphics_toolkit::create_object: "
+                 "create %s from thread %p",
+                 go.type ().c_str (), QThread::currentThreadId ());
 
-    Object *obj = nullptr;
+  Object *obj = nullptr;
 
-    if (go.isa ("figure"))
-      obj = Figure::create (m_interpreter, go);
-    else if (go.isa ("uicontrol"))
-      {
-        uicontrol::properties& up =
-          Utils::properties<uicontrol> (go);
+  if (go.isa ("figure"))
+    obj = Figure::create (m_interpreter, go);
+  else if (go.isa ("uicontrol"))
+    {
+      uicontrol::properties& up =
+        Utils::properties<uicontrol> (go);
 
-        if (up.style_is ("pushbutton"))
-          obj = PushButtonControl::create (m_interpreter, go);
-        else if (up.style_is ("edit"))
-          obj = EditControl::create (m_interpreter, go);
-        else if (up.style_is ("checkbox"))
-          obj = CheckBoxControl::create (m_interpreter, go);
-        else if (up.style_is ("radiobutton"))
-          obj = RadioButtonControl::create (m_interpreter, go);
-        else if (up.style_is ("togglebutton"))
-          obj = ToggleButtonControl::create (m_interpreter, go);
-        else if (up.style_is ("text"))
-          obj = TextControl::create (m_interpreter, go);
-        else if (up.style_is ("popupmenu"))
-          obj = PopupMenuControl::create (m_interpreter, go);
-        else if (up.style_is ("slider"))
-          obj = SliderControl::create (m_interpreter, go);
-        else if (up.style_is ("listbox"))
-          obj = ListBoxControl::create (m_interpreter, go);
-      }
-    else if (go.isa ("uibuttongroup"))
-      obj = ButtonGroup::create (m_interpreter, go);
-    else if (go.isa ("uipanel"))
-      obj = Panel::create (m_interpreter, go);
-    else if (go.isa ("uimenu"))
-      obj = Menu::create (m_interpreter, go);
-    else if (go.isa ("uicontextmenu"))
-      obj = ContextMenu::create (m_interpreter, go);
-    else if (go.isa ("uitable"))
-      obj = Table::create (m_interpreter, go);
-    else if (go.isa ("uitoolbar"))
-      obj = ToolBar::create (m_interpreter, go);
-    else if (go.isa ("uipushtool"))
-      obj = PushTool::create (m_interpreter, go);
-    else if (go.isa ("uitoggletool"))
-      obj = ToggleTool::create (m_interpreter, go);
-    else
-      qWarning ("qt_graphics_toolkit::create_object: unsupported type '%s'",
-                go.type ().c_str ());
+      if (up.style_is ("pushbutton"))
+        obj = PushButtonControl::create (m_interpreter, go);
+      else if (up.style_is ("edit"))
+        obj = EditControl::create (m_interpreter, go);
+      else if (up.style_is ("checkbox"))
+        obj = CheckBoxControl::create (m_interpreter, go);
+      else if (up.style_is ("radiobutton"))
+        obj = RadioButtonControl::create (m_interpreter, go);
+      else if (up.style_is ("togglebutton"))
+        obj = ToggleButtonControl::create (m_interpreter, go);
+      else if (up.style_is ("text"))
+        obj = TextControl::create (m_interpreter, go);
+      else if (up.style_is ("popupmenu"))
+        obj = PopupMenuControl::create (m_interpreter, go);
+      else if (up.style_is ("slider"))
+        obj = SliderControl::create (m_interpreter, go);
+      else if (up.style_is ("listbox"))
+        obj = ListBoxControl::create (m_interpreter, go);
+    }
+  else if (go.isa ("uibuttongroup"))
+    obj = ButtonGroup::create (m_interpreter, go);
+  else if (go.isa ("uipanel"))
+    obj = Panel::create (m_interpreter, go);
+  else if (go.isa ("uimenu"))
+    obj = Menu::create (m_interpreter, go);
+  else if (go.isa ("uicontextmenu"))
+    obj = ContextMenu::create (m_interpreter, go);
+  else if (go.isa ("uitable"))
+    obj = Table::create (m_interpreter, go);
+  else if (go.isa ("uitoolbar"))
+    obj = ToolBar::create (m_interpreter, go);
+  else if (go.isa ("uipushtool"))
+    obj = PushTool::create (m_interpreter, go);
+  else if (go.isa ("uitoggletool"))
+    obj = ToggleTool::create (m_interpreter, go);
+  else
+    qWarning ("qt_graphics_toolkit::create_object: unsupported type '%s'",
+              go.type ().c_str ());
 
-    if (obj)
-      {
-        proxy->setObject (obj);
-        obj->do_connections (this);
-      }
-  }
+  if (obj)
+    {
+      proxy->setObject (obj);
+      obj->do_connections (this);
+    }
+}
 
-  void qt_graphics_toolkit::gh_callback_event (const graphics_handle& h,
-                                               const std::string& nm)
-  {
-    gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+void qt_graphics_toolkit::gh_callback_event (const graphics_handle& h,
+                                             const std::string& nm)
+{
+  gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
 
-    gh_mgr.post_callback (h, nm);
-  }
+  gh_mgr.post_callback (h, nm);
+}
 
-  void qt_graphics_toolkit::gh_callback_event (const graphics_handle& h,
-                                               const std::string& nm,
-                                               const octave_value& data)
-  {
-    gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+void qt_graphics_toolkit::gh_callback_event (const graphics_handle& h,
+                                             const std::string& nm,
+                                             const octave_value& data)
+{
+  gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
 
-    gh_mgr.post_callback (h, nm, data);
-  }
+  gh_mgr.post_callback (h, nm, data);
+}
 
-  void qt_graphics_toolkit::gh_set_event (const graphics_handle& h,
-                                          const std::string& nm,
-                                          const octave_value& value)
-  {
-    gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+void qt_graphics_toolkit::gh_set_event (const graphics_handle& h,
+                                        const std::string& nm,
+                                        const octave_value& value)
+{
+  gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
 
-    gh_mgr.post_set (h, nm, value);
-  }
+  gh_mgr.post_set (h, nm, value);
+}
 
-  void qt_graphics_toolkit::gh_set_event (const graphics_handle& h,
-                                          const std::string& nm,
-                                          const octave_value& value,
-                                          bool notify_toolkit)
-  {
-    gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+void qt_graphics_toolkit::gh_set_event (const graphics_handle& h,
+                                        const std::string& nm,
+                                        const octave_value& value,
+                                        bool notify_toolkit)
+{
+  gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
 
-    gh_mgr.post_set (h, nm, value, notify_toolkit);
-  }
+  gh_mgr.post_set (h, nm, value, notify_toolkit);
+}
 
-  void qt_graphics_toolkit::gh_set_event (const graphics_handle& h,
-                                          const std::string& nm,
-                                          const octave_value& value,
-                                          bool notify_toolkit,
-                                          bool redraw_figure)
-  {
-    gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
+void qt_graphics_toolkit::gh_set_event (const graphics_handle& h,
+                                        const std::string& nm,
+                                        const octave_value& value,
+                                        bool notify_toolkit,
+                                        bool redraw_figure)
+{
+  gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
 
-    gh_mgr.post_set (h, nm, value, notify_toolkit, redraw_figure);
-  }
+  gh_mgr.post_set (h, nm, value, notify_toolkit, redraw_figure);
+}
 
 OCTAVE_END_NAMESPACE(octave);
--- a/libgui/graphics/qt-graphics-toolkit.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/graphics/qt-graphics-toolkit.h	Thu Feb 02 12:25:51 2023 -0800
@@ -33,91 +33,91 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class interpreter;
+class interpreter;
 
-  class Object;
-  class ObjectProxy;
+class Object;
+class ObjectProxy;
 
-  class qt_graphics_toolkit
-    : public QObject, public octave::base_graphics_toolkit
-  {
-    Q_OBJECT
+class qt_graphics_toolkit
+  : public QObject, public octave::base_graphics_toolkit
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    qt_graphics_toolkit (octave::interpreter& interp);
+  qt_graphics_toolkit (octave::interpreter& interp);
 
-    ~qt_graphics_toolkit () = default;
+  ~qt_graphics_toolkit () = default;
 
-    // The interpreter may call graphics toolkit functions that we
-    // implement here.  The Qt GUI that manages these actions runs in a
-    // separate thread.  So in order to correctly cross from the
-    // interpreter thread to the GUI thread, these functions should emit
-    // signals (in the interpreter thread) that are handled by slots
-    // that will run in the GUI thread.  This design is similar to the
-    // event_manager, interpreter_events, and qt_interpreter_events
-    // classes work to pass messages from the interpreter to the GUI.
-    //
-    // FIXME: currently most of these functions do not emit signals.
-    // They may work because they use locking and the gh_manager class,
-    // but it might be better to use Qt signals and slots.  In any case,
-    // we should ensure that they are correctly handling the connection
-    // between the interpreter and GUI threads.
+  // The interpreter may call graphics toolkit functions that we
+  // implement here.  The Qt GUI that manages these actions runs in a
+  // separate thread.  So in order to correctly cross from the
+  // interpreter thread to the GUI thread, these functions should emit
+  // signals (in the interpreter thread) that are handled by slots
+  // that will run in the GUI thread.  This design is similar to the
+  // event_manager, interpreter_events, and qt_interpreter_events
+  // classes work to pass messages from the interpreter to the GUI.
+  //
+  // FIXME: currently most of these functions do not emit signals.
+  // They may work because they use locking and the gh_manager class,
+  // but it might be better to use Qt signals and slots.  In any case,
+  // we should ensure that they are correctly handling the connection
+  // between the interpreter and GUI threads.
 
-    bool is_valid () const { return true; }
+  bool is_valid () const { return true; }
 
-    void redraw_figure (const graphics_object& h) const;
+  void redraw_figure (const graphics_object& h) const;
 
-    void show_figure (const graphics_object& h) const;
+  void show_figure (const graphics_object& h) const;
 
-    void update (const graphics_object& obj, int pId);
+  void update (const graphics_object& obj, int pId);
 
-    bool initialize (const graphics_object& obj);
+  bool initialize (const graphics_object& obj);
 
-    void finalize (const graphics_object& obj);
+  void finalize (const graphics_object& obj);
 
-    void print_figure (const graphics_object& go,
-                       const std::string& term,
-                       const std::string& file_cmd,
-                       const std::string& /*debug_file*/) const;
+  void print_figure (const graphics_object& go,
+                     const std::string& term,
+                     const std::string& file_cmd,
+                     const std::string& /*debug_file*/) const;
 
-    uint8NDArray get_pixels (const graphics_object& go) const;
+  uint8NDArray get_pixels (const graphics_object& go) const;
 
-    Matrix get_text_extent (const graphics_object& go) const;
+  Matrix get_text_extent (const graphics_object& go) const;
 
-    static Object * toolkitObject (const graphics_object& go);
+  static Object * toolkitObject (const graphics_object& go);
 
-    static ObjectProxy * toolkitObjectProxy (const graphics_object& go);
+  static ObjectProxy * toolkitObjectProxy (const graphics_object& go);
 
-  signals:
+signals:
 
-    void create_object_signal (double handle);
+  void create_object_signal (double handle);
 
-  public slots:
+public slots:
 
-    void interpreter_event (const octave::fcn_callback& fcn);
-    void interpreter_event (const octave::meth_callback& meth);
+  void interpreter_event (const octave::fcn_callback& fcn);
+  void interpreter_event (const octave::meth_callback& meth);
 
-    void create_object (double handle);
+  void create_object (double handle);
 
-    void gh_callback_event (const graphics_handle& h, const std::string& name);
+  void gh_callback_event (const graphics_handle& h, const std::string& name);
 
-    void gh_callback_event (const graphics_handle& h, const std::string& name,
-                            const octave_value& data);
+  void gh_callback_event (const graphics_handle& h, const std::string& name,
+                          const octave_value& data);
 
-    void gh_set_event (const graphics_handle& h, const std::string& name,
-                       const octave_value& value);
+  void gh_set_event (const graphics_handle& h, const std::string& name,
+                     const octave_value& value);
 
-    void gh_set_event (const graphics_handle& h, const std::string& name,
-                       const octave_value& value, bool notify_toolkit);
+  void gh_set_event (const graphics_handle& h, const std::string& name,
+                     const octave_value& value, bool notify_toolkit);
 
-    void gh_set_event (const graphics_handle& h, const std::string& name,
-                       const octave_value& value, bool notify_toolkit,
-                       bool redraw_figure);
-  private:
+  void gh_set_event (const graphics_handle& h, const std::string& name,
+                     const octave_value& value, bool notify_toolkit,
+                     bool redraw_figure);
+private:
 
-    octave::interpreter& m_interpreter;
-  };
+  octave::interpreter& m_interpreter;
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/src/command-widget.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/command-widget.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -51,292 +51,292 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  command_widget::command_widget (QWidget *p)
-    : QWidget (p), m_incomplete_parse (false),
-      m_prompt (QString ()),
-      m_console (new console (this))
-  {
-    QPushButton *pause_button = new QPushButton (tr("Pause"), this);
-    QPushButton *stop_button = new QPushButton (tr("Stop"), this);
-    QPushButton *resume_button = new QPushButton (tr("Continue"), this);
+command_widget::command_widget (QWidget *p)
+  : QWidget (p), m_incomplete_parse (false),
+    m_prompt (QString ()),
+    m_console (new console (this))
+{
+  QPushButton *pause_button = new QPushButton (tr("Pause"), this);
+  QPushButton *stop_button = new QPushButton (tr("Stop"), this);
+  QPushButton *resume_button = new QPushButton (tr("Continue"), this);
 
-    QGroupBox *input_group_box = new QGroupBox ();
-    QHBoxLayout *input_layout = new QHBoxLayout;
-    input_layout->addWidget (pause_button);
-    input_layout->addWidget (stop_button);
-    input_layout->addWidget (resume_button);
-    input_group_box->setLayout (input_layout);
+  QGroupBox *input_group_box = new QGroupBox ();
+  QHBoxLayout *input_layout = new QHBoxLayout;
+  input_layout->addWidget (pause_button);
+  input_layout->addWidget (stop_button);
+  input_layout->addWidget (resume_button);
+  input_group_box->setLayout (input_layout);
 
-    QVBoxLayout *main_layout = new QVBoxLayout ();
-    main_layout->addWidget (m_console);
-    main_layout->addWidget (input_group_box);
+  QVBoxLayout *main_layout = new QVBoxLayout ();
+  main_layout->addWidget (m_console);
+  main_layout->addWidget (input_group_box);
 
-    setLayout (main_layout);
+  setLayout (main_layout);
 
-    setFocusProxy (m_console);
+  setFocusProxy (m_console);
 
-    connect (pause_button, &QPushButton::clicked,
-             this, &command_widget::interpreter_pause);
+  connect (pause_button, &QPushButton::clicked,
+           this, &command_widget::interpreter_pause);
 
-    connect (resume_button, &QPushButton::clicked,
-             this, &command_widget::interpreter_resume);
+  connect (resume_button, &QPushButton::clicked,
+           this, &command_widget::interpreter_resume);
 
-    connect (stop_button, &QPushButton::clicked,
-             this, &command_widget::interpreter_stop);
+  connect (stop_button, &QPushButton::clicked,
+           this, &command_widget::interpreter_stop);
 
-    connect (this, &command_widget::update_prompt_signal,
-             this, &command_widget::update_prompt);
+  connect (this, &command_widget::update_prompt_signal,
+           this, &command_widget::update_prompt);
 
-    connect (this, &command_widget::new_command_line_signal,
-             m_console, &console::new_command_line);
+  connect (this, &command_widget::new_command_line_signal,
+           m_console, &console::new_command_line);
 
-    connect (m_console, QOverload<const fcn_callback&>::of (&console::interpreter_event),
-             this, QOverload<const fcn_callback&>::of (&command_widget::interpreter_event));
+  connect (m_console, QOverload<const fcn_callback&>::of (&console::interpreter_event),
+           this, QOverload<const fcn_callback&>::of (&command_widget::interpreter_event));
 
-    connect (m_console, QOverload<const meth_callback&>::of (&console::interpreter_event),
-             this, QOverload<const meth_callback&>::of (&command_widget::interpreter_event));
+  connect (m_console, QOverload<const meth_callback&>::of (&console::interpreter_event),
+           this, QOverload<const meth_callback&>::of (&command_widget::interpreter_event));
 
-    insert_interpreter_output ("\n\n    Welcome to Octave\n\n");
+  insert_interpreter_output ("\n\n    Welcome to Octave\n\n");
 
-  }
+}
 
-  void command_widget::init_command_prompt ()
-  {
-    // The interpreter_event callback function below emits a signal.
-    // Because we don't control when that happens, use a guarded pointer
-    // so that the callback can abort if this object is no longer valid.
+void command_widget::init_command_prompt ()
+{
+  // The interpreter_event callback function below emits a signal.
+  // Because we don't control when that happens, use a guarded pointer
+  // so that the callback can abort if this object is no longer valid.
 
-    QPointer<command_widget> this_cw (this);
+  QPointer<command_widget> this_cw (this);
 
-    emit interpreter_event
-      ([=] (interpreter& interp)
-       {
-         // INTERPRETER THREAD
+  emit interpreter_event
+    ([=] (interpreter& interp)
+     {
+       // INTERPRETER THREAD
 
-         // We can skip the entire callback function because it does not
-         // make any changes to the interpreter state.
+       // We can skip the entire callback function because it does not
+       // make any changes to the interpreter state.
 
-         if (this_cw.isNull ())
-           return;
+       if (this_cw.isNull ())
+         return;
 
-         std::string prompt = interp.PS1 ();
-         std::string decoded_prompt
-           = command_editor::decode_prompt_string (prompt);
+       std::string prompt = interp.PS1 ();
+       std::string decoded_prompt
+         = command_editor::decode_prompt_string (prompt);
 
-         emit update_prompt_signal (QString::fromStdString (decoded_prompt));
+       emit update_prompt_signal (QString::fromStdString (decoded_prompt));
 
-         emit new_command_line_signal ();
-       });
-  }
+       emit new_command_line_signal ();
+     });
+}
 
-  void command_widget::update_prompt (const QString& prompt)
-  {
-    m_prompt = prompt;
-  }
+void command_widget::update_prompt (const QString& prompt)
+{
+  m_prompt = prompt;
+}
 
-  QString command_widget::prompt ()
-  {
-    return m_prompt;
-  }
+QString command_widget::prompt ()
+{
+  return m_prompt;
+}
 
-  void command_widget::insert_interpreter_output (const QString& msg)
-  {
-    m_console->append (msg);
-  }
+void command_widget::insert_interpreter_output (const QString& msg)
+{
+  m_console->append (msg);
+}
 
-  void command_widget::process_input_line (const QString& input_line)
-  {
-    // The interpreter_event callback function below emits a signal.
-    // Because we don't control when that happens, use a guarded pointer
-    // so that the callback can abort if this object is no longer valid.
+void command_widget::process_input_line (const QString& input_line)
+{
+  // The interpreter_event callback function below emits a signal.
+  // Because we don't control when that happens, use a guarded pointer
+  // so that the callback can abort if this object is no longer valid.
 
-    QPointer<command_widget> this_cw (this);
+  QPointer<command_widget> this_cw (this);
 
-    emit interpreter_event
-      ([=] (interpreter& interp)
-       {
-         // INTERPRETER THREAD
+  emit interpreter_event
+    ([=] (interpreter& interp)
+     {
+       // INTERPRETER THREAD
 
-         // If THIS_CW is no longer valid, we still want to parse and
-         // execute INPUT_LINE but we can't emit the signals associated
-         // with THIS_CW.
+       // If THIS_CW is no longer valid, we still want to parse and
+       // execute INPUT_LINE but we can't emit the signals associated
+       // with THIS_CW.
 
-         interp.parse_and_execute (input_line.toStdString (),
-                                   m_incomplete_parse);
+       interp.parse_and_execute (input_line.toStdString (),
+                                 m_incomplete_parse);
 
-         if (this_cw.isNull ())
-           return;
+       if (this_cw.isNull ())
+         return;
 
-         std::string prompt
-           = m_incomplete_parse ? interp.PS2 () : interp.PS1 ();
+       std::string prompt
+         = m_incomplete_parse ? interp.PS2 () : interp.PS1 ();
 
-         std::string decoded_prompt
-           = command_editor::decode_prompt_string (prompt);
+       std::string decoded_prompt
+         = command_editor::decode_prompt_string (prompt);
 
-         emit update_prompt_signal (QString::fromStdString (decoded_prompt));
+       emit update_prompt_signal (QString::fromStdString (decoded_prompt));
 
-         emit new_command_line_signal ();
-       });
+       emit new_command_line_signal ();
+     });
 
-  }
+}
 
-  void command_widget::notice_settings ()
-  {
-    gui_settings settings;
+void command_widget::notice_settings ()
+{
+  gui_settings settings;
 
-    // Set terminal font:
-    QFont term_font = QFont ();
-    term_font.setStyleHint (QFont::TypeWriter);
-    QString default_font = settings.string_value (global_mono_font);
-    term_font.setFamily
-      (settings.value (cs_font.settings_key (), default_font).toString ());
-    term_font.setPointSize
-      (settings.int_value (cs_font_size));
+  // Set terminal font:
+  QFont term_font = QFont ();
+  term_font.setStyleHint (QFont::TypeWriter);
+  QString default_font = settings.string_value (global_mono_font);
+  term_font.setFamily
+    (settings.value (cs_font.settings_key (), default_font).toString ());
+  term_font.setPointSize
+    (settings.int_value (cs_font_size));
 
-    m_console->setFont (term_font);
+  m_console->setFont (term_font);
 
-    // Colors
-    int mode = settings.int_value (cs_color_mode);
-    QColor fgc = settings.color_value (cs_colors[0], mode);
-    QColor bgc = settings.color_value (cs_colors[1], mode);
+  // Colors
+  int mode = settings.int_value (cs_color_mode);
+  QColor fgc = settings.color_value (cs_colors[0], mode);
+  QColor bgc = settings.color_value (cs_colors[1], mode);
 
-    m_console->setStyleSheet (QString ("color: %1; background-color:%2;")
-                                     .arg (fgc.name ()).arg (bgc.name ()));
-  }
+  m_console->setStyleSheet (QString ("color: %1; background-color:%2;")
+                                   .arg (fgc.name ()).arg (bgc.name ()));
+}
 
-  // The console itself using QScintilla.
-  // This implementation is partly based on the basic concept of
-  // "qpconsole" as proposed by user "DerManu" in the Qt-forum thread
-  // https://forum.qt.io/topic/28765/command-terminal-using-qtextedit
+// The console itself using QScintilla.
+// This implementation is partly based on the basic concept of
+// "qpconsole" as proposed by user "DerManu" in the Qt-forum thread
+// https://forum.qt.io/topic/28765/command-terminal-using-qtextedit
 
-  console::console (command_widget *p)
-    : QsciScintilla (p),
-      m_command_position (-1),
-      m_cursor_position (0),
-      m_text_changed (false),
-      m_command_widget (p),
-      m_last_key_string (QString ())
-  {
-    setMargins (0);
-    setWrapMode (QsciScintilla::WrapWord);
+console::console (command_widget *p)
+  : QsciScintilla (p),
+    m_command_position (-1),
+    m_cursor_position (0),
+    m_text_changed (false),
+    m_command_widget (p),
+    m_last_key_string (QString ())
+{
+  setMargins (0);
+  setWrapMode (QsciScintilla::WrapWord);
 
-    connect (this, SIGNAL (cursorPositionChanged (int, int)),
-             this, SLOT (cursor_position_changed (int, int)));
+  connect (this, SIGNAL (cursorPositionChanged (int, int)),
+           this, SLOT (cursor_position_changed (int, int)));
 
-    connect (this, SIGNAL (textChanged ()),
-             this, SLOT (text_changed ()));
+  connect (this, SIGNAL (textChanged ()),
+           this, SLOT (text_changed ()));
 
-    connect (this, SIGNAL (modificationAttempted ()),
-             this, SLOT (move_cursor_to_end ()));
-  }
+  connect (this, SIGNAL (modificationAttempted ()),
+           this, SLOT (move_cursor_to_end ()));
+}
 
-  // Prepare a new command line with the current prompt
-  void console::new_command_line (const QString& command)
-  {
-    if (! text (lines () -1).isEmpty ())
-      append ("\n");
+// Prepare a new command line with the current prompt
+void console::new_command_line (const QString& command)
+{
+  if (! text (lines () -1).isEmpty ())
+    append ("\n");
 
-    append_string (m_command_widget->prompt ());
+  append_string (m_command_widget->prompt ());
 
-    int line, index;
-    getCursorPosition (&line,&index);
-    m_command_position = positionFromLineIndex (line, index);
+  int line, index;
+  getCursorPosition (&line,&index);
+  m_command_position = positionFromLineIndex (line, index);
 
-    append_string (command);
-  }
+  append_string (command);
+}
 
-  // Accept the current command line (or block)
-  void console::accept_command_line ()
-  {
-    QString input_line = text (lines () - 1);
+// Accept the current command line (or block)
+void console::accept_command_line ()
+{
+  QString input_line = text (lines () - 1);
 
-    if (input_line.startsWith (m_command_widget->prompt ()))
-      input_line.remove(0, m_command_widget->prompt ().length ());
+  if (input_line.startsWith (m_command_widget->prompt ()))
+    input_line.remove(0, m_command_widget->prompt ().length ());
 
-    input_line = input_line.trimmed ();
+  input_line = input_line.trimmed ();
 
-    append_string ("\n");
+  append_string ("\n");
 
-    if (input_line.isEmpty ())
-      new_command_line ();
-    else
-      m_command_widget->process_input_line (input_line);
-  }
+  if (input_line.isEmpty ())
+    new_command_line ();
+  else
+    m_command_widget->process_input_line (input_line);
+}
 
-  // Execute a command
-  void console::execute_command (const QString& command)
-  {
-    if (command.trimmed ().isEmpty ())
-      return;
+// Execute a command
+void console::execute_command (const QString& command)
+{
+  if (command.trimmed ().isEmpty ())
+    return;
 
-    new_command_line (command);
-    accept_command_line ();
-  }
+  new_command_line (command);
+  accept_command_line ();
+}
 
-  // Append a string and update the curdor püosition
-  void console::append_string (const QString& string)
-  {
-    setReadOnly (false);
-    append (string);
+// Append a string and update the curdor püosition
+void console::append_string (const QString& string)
+{
+  setReadOnly (false);
+  append (string);
 
-    int line, index;
-    lineIndexFromPosition (text ().length (), &line, &index);
+  int line, index;
+  lineIndexFromPosition (text ().length (), &line, &index);
 
-    setCursorPosition (line, index);
-  }
+  setCursorPosition (line, index);
+}
 
-  // Cursor position changed: Are we in the command line or not?
-  void console::cursor_position_changed (int line, int col)
-  {
-    m_cursor_position = positionFromLineIndex (line, col);
-    if (m_cursor_position < m_command_position)
-      {
-        // We are in the read only area
-        if (m_text_changed && (m_cursor_position == m_command_position - 1))
-          {
-            setReadOnly (false);
-            insert (m_command_widget->prompt ().right (1)); // And here we have tried to remove the prompt by Backspace
-            setCursorPosition (line+1, col);
-          }
-        setReadOnly (true);
-      }
-    else
-      setReadOnly (false);  // Writable area
+// Cursor position changed: Are we in the command line or not?
+void console::cursor_position_changed (int line, int col)
+{
+  m_cursor_position = positionFromLineIndex (line, col);
+  if (m_cursor_position < m_command_position)
+    {
+      // We are in the read only area
+      if (m_text_changed && (m_cursor_position == m_command_position - 1))
+        {
+          setReadOnly (false);
+          insert (m_command_widget->prompt ().right (1)); // And here we have tried to remove the prompt by Backspace
+          setCursorPosition (line+1, col);
+        }
+      setReadOnly (true);
+    }
+  else
+    setReadOnly (false);  // Writable area
 
-    m_text_changed = false;
-  }
+  m_text_changed = false;
+}
 
-  // User attempted to type on read only mode: move cursor at end and allow
-  // editing
-  void console::move_cursor_to_end ()
-  {
-    if ((! m_last_key_string.isEmpty ()) && (m_last_key_string.at (0).isPrint ()))
-      {
-        append_string (m_last_key_string);
-        setReadOnly (true); // Avoid that changing read only text is done afterwards
-      }
-  }
+// User attempted to type on read only mode: move cursor at end and allow
+// editing
+void console::move_cursor_to_end ()
+{
+  if ((! m_last_key_string.isEmpty ()) && (m_last_key_string.at (0).isPrint ()))
+    {
+      append_string (m_last_key_string);
+      setReadOnly (true); // Avoid that changing read only text is done afterwards
+    }
+}
 
-  // Text has changed: is cursor still in "writable" area?
-  // This signal seems to be emitted before cursor position changed.
-  void console::text_changed ()
-  {
-    m_text_changed = true;
-  }
+// Text has changed: is cursor still in "writable" area?
+// This signal seems to be emitted before cursor position changed.
+void console::text_changed ()
+{
+  m_text_changed = true;
+}
 
-  // Re-implement key event
-  void console::keyPressEvent (QKeyEvent *e)
-  {
-    if (e->key () == Qt::Key_Return)
-      // On "return", accept the current command line
-      accept_command_line ();
-    else
-      {
-        // Otherwise, store text process the expected event
-        m_last_key_string = e->text ();
-        QsciScintilla::keyPressEvent(e);
-      }
-  }
+// Re-implement key event
+void console::keyPressEvent (QKeyEvent *e)
+{
+  if (e->key () == Qt::Key_Return)
+    // On "return", accept the current command line
+    accept_command_line ();
+  else
+    {
+      // Otherwise, store text process the expected event
+      m_last_key_string = e->text ();
+      QsciScintilla::keyPressEvent(e);
+    }
+}
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/src/command-widget.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/command-widget.h	Thu Feb 02 12:25:51 2023 -0800
@@ -40,95 +40,95 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class command_widget;
+class command_widget;
 
-  class console : public QsciScintilla
-  {
-    Q_OBJECT
+class console : public QsciScintilla
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    console (command_widget *p);
+  console (command_widget *p);
 
-  signals:
+signals:
 
-    void interpreter_event (const fcn_callback& fcn);
-    void interpreter_event (const meth_callback& meth);
+  void interpreter_event (const fcn_callback& fcn);
+  void interpreter_event (const meth_callback& meth);
 
-  public slots:
+public slots:
 
-    void cursor_position_changed (int line, int col);
+  void cursor_position_changed (int line, int col);
 
-    void text_changed ();
+  void text_changed ();
 
-    void move_cursor_to_end ();
+  void move_cursor_to_end ();
 
-    void new_command_line (const QString& command = QString ());
+  void new_command_line (const QString& command = QString ());
 
-    void execute_command (const QString& command);
+  void execute_command (const QString& command);
 
-  protected:
+protected:
 
-    void keyPressEvent (QKeyEvent *e);
+  void keyPressEvent (QKeyEvent *e);
 
-  private:
+private:
 
-    void append_string (const QString& string);
+  void append_string (const QString& string);
 
-    void accept_command_line ();
+  void accept_command_line ();
 
-    int m_command_position;
-    int m_cursor_position;
-    bool m_text_changed;
-    command_widget *m_command_widget;
-    QString m_last_key_string;
+  int m_command_position;
+  int m_cursor_position;
+  bool m_text_changed;
+  command_widget *m_command_widget;
+  QString m_last_key_string;
 
-  };
+};
 
-  class command_widget : public QWidget
-  {
-    Q_OBJECT
+class command_widget : public QWidget
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    command_widget (QWidget *p);
+  command_widget (QWidget *p);
 
-    console * get_console ( ) { return m_console; };
+  console * get_console ( ) { return m_console; };
 
-    void init_command_prompt ();
+  void init_command_prompt ();
 
-    QString prompt ();
+  QString prompt ();
 
-  signals:
+signals:
 
-    void clear_line_edit ();
+  void clear_line_edit ();
 
-    void interpreter_pause ();
-    void interpreter_resume ();
-    void interpreter_stop ();
+  void interpreter_pause ();
+  void interpreter_resume ();
+  void interpreter_stop ();
 
-    void update_prompt_signal (const QString& prompt);
-    void new_command_line_signal (const QString& command = QString ());
+  void update_prompt_signal (const QString& prompt);
+  void new_command_line_signal (const QString& command = QString ());
 
-    void interpreter_event (const fcn_callback& fcn);
-    void interpreter_event (const meth_callback& meth);
+  void interpreter_event (const fcn_callback& fcn);
+  void interpreter_event (const meth_callback& meth);
 
-  public slots:
+public slots:
 
-    void process_input_line (const QString& input_line);
+  void process_input_line (const QString& input_line);
 
-    void update_prompt (const QString& prompt);
+  void update_prompt (const QString& prompt);
 
-    void insert_interpreter_output (const QString& msg);
+  void insert_interpreter_output (const QString& msg);
 
-    void notice_settings ();
+  void notice_settings ();
 
-  private:
+private:
 
-    bool m_incomplete_parse;
-    QString m_prompt;
-    console *m_console;
-  };
+  bool m_incomplete_parse;
+  QString m_prompt;
+  console *m_console;
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/src/community-news.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/community-news.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -40,94 +40,94 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  community_news::community_news (int serial)
-    : QWidget (nullptr), m_browser (nullptr)
-  {
-    construct ("https://octave.org", "community-news.html", serial);
-  }
+community_news::community_news (int serial)
+  : QWidget (nullptr), m_browser (nullptr)
+{
+  construct ("https://octave.org", "community-news.html", serial);
+}
 
-  community_news::community_news (QWidget *parent, const QString& base_url,
-                                  const QString& page, int serial)
-    : QWidget (parent), m_browser (nullptr)
-  {
-    construct (base_url, page, serial);
-  }
+community_news::community_news (QWidget *parent, const QString& base_url,
+                                const QString& page, int serial)
+  : QWidget (parent), m_browser (nullptr)
+{
+  construct (base_url, page, serial);
+}
 
-  void community_news::construct (const QString& base_url, const QString& page,
-                                  int serial)
-  {
-    m_browser = new QTextBrowser (this);
+void community_news::construct (const QString& base_url, const QString& page,
+                                int serial)
+{
+  m_browser = new QTextBrowser (this);
 
-    m_browser->setObjectName ("OctaveNews");
-    m_browser->setOpenExternalLinks (true);
+  m_browser->setObjectName ("OctaveNews");
+  m_browser->setOpenExternalLinks (true);
 
-    QVBoxLayout *vlayout = new QVBoxLayout;
+  QVBoxLayout *vlayout = new QVBoxLayout;
 
-    vlayout->addWidget (m_browser);
+  vlayout->addWidget (m_browser);
 
-    setLayout (vlayout);
-    setWindowTitle (tr ("Octave Community News"));
+  setLayout (vlayout);
+  setWindowTitle (tr ("Octave Community News"));
 
-    int win_x, win_y;
-    get_screen_geometry (win_x, win_y);
+  int win_x, win_y;
+  get_screen_geometry (win_x, win_y);
 
-    resize (win_x/2, win_y/2);
-    move ((win_x - width ())/2, (win_y - height ())/2);
+  resize (win_x/2, win_y/2);
+  move ((win_x - width ())/2, (win_y - height ())/2);
 
-    gui_settings settings;
+  gui_settings settings;
 
-    QString icon;
-    QString icon_set = settings.string_value (dw_icon_set);
-    if (icon_set != "NONE")
-      // No extra icon for Community news, take the one of the release notes
-      icon = dw_icon_set_names[icon_set] + "ReleaseWidget.png";
-    else
-      icon = dw_icon_set_names[icon_set];
+  QString icon;
+  QString icon_set = settings.string_value (dw_icon_set);
+  if (icon_set != "NONE")
+    // No extra icon for Community news, take the one of the release notes
+    icon = dw_icon_set_names[icon_set] + "ReleaseWidget.png";
+  else
+    icon = dw_icon_set_names[icon_set];
 
-    setWindowIcon (QIcon (icon));
+  setWindowIcon (QIcon (icon));
 
-    // FIXME: This is a news reader preference, so shouldn't it be used
-    // in the news_reader object?
+  // FIXME: This is a news reader preference, so shouldn't it be used
+  // in the news_reader object?
 
-    bool connect_to_web = settings.bool_value (nr_allow_connection);
+  bool connect_to_web = settings.bool_value (nr_allow_connection);
 
-    QThread *worker_thread = new QThread;
+  QThread *worker_thread = new QThread;
 
-    news_reader *reader
-      = new news_reader (base_url, page, serial, connect_to_web);
+  news_reader *reader
+    = new news_reader (base_url, page, serial, connect_to_web);
 
-    reader->moveToThread (worker_thread);
+  reader->moveToThread (worker_thread);
 
-    connect (reader, &news_reader::display_news_signal,
-             this, &community_news::set_news);
+  connect (reader, &news_reader::display_news_signal,
+           this, &community_news::set_news);
 
-    connect (worker_thread, &QThread::started,
-             reader, &news_reader::process);
+  connect (worker_thread, &QThread::started,
+           reader, &news_reader::process);
 
-    connect (reader, &news_reader::finished, worker_thread, &QThread::quit);
+  connect (reader, &news_reader::finished, worker_thread, &QThread::quit);
 
-    connect (reader, &news_reader::finished, reader, &news_reader::deleteLater);
+  connect (reader, &news_reader::finished, reader, &news_reader::deleteLater);
 
-    connect (worker_thread, &QThread::finished,
-             worker_thread, &QThread::deleteLater);
+  connect (worker_thread, &QThread::finished,
+           worker_thread, &QThread::deleteLater);
 
-    worker_thread->start ();
-  }
+  worker_thread->start ();
+}
 
-  void community_news::set_news (const QString& news)
-  {
-    m_browser->setHtml (news);
-  }
+void community_news::set_news (const QString& news)
+{
+  m_browser->setHtml (news);
+}
 
-  void community_news::display ()
-  {
-    if (! isVisible ())
-      show ();
-    else if (isMinimized ())
-      showNormal ();
+void community_news::display ()
+{
+  if (! isVisible ())
+    show ();
+  else if (isMinimized ())
+    showNormal ();
 
-    raise ();
-    activateWindow ();
-  }
+  raise ();
+  activateWindow ();
+}
 
 OCTAVE_END_NAMESPACE(octave)
--- a/libgui/src/community-news.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/community-news.h	Thu Feb 02 12:25:51 2023 -0800
@@ -33,33 +33,33 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class community_news : public QWidget
-  {
-    Q_OBJECT
+class community_news : public QWidget
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    community_news (int serial);
+  community_news (int serial);
 
-    community_news (QWidget *parent = nullptr,
-                    const QString& base_url = "https://octave.org",
-                    const QString& page = "community-news.html",
-                    int serial = -1);
+  community_news (QWidget *parent = nullptr,
+                  const QString& base_url = "https://octave.org",
+                  const QString& page = "community-news.html",
+                  int serial = -1);
 
-    ~community_news () = default;
+  ~community_news () = default;
 
-  public slots:
+public slots:
 
-    void set_news (const QString& news);
+  void set_news (const QString& news);
 
-    void display ();
+  void display ();
 
-  private:
+private:
 
-    void construct (const QString& base_url, const QString& page, int serial);
+  void construct (const QString& base_url, const QString& page, int serial);
 
-    QTextBrowser *m_browser;
-  };
+  QTextBrowser *m_browser;
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/src/dialog.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/dialog.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -47,653 +47,653 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  QUIWidgetCreator::QUIWidgetCreator ()
-    : QObject (), m_dialog_result (-1), m_dialog_button (),
-      m_string_list (), m_list_index (), m_path_name ()
-  {
-    connect (this, &QUIWidgetCreator::create_dialog,
-             this, &QUIWidgetCreator::handle_create_dialog);
+QUIWidgetCreator::QUIWidgetCreator ()
+  : QObject (), m_dialog_result (-1), m_dialog_button (),
+    m_string_list (), m_list_index (), m_path_name ()
+{
+  connect (this, &QUIWidgetCreator::create_dialog,
+           this, &QUIWidgetCreator::handle_create_dialog);
 
-    connect (this, &QUIWidgetCreator::create_listview,
-             this, &QUIWidgetCreator::handle_create_listview);
+  connect (this, &QUIWidgetCreator::create_listview,
+           this, &QUIWidgetCreator::handle_create_listview);
 
-    connect (this, &QUIWidgetCreator::create_inputlayout,
-             this, &QUIWidgetCreator::handle_create_inputlayout);
+  connect (this, &QUIWidgetCreator::create_inputlayout,
+           this, &QUIWidgetCreator::handle_create_inputlayout);
 
-    connect (this, &QUIWidgetCreator::create_filedialog,
-             this, &QUIWidgetCreator::handle_create_filedialog);
-  }
+  connect (this, &QUIWidgetCreator::create_filedialog,
+           this, &QUIWidgetCreator::handle_create_filedialog);
+}
 
-  QString QUIWidgetCreator::rm_amp (const QString& text)
-  {
-    QString text_wo_amp = text;
-    text_wo_amp.replace (QRegExp ("&(\\w)"), "\\1");
-    return text_wo_amp;
-  }
+QString QUIWidgetCreator::rm_amp (const QString& text)
+{
+  QString text_wo_amp = text;
+  text_wo_amp.replace (QRegExp ("&(\\w)"), "\\1");
+  return text_wo_amp;
+}
 
-  QString QUIWidgetCreator::message_dialog (const QString& message,
-                                            const QString& title,
-                                            const QString& icon,
-                                            const QStringList& buttons,
-                                            const QString& defbutton,
-                                            const QStringList& role)
-  {
-    QMutexLocker autolock (&m_mutex);
+QString QUIWidgetCreator::message_dialog (const QString& message,
+                                          const QString& title,
+                                          const QString& icon,
+                                          const QStringList& buttons,
+                                          const QString& defbutton,
+                                          const QStringList& role)
+{
+  QMutexLocker autolock (&m_mutex);
 
-    // Store button text before a window-manager adds accelerators.
+  // Store button text before a window-manager adds accelerators.
 
-    m_button_list = buttons;
+  m_button_list = buttons;
 
-    // Use the last button in the list as the reject result, i.e., when
-    // no button is pressed such as in the case of the upper right close
-    // tab.
-    if (! buttons.isEmpty ())
-      m_dialog_button = buttons.last ();
+  // Use the last button in the list as the reject result, i.e., when
+  // no button is pressed such as in the case of the upper right close
+  // tab.
+  if (! buttons.isEmpty ())
+    m_dialog_button = buttons.last ();
 
-    QString xicon = icon;
-    if (xicon.isEmpty ())
-      xicon = "none";
+  QString xicon = icon;
+  if (xicon.isEmpty ())
+    xicon = "none";
 
-    emit create_dialog (message, title, xicon, buttons, defbutton, role);
+  emit create_dialog (message, title, xicon, buttons, defbutton, role);
 
-    // Wait while the user is responding to message box.
-    wait ();
+  // Wait while the user is responding to message box.
+  wait ();
 
-    // The GUI has sent a signal and the thread has been awakened.
-    return m_dialog_button;
-  };
+  // The GUI has sent a signal and the thread has been awakened.
+  return m_dialog_button;
+};
 
-  QPair<QIntList, int>
-  QUIWidgetCreator::list_dialog (const QStringList& list, const QString& mode,
-                                 int wd, int ht, const QList<int>& initial,
-                                 const QString& name,
-                                 const QStringList& prompt,
-                                 const QString& ok_string,
-                                 const QString& cancel_string)
-  {
-    if (list.isEmpty ())
-      return QPair<QIntList, int> ();
+QPair<QIntList, int>
+QUIWidgetCreator::list_dialog (const QStringList& list, const QString& mode,
+                               int wd, int ht, const QList<int>& initial,
+                               const QString& name,
+                               const QStringList& prompt,
+                               const QString& ok_string,
+                               const QString& cancel_string)
+{
+  if (list.isEmpty ())
+    return QPair<QIntList, int> ();
 
-    QMutexLocker autolock (&m_mutex);
+  QMutexLocker autolock (&m_mutex);
 
-    emit create_listview (list, mode, wd, ht, initial, name,
-                          prompt, ok_string, cancel_string);
+  emit create_listview (list, mode, wd, ht, initial, name,
+                        prompt, ok_string, cancel_string);
 
-    // Wait while the user is responding to message box.
-    wait ();
+  // Wait while the user is responding to message box.
+  wait ();
 
-    // The GUI has sent a signal and the thread has been awakened.
-    return QPair<QIntList, int> (m_list_index, m_dialog_result);
-  };
+  // The GUI has sent a signal and the thread has been awakened.
+  return QPair<QIntList, int> (m_list_index, m_dialog_result);
+};
 
-  // Create a message dialog with specified string, buttons and
-  // decorative text.
+// Create a message dialog with specified string, buttons and
+// decorative text.
 
-  QStringList QUIWidgetCreator::input_dialog (const QStringList& prompt,
-                                              const QString& title,
-                                              const QFloatList& nr,
-                                              const QFloatList& nc,
-                                              const QStringList& defaults)
-  {
-    if (prompt.isEmpty ())
-      return QStringList ();
+QStringList QUIWidgetCreator::input_dialog (const QStringList& prompt,
+                                            const QString& title,
+                                            const QFloatList& nr,
+                                            const QFloatList& nc,
+                                            const QStringList& defaults)
+{
+  if (prompt.isEmpty ())
+    return QStringList ();
 
-    QMutexLocker autolock (&m_mutex);
+  QMutexLocker autolock (&m_mutex);
 
-    emit create_inputlayout (prompt, title, nr, nc, defaults);
+  emit create_inputlayout (prompt, title, nr, nc, defaults);
 
-    // Wait while the user is responding to message box.
-    wait ();
+  // Wait while the user is responding to message box.
+  wait ();
 
-    // The GUI has sent a signal and the thread has been awakened.
-    return m_string_list;
-  };
+  // The GUI has sent a signal and the thread has been awakened.
+  return m_string_list;
+};
 
-  QStringList QUIWidgetCreator::file_dialog (const QStringList& filters,
-                                             const QString& title,
-                                             const QString& filename,
-                                             const QString& dirname,
-                                             const QString& multimode)
-  {
-    QMutexLocker autolock (&m_mutex);
+QStringList QUIWidgetCreator::file_dialog (const QStringList& filters,
+                                           const QString& title,
+                                           const QString& filename,
+                                           const QString& dirname,
+                                           const QString& multimode)
+{
+  QMutexLocker autolock (&m_mutex);
 
-    emit create_filedialog (filters, title, filename, dirname, multimode);
+  emit create_filedialog (filters, title, filename, dirname, multimode);
 
-    // Wait while the user is responding to dialog.
-    wait ();
+  // Wait while the user is responding to dialog.
+  wait ();
 
-    // The GUI has sent a signal and the thread has been awakened.
-    // Add all the file dialog results to a string list.
-    QStringList retval;
-    retval << m_string_list
-           << m_path_name
-           << QString::number (m_dialog_result);
+  // The GUI has sent a signal and the thread has been awakened.
+  // Add all the file dialog results to a string list.
+  QStringList retval;
+  retval << m_string_list
+         << m_path_name
+         << QString::number (m_dialog_result);
 
-    return retval;
-  }
+  return retval;
+}
 
-  void QUIWidgetCreator::handle_create_dialog (const QString& message,
-                                               const QString& title,
-                                               const QString& icon,
-                                               const QStringList& button,
-                                               const QString& defbutton,
-                                               const QStringList& role)
-  {
-    MessageDialog *message_dialog
-      = new MessageDialog (message, title, icon, button, defbutton, role);
+void QUIWidgetCreator::handle_create_dialog (const QString& message,
+                                             const QString& title,
+                                             const QString& icon,
+                                             const QStringList& button,
+                                             const QString& defbutton,
+                                             const QStringList& role)
+{
+  MessageDialog *message_dialog
+    = new MessageDialog (message, title, icon, button, defbutton, role);
 
-    connect (message_dialog, &MessageDialog::buttonClicked,
-             this, &QUIWidgetCreator::dialog_button_clicked);
+  connect (message_dialog, &MessageDialog::buttonClicked,
+           this, &QUIWidgetCreator::dialog_button_clicked);
 
-    message_dialog->setAttribute (Qt::WA_DeleteOnClose);
-    message_dialog->show ();
-  }
+  message_dialog->setAttribute (Qt::WA_DeleteOnClose);
+  message_dialog->show ();
+}
 
-  void QUIWidgetCreator::dialog_button_clicked (QAbstractButton *button)
-  {
-    // button is NULL when dialog is closed.
-    if (button)
-      {
-        // Check for a matching button text while ignoring accelerators
-        // because the window manager may have added one in the passed
-        // button.
+void QUIWidgetCreator::dialog_button_clicked (QAbstractButton *button)
+{
+  // button is NULL when dialog is closed.
+  if (button)
+    {
+      // Check for a matching button text while ignoring accelerators
+      // because the window manager may have added one in the passed
+      // button.
 
-        QString text_clean = rm_amp (button->text ());
+      QString text_clean = rm_amp (button->text ());
 
-        for (int i = 0; i < m_button_list.count (); i++)
-          {
-            if (rm_amp (m_button_list.at (i)) == text_clean)
-              {
-                // Text w/o extra accelerator.
-                m_dialog_button = m_button_list.at (i);
-                break;
-              }
-          }
-      }
+      for (int i = 0; i < m_button_list.count (); i++)
+        {
+          if (rm_amp (m_button_list.at (i)) == text_clean)
+            {
+              // Text w/o extra accelerator.
+              m_dialog_button = m_button_list.at (i);
+              break;
+            }
+        }
+    }
 
-    // The value should always be 1 for the Octave functions.
-    m_dialog_result = 1;
+  // The value should always be 1 for the Octave functions.
+  m_dialog_result = 1;
 
-    // Wake up Octave process so that it continues.
-    wake_all ();
-  }
+  // Wake up Octave process so that it continues.
+  wake_all ();
+}
 
-  // Create a list dialog with specified list, initially selected, mode,
-  // view size and decorative text.
+// Create a list dialog with specified list, initially selected, mode,
+// view size and decorative text.
 
-  void QUIWidgetCreator::handle_create_listview (const QStringList& list,
-                                                 const QString& mode,
-                                                 int wd, int ht,
-                                                 const QIntList& initial,
-                                                 const QString& name,
-                                                 const QStringList& prompt,
-                                                 const QString& ok_string,
-                                                 const QString& cancel_string)
-  {
-    ListDialog *list_dialog
-      = new ListDialog (list, mode, wd, ht, initial,
-                        name, prompt, ok_string, cancel_string);
+void QUIWidgetCreator::handle_create_listview (const QStringList& list,
+                                               const QString& mode,
+                                               int wd, int ht,
+                                               const QIntList& initial,
+                                               const QString& name,
+                                               const QStringList& prompt,
+                                               const QString& ok_string,
+                                               const QString& cancel_string)
+{
+  ListDialog *list_dialog
+    = new ListDialog (list, mode, wd, ht, initial,
+                      name, prompt, ok_string, cancel_string);
 
-    connect (list_dialog, &ListDialog::finish_selection,
-             this, &QUIWidgetCreator::list_select_finished);
+  connect (list_dialog, &ListDialog::finish_selection,
+           this, &QUIWidgetCreator::list_select_finished);
 
-    list_dialog->setAttribute (Qt::WA_DeleteOnClose);
-    list_dialog->show ();
-  }
+  list_dialog->setAttribute (Qt::WA_DeleteOnClose);
+  list_dialog->show ();
+}
 
-  void QUIWidgetCreator::list_select_finished (const QIntList& selected,
-                                               int button_pressed)
-  {
-    // Store the value so that builtin functions can retrieve.
+void QUIWidgetCreator::list_select_finished (const QIntList& selected,
+                                             int button_pressed)
+{
+  // Store the value so that builtin functions can retrieve.
 
-    m_list_index = selected;
-    m_dialog_result = button_pressed;
+  m_list_index = selected;
+  m_dialog_result = button_pressed;
 
-    // Wake up Octave process so that it continues.
-    wake_all ();
-  }
+  // Wake up Octave process so that it continues.
+  wake_all ();
+}
 
-  // Create an input dialog with specified prompts and defaults, title
-  // and row/column size specifications.
+// Create an input dialog with specified prompts and defaults, title
+// and row/column size specifications.
 
-  void QUIWidgetCreator::handle_create_inputlayout (const QStringList& prompt,
-                                                    const QString& title,
-                                                    const QFloatList& nr,
-                                                    const QFloatList& nc,
-                                                    const QStringList& defaults)
-  {
-    InputDialog *input_dialog
-      = new InputDialog (prompt, title, nr, nc, defaults);
+void QUIWidgetCreator::handle_create_inputlayout (const QStringList& prompt,
+                                                  const QString& title,
+                                                  const QFloatList& nr,
+                                                  const QFloatList& nc,
+                                                  const QStringList& defaults)
+{
+  InputDialog *input_dialog
+    = new InputDialog (prompt, title, nr, nc, defaults);
 
-    connect (input_dialog, &InputDialog::finish_input,
-             this, &QUIWidgetCreator::input_finished);
+  connect (input_dialog, &InputDialog::finish_input,
+           this, &QUIWidgetCreator::input_finished);
 
-    input_dialog->setAttribute (Qt::WA_DeleteOnClose);
-    input_dialog->show ();
-  }
+  input_dialog->setAttribute (Qt::WA_DeleteOnClose);
+  input_dialog->show ();
+}
 
-  void QUIWidgetCreator::input_finished (const QStringList& input,
-                                         int button_pressed)
-  {
-    // Store the value so that builtin functions can retrieve.
+void QUIWidgetCreator::input_finished (const QStringList& input,
+                                       int button_pressed)
+{
+  // Store the value so that builtin functions can retrieve.
 
-    m_string_list = input;
-    m_dialog_result = button_pressed;
+  m_string_list = input;
+  m_dialog_result = button_pressed;
 
-    // Wake up Octave process so that it continues.
-    wake_all ();
-  }
+  // Wake up Octave process so that it continues.
+  wake_all ();
+}
 
-  void QUIWidgetCreator::handle_create_filedialog (const QStringList& filters,
-                                                   const QString& title,
-                                                   const QString& filename,
-                                                   const QString& dirname,
-                                                   const QString& multimode)
-  {
-    FileDialog *file_dialog
-      = new FileDialog (filters, title, filename, dirname, multimode);
+void QUIWidgetCreator::handle_create_filedialog (const QStringList& filters,
+                                                 const QString& title,
+                                                 const QString& filename,
+                                                 const QString& dirname,
+                                                 const QString& multimode)
+{
+  FileDialog *file_dialog
+    = new FileDialog (filters, title, filename, dirname, multimode);
 
-    connect (file_dialog, &FileDialog::finish_input,
-             this, &QUIWidgetCreator::filedialog_finished);
+  connect (file_dialog, &FileDialog::finish_input,
+           this, &QUIWidgetCreator::filedialog_finished);
 
-    file_dialog->setAttribute (Qt::WA_DeleteOnClose);
-    file_dialog->show ();
-  }
+  file_dialog->setAttribute (Qt::WA_DeleteOnClose);
+  file_dialog->show ();
+}
 
-  void QUIWidgetCreator::filedialog_finished (const QStringList& files,
-                                              const QString& path,
-                                              int filterindex)
-  {
-    // Store the value so that builtin functions can retrieve.
+void QUIWidgetCreator::filedialog_finished (const QStringList& files,
+                                            const QString& path,
+                                            int filterindex)
+{
+  // Store the value so that builtin functions can retrieve.
 
-    m_string_list = files;
-    m_dialog_result = filterindex;
-    m_path_name = path;
+  m_string_list = files;
+  m_dialog_result = filterindex;
+  m_path_name = path;
 
-    // Wake up Octave process so that it continues.
-    wake_all ();
-  }
+  // Wake up Octave process so that it continues.
+  wake_all ();
+}
 
-  MessageDialog::MessageDialog (const QString& message,
-                                const QString& title, const QString& qsicon,
-                                const QStringList& qsbutton,
-                                const QString& defbutton,
-                                const QStringList& role)
-    : QMessageBox (QMessageBox::NoIcon, title.isEmpty () ? " " : title,
-                   message)
-  {
-    // Create a NonModal message.
-    setWindowModality (Qt::NonModal);
+MessageDialog::MessageDialog (const QString& message,
+                              const QString& title, const QString& qsicon,
+                              const QStringList& qsbutton,
+                              const QString& defbutton,
+                              const QStringList& role)
+  : QMessageBox (QMessageBox::NoIcon, title.isEmpty () ? " " : title,
+                 message)
+{
+  // Create a NonModal message.
+  setWindowModality (Qt::NonModal);
 
-    // Interpret the icon string, because enumeration QMessageBox::Icon can't
-    // easily be made to pass through a signal.
+  // Interpret the icon string, because enumeration QMessageBox::Icon can't
+  // easily be made to pass through a signal.
 
-    QMessageBox::Icon eicon = QMessageBox::NoIcon;
+  QMessageBox::Icon eicon = QMessageBox::NoIcon;
 
-    if (qsicon == "error")
-      eicon = QMessageBox::Critical;
-    else if (qsicon == "warn")
-      eicon = QMessageBox::Warning;
-    else if (qsicon == "help")
-      eicon = QMessageBox::Information;
-    else if (qsicon == "quest")
-      eicon = QMessageBox::Question;
+  if (qsicon == "error")
+    eicon = QMessageBox::Critical;
+  else if (qsicon == "warn")
+    eicon = QMessageBox::Warning;
+  else if (qsicon == "help")
+    eicon = QMessageBox::Information;
+  else if (qsicon == "quest")
+    eicon = QMessageBox::Question;
 
-    setIcon (eicon);
+  setIcon (eicon);
 
-    int N = (qsbutton.size () < role.size () ? qsbutton.size () : role.size ());
+  int N = (qsbutton.size () < role.size () ? qsbutton.size () : role.size ());
 
-    if (N == 0)
-      addButton (QMessageBox::Ok);
-    else
-      {
-        for (int i = 0; i < N; i++)
-          {
-            // Interpret the button role string, because enumeration
-            // QMessageBox::ButtonRole can't be made to pass through a
-            // signal.
+  if (N == 0)
+    addButton (QMessageBox::Ok);
+  else
+    {
+      for (int i = 0; i < N; i++)
+        {
+          // Interpret the button role string, because enumeration
+          // QMessageBox::ButtonRole can't be made to pass through a
+          // signal.
 
-            QString srole = role.at (i);
-            QMessageBox::ButtonRole erole = QMessageBox::InvalidRole;
-            if (srole == "ResetRole")
-              erole = QMessageBox::ResetRole;
-            else if (srole == "YesRole")
-              erole = QMessageBox::YesRole;
-            else if (srole == "NoRole")
-              erole = QMessageBox::NoRole;
-            else if (srole == "RejectRole")
-              erole = QMessageBox::RejectRole;
-            else if (srole == "AcceptRole")
-              erole = QMessageBox::AcceptRole;
+          QString srole = role.at (i);
+          QMessageBox::ButtonRole erole = QMessageBox::InvalidRole;
+          if (srole == "ResetRole")
+            erole = QMessageBox::ResetRole;
+          else if (srole == "YesRole")
+            erole = QMessageBox::YesRole;
+          else if (srole == "NoRole")
+            erole = QMessageBox::NoRole;
+          else if (srole == "RejectRole")
+            erole = QMessageBox::RejectRole;
+          else if (srole == "AcceptRole")
+            erole = QMessageBox::AcceptRole;
 
-            QPushButton *pbutton = addButton (qsbutton.at (i), erole);
-            if (qsbutton.at (i) == defbutton)
-              setDefaultButton (pbutton);
+          QPushButton *pbutton = addButton (qsbutton.at (i), erole);
+          if (qsbutton.at (i) == defbutton)
+            setDefaultButton (pbutton);
 
-            // Make the last button the button pressed when <esc> key activated.
-            if (i == N-1)
-              {
-                // FIXME: Why define and then immediately test value?
+          // Make the last button the button pressed when <esc> key activated.
+          if (i == N-1)
+            {
+              // FIXME: Why define and then immediately test value?
 #define ACTIVE_ESCAPE 1
 #if ACTIVE_ESCAPE
-                setEscapeButton (pbutton);
+              setEscapeButton (pbutton);
 #else
-                setEscapeButton (0);
+              setEscapeButton (0);
 #endif
 #undef ACTIVE_ESCAPE
-              }
-          }
-      }
-  }
+            }
+        }
+    }
+}
 
-  ListDialog::ListDialog (const QStringList& list,
-                          const QString& mode, int wd, int ht,
-                          const QList<int>& initial, const QString& title,
-                          const QStringList& prompt,
-                          const QString& ok_string,
-                          const QString& cancel_string)
-    : QDialog (), m_model (new QStringListModel (list, this))
-  {
-    QListView *view = new QListView;
-    view->setModel (m_model);
+ListDialog::ListDialog (const QStringList& list,
+                        const QString& mode, int wd, int ht,
+                        const QList<int>& initial, const QString& title,
+                        const QStringList& prompt,
+                        const QString& ok_string,
+                        const QString& cancel_string)
+  : QDialog (), m_model (new QStringListModel (list, this))
+{
+  QListView *view = new QListView;
+  view->setModel (m_model);
 
-    if (mode == "single")
-      view->setSelectionMode (QAbstractItemView::SingleSelection);
-    else if (mode == "multiple")
-      view->setSelectionMode (QAbstractItemView::ExtendedSelection);
-    else
-      view->setSelectionMode (QAbstractItemView::NoSelection);
+  if (mode == "single")
+    view->setSelectionMode (QAbstractItemView::SingleSelection);
+  else if (mode == "multiple")
+    view->setSelectionMode (QAbstractItemView::ExtendedSelection);
+  else
+    view->setSelectionMode (QAbstractItemView::NoSelection);
 
-    selector = view->selectionModel ();
-    for (int i = 0; i < initial.count(); i++)
-      {
-        QModelIndex idx = m_model->index (initial.value (i) - 1, 0,
-                                          QModelIndex ());
-        selector->select (idx, QItemSelectionModel::Select);
-      }
+  selector = view->selectionModel ();
+  for (int i = 0; i < initial.count(); i++)
+    {
+      QModelIndex idx = m_model->index (initial.value (i) - 1, 0,
+                                        QModelIndex ());
+      selector->select (idx, QItemSelectionModel::Select);
+    }
 
-    bool fixed_layout = false;
-    if (wd > 0 && ht > 0)
-      {
-        view->setFixedSize (wd, ht);
-        fixed_layout = true;
-      }
+  bool fixed_layout = false;
+  if (wd > 0 && ht > 0)
+    {
+      view->setFixedSize (wd, ht);
+      fixed_layout = true;
+    }
 
-    view->setEditTriggers (QAbstractItemView::NoEditTriggers);
+  view->setEditTriggers (QAbstractItemView::NoEditTriggers);
 
-    QVBoxLayout *listLayout = new QVBoxLayout;
-    if (! prompt.isEmpty ())
-      {
-        // Note: Assume html-like Rich Text.
-        // Check for future incompatibilities if any.
-        QString prompt_string;
-        prompt_string.append (prompt.at (0));
-        for (int j = 1; j < prompt.length (); j++)
-          {
-            prompt_string.append ("<br>");
-            prompt_string.append (prompt.at (j));
-          }
-        QLabel *plabel = new QLabel (prompt_string);
-        plabel->setTextFormat (Qt::RichText);
-        listLayout->addWidget (plabel);
-      }
-    listLayout->addWidget (view);
-    QPushButton *select_all = new QPushButton (tr ("Select All"));
-    select_all->setVisible (mode == "multiple");
-    listLayout->addWidget (select_all);
+  QVBoxLayout *listLayout = new QVBoxLayout;
+  if (! prompt.isEmpty ())
+    {
+      // Note: Assume html-like Rich Text.
+      // Check for future incompatibilities if any.
+      QString prompt_string;
+      prompt_string.append (prompt.at (0));
+      for (int j = 1; j < prompt.length (); j++)
+        {
+          prompt_string.append ("<br>");
+          prompt_string.append (prompt.at (j));
+        }
+      QLabel *plabel = new QLabel (prompt_string);
+      plabel->setTextFormat (Qt::RichText);
+      listLayout->addWidget (plabel);
+    }
+  listLayout->addWidget (view);
+  QPushButton *select_all = new QPushButton (tr ("Select All"));
+  select_all->setVisible (mode == "multiple");
+  listLayout->addWidget (select_all);
 
-    QPushButton *buttonOk = new QPushButton (ok_string);
-    QPushButton *buttonCancel = new QPushButton (cancel_string);
-    QHBoxLayout *buttonsLayout = new QHBoxLayout;
-    buttonsLayout->addStretch (1);
-    buttonsLayout->addWidget (buttonOk);
-    buttonsLayout->addWidget (buttonCancel);
-    buttonOk->setDefault (true);
+  QPushButton *buttonOk = new QPushButton (ok_string);
+  QPushButton *buttonCancel = new QPushButton (cancel_string);
+  QHBoxLayout *buttonsLayout = new QHBoxLayout;
+  buttonsLayout->addStretch (1);
+  buttonsLayout->addWidget (buttonOk);
+  buttonsLayout->addWidget (buttonCancel);
+  buttonOk->setDefault (true);
 
-    QVBoxLayout *mainLayout = new QVBoxLayout;
-    mainLayout->addLayout (listLayout);
-    mainLayout->addSpacing (12);
-    mainLayout->addLayout (buttonsLayout);
-    setLayout (mainLayout);
-    if (fixed_layout)
-      layout ()->setSizeConstraint (QLayout::SetFixedSize);
+  QVBoxLayout *mainLayout = new QVBoxLayout;
+  mainLayout->addLayout (listLayout);
+  mainLayout->addSpacing (12);
+  mainLayout->addLayout (buttonsLayout);
+  setLayout (mainLayout);
+  if (fixed_layout)
+    layout ()->setSizeConstraint (QLayout::SetFixedSize);
 
-    // If empty, make blank rather than use default OS behavior.
-    setWindowTitle (title.isEmpty () ? " " : title);
+  // If empty, make blank rather than use default OS behavior.
+  setWindowTitle (title.isEmpty () ? " " : title);
 
-    connect (select_all, &QPushButton::clicked,
-             view, &QListView::selectAll);
+  connect (select_all, &QPushButton::clicked,
+           view, &QListView::selectAll);
 
-    connect (buttonOk, &QPushButton::clicked,
-             this, &ListDialog::buttonOk_clicked);
+  connect (buttonOk, &QPushButton::clicked,
+           this, &ListDialog::buttonOk_clicked);
 
-    connect (buttonCancel, &QPushButton::clicked,
-             this, &ListDialog::buttonCancel_clicked);
+  connect (buttonCancel, &QPushButton::clicked,
+           this, &ListDialog::buttonCancel_clicked);
 
-    connect (view, &QListView::doubleClicked,
-             this, &ListDialog::item_double_clicked);
-  }
+  connect (view, &QListView::doubleClicked,
+           this, &ListDialog::item_double_clicked);
+}
 
-  void ListDialog::buttonOk_clicked ()
-  {
-    // Store information about what button was pressed so that builtin
-    // functions can retrieve.
+void ListDialog::buttonOk_clicked ()
+{
+  // Store information about what button was pressed so that builtin
+  // functions can retrieve.
 
-    QModelIndexList selected_index = selector->selectedIndexes ();
-    QIntList selected_int;
+  QModelIndexList selected_index = selector->selectedIndexes ();
+  QIntList selected_int;
 
-    for (int i = 0; i < selected_index.size (); i++)
-      selected_int << selected_index.at (i).row () + 1;
+  for (int i = 0; i < selected_index.size (); i++)
+    selected_int << selected_index.at (i).row () + 1;
 
-    emit finish_selection (selected_int, 1);
+  emit finish_selection (selected_int, 1);
 
-    done (QDialog::Accepted);
-  }
+  done (QDialog::Accepted);
+}
 
-  void ListDialog::buttonCancel_clicked ()
-  {
-    // Store information about what button was pressed so that builtin
-    // functions can retrieve.
+void ListDialog::buttonCancel_clicked ()
+{
+  // Store information about what button was pressed so that builtin
+  // functions can retrieve.
 
-    QIntList empty;
+  QIntList empty;
 
-    emit finish_selection (empty, 0);
+  emit finish_selection (empty, 0);
 
-    done (QDialog::Rejected);
-  }
+  done (QDialog::Rejected);
+}
 
-  void ListDialog::reject ()
-  {
-    buttonCancel_clicked ();
-  }
+void ListDialog::reject ()
+{
+  buttonCancel_clicked ();
+}
 
-  void ListDialog::item_double_clicked (const QModelIndex&)
-  {
-    buttonOk_clicked ();
-  }
+void ListDialog::item_double_clicked (const QModelIndex&)
+{
+  buttonOk_clicked ();
+}
 
-  InputDialog::InputDialog (const QStringList& prompt,
-                            const QString& title, const QFloatList& nr,
-                            const QFloatList& nc, const QStringList& defaults)
-    : QDialog ()
-  {
+InputDialog::InputDialog (const QStringList& prompt,
+                          const QString& title, const QFloatList& nr,
+                          const QFloatList& nc, const QStringList& defaults)
+  : QDialog ()
+{
 
 #define LINE_EDIT_FOLLOWS_PROMPT 0
 
 #if LINE_EDIT_FOLLOWS_PROMPT
-    // Prompt on left followed by input on right.
-    QGridLayout *promptInputLayout = new QGridLayout;
+  // Prompt on left followed by input on right.
+  QGridLayout *promptInputLayout = new QGridLayout;
 #else
-    // Prompt aligned above input.
-    QVBoxLayout *promptInputLayout = new QVBoxLayout;
+  // Prompt aligned above input.
+  QVBoxLayout *promptInputLayout = new QVBoxLayout;
 #endif
-    int N_gridrows = prompt.size ();
-    for (int i = 0; i < N_gridrows; i++)
-      {
-        QLabel *label = new QLabel (prompt.at (i));
-        QLineEdit *line_edit = new QLineEdit ();
-        if (i < defaults.size ())
-          line_edit->setText (defaults.at (i));
-        if (i < nr.size () && nr.at (i) > 0)
-          {
-            QSize qsize = line_edit->sizeHint ();
-            int intval = qsize.height () * nr.at (i);
-            line_edit->setFixedHeight (intval);
-            if (i < nc.size () && nc.at (i) > 0)
-              {
-                intval = qsize.height () * nc.at (i) / 2;
-                line_edit->setFixedWidth (intval);
-              }
-          }
-        input_line << line_edit;
+  int N_gridrows = prompt.size ();
+  for (int i = 0; i < N_gridrows; i++)
+    {
+      QLabel *label = new QLabel (prompt.at (i));
+      QLineEdit *line_edit = new QLineEdit ();
+      if (i < defaults.size ())
+        line_edit->setText (defaults.at (i));
+      if (i < nr.size () && nr.at (i) > 0)
+        {
+          QSize qsize = line_edit->sizeHint ();
+          int intval = qsize.height () * nr.at (i);
+          line_edit->setFixedHeight (intval);
+          if (i < nc.size () && nc.at (i) > 0)
+            {
+              intval = qsize.height () * nc.at (i) / 2;
+              line_edit->setFixedWidth (intval);
+            }
+        }
+      input_line << line_edit;
 #if LINE_EDIT_FOLLOWS_PROMPT
-        promptInputLayout->addWidget (label, i + 1, 0);
-        promptInputLayout->addWidget (line_edit, i + 1, 1);
+      promptInputLayout->addWidget (label, i + 1, 0);
+      promptInputLayout->addWidget (line_edit, i + 1, 1);
 #else
-        promptInputLayout->addWidget (label);
-        promptInputLayout->addWidget (line_edit);
+      promptInputLayout->addWidget (label);
+      promptInputLayout->addWidget (line_edit);
 #endif
-      }
+    }
 #undef LINE_EDIT_FOLLOWS_PROMPT
 
-    QPushButton *buttonOk = new QPushButton ("OK");
-    QPushButton *buttonCancel = new QPushButton ("Cancel");
-    QHBoxLayout *buttonsLayout = new QHBoxLayout;
-    buttonsLayout->addStretch (1);
-    buttonsLayout->addWidget (buttonOk);
-    buttonsLayout->addWidget (buttonCancel);
+  QPushButton *buttonOk = new QPushButton ("OK");
+  QPushButton *buttonCancel = new QPushButton ("Cancel");
+  QHBoxLayout *buttonsLayout = new QHBoxLayout;
+  buttonsLayout->addStretch (1);
+  buttonsLayout->addWidget (buttonOk);
+  buttonsLayout->addWidget (buttonCancel);
 
-    QVBoxLayout *mainLayout = new QVBoxLayout;
-    mainLayout->addLayout (promptInputLayout);
-    mainLayout->addSpacing (12);
-    mainLayout->addLayout (buttonsLayout);
-    setLayout (mainLayout);
+  QVBoxLayout *mainLayout = new QVBoxLayout;
+  mainLayout->addLayout (promptInputLayout);
+  mainLayout->addSpacing (12);
+  mainLayout->addLayout (buttonsLayout);
+  setLayout (mainLayout);
 
-    // If empty, make blank rather than use default OS behavior.
-    setWindowTitle (title.isEmpty () ? " " : title);
+  // If empty, make blank rather than use default OS behavior.
+  setWindowTitle (title.isEmpty () ? " " : title);
 
-    connect (buttonOk, &QPushButton::clicked,
-             this, &InputDialog::buttonOk_clicked);
+  connect (buttonOk, &QPushButton::clicked,
+           this, &InputDialog::buttonOk_clicked);
 
-    connect (buttonCancel, &QPushButton::clicked,
-             this, &InputDialog::buttonCancel_clicked);
-  }
+  connect (buttonCancel, &QPushButton::clicked,
+           this, &InputDialog::buttonCancel_clicked);
+}
 
-  void InputDialog::buttonOk_clicked ()
-  {
-    // Store information about what button was pressed so that builtin
-    // functions can retrieve.
+void InputDialog::buttonOk_clicked ()
+{
+  // Store information about what button was pressed so that builtin
+  // functions can retrieve.
 
-    QStringList string_result;
-    for (int i = 0; i < input_line.size (); i++)
-      string_result << input_line.at (i)->text ();
-    emit finish_input (string_result, 1);
-    done (QDialog::Accepted);
-  }
+  QStringList string_result;
+  for (int i = 0; i < input_line.size (); i++)
+    string_result << input_line.at (i)->text ();
+  emit finish_input (string_result, 1);
+  done (QDialog::Accepted);
+}
 
-  void InputDialog::buttonCancel_clicked ()
-  {
-    // Store information about what button was pressed so that builtin
-    // functions can retrieve.
+void InputDialog::buttonCancel_clicked ()
+{
+  // Store information about what button was pressed so that builtin
+  // functions can retrieve.
 
-    QStringList empty;
-    emit finish_input (empty, 0);
-    done (QDialog::Rejected);
-  }
+  QStringList empty;
+  emit finish_input (empty, 0);
+  done (QDialog::Rejected);
+}
 
-  void InputDialog::reject ()
-  {
-    buttonCancel_clicked ();
-  }
+void InputDialog::reject ()
+{
+  buttonCancel_clicked ();
+}
 
-  FileDialog::FileDialog (const QStringList& name_filters,
-                          const QString& title, const QString& filename,
-                          const QString& dirname, const QString& multimode)
-    : QFileDialog ()
-  {
-    // Create a NonModal message.
-    setWindowModality (Qt::NonModal);
+FileDialog::FileDialog (const QStringList& name_filters,
+                        const QString& title, const QString& filename,
+                        const QString& dirname, const QString& multimode)
+  : QFileDialog ()
+{
+  // Create a NonModal message.
+  setWindowModality (Qt::NonModal);
 
-    setWindowTitle (title.isEmpty () ? " " : title);
-    setDirectory (dirname);
+  setWindowTitle (title.isEmpty () ? " " : title);
+  setDirectory (dirname);
 
-    // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
+  // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
 
-    gui_settings settings;
+  gui_settings settings;
 
-    if (! settings.bool_value (global_use_native_dialogs))
-      setOption(QFileDialog::DontUseNativeDialog);
+  if (! settings.bool_value (global_use_native_dialogs))
+    setOption(QFileDialog::DontUseNativeDialog);
 
-    if (multimode == "on")         // uigetfile multiselect=on
-      {
-        setFileMode (QFileDialog::ExistingFiles);
-        setAcceptMode (QFileDialog::AcceptOpen);
-      }
-    else if (multimode == "create") // uiputfile
-      {
-        setFileMode (QFileDialog::AnyFile);
-        setAcceptMode (QFileDialog::AcceptSave);
-        setOption (QFileDialog::DontConfirmOverwrite, false);
-      }
-    else if (multimode == "dir")    // uigetdir
-      {
-        setFileMode (QFileDialog::Directory);
-        setOption (QFileDialog::ShowDirsOnly, true);
-        setOption (QFileDialog::HideNameFilterDetails, true);
-        setAcceptMode (QFileDialog::AcceptOpen);
-      }
-    else                           // uigetfile multiselect=off
-      {
-        setFileMode (QFileDialog::ExistingFile);
-        setAcceptMode (QFileDialog::AcceptOpen);
-      }
+  if (multimode == "on")         // uigetfile multiselect=on
+    {
+      setFileMode (QFileDialog::ExistingFiles);
+      setAcceptMode (QFileDialog::AcceptOpen);
+    }
+  else if (multimode == "create") // uiputfile
+    {
+      setFileMode (QFileDialog::AnyFile);
+      setAcceptMode (QFileDialog::AcceptSave);
+      setOption (QFileDialog::DontConfirmOverwrite, false);
+    }
+  else if (multimode == "dir")    // uigetdir
+    {
+      setFileMode (QFileDialog::Directory);
+      setOption (QFileDialog::ShowDirsOnly, true);
+      setOption (QFileDialog::HideNameFilterDetails, true);
+      setAcceptMode (QFileDialog::AcceptOpen);
+    }
+  else                           // uigetfile multiselect=off
+    {
+      setFileMode (QFileDialog::ExistingFile);
+      setAcceptMode (QFileDialog::AcceptOpen);
+    }
 
-    setNameFilters (name_filters);
+  setNameFilters (name_filters);
 
-    selectFile (filename);
+  selectFile (filename);
 
-    connect (this, &FileDialog::accepted, this, &FileDialog::acceptSelection);
+  connect (this, &FileDialog::accepted, this, &FileDialog::acceptSelection);
 
-    connect (this, &FileDialog::rejected, this, &FileDialog::rejectSelection);
-  }
+  connect (this, &FileDialog::rejected, this, &FileDialog::rejectSelection);
+}
 
-  void FileDialog::rejectSelection ()
-  {
-    QStringList empty;
-    emit finish_input (empty, "", 0);
-  }
+void FileDialog::rejectSelection ()
+{
+  QStringList empty;
+  emit finish_input (empty, "", 0);
+}
 
-  void FileDialog::acceptSelection ()
-  {
-    QStringList string_result;
-    QString path;
-    int idx = 1;
+void FileDialog::acceptSelection ()
+{
+  QStringList string_result;
+  QString path;
+  int idx = 1;
 
-    string_result = selectedFiles ();
+  string_result = selectedFiles ();
 
-    if (testOption (QFileDialog::ShowDirsOnly) && string_result.size () > 0)
-      path = string_result[0];
-    else
-      path = directory ().absolutePath ();
+  if (testOption (QFileDialog::ShowDirsOnly) && string_result.size () > 0)
+    path = string_result[0];
+  else
+    path = directory ().absolutePath ();
 
-    // Matlab expects just the filename, whereas the file dialog gave us
-    // full path names, so fix it.
+  // Matlab expects just the filename, whereas the file dialog gave us
+  // full path names, so fix it.
 
-    for (int i = 0; i < string_result.size (); i++)
-      string_result[i] = QFileInfo (string_result[i]).fileName ();
+  for (int i = 0; i < string_result.size (); i++)
+    string_result[i] = QFileInfo (string_result[i]).fileName ();
 
-    // If not showing only dirs, add end slash for the path component.
-    if (testOption (QFileDialog::ShowDirsOnly)  == false)
-      path += '/';
+  // If not showing only dirs, add end slash for the path component.
+  if (testOption (QFileDialog::ShowDirsOnly)  == false)
+    path += '/';
 
-    // Convert to native slashes.
-    path = QDir::toNativeSeparators (path);
+  // Convert to native slashes.
+  path = QDir::toNativeSeparators (path);
 
-    QStringList name_filters = nameFilters ();
-    idx = name_filters.indexOf (selectedNameFilter ()) + 1;
+  QStringList name_filters = nameFilters ();
+  idx = name_filters.indexOf (selectedNameFilter ()) + 1;
 
-    // Send the selected info.
-    emit finish_input (string_result, path, idx);
-  }
+  // Send the selected info.
+  emit finish_input (string_result, path, idx);
+}
 
 OCTAVE_END_NAMESPACE(octave)
--- a/libgui/src/dialog.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/dialog.h	Thu Feb 02 12:25:51 2023 -0800
@@ -44,235 +44,235 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class QUIWidgetCreator : public QObject
-  {
-    Q_OBJECT
+class QUIWidgetCreator : public QObject
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    QUIWidgetCreator ();
+  QUIWidgetCreator ();
 
-    ~QUIWidgetCreator () = default;
+  ~QUIWidgetCreator () = default;
 
-  public:
+public:
 
-    QString rm_amp (const QString& text);
+  QString rm_amp (const QString& text);
 
-    QString message_dialog (const QString& message, const QString& title,
-                            const QString& icon, const QStringList& button,
-                            const QString& defbutton, const QStringList& role);
+  QString message_dialog (const QString& message, const QString& title,
+                          const QString& icon, const QStringList& button,
+                          const QString& defbutton, const QStringList& role);
 
-    int get_dialog_result () { return m_dialog_result; }
+  int get_dialog_result () { return m_dialog_result; }
 
-    QString get_dialog_button () { return m_dialog_button; }
+  QString get_dialog_button () { return m_dialog_button; }
 
-    QPair<QIntList, int> list_dialog (const QStringList& list,
-                                      const QString& mode,
-                                      int wd, int ht,
-                                      const QList<int>& initial,
-                                      const QString& name,
-                                      const QStringList& prompt,
-                                      const QString& ok_string,
-                                      const QString& cancel_string);
+  QPair<QIntList, int> list_dialog (const QStringList& list,
+                                    const QString& mode,
+                                    int wd, int ht,
+                                    const QList<int>& initial,
+                                    const QString& name,
+                                    const QStringList& prompt,
+                                    const QString& ok_string,
+                                    const QString& cancel_string);
 
-    QIntList get_list_index () const { return m_list_index; }
+  QIntList get_list_index () const { return m_list_index; }
 
-    QStringList input_dialog (const QStringList& prompt, const QString& title,
-                              const QFloatList& nr, const QFloatList& nc,
-                              const QStringList& defaults);
+  QStringList input_dialog (const QStringList& prompt, const QString& title,
+                            const QFloatList& nr, const QFloatList& nc,
+                            const QStringList& defaults);
 
-    QStringList get_string_list () const { return m_string_list; }
+  QStringList get_string_list () const { return m_string_list; }
 
-    QStringList file_dialog (const QStringList& filters, const QString& title,
-                             const QString& filename, const QString& dirname,
-                             const QString& multimode);
+  QStringList file_dialog (const QStringList& filters, const QString& title,
+                           const QString& filename, const QString& dirname,
+                           const QString& multimode);
 
-    QString get_dialog_path () const { return m_path_name; }
+  QString get_dialog_path () const { return m_path_name; }
 
-    void lock () { m_mutex.lock (); }
-    void wait () { m_waitcondition.wait (&m_mutex); }
-    void unlock () { m_mutex.unlock (); }
-    void wake_all () { m_waitcondition.wakeAll (); }
+  void lock () { m_mutex.lock (); }
+  void wait () { m_waitcondition.wait (&m_mutex); }
+  void unlock () { m_mutex.unlock (); }
+  void wake_all () { m_waitcondition.wakeAll (); }
 
-  signals:
+signals:
 
-    void create_dialog (const QString&, const QString&, const QString&,
-                        const QStringList&, const QString&, const QStringList&);
+  void create_dialog (const QString&, const QString&, const QString&,
+                      const QStringList&, const QString&, const QStringList&);
 
-    void create_listview (const QStringList&, const QString&, int, int,
-                          const QIntList&, const QString&, const QStringList&,
-                          const QString&, const QString&);
+  void create_listview (const QStringList&, const QString&, int, int,
+                        const QIntList&, const QString&, const QStringList&,
+                        const QString&, const QString&);
 
-    void create_inputlayout (const QStringList&, const QString&,
-                             const QFloatList&, const QFloatList&,
-                             const QStringList&);
+  void create_inputlayout (const QStringList&, const QString&,
+                           const QFloatList&, const QFloatList&,
+                           const QStringList&);
 
-    void create_filedialog (const QStringList& filters, const QString& title,
-                            const QString& filename, const QString& dirname,
-                            const QString& multimode);
-  public slots:
+  void create_filedialog (const QStringList& filters, const QString& title,
+                          const QString& filename, const QString& dirname,
+                          const QString& multimode);
+public slots:
 
-    void handle_create_dialog (const QString& message, const QString& title,
-                               const QString& icon, const QStringList& button,
-                               const QString& defbutton,
-                               const QStringList& role);
+  void handle_create_dialog (const QString& message, const QString& title,
+                             const QString& icon, const QStringList& button,
+                             const QString& defbutton,
+                             const QStringList& role);
 
-    void dialog_button_clicked (QAbstractButton *button);
+  void dialog_button_clicked (QAbstractButton *button);
 
-    void handle_create_listview (const QStringList& list, const QString& mode,
-                                 int width, int height,
-                                 const QIntList& initial,
-                                 const QString& name,
-                                 const QStringList& prompt,
-                                 const QString& ok_string,
-                                 const QString& cancel_string);
+  void handle_create_listview (const QStringList& list, const QString& mode,
+                               int width, int height,
+                               const QIntList& initial,
+                               const QString& name,
+                               const QStringList& prompt,
+                               const QString& ok_string,
+                               const QString& cancel_string);
 
-    void list_select_finished (const QIntList& selected, int button_pressed);
+  void list_select_finished (const QIntList& selected, int button_pressed);
 
-    void handle_create_inputlayout (const QStringList&, const QString&,
-                                    const QFloatList&, const QFloatList&,
-                                    const QStringList&);
+  void handle_create_inputlayout (const QStringList&, const QString&,
+                                  const QFloatList&, const QFloatList&,
+                                  const QStringList&);
 
-    void input_finished (const QStringList& input, int button_pressed);
+  void input_finished (const QStringList& input, int button_pressed);
 
-    void handle_create_filedialog (const QStringList& filters,
-                                   const QString& title,
-                                   const QString& filename,
-                                   const QString& dirname,
-                                   const QString& multimode);
+  void handle_create_filedialog (const QStringList& filters,
+                                 const QString& title,
+                                 const QString& filename,
+                                 const QString& dirname,
+                                 const QString& multimode);
 
-    void filedialog_finished (const QStringList& files, const QString& path,
-                              int filterindex);
+  void filedialog_finished (const QStringList& files, const QString& path,
+                            int filterindex);
 
-  private:
+private:
 
-    int m_dialog_result;
-    QString m_dialog_button;
+  int m_dialog_result;
+  QString m_dialog_button;
 
-    // A copy of the dialogs button texts
-    QStringList m_button_list;
+  // A copy of the dialogs button texts
+  QStringList m_button_list;
 
-    // The list could conceivably be big.  Not sure how things are
-    // stored internally, so keep off of the stack.
-    QStringList m_string_list;
-    QIntList m_list_index;
+  // The list could conceivably be big.  Not sure how things are
+  // stored internally, so keep off of the stack.
+  QStringList m_string_list;
+  QIntList m_list_index;
 
-    QString m_path_name;
+  QString m_path_name;
 
-    // GUI objects cannot be accessed in the non-GUI thread.  However,
-    // signals can be sent to slots across threads with proper
-    // synchronization.  Hence, the use of QWaitCondition.
-    QMutex m_mutex;
-    QWaitCondition m_waitcondition;
-  };
+  // GUI objects cannot be accessed in the non-GUI thread.  However,
+  // signals can be sent to slots across threads with proper
+  // synchronization.  Hence, the use of QWaitCondition.
+  QMutex m_mutex;
+  QWaitCondition m_waitcondition;
+};
 
-  class MessageDialog : public QMessageBox
-  {
-    Q_OBJECT
+class MessageDialog : public QMessageBox
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    MessageDialog (const QString& message,
-                   const QString& title, const QString& icon,
-                   const QStringList& button, const QString& defbutton,
-                   const QStringList& role);
+  MessageDialog (const QString& message,
+                 const QString& title, const QString& icon,
+                 const QStringList& button, const QString& defbutton,
+                 const QStringList& role);
 
-    ~MessageDialog () = default;
+  ~MessageDialog () = default;
 
-  private:
+private:
 
-    void closeEvent (QCloseEvent *)
-    {
-      // Reroute the close tab to a button click so there is only a single
-      // route to waking the wait condition.
-      emit buttonClicked (nullptr);
-    }
-  };
+  void closeEvent (QCloseEvent *)
+  {
+    // Reroute the close tab to a button click so there is only a single
+    // route to waking the wait condition.
+    emit buttonClicked (nullptr);
+  }
+};
 
-  class ListDialog : public QDialog
-  {
-    Q_OBJECT
+class ListDialog : public QDialog
+{
+  Q_OBJECT
 
-    QItemSelectionModel *selector;
+  QItemSelectionModel *selector;
 
-  public:
+public:
 
-    ListDialog (const QStringList& list,
-                const QString& mode, int width, int height,
-                const QList<int>& initial, const QString& name,
-                const QStringList& prompt, const QString& ok_string,
-                const QString& cancel_string);
+  ListDialog (const QStringList& list,
+              const QString& mode, int width, int height,
+              const QList<int>& initial, const QString& name,
+              const QStringList& prompt, const QString& ok_string,
+              const QString& cancel_string);
 
-    ~ListDialog () = default;
+  ~ListDialog () = default;
 
-  signals:
+signals:
 
-    void finish_selection (const QIntList&, int);
+  void finish_selection (const QIntList&, int);
 
-  public slots:
+public slots:
 
-    void buttonOk_clicked ();
+  void buttonOk_clicked ();
 
-    void buttonCancel_clicked ();
+  void buttonCancel_clicked ();
 
-    void reject ();
+  void reject ();
 
-    void item_double_clicked (const QModelIndex&);
+  void item_double_clicked (const QModelIndex&);
 
-  private:
+private:
 
-    QAbstractItemModel *m_model;
-  };
+  QAbstractItemModel *m_model;
+};
 
-  class InputDialog : public QDialog
-  {
-    Q_OBJECT
+class InputDialog : public QDialog
+{
+  Q_OBJECT
 
-    QList<QLineEdit *> input_line;
+  QList<QLineEdit *> input_line;
 
-  public:
+public:
 
-    InputDialog (const QStringList& prompt,
-                 const QString& title, const QFloatList& nr,
-                 const QFloatList& nc, const QStringList& defaults);
+  InputDialog (const QStringList& prompt,
+               const QString& title, const QFloatList& nr,
+               const QFloatList& nc, const QStringList& defaults);
 
-    ~InputDialog () = default;
+  ~InputDialog () = default;
 
-  signals:
+signals:
 
-    void finish_input (const QStringList&, int);
+  void finish_input (const QStringList&, int);
 
-  public slots:
+public slots:
 
-    void buttonOk_clicked ();
+  void buttonOk_clicked ();
 
-    void buttonCancel_clicked ();
+  void buttonCancel_clicked ();
 
-    void reject ();
-  };
+  void reject ();
+};
 
-  class FileDialog : public QFileDialog
-  {
-    Q_OBJECT
+class FileDialog : public QFileDialog
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    FileDialog (const QStringList& filters,
-                const QString& title, const QString& filename,
-                const QString& dirname, const QString& multimode);
+  FileDialog (const QStringList& filters,
+              const QString& title, const QString& filename,
+              const QString& dirname, const QString& multimode);
 
-    ~FileDialog () = default;
+  ~FileDialog () = default;
 
-  signals:
+signals:
 
-    void finish_input (const QStringList&, const QString&, int);
+  void finish_input (const QStringList&, const QString&, int);
 
-  private slots:
+private slots:
 
-    void acceptSelection ();
+  void acceptSelection ();
 
-    void rejectSelection ();
-  };
+  void rejectSelection ();
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/src/documentation-bookmarks.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/documentation-bookmarks.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -51,493 +51,493 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  documentation_bookmarks::documentation_bookmarks (documentation *doc,
-                                                    documentation_browser *browser,
-                                                    QWidget *p)
-    : QWidget (p), m_doc (doc), m_browser (browser), m_ctx_menu_item (nullptr)
-  {
-    setObjectName ("documentation_tab_bookmarks");
+documentation_bookmarks::documentation_bookmarks (documentation *doc,
+                                                  documentation_browser *browser,
+                                                  QWidget *p)
+  : QWidget (p), m_doc (doc), m_browser (browser), m_ctx_menu_item (nullptr)
+{
+  setObjectName ("documentation_tab_bookmarks");
 
-    gui_settings settings;
+  gui_settings settings;
 
-    // Setup the tree view with the bookmarks
-    m_tree = new QTreeWidget (p);
+  // Setup the tree view with the bookmarks
+  m_tree = new QTreeWidget (p);
 
-    m_tree->setContextMenuPolicy (Qt::CustomContextMenu);
-    m_tree->setSelectionMode (QAbstractItemView::ExtendedSelection);
-    m_tree->setSortingEnabled (false);
-    m_tree->setDragEnabled(true);
-    m_tree->viewport()->setAcceptDrops(true);
-    m_tree->setDropIndicatorShown(true);
-    m_tree->setDragDropMode(QAbstractItemView::InternalMove);
-    m_tree->setColumnCount (1);
-    m_tree->setHeaderHidden (true);
-    m_tree->setEditTriggers (QAbstractItemView::EditKeyPressed
-                             | QAbstractItemView::SelectedClicked);
+  m_tree->setContextMenuPolicy (Qt::CustomContextMenu);
+  m_tree->setSelectionMode (QAbstractItemView::ExtendedSelection);
+  m_tree->setSortingEnabled (false);
+  m_tree->setDragEnabled(true);
+  m_tree->viewport()->setAcceptDrops(true);
+  m_tree->setDropIndicatorShown(true);
+  m_tree->setDragDropMode(QAbstractItemView::InternalMove);
+  m_tree->setColumnCount (1);
+  m_tree->setHeaderHidden (true);
+  m_tree->setEditTriggers (QAbstractItemView::EditKeyPressed
+                           | QAbstractItemView::SelectedClicked);
 
-    connect (m_tree, &QTreeWidget::customContextMenuRequested,
-             this, &documentation_bookmarks::ctx_menu);
-    connect (m_tree, &QTreeWidget::itemDoubleClicked,
-             this, &documentation_bookmarks::handle_double_click);
+  connect (m_tree, &QTreeWidget::customContextMenuRequested,
+           this, &documentation_bookmarks::ctx_menu);
+  connect (m_tree, &QTreeWidget::itemDoubleClicked,
+           this, &documentation_bookmarks::handle_double_click);
 
-    // Define the icons for the tree view
-    icon_folder.addPixmap (style ()->standardPixmap(QStyle::SP_DirClosedIcon),
-                           QIcon::Normal, QIcon::Off);
-    icon_folder.addPixmap (style ()->standardPixmap(QStyle::SP_DirOpenIcon),
-                           QIcon::Normal, QIcon::On);
-    icon_bookmark.addPixmap (style ()->standardPixmap(QStyle::SP_FileIcon));
+  // Define the icons for the tree view
+  icon_folder.addPixmap (style ()->standardPixmap(QStyle::SP_DirClosedIcon),
+                         QIcon::Normal, QIcon::Off);
+  icon_folder.addPixmap (style ()->standardPixmap(QStyle::SP_DirOpenIcon),
+                         QIcon::Normal, QIcon::On);
+  icon_bookmark.addPixmap (style ()->standardPixmap(QStyle::SP_FileIcon));
 
-    // Setup and read the bookmarkfile
-    QFileInfo f (settings.fileName ());
-    QString f_path = f.absolutePath ();
-    f.setFile (QDir (f_path), dc_bookmark_file);
-    m_xbel_file.setFileName (f.absoluteFilePath ());
+  // Setup and read the bookmarkfile
+  QFileInfo f (settings.fileName ());
+  QString f_path = f.absolutePath ();
+  f.setFile (QDir (f_path), dc_bookmark_file);
+  m_xbel_file.setFileName (f.absoluteFilePath ());
 
-    if (m_xbel_file.exists ())
-      {
-        QString err = read_bookmarks ();
-        if ( !err.isEmpty ())
-          {
-            err.append (tr ("\nNo documentation bookmarks loaded!"));
-            QMessageBox::warning (this,
-                                  tr ("Octave: Loading Documentation Bookmarks"),
-                                  err);
-            m_xbel_file.close ();
-          }
-      }
+  if (m_xbel_file.exists ())
+    {
+      QString err = read_bookmarks ();
+      if ( !err.isEmpty ())
+        {
+          err.append (tr ("\nNo documentation bookmarks loaded!"));
+          QMessageBox::warning (this,
+                                tr ("Octave: Loading Documentation Bookmarks"),
+                                err);
+          m_xbel_file.close ();
+        }
+    }
 
-    // Setup the filter widget
-    m_filter_widget = new QWidget (p);
-    m_filter = new QComboBox (m_filter_widget);
+  // Setup the filter widget
+  m_filter_widget = new QWidget (p);
+  m_filter = new QComboBox (m_filter_widget);
 
-    m_filter->setToolTip (tr ("Enter text to search the bookmarks"));
-    m_filter->setEditable (true);
-    m_filter->setInsertPolicy (QComboBox::NoInsert);
-    m_filter->setMaxCount (10);
-    m_filter->setMaxVisibleItems (10);
-    m_filter->setSizeAdjustPolicy (QComboBox::AdjustToMinimumContentsLengthWithIcon);
-    QSizePolicy size_pol (QSizePolicy::Expanding, QSizePolicy::Preferred);
-    m_filter->setSizePolicy (size_pol);
-    m_filter->completer ()->setCaseSensitivity (Qt::CaseSensitive);
+  m_filter->setToolTip (tr ("Enter text to search the bookmarks"));
+  m_filter->setEditable (true);
+  m_filter->setInsertPolicy (QComboBox::NoInsert);
+  m_filter->setMaxCount (10);
+  m_filter->setMaxVisibleItems (10);
+  m_filter->setSizeAdjustPolicy (QComboBox::AdjustToMinimumContentsLengthWithIcon);
+  QSizePolicy size_pol (QSizePolicy::Expanding, QSizePolicy::Preferred);
+  m_filter->setSizePolicy (size_pol);
+  m_filter->completer ()->setCaseSensitivity (Qt::CaseSensitive);
 
-    m_filter->addItems (settings.string_list_value (dc_bookmark_filter_mru));
+  m_filter->addItems (settings.string_list_value (dc_bookmark_filter_mru));
 
-    connect (m_filter, &QComboBox::editTextChanged,
-             this, &documentation_bookmarks::filter_bookmarks);
-    connect (m_filter->lineEdit (), &QLineEdit::editingFinished,
-             this, &documentation_bookmarks::update_filter_history);
+  connect (m_filter, &QComboBox::editTextChanged,
+           this, &documentation_bookmarks::filter_bookmarks);
+  connect (m_filter->lineEdit (), &QLineEdit::editingFinished,
+           this, &documentation_bookmarks::update_filter_history);
 
-    m_filter_checkbox = new QCheckBox (m_filter_widget);
-    bool filter_state = settings.bool_value (dc_bookmark_filter_active);
-    m_filter_checkbox->setChecked (filter_state);
-    filter_activate (filter_state);
+  m_filter_checkbox = new QCheckBox (m_filter_widget);
+  bool filter_state = settings.bool_value (dc_bookmark_filter_active);
+  m_filter_checkbox->setChecked (filter_state);
+  filter_activate (filter_state);
 
-    connect (m_filter_checkbox, &QCheckBox::toggled,
-             this, &documentation_bookmarks::filter_activate);
+  connect (m_filter_checkbox, &QCheckBox::toggled,
+           this, &documentation_bookmarks::filter_activate);
 
-    QLabel *filter_label = new QLabel (tr ("Filter"), m_filter_widget);
-    QHBoxLayout *h_box_bm = new QHBoxLayout (m_filter_widget);
-    h_box_bm->addWidget (filter_label);
-    h_box_bm->addWidget (m_filter_checkbox);
-    h_box_bm->addWidget (m_filter);
-    h_box_bm->setMargin (2);
-    m_filter_widget->setLayout (h_box_bm);
+  QLabel *filter_label = new QLabel (tr ("Filter"), m_filter_widget);
+  QHBoxLayout *h_box_bm = new QHBoxLayout (m_filter_widget);
+  h_box_bm->addWidget (filter_label);
+  h_box_bm->addWidget (m_filter_checkbox);
+  h_box_bm->addWidget (m_filter);
+  h_box_bm->setMargin (2);
+  m_filter_widget->setLayout (h_box_bm);
 
-    m_filter_shown = settings.bool_value (dc_bookmark_filter_shown);
-    m_filter_widget->setVisible (m_filter_shown);
+  m_filter_shown = settings.bool_value (dc_bookmark_filter_shown);
+  m_filter_widget->setVisible (m_filter_shown);
 
-    // Resulting Layout of this widget
-    QVBoxLayout *v_box_bm = new QVBoxLayout (this);
-    v_box_bm->addWidget (m_filter_widget);
-    v_box_bm->addWidget (m_tree);
-    setLayout (v_box_bm);
-  }
+  // Resulting Layout of this widget
+  QVBoxLayout *v_box_bm = new QVBoxLayout (this);
+  v_box_bm->addWidget (m_filter_widget);
+  v_box_bm->addWidget (m_tree);
+  setLayout (v_box_bm);
+}
 
-  // Slot for adding the current page as a bookmark
-  void documentation_bookmarks::add_bookmark ()
-  {
-    QUrl url = m_browser->historyUrl (0);
+// Slot for adding the current page as a bookmark
+void documentation_bookmarks::add_bookmark ()
+{
+  QUrl url = m_browser->historyUrl (0);
 
-    // Check if bookmark already exists and select if yes
-    QTreeWidgetItemIterator it (m_tree);
-    while (*it)
-      {
-        QUrl url_i = (*it)->data (0, url_role).toUrl ();
-        if (url == url_i)
-          {
-            m_tree->setCurrentItem (*it);
-            (*it)->setExpanded (true);
-            return;
-          }
-        it++;
-      }
+  // Check if bookmark already exists and select if yes
+  QTreeWidgetItemIterator it (m_tree);
+  while (*it)
+    {
+      QUrl url_i = (*it)->data (0, url_role).toUrl ();
+      if (url == url_i)
+        {
+          m_tree->setCurrentItem (*it);
+          (*it)->setExpanded (true);
+          return;
+        }
+      it++;
+    }
 
-    // Add the anchor name to the title of the page and add the bookmark
-    // as top-level-item
-    QString title = m_doc->title_and_anchor (m_browser->historyTitle (0), url);
-    add_bookmark (title, url.toString ());
-  }
+  // Add the anchor name to the title of the page and add the bookmark
+  // as top-level-item
+  QString title = m_doc->title_and_anchor (m_browser->historyTitle (0), url);
+  add_bookmark (title, url.toString ());
+}
 
-  // Function for actually adding a bookmark to the tree
-  void documentation_bookmarks::add_bookmark (const QString& title,
-                                              const QString& url,
-                                              QTreeWidgetItem* item)
-  {
-    // Create new bookmark
-    QTreeWidgetItem *new_item = new QTreeWidgetItem (QStringList (title));
-    new_item->setData (0, tag_role, QVariant (bookmark_tag));
-    new_item->setData (0, url_role, QVariant (url));
-    new_item->setFlags ((new_item->flags () & (~Qt::ItemIsDropEnabled))
-                                            | Qt::ItemIsEditable
-                                            | Qt::ItemIsDragEnabled);
-    new_item->setIcon (0, icon_bookmark);
+// Function for actually adding a bookmark to the tree
+void documentation_bookmarks::add_bookmark (const QString& title,
+                                            const QString& url,
+                                            QTreeWidgetItem* item)
+{
+  // Create new bookmark
+  QTreeWidgetItem *new_item = new QTreeWidgetItem (QStringList (title));
+  new_item->setData (0, tag_role, QVariant (bookmark_tag));
+  new_item->setData (0, url_role, QVariant (url));
+  new_item->setFlags ((new_item->flags () & (~Qt::ItemIsDropEnabled))
+                                          | Qt::ItemIsEditable
+                                          | Qt::ItemIsDragEnabled);
+  new_item->setIcon (0, icon_bookmark);
 
-    // Insert as top level or child item
-    // TODO: Open dialog allowing to select a target folder if this
-    //       bookmark is added manually and not by reading a bookmark file
-    if (item)
-      item->addChild (new_item);
-    else
-      m_tree->addTopLevelItem (new_item);
-  }
+  // Insert as top level or child item
+  // TODO: Open dialog allowing to select a target folder if this
+  //       bookmark is added manually and not by reading a bookmark file
+  if (item)
+    item->addChild (new_item);
+  else
+    m_tree->addTopLevelItem (new_item);
+}
 
-  // Slot for adding a folder from the context menu
-  void documentation_bookmarks::add_folder (bool)
-  {
-    QTreeWidgetItem *parent_item = nullptr;
+// Slot for adding a folder from the context menu
+void documentation_bookmarks::add_folder (bool)
+{
+  QTreeWidgetItem *parent_item = nullptr;
 
-    if (m_ctx_menu_item)
-      {
-        if (m_ctx_menu_item->data (0, tag_role).toInt () == folder_tag)
-          parent_item = m_ctx_menu_item;
-        else
-          {
-            QTreeWidgetItem *p = m_ctx_menu_item->parent ();
-            if (p)
-              parent_item = p;
-          }
-      }
+  if (m_ctx_menu_item)
+    {
+      if (m_ctx_menu_item->data (0, tag_role).toInt () == folder_tag)
+        parent_item = m_ctx_menu_item;
+      else
+        {
+          QTreeWidgetItem *p = m_ctx_menu_item->parent ();
+          if (p)
+            parent_item = p;
+        }
+    }
 
-    QTreeWidgetItem *new_folder = add_folder (tr ("New Folder"), parent_item);
+  QTreeWidgetItem *new_folder = add_folder (tr ("New Folder"), parent_item);
 
-    m_tree->setCurrentItem (new_folder);
-    m_tree->editItem (new_folder);
-  }
+  m_tree->setCurrentItem (new_folder);
+  m_tree->editItem (new_folder);
+}
 
-  // Function for actually adding a folder to the tree
-  QTreeWidgetItem* documentation_bookmarks::add_folder (const QString& folder,
-                                            QTreeWidgetItem *item, bool expanded)
-  {
-    QTreeWidgetItem *new_folder = new QTreeWidgetItem (QStringList (folder));
-    new_folder->setData (0, tag_role, QVariant (folder_tag));
-    new_folder->setFlags (new_folder->flags() | Qt::ItemIsEditable
-                                              | Qt::ItemIsDragEnabled
-                                              | Qt::ItemIsDropEnabled);
-    new_folder->setChildIndicatorPolicy (QTreeWidgetItem::DontShowIndicatorWhenChildless);
-    new_folder->setIcon (0, icon_folder);
-    new_folder->setExpanded (expanded);
+// Function for actually adding a folder to the tree
+QTreeWidgetItem* documentation_bookmarks::add_folder (const QString& folder,
+                                          QTreeWidgetItem *item, bool expanded)
+{
+  QTreeWidgetItem *new_folder = new QTreeWidgetItem (QStringList (folder));
+  new_folder->setData (0, tag_role, QVariant (folder_tag));
+  new_folder->setFlags (new_folder->flags() | Qt::ItemIsEditable
+                                            | Qt::ItemIsDragEnabled
+                                            | Qt::ItemIsDropEnabled);
+  new_folder->setChildIndicatorPolicy (QTreeWidgetItem::DontShowIndicatorWhenChildless);
+  new_folder->setIcon (0, icon_folder);
+  new_folder->setExpanded (expanded);
 
-    // Insert as top level or child item
-    if (item)
-      item->addChild (new_folder);
-    else
-      m_tree->addTopLevelItem (new_folder);
+  // Insert as top level or child item
+  if (item)
+    item->addChild (new_folder);
+  else
+    m_tree->addTopLevelItem (new_folder);
 
-    return new_folder;
-  }
+  return new_folder;
+}
 
-  void documentation_bookmarks::filter_bookmarks (const QString& pattern)
-  {
-    QTreeWidgetItemIterator it (m_tree);
+void documentation_bookmarks::filter_bookmarks (const QString& pattern)
+{
+  QTreeWidgetItemIterator it (m_tree);
 
-    while (*it)
-      {
-        if ((*it)->text (0).contains (pattern, Qt::CaseInsensitive))
-          {
-            (*it)->setHidden (false);
-            (*it)->setExpanded (true);
-            QTreeWidgetItem *p = (*it)->parent ();
-            while (p)
-              {
-                p->setHidden (false);
-                p->setExpanded (true);
-                p = p->parent ();
-              }
-          }
-        else
-          (*it)->setHidden (true);
+  while (*it)
+    {
+      if ((*it)->text (0).contains (pattern, Qt::CaseInsensitive))
+        {
+          (*it)->setHidden (false);
+          (*it)->setExpanded (true);
+          QTreeWidgetItem *p = (*it)->parent ();
+          while (p)
+            {
+              p->setHidden (false);
+              p->setExpanded (true);
+              p = p->parent ();
+            }
+        }
+      else
+        (*it)->setHidden (true);
 
-        it++;
-      }
-  }
+      it++;
+    }
+}
 
-  void documentation_bookmarks::filter_activate (bool state)
-  {
-    m_filter->setEnabled (state);
+void documentation_bookmarks::filter_activate (bool state)
+{
+  m_filter->setEnabled (state);
 
-    QString pattern;
-    if (state)
-      pattern = m_filter->currentText ();
+  QString pattern;
+  if (state)
+    pattern = m_filter->currentText ();
 
-    filter_bookmarks (pattern);
-  }
+  filter_bookmarks (pattern);
+}
 
-  void documentation_bookmarks::update_filter_history ()
-  {
-    QString text = m_filter->currentText ();   // get current text
-    int index = m_filter->findText (text);     // and its actual index
+void documentation_bookmarks::update_filter_history ()
+{
+  QString text = m_filter->currentText ();   // get current text
+  int index = m_filter->findText (text);     // and its actual index
 
-    if (index > -1)
-      m_filter->removeItem (index);    // remove if already existing
+  if (index > -1)
+    m_filter->removeItem (index);    // remove if already existing
 
-    m_filter->insertItem (0, text);    // (re)insert at beginning
-    m_filter->setCurrentIndex (0);
-  }
+  m_filter->insertItem (0, text);    // (re)insert at beginning
+  m_filter->setCurrentIndex (0);
+}
 
-  void documentation_bookmarks::handle_double_click (QTreeWidgetItem *item, int)
-  {
-    int tag = item->data (0, tag_role).toInt ();
+void documentation_bookmarks::handle_double_click (QTreeWidgetItem *item, int)
+{
+  int tag = item->data (0, tag_role).toInt ();
 
-    if (tag == folder_tag)
-      {
-        item->setExpanded (! item->isExpanded ());
-        return;
-      }
+  if (tag == folder_tag)
+    {
+      item->setExpanded (! item->isExpanded ());
+      return;
+    }
 
-    if (tag == bookmark_tag)
-      {
-        QUrl url = item->data (0, url_role).toUrl ();
-        if (! url.isEmpty ())
-          m_browser->setSource (url);
-        return;
-      }
-  }
+  if (tag == bookmark_tag)
+    {
+      QUrl url = item->data (0, url_role).toUrl ();
+      if (! url.isEmpty ())
+        m_browser->setSource (url);
+      return;
+    }
+}
 
-  void documentation_bookmarks::ctx_menu (const QPoint& xpos)
-  {
-    QMenu menu (this);
+void documentation_bookmarks::ctx_menu (const QPoint& xpos)
+{
+  QMenu menu (this);
 
-    m_ctx_menu_item = m_tree->itemAt (xpos);
+  m_ctx_menu_item = m_tree->itemAt (xpos);
 
-    if (m_ctx_menu_item)
-      {
-        gui_settings settings;
+  if (m_ctx_menu_item)
+    {
+      gui_settings settings;
 
-        menu.addAction (tr ("&Open"), this, &documentation_bookmarks::open);
-        menu.addAction (tr ("&Rename"), this, &documentation_bookmarks::edit);
-        menu.addAction (settings.icon ("window-close"), tr ("Remo&ve"),
-                        this, &documentation_bookmarks::remove);
-        menu.addSeparator ();
-      }
+      menu.addAction (tr ("&Open"), this, &documentation_bookmarks::open);
+      menu.addAction (tr ("&Rename"), this, &documentation_bookmarks::edit);
+      menu.addAction (settings.icon ("window-close"), tr ("Remo&ve"),
+                      this, &documentation_bookmarks::remove);
+      menu.addSeparator ();
+    }
 
-    menu.addAction (tr ("&Add Folder"), this,
-                    QOverload<bool>::of (&documentation_bookmarks::add_folder));
+  menu.addAction (tr ("&Add Folder"), this,
+                  QOverload<bool>::of (&documentation_bookmarks::add_folder));
 
-    menu.addSeparator ();
+  menu.addSeparator ();
 
-    if (m_filter_shown)
-      menu.addAction (tr ("Hide &Filter"),
-                      this, &documentation_bookmarks::show_filter);
-    else
-      menu.addAction (tr ("Show &Filter"),
-                      this, &documentation_bookmarks::show_filter);
+  if (m_filter_shown)
+    menu.addAction (tr ("Hide &Filter"),
+                    this, &documentation_bookmarks::show_filter);
+  else
+    menu.addAction (tr ("Show &Filter"),
+                    this, &documentation_bookmarks::show_filter);
 
-    menu.exec (m_tree->mapToGlobal (xpos));
-  }
+  menu.exec (m_tree->mapToGlobal (xpos));
+}
 
-  void documentation_bookmarks::open (bool)
-  {
-    QList<QTreeWidgetItem *> items = m_tree->selectedItems ();
+void documentation_bookmarks::open (bool)
+{
+  QList<QTreeWidgetItem *> items = m_tree->selectedItems ();
 
-    if (items.size () > 0)
-      handle_double_click (items.at (0));
-  }
+  if (items.size () > 0)
+    handle_double_click (items.at (0));
+}
 
-  void documentation_bookmarks::edit (bool)
-  {
-    QList<QTreeWidgetItem *> items = m_tree->selectedItems ();
+void documentation_bookmarks::edit (bool)
+{
+  QList<QTreeWidgetItem *> items = m_tree->selectedItems ();
 
-    if (items.size () > 0)
-      m_tree->editItem (items.at (0));
-  }
+  if (items.size () > 0)
+    m_tree->editItem (items.at (0));
+}
 
-  void documentation_bookmarks::remove (bool)
-  {
-    QList<QTreeWidgetItem *> items = m_tree->selectedItems ();
+void documentation_bookmarks::remove (bool)
+{
+  QList<QTreeWidgetItem *> items = m_tree->selectedItems ();
 
-    for (const auto& it : items)
-      if (it)
-        m_tree->takeTopLevelItem (m_tree->indexOfTopLevelItem (it));
-  }
+  for (const auto& it : items)
+    if (it)
+      m_tree->takeTopLevelItem (m_tree->indexOfTopLevelItem (it));
+}
 
-  void documentation_bookmarks::show_filter (bool)
-  {
-    m_filter_shown = ! m_filter_shown;
-    m_filter_widget->setVisible (m_filter_shown);
-  }
+void documentation_bookmarks::show_filter (bool)
+{
+  m_filter_shown = ! m_filter_shown;
+  m_filter_widget->setVisible (m_filter_shown);
+}
 
-  void documentation_bookmarks::save_settings ()
-  {
-    // Write the bookmarks to the xbel-file
-    write_bookmarks ();
+void documentation_bookmarks::save_settings ()
+{
+  // Write the bookmarks to the xbel-file
+  write_bookmarks ();
 
-    // Store settings
-    gui_settings settings;
+  // Store settings
+  gui_settings settings;
 
-    settings.setValue (dc_bookmark_filter_active.settings_key (), m_filter_checkbox->isChecked ());
-    settings.setValue (dc_bookmark_filter_shown.settings_key (), m_filter_shown);
+  settings.setValue (dc_bookmark_filter_active.settings_key (), m_filter_checkbox->isChecked ());
+  settings.setValue (dc_bookmark_filter_shown.settings_key (), m_filter_shown);
 
-    QStringList mru;
-    for (int i = 0; i < m_filter->count (); i++)
-      mru.append (m_filter->itemText (i));
-    settings.setValue (dc_bookmark_filter_mru.settings_key (), mru);
+  QStringList mru;
+  for (int i = 0; i < m_filter->count (); i++)
+    mru.append (m_filter->itemText (i));
+  settings.setValue (dc_bookmark_filter_mru.settings_key (), mru);
 
-    settings.sync ();
-  }
+  settings.sync ();
+}
 
-  void documentation_bookmarks::write_bookmarks ()
-  {
-    if (! m_xbel_file.open (QFile::WriteOnly | QFile::Text))
-      {
-        QMessageBox::warning (this, tr("Octave: Saving Documentation Bookmarks"),
-                              tr("Unable to write file %1:\n%2.\n\n"
-                                 "Documentation bookmarks are not saved!\n")
-                                .arg (m_xbel_file.fileName ())
-                                .arg (m_xbel_file.errorString()));
-        return;
-      }
+void documentation_bookmarks::write_bookmarks ()
+{
+  if (! m_xbel_file.open (QFile::WriteOnly | QFile::Text))
+    {
+      QMessageBox::warning (this, tr("Octave: Saving Documentation Bookmarks"),
+                            tr("Unable to write file %1:\n%2.\n\n"
+                               "Documentation bookmarks are not saved!\n")
+                              .arg (m_xbel_file.fileName ())
+                              .arg (m_xbel_file.errorString()));
+      return;
+    }
 
-    QXmlStreamWriter xml_writer (&m_xbel_file);
-    xml_writer.setAutoFormatting (true);
+  QXmlStreamWriter xml_writer (&m_xbel_file);
+  xml_writer.setAutoFormatting (true);
 
-    xml_writer.writeStartDocument ();
-    xml_writer.writeDTD (dc_xbel_doctype);
-    xml_writer.writeStartElement (dc_xbel_name_format);
-    xml_writer.writeAttribute (dc_xbel_attr_version, dc_xbel_value_version);
+  xml_writer.writeStartDocument ();
+  xml_writer.writeDTD (dc_xbel_doctype);
+  xml_writer.writeStartElement (dc_xbel_name_format);
+  xml_writer.writeAttribute (dc_xbel_attr_version, dc_xbel_value_version);
 
-    for (int i = 0; i < m_tree->topLevelItemCount(); i++)
-      write_tree_item (&xml_writer, m_tree->topLevelItem (i));
+  for (int i = 0; i < m_tree->topLevelItemCount(); i++)
+    write_tree_item (&xml_writer, m_tree->topLevelItem (i));
 
-    xml_writer.writeEndDocument();
+  xml_writer.writeEndDocument();
 
-    m_xbel_file.flush ();
-    m_xbel_file.close ();
-  }
+  m_xbel_file.flush ();
+  m_xbel_file.close ();
+}
 
-  void documentation_bookmarks::write_tree_item (QXmlStreamWriter* xml_writer,
-                                                 const QTreeWidgetItem *item)
-  {
-    switch (item->data (0, tag_role).toInt ())
-      {
-      case folder_tag:
-        xml_writer->writeStartElement (dc_xbel_name_folder);
-        xml_writer->writeAttribute (dc_xbel_attr_folded,
-                                    item->isExpanded () ? dc_xbel_value_no : dc_xbel_value_yes);
-        xml_writer->writeTextElement (dc_xbel_name_title, item->text(0));
-        for (int i = 0; i < item->childCount (); i++)
-          write_tree_item (xml_writer, item->child (i));
-        xml_writer->writeEndElement ();
-        break;
+void documentation_bookmarks::write_tree_item (QXmlStreamWriter* xml_writer,
+                                               const QTreeWidgetItem *item)
+{
+  switch (item->data (0, tag_role).toInt ())
+    {
+    case folder_tag:
+      xml_writer->writeStartElement (dc_xbel_name_folder);
+      xml_writer->writeAttribute (dc_xbel_attr_folded,
+                                  item->isExpanded () ? dc_xbel_value_no : dc_xbel_value_yes);
+      xml_writer->writeTextElement (dc_xbel_name_title, item->text(0));
+      for (int i = 0; i < item->childCount (); i++)
+        write_tree_item (xml_writer, item->child (i));
+      xml_writer->writeEndElement ();
+      break;
 
-      case bookmark_tag:
-        xml_writer->writeStartElement (dc_xbel_name_bookmark);
-        xml_writer->writeAttribute (dc_xbel_attr_href, item->data (0, url_role).toString ());
-        xml_writer->writeTextElement (dc_xbel_name_title, item->text (0));
-        xml_writer->writeEndElement ();
-        break;
-      }
-  }
+    case bookmark_tag:
+      xml_writer->writeStartElement (dc_xbel_name_bookmark);
+      xml_writer->writeAttribute (dc_xbel_attr_href, item->data (0, url_role).toString ());
+      xml_writer->writeTextElement (dc_xbel_name_title, item->text (0));
+      xml_writer->writeEndElement ();
+      break;
+    }
+}
 
-  QString documentation_bookmarks::read_bookmarks ()
-  {
-    QString error_message;
+QString documentation_bookmarks::read_bookmarks ()
+{
+  QString error_message;
 
-    // Check the file
-    if (! m_xbel_file.open (QFile::ReadOnly | QFile::Text))
-      {
-        error_message = tr ("Unable to read file %1:\n%2.")
-                            .arg (m_xbel_file.fileName ())
-                            .arg (m_xbel_file.errorString());
-        return error_message;
-      }
+  // Check the file
+  if (! m_xbel_file.open (QFile::ReadOnly | QFile::Text))
+    {
+      error_message = tr ("Unable to read file %1:\n%2.")
+                          .arg (m_xbel_file.fileName ())
+                          .arg (m_xbel_file.errorString());
+      return error_message;
+    }
 
-    QXmlStreamReader xml_reader (&m_xbel_file);
+  QXmlStreamReader xml_reader (&m_xbel_file);
 
-    if (! xml_reader.readNextStartElement ())
-      {
-        error_message = tr ("No start element found in %1.\n"
-                            "Invalid bookmark file?")
-                            .arg (m_xbel_file.fileName ());
-        return error_message;
-      }
+  if (! xml_reader.readNextStartElement ())
+    {
+      error_message = tr ("No start element found in %1.\n"
+                          "Invalid bookmark file?")
+                          .arg (m_xbel_file.fileName ());
+      return error_message;
+    }
 
-    if (xml_reader.name() != dc_xbel_name_format
-        || xml_reader.attributes ().value (dc_xbel_attr_version) != dc_xbel_value_version)
-      {
-        error_message = tr ("The file\n"
-                            "%1\n"
-                            "is not a valid XBEL file version 1.0.")
-                            .arg (m_xbel_file.fileName ());
-        return error_message;
-      }
+  if (xml_reader.name() != dc_xbel_name_format
+      || xml_reader.attributes ().value (dc_xbel_attr_version) != dc_xbel_value_version)
+    {
+      error_message = tr ("The file\n"
+                          "%1\n"
+                          "is not a valid XBEL file version 1.0.")
+                          .arg (m_xbel_file.fileName ());
+      return error_message;
+    }
 
-    // Read the elements from the file
-    while (xml_reader.readNextStartElement ())
-      {
-        if (xml_reader.name () == dc_xbel_name_folder)
-          read_next_item (&xml_reader, folder_tag);
-        else if (xml_reader.name () == dc_xbel_name_bookmark)
-          read_next_item (&xml_reader, bookmark_tag);
-        else
-          xml_reader.skipCurrentElement ();
-      }
+  // Read the elements from the file
+  while (xml_reader.readNextStartElement ())
+    {
+      if (xml_reader.name () == dc_xbel_name_folder)
+        read_next_item (&xml_reader, folder_tag);
+      else if (xml_reader.name () == dc_xbel_name_bookmark)
+        read_next_item (&xml_reader, bookmark_tag);
+      else
+        xml_reader.skipCurrentElement ();
+    }
 
-    m_xbel_file.close ();
+  m_xbel_file.close ();
 
-    return error_message;
-  }
+  return error_message;
+}
 
-  void documentation_bookmarks::read_next_item (QXmlStreamReader *xml_reader,
-                                                item_tag tag, QTreeWidgetItem *item)
-  {
-    QString title (tr ("Unknown title"));
-    if (tag == folder_tag)
-      {
-        // Next item is a folder, which might also have children
-        bool expanded = (xml_reader->attributes().value (dc_xbel_attr_folded) == dc_xbel_value_no);
+void documentation_bookmarks::read_next_item (QXmlStreamReader *xml_reader,
+                                              item_tag tag, QTreeWidgetItem *item)
+{
+  QString title (tr ("Unknown title"));
+  if (tag == folder_tag)
+    {
+      // Next item is a folder, which might also have children
+      bool expanded = (xml_reader->attributes().value (dc_xbel_attr_folded) == dc_xbel_value_no);
 
-        QTreeWidgetItem *new_folder = add_folder (title, item, expanded);
+      QTreeWidgetItem *new_folder = add_folder (title, item, expanded);
 
-        // Check elements of this folder for title and for recursively
-        // adding sub-items
-        while (xml_reader->readNextStartElement ())
-          {
-            if (xml_reader->name () == dc_xbel_name_title)
-              {
-                title = xml_reader->readElementText();
-                new_folder->setText (0, title);
-              }
-            else if (xml_reader->name () == dc_xbel_name_folder)
-              read_next_item (xml_reader, folder_tag, new_folder);
-            else if (xml_reader->name () == dc_xbel_name_bookmark)
-              read_next_item (xml_reader, bookmark_tag, new_folder);
-            else
-              xml_reader->skipCurrentElement ();
-          }
-      }
-    else if (tag == bookmark_tag)
-      {
-        // Next item is a bookmark, without children
-        QString url = xml_reader->attributes().value (dc_xbel_attr_href).toString ();
-        while (xml_reader->readNextStartElement ())
-          {
-            if (xml_reader->name() == dc_xbel_name_title)
+      // Check elements of this folder for title and for recursively
+      // adding sub-items
+      while (xml_reader->readNextStartElement ())
+        {
+          if (xml_reader->name () == dc_xbel_name_title)
+            {
               title = xml_reader->readElementText();
-            else
-              xml_reader->skipCurrentElement ();
-          }
-        add_bookmark (title, url, item);
-      }
-  }
+              new_folder->setText (0, title);
+            }
+          else if (xml_reader->name () == dc_xbel_name_folder)
+            read_next_item (xml_reader, folder_tag, new_folder);
+          else if (xml_reader->name () == dc_xbel_name_bookmark)
+            read_next_item (xml_reader, bookmark_tag, new_folder);
+          else
+            xml_reader->skipCurrentElement ();
+        }
+    }
+  else if (tag == bookmark_tag)
+    {
+      // Next item is a bookmark, without children
+      QString url = xml_reader->attributes().value (dc_xbel_attr_href).toString ();
+      while (xml_reader->readNextStartElement ())
+        {
+          if (xml_reader->name() == dc_xbel_name_title)
+            title = xml_reader->readElementText();
+          else
+            xml_reader->skipCurrentElement ();
+        }
+      add_bookmark (title, url, item);
+    }
+}
 
 OCTAVE_END_NAMESPACE(octave)
--- a/libgui/src/documentation-bookmarks.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/documentation-bookmarks.h	Thu Feb 02 12:25:51 2023 -0800
@@ -36,86 +36,86 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class documentation;
+class documentation;
 
-  class documentation_bookmarks : public QWidget
-  {
-    Q_OBJECT
+class documentation_bookmarks : public QWidget
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    documentation_bookmarks (documentation *doc,
-                             documentation_browser *browser,
-                             QWidget *p = nullptr);
+  documentation_bookmarks (documentation *doc,
+                           documentation_browser *browser,
+                           QWidget *p = nullptr);
 
-    ~documentation_bookmarks () = default;
+  ~documentation_bookmarks () = default;
 
-  public slots:
+public slots:
 
-    void add_bookmark ();
-    void add_folder (bool);
-    void save_settings ();
+  void add_bookmark ();
+  void add_folder (bool);
+  void save_settings ();
 
-  private slots:
+private slots:
 
-    void filter_bookmarks (const QString& pattern);
-    void filter_activate (bool state);
-    void update_filter_history ();
-    void handle_double_click (QTreeWidgetItem *item, int col = 0);
-    void ctx_menu (const QPoint& xpos);
-    void open (bool);
-    void edit (bool);
-    void remove (bool);
-    void show_filter (bool);
+  void filter_bookmarks (const QString& pattern);
+  void filter_activate (bool state);
+  void update_filter_history ();
+  void handle_double_click (QTreeWidgetItem *item, int col = 0);
+  void ctx_menu (const QPoint& xpos);
+  void open (bool);
+  void edit (bool);
+  void remove (bool);
+  void show_filter (bool);
 
-  private:
+private:
 
-    enum item_role
-    {
-      url_role = Qt::UserRole,
-      tag_role = Qt::UserRole + 1
-    };
-    enum item_tag
-    {
-      bookmark_tag,
-      folder_tag
-    };
+  enum item_role
+  {
+    url_role = Qt::UserRole,
+    tag_role = Qt::UserRole + 1
+  };
+  enum item_tag
+  {
+    bookmark_tag,
+    folder_tag
+  };
 
-    void add_bookmark (const QString& title, const QString& url,
-                       QTreeWidgetItem *item = nullptr);
-    QTreeWidgetItem* add_folder (const QString& folder,
-                                 QTreeWidgetItem *item = nullptr,
-                                 bool expanded = true);
+  void add_bookmark (const QString& title, const QString& url,
+                     QTreeWidgetItem *item = nullptr);
+  QTreeWidgetItem* add_folder (const QString& folder,
+                               QTreeWidgetItem *item = nullptr,
+                               bool expanded = true);
 
-    /*!
-        Writing to and reading bookmarks from an xbel-file as
-        proposed in the qt example
-        [QXmlStream Bookmarks Example](https://doc.qt.io/qt-5/qtxml-streambookmarks-example.html)
-    */
-    void write_bookmarks ();
-    void write_tree_item (QXmlStreamWriter *xml_writer,
-                          const QTreeWidgetItem *item);
-    QString read_bookmarks ();
-    void read_next_item (QXmlStreamReader *xml_writer, item_tag tag,
-                         QTreeWidgetItem *item = nullptr);
+  /*!
+      Writing to and reading bookmarks from an xbel-file as
+      proposed in the qt example
+      [QXmlStream Bookmarks Example](https://doc.qt.io/qt-5/qtxml-streambookmarks-example.html)
+  */
+  void write_bookmarks ();
+  void write_tree_item (QXmlStreamWriter *xml_writer,
+                        const QTreeWidgetItem *item);
+  QString read_bookmarks ();
+  void read_next_item (QXmlStreamReader *xml_writer, item_tag tag,
+                       QTreeWidgetItem *item = nullptr);
 
-    documentation *m_doc;
-    documentation_browser *m_browser;
+  documentation *m_doc;
+  documentation_browser *m_browser;
 
-    QComboBox *m_filter;
-    QTreeWidget *m_tree;
+  QComboBox *m_filter;
+  QTreeWidget *m_tree;
 
-    QTreeWidgetItem *m_ctx_menu_item;
+  QTreeWidgetItem *m_ctx_menu_item;
 
-    QIcon icon_folder;
-    QIcon icon_bookmark;
+  QIcon icon_folder;
+  QIcon icon_bookmark;
 
-    QWidget *m_filter_widget;
-    QCheckBox *m_filter_checkbox;
-    bool m_filter_shown;
+  QWidget *m_filter_widget;
+  QCheckBox *m_filter_checkbox;
+  bool m_filter_shown;
 
-    QFile m_xbel_file;
-  };
+  QFile m_xbel_file;
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/src/documentation-dock-widget.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/documentation-dock-widget.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -33,64 +33,64 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  documentation_dock_widget::documentation_dock_widget (QWidget *p)
-    : octave_dock_widget ("DocumentationDockWidget", p),
-      m_docs (new documentation (this))
-  {
-    set_title (tr ("Documentation"));
-    setStatusTip (tr ("See the documentation for help."));
+documentation_dock_widget::documentation_dock_widget (QWidget *p)
+  : octave_dock_widget ("DocumentationDockWidget", p),
+    m_docs (new documentation (this))
+{
+  set_title (tr ("Documentation"));
+  setStatusTip (tr ("See the documentation for help."));
 
-    setWidget (m_docs);
+  setWidget (m_docs);
 
-    if (! p)
-      make_window ();
-  }
+  if (! p)
+    make_window ();
+}
 
-  void documentation_dock_widget::notice_settings ()
-  {
-    m_docs->notice_settings ();
-  }
+void documentation_dock_widget::notice_settings ()
+{
+  m_docs->notice_settings ();
+}
 
-  void documentation_dock_widget::save_settings ()
-  {
-    m_docs->save_settings ();
-    octave_dock_widget::save_settings ();
-  }
+void documentation_dock_widget::save_settings ()
+{
+  m_docs->save_settings ();
+  octave_dock_widget::save_settings ();
+}
 
-  void documentation_dock_widget::copyClipboard ()
-  {
-    m_docs->copyClipboard ();
-  }
+void documentation_dock_widget::copyClipboard ()
+{
+  m_docs->copyClipboard ();
+}
 
-  void documentation_dock_widget::pasteClipboard ()
-  {
-    m_docs->pasteClipboard ();
-  }
+void documentation_dock_widget::pasteClipboard ()
+{
+  m_docs->pasteClipboard ();
+}
 
-  void documentation_dock_widget::selectAll ()
-  {
-    m_docs->selectAll ();
-  }
+void documentation_dock_widget::selectAll ()
+{
+  m_docs->selectAll ();
+}
 
-  void documentation_dock_widget::showDoc (const QString& name)
-  {
-    // show the doc pane without focus for carrying on typing in the console
-    if (! isVisible ())
-      setVisible (true);
+void documentation_dock_widget::showDoc (const QString& name)
+{
+  // show the doc pane without focus for carrying on typing in the console
+  if (! isVisible ())
+    setVisible (true);
 
-    raise ();
+  raise ();
 
-    m_docs->load_ref (name);
-  }
+  m_docs->load_ref (name);
+}
 
-  void documentation_dock_widget::registerDoc (const QString& name)
-  {
-    m_docs->registerDoc (name);
-  }
+void documentation_dock_widget::registerDoc (const QString& name)
+{
+  m_docs->registerDoc (name);
+}
 
-  void documentation_dock_widget::unregisterDoc (const QString& name)
-  {
-    m_docs->unregisterDoc (name);
-  }
+void documentation_dock_widget::unregisterDoc (const QString& name)
+{
+  m_docs->unregisterDoc (name);
+}
 
 OCTAVE_END_NAMESPACE(octave)
--- a/libgui/src/documentation-dock-widget.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/documentation-dock-widget.h	Thu Feb 02 12:25:51 2023 -0800
@@ -31,33 +31,33 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class documentation_dock_widget : public octave_dock_widget
-  {
-    Q_OBJECT
+class documentation_dock_widget : public octave_dock_widget
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    documentation_dock_widget (QWidget *parent);
+  documentation_dock_widget (QWidget *parent);
 
-    ~documentation_dock_widget () = default;
+  ~documentation_dock_widget () = default;
 
-  public slots:
+public slots:
 
-    void notice_settings ();
-    void save_settings ();
+  void notice_settings ();
+  void save_settings ();
 
-    void copyClipboard ();
-    void pasteClipboard ();
-    void selectAll ();
+  void copyClipboard ();
+  void pasteClipboard ();
+  void selectAll ();
 
-    void showDoc (const QString& name);
-    void registerDoc (const QString& name);
-    void unregisterDoc (const QString& name);
+  void showDoc (const QString& name);
+  void registerDoc (const QString& name);
+  void unregisterDoc (const QString& name);
 
-  private:
+private:
 
-    documentation *m_docs;
-  };
+  documentation *m_docs;
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/src/documentation.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/documentation.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -66,1047 +66,1047 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  // The documentation splitter, which is the main widget
-  // of the doc dock widget
-  documentation::documentation (QWidget *p)
-    : QSplitter (Qt::Horizontal, p),
-      m_doc_widget (this),
-      m_tool_bar (new QToolBar (this)),
-      m_query_string (QString ()),
-      m_indexed (false),
-      m_current_ref_name (QString ()),
-      m_prev_pages_menu (new QMenu (this)),
-      m_next_pages_menu (new QMenu (this)),
-      m_prev_pages_count (0),
-      m_next_pages_count (0),
-      m_findnext_shortcut (new QShortcut (this)),
-      m_findprev_shortcut (new QShortcut (this))
-  {
-    // Get original collection
-    QString collection = getenv ("OCTAVE_QTHELP_COLLECTION");
-    if (collection.isEmpty ())
-      collection = QString::fromStdString (config::oct_doc_dir ()
-                                           + sys::file_ops::dir_sep_str ()
-                                           + "octave_interpreter.qhc");
+// The documentation splitter, which is the main widget
+// of the doc dock widget
+documentation::documentation (QWidget *p)
+  : QSplitter (Qt::Horizontal, p),
+    m_doc_widget (this),
+    m_tool_bar (new QToolBar (this)),
+    m_query_string (QString ()),
+    m_indexed (false),
+    m_current_ref_name (QString ()),
+    m_prev_pages_menu (new QMenu (this)),
+    m_next_pages_menu (new QMenu (this)),
+    m_prev_pages_count (0),
+    m_next_pages_count (0),
+    m_findnext_shortcut (new QShortcut (this)),
+    m_findprev_shortcut (new QShortcut (this))
+{
+  // Get original collection
+  QString collection = getenv ("OCTAVE_QTHELP_COLLECTION");
+  if (collection.isEmpty ())
+    collection = QString::fromStdString (config::oct_doc_dir ()
+                                         + sys::file_ops::dir_sep_str ()
+                                         + "octave_interpreter.qhc");
 
-    // Setup the help engine with the original collection, use a writable copy
-    // of the original collection and load the help data
-    m_help_engine = new QHelpEngine (collection, this);
+  // Setup the help engine with the original collection, use a writable copy
+  // of the original collection and load the help data
+  m_help_engine = new QHelpEngine (collection, this);
 
-    // Mark help as readonly to avoid error if collection file is stored in a
-    // readonly location
-    m_help_engine->setProperty ("_q_readonly",
-                                QVariant::fromValue<bool> (true));
+  // Mark help as readonly to avoid error if collection file is stored in a
+  // readonly location
+  m_help_engine->setProperty ("_q_readonly",
+                              QVariant::fromValue<bool> (true));
 
-    QString tmpdir = QString::fromStdString (sys::env::get_temp_directory ());
-    m_collection
-      = QString::fromStdString (sys::tempnam (tmpdir.toStdString (),
-                                              "oct-qhelp-"));
+  QString tmpdir = QString::fromStdString (sys::env::get_temp_directory ());
+  m_collection
+    = QString::fromStdString (sys::tempnam (tmpdir.toStdString (),
+                                            "oct-qhelp-"));
 
-    if (m_help_engine->copyCollectionFile (m_collection))
-      m_help_engine->setCollectionFile (m_collection);
-    else
+  if (m_help_engine->copyCollectionFile (m_collection))
+    m_help_engine->setCollectionFile (m_collection);
+  else
 #ifdef ENABLE_DOCS
-      // FIXME: Perhaps a better way to do this would be to keep a count
-      // in the GUI preferences file.  After issuing this warning 3 times
-      // it would be disabled.  The count would need to be reset when a new
-      // version of Octave is installed.
-      QMessageBox::warning (this, tr ("Octave Documentation"),
-                            tr ("Could not copy help collection to temporary\n"
-                                "file. Search capabilities may be affected.\n"
-                                "%1").arg (m_help_engine->error ()));
+    // FIXME: Perhaps a better way to do this would be to keep a count
+    // in the GUI preferences file.  After issuing this warning 3 times
+    // it would be disabled.  The count would need to be reset when a new
+    // version of Octave is installed.
+    QMessageBox::warning (this, tr ("Octave Documentation"),
+                          tr ("Could not copy help collection to temporary\n"
+                              "file. Search capabilities may be affected.\n"
+                              "%1").arg (m_help_engine->error ()));
 #endif
 
-    connect(m_help_engine->searchEngine (), SIGNAL(indexingFinished ()),
-            this, SLOT(load_index ()));
-    connect(m_help_engine, SIGNAL(setupFinished ()),
-            m_help_engine->searchEngine (), SLOT(reindexDocumentation ()));
+  connect(m_help_engine->searchEngine (), SIGNAL(indexingFinished ()),
+          this, SLOT(load_index ()));
+  connect(m_help_engine, SIGNAL(setupFinished ()),
+          m_help_engine->searchEngine (), SLOT(reindexDocumentation ()));
 
-    if (! m_help_engine->setupData())
-      {
+  if (! m_help_engine->setupData())
+    {
 #ifdef ENABLE_DOCS
-        QMessageBox::warning (this, tr ("Octave Documentation"),
-                              tr ("Could not setup the data required for the\n"
-                                  "documentation viewer. Only help texts in\n"
-                                  "the Command Window will be available."));
+      QMessageBox::warning (this, tr ("Octave Documentation"),
+                            tr ("Could not setup the data required for the\n"
+                                "documentation viewer. Only help texts in\n"
+                                "the Command Window will be available."));
 #endif
 
-        disconnect (m_help_engine, 0, 0, 0);
+      disconnect (m_help_engine, 0, 0, 0);
 
-        delete m_help_engine;
-        m_help_engine = nullptr;
-      }
+      delete m_help_engine;
+      m_help_engine = nullptr;
+    }
 
-    // The browser
-    QWidget *browser_find = new QWidget (this);
-    m_doc_browser = new documentation_browser (m_help_engine, browser_find);
-    connect (m_doc_browser, &documentation_browser::cursorPositionChanged,
-             this, &documentation::handle_cursor_position_change);
+  // The browser
+  QWidget *browser_find = new QWidget (this);
+  m_doc_browser = new documentation_browser (m_help_engine, browser_find);
+  connect (m_doc_browser, &documentation_browser::cursorPositionChanged,
+           this, &documentation::handle_cursor_position_change);
 
-    // Tool bar
-    construct_tool_bar ();
+  // Tool bar
+  construct_tool_bar ();
 
-    // Find bar
-    QWidget *find_footer = new QWidget (browser_find);
-    QLabel *find_label = new QLabel (tr ("Find:"), find_footer);
-    m_find_line_edit = new QLineEdit (find_footer);
-    connect (m_find_line_edit, &QLineEdit::returnPressed,
-             this, [=] () { find (); });
-    connect (m_find_line_edit, &QLineEdit::textEdited,
-             this, &documentation::find_forward_from_anchor);
-    QToolButton *forward_button = new QToolButton (find_footer);
-    forward_button->setText (tr ("Search forward"));
-    forward_button->setToolTip (tr ("Search forward"));
+  // Find bar
+  QWidget *find_footer = new QWidget (browser_find);
+  QLabel *find_label = new QLabel (tr ("Find:"), find_footer);
+  m_find_line_edit = new QLineEdit (find_footer);
+  connect (m_find_line_edit, &QLineEdit::returnPressed,
+           this, [=] () { find (); });
+  connect (m_find_line_edit, &QLineEdit::textEdited,
+           this, &documentation::find_forward_from_anchor);
+  QToolButton *forward_button = new QToolButton (find_footer);
+  forward_button->setText (tr ("Search forward"));
+  forward_button->setToolTip (tr ("Search forward"));
 
-    gui_settings settings;
+  gui_settings settings;
 
-    forward_button->setIcon (settings.icon ("go-down"));
-    connect (forward_button, &QToolButton::pressed,
-             this, [=] () { find (); });
-    QToolButton *backward_button = new QToolButton (find_footer);
-    backward_button->setText (tr ("Search backward"));
-    backward_button->setToolTip (tr ("Search backward"));
-    backward_button->setIcon (settings.icon ("go-up"));
-    connect (backward_button, &QToolButton::pressed,
-             this, &documentation::find_backward);
-    QHBoxLayout *h_box_find_footer = new QHBoxLayout (find_footer);
-    h_box_find_footer->addWidget (find_label);
-    h_box_find_footer->addWidget (m_find_line_edit);
-    h_box_find_footer->addWidget (forward_button);
-    h_box_find_footer->addWidget (backward_button);
-    h_box_find_footer->setMargin (2);
-    find_footer->setLayout (h_box_find_footer);
+  forward_button->setIcon (settings.icon ("go-down"));
+  connect (forward_button, &QToolButton::pressed,
+           this, [=] () { find (); });
+  QToolButton *backward_button = new QToolButton (find_footer);
+  backward_button->setText (tr ("Search backward"));
+  backward_button->setToolTip (tr ("Search backward"));
+  backward_button->setIcon (settings.icon ("go-up"));
+  connect (backward_button, &QToolButton::pressed,
+           this, &documentation::find_backward);
+  QHBoxLayout *h_box_find_footer = new QHBoxLayout (find_footer);
+  h_box_find_footer->addWidget (find_label);
+  h_box_find_footer->addWidget (m_find_line_edit);
+  h_box_find_footer->addWidget (forward_button);
+  h_box_find_footer->addWidget (backward_button);
+  h_box_find_footer->setMargin (2);
+  find_footer->setLayout (h_box_find_footer);
 
-    QVBoxLayout *v_box_browser_find = new QVBoxLayout (browser_find);
-    v_box_browser_find->addWidget (m_tool_bar);
-    v_box_browser_find->addWidget (m_doc_browser);
-    v_box_browser_find->addWidget (find_footer);
-    browser_find->setLayout (v_box_browser_find);
+  QVBoxLayout *v_box_browser_find = new QVBoxLayout (browser_find);
+  v_box_browser_find->addWidget (m_tool_bar);
+  v_box_browser_find->addWidget (m_doc_browser);
+  v_box_browser_find->addWidget (find_footer);
+  browser_find->setLayout (v_box_browser_find);
 
-    notice_settings ();
+  notice_settings ();
 
-    m_findnext_shortcut->setContext (Qt::WidgetWithChildrenShortcut);
-    connect (m_findnext_shortcut, &QShortcut::activated,
-             this, [=] () { find (); });
-    m_findprev_shortcut->setContext (Qt::WidgetWithChildrenShortcut);
-    connect (m_findprev_shortcut, &QShortcut::activated,
-             this, &documentation::find_backward);
+  m_findnext_shortcut->setContext (Qt::WidgetWithChildrenShortcut);
+  connect (m_findnext_shortcut, &QShortcut::activated,
+           this, [=] () { find (); });
+  m_findprev_shortcut->setContext (Qt::WidgetWithChildrenShortcut);
+  connect (m_findprev_shortcut, &QShortcut::activated,
+           this, &documentation::find_backward);
 
-    find_footer->hide ();
-    m_search_anchor_position = 0;
+  find_footer->hide ();
+  m_search_anchor_position = 0;
 
-    if (m_help_engine)
-      {
+  if (m_help_engine)
+    {
 #if defined (HAVE_NEW_QHELPINDEXWIDGET_API)
-        // Starting in Qt 5.15, help engine uses filters instead of old API
-        m_help_engine->setUsesFilterEngine (true);
+      // Starting in Qt 5.15, help engine uses filters instead of old API
+      m_help_engine->setUsesFilterEngine (true);
 #endif
-        // Layout contents, index and search
-        QTabWidget *navi = new QTabWidget (this);
-        navi->setTabsClosable (false);
-        navi->setMovable (true);
+      // Layout contents, index and search
+      QTabWidget *navi = new QTabWidget (this);
+      navi->setTabsClosable (false);
+      navi->setMovable (true);
 
-        // Contents
-        QHelpContentWidget *content = m_help_engine->contentWidget ();
-        content->setObjectName ("documentation_tab_contents");
-        navi->addTab (content, tr ("Contents"));
+      // Contents
+      QHelpContentWidget *content = m_help_engine->contentWidget ();
+      content->setObjectName ("documentation_tab_contents");
+      navi->addTab (content, tr ("Contents"));
 
-        connect (m_help_engine->contentWidget (),
-                 &QHelpContentWidget::linkActivated,
-                 m_doc_browser, [=] (const QUrl& url) {
-                   m_doc_browser->handle_index_clicked (url); });
+      connect (m_help_engine->contentWidget (),
+               &QHelpContentWidget::linkActivated,
+               m_doc_browser, [=] (const QUrl& url) {
+                 m_doc_browser->handle_index_clicked (url); });
 
-        // Index
-        QHelpIndexWidget *index = m_help_engine->indexWidget ();
+      // Index
+      QHelpIndexWidget *index = m_help_engine->indexWidget ();
 
-        m_filter = new QComboBox (this);
-        m_filter->setToolTip (tr ("Enter text to search the indices"));
-        m_filter->setEditable (true);
-        m_filter->setInsertPolicy (QComboBox::NoInsert);
-        m_filter->setMaxCount (10);
-        m_filter->setMaxVisibleItems (10);
-        m_filter->setSizeAdjustPolicy (QComboBox::AdjustToMinimumContentsLengthWithIcon);
-        QSizePolicy sizePol (QSizePolicy::Expanding, QSizePolicy::Preferred);
-        m_filter->setSizePolicy (sizePol);
-        m_filter->completer ()->setCaseSensitivity (Qt::CaseSensitive);
-        QLabel *filter_label = new QLabel (tr ("Search"));
+      m_filter = new QComboBox (this);
+      m_filter->setToolTip (tr ("Enter text to search the indices"));
+      m_filter->setEditable (true);
+      m_filter->setInsertPolicy (QComboBox::NoInsert);
+      m_filter->setMaxCount (10);
+      m_filter->setMaxVisibleItems (10);
+      m_filter->setSizeAdjustPolicy (QComboBox::AdjustToMinimumContentsLengthWithIcon);
+      QSizePolicy sizePol (QSizePolicy::Expanding, QSizePolicy::Preferred);
+      m_filter->setSizePolicy (sizePol);
+      m_filter->completer ()->setCaseSensitivity (Qt::CaseSensitive);
+      QLabel *filter_label = new QLabel (tr ("Search"));
 
-        QWidget *filter_all = new QWidget (navi);
-        QHBoxLayout *h_box_index = new QHBoxLayout (filter_all);
-        h_box_index->addWidget (filter_label);
-        h_box_index->addWidget (m_filter);
-        h_box_index->setMargin (2);
-        filter_all->setLayout (h_box_index);
+      QWidget *filter_all = new QWidget (navi);
+      QHBoxLayout *h_box_index = new QHBoxLayout (filter_all);
+      h_box_index->addWidget (filter_label);
+      h_box_index->addWidget (m_filter);
+      h_box_index->setMargin (2);
+      filter_all->setLayout (h_box_index);
 
-        QWidget *index_all = new QWidget (navi);
-        index_all->setObjectName ("documentation_tab_index");
-        QVBoxLayout *v_box_index = new QVBoxLayout (index_all);
-        v_box_index->addWidget (filter_all);
-        v_box_index->addWidget (index);
-        index_all->setLayout (v_box_index);
+      QWidget *index_all = new QWidget (navi);
+      index_all->setObjectName ("documentation_tab_index");
+      QVBoxLayout *v_box_index = new QVBoxLayout (index_all);
+      v_box_index->addWidget (filter_all);
+      v_box_index->addWidget (index);
+      index_all->setLayout (v_box_index);
 
-        navi->addTab (index_all, tr ("Function Index"));
+      navi->addTab (index_all, tr ("Function Index"));
 
 #if defined (HAVE_NEW_QHELPINDEXWIDGET_API)
-        connect (m_help_engine->indexWidget (),
-                 &QHelpIndexWidget::documentActivated,
-                 this, [=] (const QHelpLink &link) {
-                   m_doc_browser->handle_index_clicked (link.url); });
+      connect (m_help_engine->indexWidget (),
+               &QHelpIndexWidget::documentActivated,
+               this, [=] (const QHelpLink &link) {
+                 m_doc_browser->handle_index_clicked (link.url); });
 #else
-        connect (m_help_engine->indexWidget (),
-                 &QHelpIndexWidget::linkActivated,
-                 m_doc_browser, &documentation_browser::handle_index_clicked);
+      connect (m_help_engine->indexWidget (),
+               &QHelpIndexWidget::linkActivated,
+               m_doc_browser, &documentation_browser::handle_index_clicked);
 #endif
 
-        connect (m_filter, &QComboBox::editTextChanged,
-                 this, &documentation::filter_update);
+      connect (m_filter, &QComboBox::editTextChanged,
+               this, &documentation::filter_update);
 
-        connect (m_filter->lineEdit (), &QLineEdit::editingFinished,
-                 this, &documentation::filter_update_history);
+      connect (m_filter->lineEdit (), &QLineEdit::editingFinished,
+               this, &documentation::filter_update_history);
 
-        // Bookmarks (own class)
-        m_bookmarks = new documentation_bookmarks (this, m_doc_browser, navi);
-        navi->addTab (m_bookmarks, tr ("Bookmarks"));
+      // Bookmarks (own class)
+      m_bookmarks = new documentation_bookmarks (this, m_doc_browser, navi);
+      navi->addTab (m_bookmarks, tr ("Bookmarks"));
 
-        connect (m_action_bookmark, &QAction::triggered,
-                 m_bookmarks, [=] () { m_bookmarks->add_bookmark (); });
+      connect (m_action_bookmark, &QAction::triggered,
+               m_bookmarks, [=] () { m_bookmarks->add_bookmark (); });
 
-        // Search
-        QHelpSearchEngine *search_engine = m_help_engine->searchEngine ();
-        QHelpSearchQueryWidget *search = search_engine->queryWidget ();
-        QHelpSearchResultWidget *result = search_engine->resultWidget ();
-        QWidget *search_all = new QWidget (navi);
-        QVBoxLayout *v_box_search = new QVBoxLayout (search_all);
-        v_box_search->addWidget (search);
-        v_box_search->addWidget (result);
-        search_all->setLayout (v_box_search);
-        search_all->setObjectName ("documentation_tab_search");
-        navi->addTab (search_all, tr ("Search"));
+      // Search
+      QHelpSearchEngine *search_engine = m_help_engine->searchEngine ();
+      QHelpSearchQueryWidget *search = search_engine->queryWidget ();
+      QHelpSearchResultWidget *result = search_engine->resultWidget ();
+      QWidget *search_all = new QWidget (navi);
+      QVBoxLayout *v_box_search = new QVBoxLayout (search_all);
+      v_box_search->addWidget (search);
+      v_box_search->addWidget (result);
+      search_all->setLayout (v_box_search);
+      search_all->setObjectName ("documentation_tab_search");
+      navi->addTab (search_all, tr ("Search"));
 
-        connect (search, &QHelpSearchQueryWidget::search,
-                 this, &documentation::global_search);
+      connect (search, &QHelpSearchQueryWidget::search,
+               this, &documentation::global_search);
 
-        connect (search_engine, &QHelpSearchEngine::searchingStarted,
-                 this, &documentation::global_search_started);
-        connect (search_engine, &QHelpSearchEngine::searchingFinished,
-                 this, &documentation::global_search_finished);
+      connect (search_engine, &QHelpSearchEngine::searchingStarted,
+               this, &documentation::global_search_started);
+      connect (search_engine, &QHelpSearchEngine::searchingFinished,
+               this, &documentation::global_search_finished);
 
-        connect (search_engine->resultWidget (),
-                 &QHelpSearchResultWidget::requestShowLink,
-                 this, &documentation::handle_search_result_clicked);
+      connect (search_engine->resultWidget (),
+               &QHelpSearchResultWidget::requestShowLink,
+               this, &documentation::handle_search_result_clicked);
 
-        // Fill the splitter
-        insertWidget (0, navi);
-        insertWidget (1, browser_find);
-        setStretchFactor (1, 1);
-      }
-  }
+      // Fill the splitter
+      insertWidget (0, navi);
+      insertWidget (1, browser_find);
+      setStretchFactor (1, 1);
+    }
+}
 
-  documentation::~documentation ()
-  {
-    // Cleanup temporary file and directory
-    QFile file (m_collection);
-    if (file.exists ())
-      {
-        QFileInfo finfo (file);
-        QString bname = finfo.fileName ();
-        QDir dir = finfo.absoluteDir ();
-        dir.setFilter (QDir::Dirs | QDir::NoDotAndDotDot | QDir::Hidden);
-        QStringList namefilter;
-        namefilter.append ("*" + bname + "*");
-        for (const auto& fi : dir.entryInfoList (namefilter))
-          {
-            std::string file_name = fi.absoluteFilePath ().toStdString ();
-            sys::recursive_rmdir (file_name);
-          }
+documentation::~documentation ()
+{
+  // Cleanup temporary file and directory
+  QFile file (m_collection);
+  if (file.exists ())
+    {
+      QFileInfo finfo (file);
+      QString bname = finfo.fileName ();
+      QDir dir = finfo.absoluteDir ();
+      dir.setFilter (QDir::Dirs | QDir::NoDotAndDotDot | QDir::Hidden);
+      QStringList namefilter;
+      namefilter.append ("*" + bname + "*");
+      for (const auto& fi : dir.entryInfoList (namefilter))
+        {
+          std::string file_name = fi.absoluteFilePath ().toStdString ();
+          sys::recursive_rmdir (file_name);
+        }
 
-        file.remove();
-      }
-  }
+      file.remove();
+    }
+}
 
-  QAction * documentation::add_action (const QIcon& icon, const QString& text,
-                                       const char *member, QWidget *receiver,
-                                       QToolBar *tool_bar)
-  {
-    QAction *a;
-    QWidget *r = this;
-    if (receiver != nullptr)
-      r = receiver;
+QAction * documentation::add_action (const QIcon& icon, const QString& text,
+                                     const char *member, QWidget *receiver,
+                                     QToolBar *tool_bar)
+{
+  QAction *a;
+  QWidget *r = this;
+  if (receiver != nullptr)
+    r = receiver;
 
-    a = new QAction (icon, text, this);
+  a = new QAction (icon, text, this);
 
-    if (member)
-      connect (a, SIGNAL (triggered ()), r, member);
+  if (member)
+    connect (a, SIGNAL (triggered ()), r, member);
 
-    if (tool_bar)
-      tool_bar->addAction (a);
+  if (tool_bar)
+    tool_bar->addAction (a);
 
-    m_doc_widget->addAction (a);  // important for shortcut context
-    a->setShortcutContext (Qt::WidgetWithChildrenShortcut);
+  m_doc_widget->addAction (a);  // important for shortcut context
+  a->setShortcutContext (Qt::WidgetWithChildrenShortcut);
 
-    return a;
-  }
+  return a;
+}
 
-  void documentation::construct_tool_bar ()
-  {
-    // Home, Previous, Next
-    gui_settings settings;
+void documentation::construct_tool_bar ()
+{
+  // Home, Previous, Next
+  gui_settings settings;
 
-    m_action_go_home
-      = add_action (settings.icon ("go-home"), tr ("Go home"), SLOT (home ()),
-                    m_doc_browser, m_tool_bar);
+  m_action_go_home
+    = add_action (settings.icon ("go-home"), tr ("Go home"), SLOT (home ()),
+                  m_doc_browser, m_tool_bar);
 
-    m_action_go_prev
-      = add_action (settings.icon ("go-previous"), tr ("Go back"),
-                    SLOT (backward ()), m_doc_browser, m_tool_bar);
-    m_action_go_prev->setEnabled (false);
+  m_action_go_prev
+    = add_action (settings.icon ("go-previous"), tr ("Go back"),
+                  SLOT (backward ()), m_doc_browser, m_tool_bar);
+  m_action_go_prev->setEnabled (false);
 
-    // popdown menu with prev pages files
-    QToolButton *popdown_button_prev_pages = new QToolButton ();
-    popdown_button_prev_pages->setToolTip (tr ("Previous pages"));
-    popdown_button_prev_pages->setMenu (m_prev_pages_menu);
-    popdown_button_prev_pages->setPopupMode (QToolButton::InstantPopup);
-    popdown_button_prev_pages->setToolButtonStyle (Qt::ToolButtonTextOnly);
-    popdown_button_prev_pages->setCheckable (false);
-    popdown_button_prev_pages->setArrowType(Qt::DownArrow);
-    m_tool_bar->addWidget (popdown_button_prev_pages);
+  // popdown menu with prev pages files
+  QToolButton *popdown_button_prev_pages = new QToolButton ();
+  popdown_button_prev_pages->setToolTip (tr ("Previous pages"));
+  popdown_button_prev_pages->setMenu (m_prev_pages_menu);
+  popdown_button_prev_pages->setPopupMode (QToolButton::InstantPopup);
+  popdown_button_prev_pages->setToolButtonStyle (Qt::ToolButtonTextOnly);
+  popdown_button_prev_pages->setCheckable (false);
+  popdown_button_prev_pages->setArrowType(Qt::DownArrow);
+  m_tool_bar->addWidget (popdown_button_prev_pages);
 
-    m_action_go_next
-      = add_action (settings.icon ("go-next"), tr ("Go forward"),
-                    SLOT (forward ()), m_doc_browser, m_tool_bar);
-    m_action_go_next->setEnabled (false);
+  m_action_go_next
+    = add_action (settings.icon ("go-next"), tr ("Go forward"),
+                  SLOT (forward ()), m_doc_browser, m_tool_bar);
+  m_action_go_next->setEnabled (false);
 
-    // popdown menu with prev pages files
-    QToolButton *popdown_button_next_pages = new QToolButton ();
-    popdown_button_next_pages->setToolTip (tr ("Next pages"));
-    popdown_button_next_pages->setMenu (m_next_pages_menu);
-    popdown_button_next_pages->setPopupMode (QToolButton::InstantPopup);
-    popdown_button_next_pages->setToolButtonStyle (Qt::ToolButtonTextOnly);
-    popdown_button_next_pages->setArrowType(Qt::DownArrow);
-    m_tool_bar->addWidget (popdown_button_next_pages);
+  // popdown menu with prev pages files
+  QToolButton *popdown_button_next_pages = new QToolButton ();
+  popdown_button_next_pages->setToolTip (tr ("Next pages"));
+  popdown_button_next_pages->setMenu (m_next_pages_menu);
+  popdown_button_next_pages->setPopupMode (QToolButton::InstantPopup);
+  popdown_button_next_pages->setToolButtonStyle (Qt::ToolButtonTextOnly);
+  popdown_button_next_pages->setArrowType(Qt::DownArrow);
+  m_tool_bar->addWidget (popdown_button_next_pages);
 
-    connect (m_doc_browser, &documentation_browser::backwardAvailable,
-             m_action_go_prev, &QAction::setEnabled);
-    connect (m_doc_browser, &documentation_browser::backwardAvailable,
-             popdown_button_prev_pages, &QToolButton::setEnabled);
-    connect (m_doc_browser, &documentation_browser::forwardAvailable,
-             m_action_go_next, &QAction::setEnabled);
-    connect (m_doc_browser, &documentation_browser::forwardAvailable,
-             popdown_button_next_pages, &QToolButton::setEnabled);
-    connect (m_doc_browser, &documentation_browser::historyChanged,
-             this, &documentation::update_history_menus);
+  connect (m_doc_browser, &documentation_browser::backwardAvailable,
+           m_action_go_prev, &QAction::setEnabled);
+  connect (m_doc_browser, &documentation_browser::backwardAvailable,
+           popdown_button_prev_pages, &QToolButton::setEnabled);
+  connect (m_doc_browser, &documentation_browser::forwardAvailable,
+           m_action_go_next, &QAction::setEnabled);
+  connect (m_doc_browser, &documentation_browser::forwardAvailable,
+           popdown_button_next_pages, &QToolButton::setEnabled);
+  connect (m_doc_browser, &documentation_browser::historyChanged,
+           this, &documentation::update_history_menus);
 
-    // Init prev/next menus
-    for (int i = 0; i < max_history_entries; ++i)
-      {
-        m_prev_pages_actions[i] = new QAction (this);
-        m_prev_pages_actions[i]->setVisible (false);
-        m_next_pages_actions[i] = new QAction (this);
-        m_next_pages_actions[i]->setVisible (false);
-        m_prev_pages_menu->addAction (m_prev_pages_actions[i]);
-        m_next_pages_menu->addAction (m_next_pages_actions[i]);
-      }
+  // Init prev/next menus
+  for (int i = 0; i < max_history_entries; ++i)
+    {
+      m_prev_pages_actions[i] = new QAction (this);
+      m_prev_pages_actions[i]->setVisible (false);
+      m_next_pages_actions[i] = new QAction (this);
+      m_next_pages_actions[i]->setVisible (false);
+      m_prev_pages_menu->addAction (m_prev_pages_actions[i]);
+      m_next_pages_menu->addAction (m_next_pages_actions[i]);
+    }
 
-    connect (m_prev_pages_menu, &QMenu::triggered,
-             this, &documentation::open_hist_url);
-    connect (m_next_pages_menu, &QMenu::triggered,
-             this, &documentation::open_hist_url);
+  connect (m_prev_pages_menu, &QMenu::triggered,
+           this, &documentation::open_hist_url);
+  connect (m_next_pages_menu, &QMenu::triggered,
+           this, &documentation::open_hist_url);
 
-    // Find
-    m_tool_bar->addSeparator ();
-    m_action_find
-      = add_action (settings.icon ("edit-find"), tr ("Find"),
-                    SLOT (activate_find ()), this, m_tool_bar);
+  // Find
+  m_tool_bar->addSeparator ();
+  m_action_find
+    = add_action (settings.icon ("edit-find"), tr ("Find"),
+                  SLOT (activate_find ()), this, m_tool_bar);
 
-    // Zoom
-    m_tool_bar->addSeparator ();
-    m_action_zoom_in
-      = add_action (settings.icon ("view-zoom-in"), tr ("Zoom in"),
-                    SLOT (zoom_in ()), m_doc_browser, m_tool_bar);
-    m_action_zoom_out
-      = add_action (settings.icon ("view-zoom-out"), tr ("Zoom out"),
-                    SLOT (zoom_out ()), m_doc_browser, m_tool_bar);
-    m_action_zoom_original
-      = add_action (settings.icon ("view-zoom-original"), tr ("Zoom original"),
-                    SLOT (zoom_original ()), m_doc_browser, m_tool_bar);
+  // Zoom
+  m_tool_bar->addSeparator ();
+  m_action_zoom_in
+    = add_action (settings.icon ("view-zoom-in"), tr ("Zoom in"),
+                  SLOT (zoom_in ()), m_doc_browser, m_tool_bar);
+  m_action_zoom_out
+    = add_action (settings.icon ("view-zoom-out"), tr ("Zoom out"),
+                  SLOT (zoom_out ()), m_doc_browser, m_tool_bar);
+  m_action_zoom_original
+    = add_action (settings.icon ("view-zoom-original"), tr ("Zoom original"),
+                  SLOT (zoom_original ()), m_doc_browser, m_tool_bar);
 
-    // Bookmarks (connect slots later)
-    m_tool_bar->addSeparator ();
-    m_action_bookmark
-      = add_action (settings.icon ("bookmark-new"),
-                    tr ("Bookmark current page"), nullptr, nullptr, m_tool_bar);
-  }
+  // Bookmarks (connect slots later)
+  m_tool_bar->addSeparator ();
+  m_action_bookmark
+    = add_action (settings.icon ("bookmark-new"),
+                  tr ("Bookmark current page"), nullptr, nullptr, m_tool_bar);
+}
 
-  void documentation::global_search ()
-  {
-    if (! m_help_engine)
-      return;
+void documentation::global_search ()
+{
+  if (! m_help_engine)
+    return;
 
-    QString query_string;
+  QString query_string;
 #if defined (HAVE_QHELPSEARCHQUERYWIDGET_SEARCHINPUT)
-    QString queries
-      = m_help_engine->searchEngine ()->queryWidget ()->searchInput ();
-    query_string = queries;
+  QString queries
+    = m_help_engine->searchEngine ()->queryWidget ()->searchInput ();
+  query_string = queries;
 #else
-    // FIXME: drop this part when support for Qt4 is dropped
-    QList<QHelpSearchQuery> queries
-      = m_help_engine->searchEngine ()->queryWidget ()->query ();
-    if (queries.count ())
-      query_string = queries.first ().wordList.join (" ");
-    else
-      query_string = "";
+  // FIXME: drop this part when support for Qt4 is dropped
+  QList<QHelpSearchQuery> queries
+    = m_help_engine->searchEngine ()->queryWidget ()->query ();
+  if (queries.count ())
+    query_string = queries.first ().wordList.join (" ");
+  else
+    query_string = "";
 #endif
 
-    if (query_string.isEmpty ())
-      return;
+  if (query_string.isEmpty ())
+    return;
 
-    // Get quoted search strings first, then take first string as fall back
-    QRegExp rx ("\"([^\"]*)\"");
-    if (rx.indexIn (query_string, 0) != -1)
-      m_internal_search = rx.cap (1);
-    else
+  // Get quoted search strings first, then take first string as fall back
+  QRegExp rx ("\"([^\"]*)\"");
+  if (rx.indexIn (query_string, 0) != -1)
+    m_internal_search = rx.cap (1);
+  else
 #if defined (HAVE_QT_SPLITBEHAVIOR_ENUM)
-      m_internal_search = query_string.split (" ", Qt::SkipEmptyParts).first ();
+    m_internal_search = query_string.split (" ", Qt::SkipEmptyParts).first ();
 #else
-      m_internal_search = query_string.split (" ", QString::SkipEmptyParts).first ();
+    m_internal_search = query_string.split (" ", QString::SkipEmptyParts).first ();
 #endif
 
-    m_help_engine->searchEngine ()->search (queries);
-  }
+  m_help_engine->searchEngine ()->search (queries);
+}
 
-  void documentation::global_search_started ()
-  {
-    qApp->setOverrideCursor(QCursor(Qt::WaitCursor));
-  }
+void documentation::global_search_started ()
+{
+  qApp->setOverrideCursor(QCursor(Qt::WaitCursor));
+}
 
-  void documentation::global_search_finished (int)
-  {
-    if (! m_help_engine)
-      return;
+void documentation::global_search_finished (int)
+{
+  if (! m_help_engine)
+    return;
 
-    if (! m_internal_search.isEmpty ())
-      {
-        m_query_string = m_internal_search;
+  if (! m_internal_search.isEmpty ())
+    {
+      m_query_string = m_internal_search;
 
-        QHelpSearchEngine *search_engine = m_help_engine->searchEngine ();
-        if (search_engine)
-          {
+      QHelpSearchEngine *search_engine = m_help_engine->searchEngine ();
+      if (search_engine)
+        {
 #if defined (HAVE_QHELPSEARCHQUERYWIDGET_SEARCHINPUT)
-            QVector<QHelpSearchResult> res
-              = search_engine->searchResults (0, search_engine->searchResultCount ());
+          QVector<QHelpSearchResult> res
+            = search_engine->searchResults (0, search_engine->searchResultCount ());
 #else
-            QList< QPair<QString, QString> > res
-              = search_engine->hits (0, search_engine->hitCount ());
+          QList< QPair<QString, QString> > res
+            = search_engine->hits (0, search_engine->hitCount ());
 #endif
 
-            if (res.count ())
-              {
-                QUrl url;
+          if (res.count ())
+            {
+              QUrl url;
 
-                if (res.count () == 1)
+              if (res.count () == 1)
 #if defined (HAVE_QHELPSEARCHQUERYWIDGET_SEARCHINPUT)
-                  url = res.front ().url ();
-#else
-                  url = res.front ().first;
-#endif
-                else
-                  {
-                    // Remove the quotes we added
-                    QString search_string = m_internal_search;
-
-                    for (const auto& r : res)
-                      {
-#if defined (HAVE_QHELPSEARCHQUERYWIDGET_SEARCHINPUT)
-                        QString title = r.title ().toLower ();
-                        QUrl tmpurl = r.url ();
+                url = res.front ().url ();
 #else
-                        QString title = r.second.toLower ();
-                        QUrl tmpurl = r.first;
+                url = res.front ().first;
 #endif
-                        if (title.contains (search_string.toLower ()))
-                          {
-                            if (title.indexOf (search_string.toLower ()) == 0)
-                              {
-                                url = tmpurl;
-                                break;
-                              }
-                            else if (url.isEmpty ())
-                              url = tmpurl;
-                          }
-                      }
-                  }
-
-                if (! url.isEmpty ())
-                  {
-                    connect (this, &documentation::show_single_result,
-                             this, &documentation::handle_search_result_clicked);
+              else
+                {
+                  // Remove the quotes we added
+                  QString search_string = m_internal_search;
 
-                    emit show_single_result (url);
-                  }
-              }
-          }
-
-        m_internal_search = QString ();
-      }
-
-    qApp->restoreOverrideCursor();
-  }
-
-  void documentation::handle_search_result_clicked (const QUrl& url)
-  {
-    // Open url with matching text
-    m_doc_browser->handle_index_clicked (url);
-
-    // Select all occurrences of matching text
-    select_all_occurrences (m_query_string);
-
-    // Open search widget with matching text as search string
-    m_find_line_edit->setText (m_query_string);
-    m_find_line_edit->parentWidget ()->show ();
+                  for (const auto& r : res)
+                    {
+#if defined (HAVE_QHELPSEARCHQUERYWIDGET_SEARCHINPUT)
+                      QString title = r.title ().toLower ();
+                      QUrl tmpurl = r.url ();
+#else
+                      QString title = r.second.toLower ();
+                      QUrl tmpurl = r.first;
+#endif
+                      if (title.contains (search_string.toLower ()))
+                        {
+                          if (title.indexOf (search_string.toLower ()) == 0)
+                            {
+                              url = tmpurl;
+                              break;
+                            }
+                          else if (url.isEmpty ())
+                            url = tmpurl;
+                        }
+                    }
+                }
 
-    // If no occurrence can be found go to the top of the page
-    if (! m_doc_browser->find (m_find_line_edit->text ()))
-      m_doc_browser->moveCursor (QTextCursor::Start);
-    else
-      {
-        // Go to to first occurrence of search text.  Going to the end and then
-        // search backwards until the last occurrence ensures the search text
-        // is visible in the first line of the visible part of the text.
-        m_doc_browser->moveCursor (QTextCursor::End);
-        while (m_doc_browser->find (m_find_line_edit->text (),
-                                    QTextDocument::FindBackward));
-      }
-  }
+              if (! url.isEmpty ())
+                {
+                  connect (this, &documentation::show_single_result,
+                           this, &documentation::handle_search_result_clicked);
+
+                  emit show_single_result (url);
+                }
+            }
+        }
+
+      m_internal_search = QString ();
+    }
 
-  void documentation::select_all_occurrences (const QString& text)
-  {
-    // Get highlight background and text color
-    QPalette pal = QApplication::palette ();
-    QTextCharFormat format;
-    QColor col = pal.color (QPalette::Highlight);
-    col.setAlphaF (0.25);
-    format.setBackground (QBrush (col));
-    format.setForeground (QBrush (pal.color (QPalette::Text)));
+  qApp->restoreOverrideCursor();
+}
+
+void documentation::handle_search_result_clicked (const QUrl& url)
+{
+  // Open url with matching text
+  m_doc_browser->handle_index_clicked (url);
 
-    // Create list for extra selected items
-    QList<QTextEdit::ExtraSelection> selected;
+  // Select all occurrences of matching text
+  select_all_occurrences (m_query_string);
+
+  // Open search widget with matching text as search string
+  m_find_line_edit->setText (m_query_string);
+  m_find_line_edit->parentWidget ()->show ();
+
+  // If no occurrence can be found go to the top of the page
+  if (! m_doc_browser->find (m_find_line_edit->text ()))
     m_doc_browser->moveCursor (QTextCursor::Start);
+  else
+    {
+      // Go to to first occurrence of search text.  Going to the end and then
+      // search backwards until the last occurrence ensures the search text
+      // is visible in the first line of the visible part of the text.
+      m_doc_browser->moveCursor (QTextCursor::End);
+      while (m_doc_browser->find (m_find_line_edit->text (),
+                                  QTextDocument::FindBackward));
+    }
+}
 
-    // Find all occurrences and add them to the selection
-    while ( m_doc_browser->find (text) )
-      {
-        QTextEdit::ExtraSelection selected_item;
-        selected_item.cursor = m_doc_browser->textCursor ();
-        selected_item.format = format;
-        selected.append (selected_item);
-      }
+void documentation::select_all_occurrences (const QString& text)
+{
+  // Get highlight background and text color
+  QPalette pal = QApplication::palette ();
+  QTextCharFormat format;
+  QColor col = pal.color (QPalette::Highlight);
+  col.setAlphaF (0.25);
+  format.setBackground (QBrush (col));
+  format.setForeground (QBrush (pal.color (QPalette::Text)));
 
-    // Apply selection and move back to the beginning
-    m_doc_browser->setExtraSelections (selected);
-    m_doc_browser->moveCursor (QTextCursor::Start);
-  }
-
-  void documentation::notice_settings ()
-  {
-    gui_settings settings;
+  // Create list for extra selected items
+  QList<QTextEdit::ExtraSelection> selected;
+  m_doc_browser->moveCursor (QTextCursor::Start);
 
-    // If m_help_engine is not defined, the objects accessed by this method
-    // are not valid.  Thus, just return in this case.
-    if (! m_help_engine)
-      return;
+  // Find all occurrences and add them to the selection
+  while ( m_doc_browser->find (text) )
+    {
+      QTextEdit::ExtraSelection selected_item;
+      selected_item.cursor = m_doc_browser->textCursor ();
+      selected_item.format = format;
+      selected.append (selected_item);
+    }
 
-    // Icon size in the toolbar.
-    int size_idx = settings.int_value (global_icon_size);
-    size_idx = (size_idx > 0) - (size_idx < 0) + 1;  // Make valid index from 0 to 2
+  // Apply selection and move back to the beginning
+  m_doc_browser->setExtraSelections (selected);
+  m_doc_browser->moveCursor (QTextCursor::Start);
+}
 
-    QStyle *st = style ();
-    int icon_size = st->pixelMetric (global_icon_sizes[size_idx]);
-    m_tool_bar->setIconSize (QSize (icon_size, icon_size));
+void documentation::notice_settings ()
+{
+  gui_settings settings;
 
-    // Shortcuts
-    settings.set_shortcut (m_action_find, sc_edit_edit_find_replace);
-    settings.shortcut (m_findnext_shortcut, sc_edit_edit_find_next);
-    settings.shortcut (m_findprev_shortcut, sc_edit_edit_find_previous);
-    settings.set_shortcut (m_action_zoom_in, sc_edit_view_zoom_in);
-    settings.set_shortcut (m_action_zoom_out, sc_edit_view_zoom_out);
-    settings.set_shortcut (m_action_zoom_original, sc_edit_view_zoom_normal);
-    settings.set_shortcut (m_action_go_home, sc_doc_go_home);
-    settings.set_shortcut (m_action_go_prev, sc_doc_go_back);
-    settings.set_shortcut (m_action_go_next, sc_doc_go_next);
-    settings.set_shortcut (m_action_bookmark, sc_doc_bookmark);
+  // If m_help_engine is not defined, the objects accessed by this method
+  // are not valid.  Thus, just return in this case.
+  if (! m_help_engine)
+    return;
+
+  // Icon size in the toolbar.
+  int size_idx = settings.int_value (global_icon_size);
+  size_idx = (size_idx > 0) - (size_idx < 0) + 1;  // Make valid index from 0 to 2
+
+  QStyle *st = style ();
+  int icon_size = st->pixelMetric (global_icon_sizes[size_idx]);
+  m_tool_bar->setIconSize (QSize (icon_size, icon_size));
 
-    // Settings for the browser
-    m_doc_browser->notice_settings ();
-  }
-
-  void documentation::save_settings ()
-  {
-    gui_settings settings;
-
-    m_doc_browser->save_settings ();
-    m_bookmarks->save_settings ();
-  }
+  // Shortcuts
+  settings.set_shortcut (m_action_find, sc_edit_edit_find_replace);
+  settings.shortcut (m_findnext_shortcut, sc_edit_edit_find_next);
+  settings.shortcut (m_findprev_shortcut, sc_edit_edit_find_previous);
+  settings.set_shortcut (m_action_zoom_in, sc_edit_view_zoom_in);
+  settings.set_shortcut (m_action_zoom_out, sc_edit_view_zoom_out);
+  settings.set_shortcut (m_action_zoom_original, sc_edit_view_zoom_normal);
+  settings.set_shortcut (m_action_go_home, sc_doc_go_home);
+  settings.set_shortcut (m_action_go_prev, sc_doc_go_back);
+  settings.set_shortcut (m_action_go_next, sc_doc_go_next);
+  settings.set_shortcut (m_action_bookmark, sc_doc_bookmark);
 
-  void documentation::copyClipboard ()
-  {
-    if (m_doc_browser->hasFocus ())
-      {
-        m_doc_browser->copy();
-      }
-  }
+  // Settings for the browser
+  m_doc_browser->notice_settings ();
+}
 
-  void documentation::pasteClipboard () { }
+void documentation::save_settings ()
+{
+  gui_settings settings;
 
-  void documentation::selectAll () { }
+  m_doc_browser->save_settings ();
+  m_bookmarks->save_settings ();
+}
 
-  void documentation::load_index ()
-  {
-    m_indexed = true;
+void documentation::copyClipboard ()
+{
+  if (m_doc_browser->hasFocus ())
+    {
+      m_doc_browser->copy();
+    }
+}
 
-    // Show index if no other page is required.
-    if (m_current_ref_name.isEmpty ())
-      m_doc_browser->setSource
-        (QUrl ("qthelp://org.octave.interpreter-1.0/doc/octave.html/index.html"));
-    else
-      load_ref (m_current_ref_name);
+void documentation::pasteClipboard () { }
+
+void documentation::selectAll () { }
+
+void documentation::load_index ()
+{
+  m_indexed = true;
 
-    m_help_engine->contentWidget ()->expandToDepth (0);
-  }
+  // Show index if no other page is required.
+  if (m_current_ref_name.isEmpty ())
+    m_doc_browser->setSource
+      (QUrl ("qthelp://org.octave.interpreter-1.0/doc/octave.html/index.html"));
+  else
+    load_ref (m_current_ref_name);
+
+  m_help_engine->contentWidget ()->expandToDepth (0);
+}
 
-  void documentation::load_ref (const QString& ref_name)
-  {
-    if (! m_help_engine || ref_name.isEmpty ())
-      return;
+void documentation::load_ref (const QString& ref_name)
+{
+  if (! m_help_engine || ref_name.isEmpty ())
+    return;
 
-    m_current_ref_name = ref_name;
+  m_current_ref_name = ref_name;
 
-    if (! m_indexed)
-      return;
+  if (! m_indexed)
+    return;
 
 #if defined (HAVE_QHELPENGINE_DOCUMENTSFORIDENTIFIER)
-    QList<QHelpLink> found_links
-      = m_help_engine->documentsForIdentifier (ref_name);
+  QList<QHelpLink> found_links
+    = m_help_engine->documentsForIdentifier (ref_name);
 #else
-    QMap<QString, QUrl> found_links
-      = m_help_engine->linksForIdentifier (ref_name);
+  QMap<QString, QUrl> found_links
+    = m_help_engine->linksForIdentifier (ref_name);
 #endif
 
-    QTabWidget *navi = static_cast<QTabWidget *> (widget (0));
+  QTabWidget *navi = static_cast<QTabWidget *> (widget (0));
 
-    if (found_links.count() > 0)
-      {
-        // First search in the function index
+  if (found_links.count() > 0)
+    {
+      // First search in the function index
 #if defined (HAVE_QHELPENGINE_DOCUMENTSFORIDENTIFIER)
-        QUrl first_url = found_links.constFirst().url;
+      QUrl first_url = found_links.constFirst().url;
 #else
-        QUrl first_url = found_links.constBegin().value ();
+      QUrl first_url = found_links.constBegin().value ();
 #endif
 
-        m_doc_browser->setSource (first_url);
+      m_doc_browser->setSource (first_url);
 
-        // Switch to function index tab
-        m_help_engine->indexWidget()->filterIndices (ref_name);
-        QWidget *index_tab
-          = navi->findChild<QWidget *> ("documentation_tab_index");
-        navi->setCurrentWidget (index_tab);
-      }
-    else
-      {
-        // Use full text search to provide the best match
-        QHelpSearchEngine *search_engine = m_help_engine->searchEngine ();
-        QHelpSearchQueryWidget *search_query = search_engine->queryWidget ();
+      // Switch to function index tab
+      m_help_engine->indexWidget()->filterIndices (ref_name);
+      QWidget *index_tab
+        = navi->findChild<QWidget *> ("documentation_tab_index");
+      navi->setCurrentWidget (index_tab);
+    }
+  else
+    {
+      // Use full text search to provide the best match
+      QHelpSearchEngine *search_engine = m_help_engine->searchEngine ();
+      QHelpSearchQueryWidget *search_query = search_engine->queryWidget ();
 
 #if defined (HAVE_QHELPSEARCHQUERYWIDGET_SEARCHINPUT)
-        QString query = ref_name;
-        query.prepend ("\"").append ("\"");
+      QString query = ref_name;
+      query.prepend ("\"").append ("\"");
 #else
-        QList<QHelpSearchQuery> query;
-        query << QHelpSearchQuery (QHelpSearchQuery::DEFAULT,
-                                   QStringList (QString("\"") + ref_name + QString("\"")));
+      QList<QHelpSearchQuery> query;
+      query << QHelpSearchQuery (QHelpSearchQuery::DEFAULT,
+                                 QStringList (QString("\"") + ref_name + QString("\"")));
 #endif
-        m_internal_search = ref_name;
-        search_engine->search (query);
+      m_internal_search = ref_name;
+      search_engine->search (query);
 
-        // Switch to search tab
+      // Switch to search tab
 #if defined (HAVE_QHELPSEARCHQUERYWIDGET_SEARCHINPUT)
-        search_query->setSearchInput (query);
+      search_query->setSearchInput (query);
 #else
-        search_query->setQuery (query);
+      search_query->setQuery (query);
 #endif
-        QWidget *search_tab
-          = navi->findChild<QWidget *> ("documentation_tab_search");
-        navi->setCurrentWidget (search_tab);
-      }
-  }
+      QWidget *search_tab
+        = navi->findChild<QWidget *> ("documentation_tab_search");
+      navi->setCurrentWidget (search_tab);
+    }
+}
 
-  void documentation::activate_find ()
-  {
-    if (m_find_line_edit->parentWidget ()->isVisible ())
-      {
-        m_find_line_edit->parentWidget ()->hide ();
-        m_doc_browser->setFocus ();
-      }
-    else
-      {
-        m_find_line_edit->parentWidget ()->show ();
-        m_find_line_edit->selectAll ();
-        m_find_line_edit->setFocus ();
-      }
-  }
+void documentation::activate_find ()
+{
+  if (m_find_line_edit->parentWidget ()->isVisible ())
+    {
+      m_find_line_edit->parentWidget ()->hide ();
+      m_doc_browser->setFocus ();
+    }
+  else
+    {
+      m_find_line_edit->parentWidget ()->show ();
+      m_find_line_edit->selectAll ();
+      m_find_line_edit->setFocus ();
+    }
+}
 
-  void documentation::filter_update (const QString& expression)
-  {
-    if (! m_help_engine)
-      return;
+void documentation::filter_update (const QString& expression)
+{
+  if (! m_help_engine)
+    return;
 
-    QString wildcard;
-    if (expression.contains (QLatin1Char('*')))
-      wildcard = expression;
+  QString wildcard;
+  if (expression.contains (QLatin1Char('*')))
+    wildcard = expression;
 
-    m_help_engine->indexWidget ()->filterIndices(expression, wildcard);
-  }
+  m_help_engine->indexWidget ()->filterIndices(expression, wildcard);
+}
 
-  void documentation::filter_update_history ()
-  {
-    QString text = m_filter->currentText ();   // get current text
-    int index = m_filter->findText (text);     // and its actual index
+void documentation::filter_update_history ()
+{
+  QString text = m_filter->currentText ();   // get current text
+  int index = m_filter->findText (text);     // and its actual index
 
-    if (index > -1)
-      m_filter->removeItem (index);            // remove if already existing
+  if (index > -1)
+    m_filter->removeItem (index);            // remove if already existing
 
-    m_filter->insertItem (0, text);            // (re)insert at beginning
-    m_filter->setCurrentIndex (0);
-  }
+  m_filter->insertItem (0, text);            // (re)insert at beginning
+  m_filter->setCurrentIndex (0);
+}
 
-  void documentation::find_backward ()
-  {
-    find (true);
-  }
+void documentation::find_backward ()
+{
+  find (true);
+}
 
-  void documentation::find (bool backward)
-  {
-    if (! m_help_engine)
-      return;
+void documentation::find (bool backward)
+{
+  if (! m_help_engine)
+    return;
 
-    QTextDocument::FindFlags find_flags;
-    if (backward)
-      find_flags = QTextDocument::FindBackward;
+  QTextDocument::FindFlags find_flags;
+  if (backward)
+    find_flags = QTextDocument::FindBackward;
 
-    if (! m_doc_browser->find (m_find_line_edit->text (), find_flags))
-      {
-        // Nothing was found, restart search from the begin or end of text
-        QTextCursor textcur = m_doc_browser->textCursor ();
-        if (backward)
-          textcur.movePosition (QTextCursor::End);
-        else
-          textcur.movePosition (QTextCursor::Start);
-        m_doc_browser->setTextCursor (textcur);
-        m_doc_browser->find (m_find_line_edit->text (), find_flags);
-      }
+  if (! m_doc_browser->find (m_find_line_edit->text (), find_flags))
+    {
+      // Nothing was found, restart search from the begin or end of text
+      QTextCursor textcur = m_doc_browser->textCursor ();
+      if (backward)
+        textcur.movePosition (QTextCursor::End);
+      else
+        textcur.movePosition (QTextCursor::Start);
+      m_doc_browser->setTextCursor (textcur);
+      m_doc_browser->find (m_find_line_edit->text (), find_flags);
+    }
 
-    record_anchor_position ();
-  }
+  record_anchor_position ();
+}
 
-  void documentation::find_forward_from_anchor (const QString& text)
-  {
-    if (! m_help_engine)
-      return;
+void documentation::find_forward_from_anchor (const QString& text)
+{
+  if (! m_help_engine)
+    return;
 
-    // Search from the current position
-    QTextCursor textcur = m_doc_browser->textCursor ();
-    textcur.setPosition (m_search_anchor_position);
-    m_doc_browser->setTextCursor (textcur);
+  // Search from the current position
+  QTextCursor textcur = m_doc_browser->textCursor ();
+  textcur.setPosition (m_search_anchor_position);
+  m_doc_browser->setTextCursor (textcur);
 
-    if (! m_doc_browser->find (text))
-      {
-        // Nothing was found, restart search from the beginning
-        textcur.movePosition (QTextCursor::Start);
-        m_doc_browser->setTextCursor (textcur);
-        m_doc_browser->find (text);
-      }
-  }
+  if (! m_doc_browser->find (text))
+    {
+      // Nothing was found, restart search from the beginning
+      textcur.movePosition (QTextCursor::Start);
+      m_doc_browser->setTextCursor (textcur);
+      m_doc_browser->find (text);
+    }
+}
 
-  void documentation::record_anchor_position ()
-  {
-    if (! m_help_engine)
-      return;
+void documentation::record_anchor_position ()
+{
+  if (! m_help_engine)
+    return;
 
-    m_search_anchor_position = m_doc_browser->textCursor ().position ();
-  }
+  m_search_anchor_position = m_doc_browser->textCursor ().position ();
+}
 
-  void documentation::handle_cursor_position_change ()
-  {
-    if (! m_help_engine)
-      return;
+void documentation::handle_cursor_position_change ()
+{
+  if (! m_help_engine)
+    return;
 
-    if (m_doc_browser->hasFocus ())
-      record_anchor_position ();
-  }
+  if (m_doc_browser->hasFocus ())
+    record_anchor_position ();
+}
 
-  void documentation::registerDoc (const QString& qch)
-  {
-    if (m_help_engine)
-      {
-        QString ns = m_help_engine->namespaceName (qch);
-        bool do_setup = true;
-        if (m_help_engine->registeredDocumentations ().contains (ns))
-          {
-            if (m_help_engine->documentationFileName (ns) == qch)
-              do_setup = false;
-            else
-              {
-                m_help_engine->unregisterDocumentation (ns);
-                m_help_engine->registerDocumentation (qch);
-              }
-          }
-        else if (! m_help_engine->registerDocumentation (qch))
-          {
-            QMessageBox::warning (this, tr ("Octave Documentation"),
-                                  tr ("Unable to register help file %1.").
-                                  arg (qch));
-            return;
-          }
+void documentation::registerDoc (const QString& qch)
+{
+  if (m_help_engine)
+    {
+      QString ns = m_help_engine->namespaceName (qch);
+      bool do_setup = true;
+      if (m_help_engine->registeredDocumentations ().contains (ns))
+        {
+          if (m_help_engine->documentationFileName (ns) == qch)
+            do_setup = false;
+          else
+            {
+              m_help_engine->unregisterDocumentation (ns);
+              m_help_engine->registerDocumentation (qch);
+            }
+        }
+      else if (! m_help_engine->registerDocumentation (qch))
+        {
+          QMessageBox::warning (this, tr ("Octave Documentation"),
+                                tr ("Unable to register help file %1.").
+                                arg (qch));
+          return;
+        }
 
-        if (do_setup)
-          m_help_engine->setupData();
-      }
-  }
+      if (do_setup)
+        m_help_engine->setupData();
+    }
+}
 
-  void documentation::unregisterDoc (const QString& qch)
-  {
-    if (! m_help_engine)
-      return;
+void documentation::unregisterDoc (const QString& qch)
+{
+  if (! m_help_engine)
+    return;
 
-    QString ns = m_help_engine->namespaceName (qch);
-    if (m_help_engine
-        && m_help_engine->registeredDocumentations ().contains (ns)
-        && m_help_engine->documentationFileName (ns) == qch)
-      {
-        m_help_engine->unregisterDocumentation (ns);
-        m_help_engine->setupData ();
-      }
-  }
+  QString ns = m_help_engine->namespaceName (qch);
+  if (m_help_engine
+      && m_help_engine->registeredDocumentations ().contains (ns)
+      && m_help_engine->documentationFileName (ns) == qch)
+    {
+      m_help_engine->unregisterDocumentation (ns);
+      m_help_engine->setupData ();
+    }
+}
 
-  void documentation::update_history_menus ()
-  {
-    if (m_prev_pages_count != m_doc_browser->backwardHistoryCount ())
-      {
-        update_history (m_doc_browser->backwardHistoryCount (),
-                        m_prev_pages_actions);
-        m_prev_pages_count = m_doc_browser->backwardHistoryCount ();
-      }
+void documentation::update_history_menus ()
+{
+  if (m_prev_pages_count != m_doc_browser->backwardHistoryCount ())
+    {
+      update_history (m_doc_browser->backwardHistoryCount (),
+                      m_prev_pages_actions);
+      m_prev_pages_count = m_doc_browser->backwardHistoryCount ();
+    }
 
-    if (m_next_pages_count != m_doc_browser->forwardHistoryCount ())
-      {
-        update_history (m_doc_browser->forwardHistoryCount (),
-                        m_next_pages_actions);
-        m_next_pages_count = m_doc_browser->forwardHistoryCount ();
-      }
-  }
+  if (m_next_pages_count != m_doc_browser->forwardHistoryCount ())
+    {
+      update_history (m_doc_browser->forwardHistoryCount (),
+                      m_next_pages_actions);
+      m_next_pages_count = m_doc_browser->forwardHistoryCount ();
+    }
+}
 
-  void documentation::update_history (int new_count, QAction **actions)
-  {
-    // Which menu has to be updated?
-    int prev_next = -1;
-    QAction *a = m_action_go_prev;
-    if (actions == m_next_pages_actions)
-      {
-        prev_next = 1;
-        a = m_action_go_next;
-      }
+void documentation::update_history (int new_count, QAction **actions)
+{
+  // Which menu has to be updated?
+  int prev_next = -1;
+  QAction *a = m_action_go_prev;
+  if (actions == m_next_pages_actions)
+    {
+      prev_next = 1;
+      a = m_action_go_next;
+    }
 
-    // Get maximal count limited by array size
-    int count = qMin (new_count, int (max_history_entries));
+  // Get maximal count limited by array size
+  int count = qMin (new_count, int (max_history_entries));
 
-    // Fill used menu entries
-    for (int i = 0; i < count; i++)
-      {
-        QString title
-          = title_and_anchor (m_doc_browser->historyTitle (prev_next*(i+1)),
-                              m_doc_browser->historyUrl (prev_next*(i+1)));
+  // Fill used menu entries
+  for (int i = 0; i < count; i++)
+    {
+      QString title
+        = title_and_anchor (m_doc_browser->historyTitle (prev_next*(i+1)),
+                            m_doc_browser->historyUrl (prev_next*(i+1)));
 
-        if (i == 0)
-          a->setText (title); // set tool tip for prev/next buttons
+      if (i == 0)
+        a->setText (title); // set tool tip for prev/next buttons
 
-        actions[i]->setText (title);
-        actions[i]->setData (m_doc_browser->historyUrl (prev_next*(i+1)));
-        actions[i]->setEnabled (true);
-        actions[i]->setVisible (true);
-      }
+      actions[i]->setText (title);
+      actions[i]->setData (m_doc_browser->historyUrl (prev_next*(i+1)));
+      actions[i]->setEnabled (true);
+      actions[i]->setVisible (true);
+    }
 
-    // Hide unused menu entries
-    for (int j = count; j < max_history_entries; j++)
-      {
-        actions[j]->setEnabled (false);
-        actions[j]->setVisible (false);
-      }
-  }
+  // Hide unused menu entries
+  for (int j = count; j < max_history_entries; j++)
+    {
+      actions[j]->setEnabled (false);
+      actions[j]->setVisible (false);
+    }
+}
 
-  void documentation::open_hist_url (QAction *a)
-  {
-    m_doc_browser->setSource (a->data ().toUrl ());
-  }
+void documentation::open_hist_url (QAction *a)
+{
+  m_doc_browser->setSource (a->data ().toUrl ());
+}
 
-  // Utility functions
+// Utility functions
 
-  QString documentation::title_and_anchor (const QString& title, const QUrl& url)
-  {
-    QString retval = title;
-    QString u = url.toString ();
+QString documentation::title_and_anchor (const QString& title, const QUrl& url)
+{
+  QString retval = title;
+  QString u = url.toString ();
 
-    retval.remove (QRegExp ("\\s*\\(*GNU Octave \\(version [^\\)]*\\)[: \\)]*"));
+  retval.remove (QRegExp ("\\s*\\(*GNU Octave \\(version [^\\)]*\\)[: \\)]*"));
 
-    // Since the title only contains the section name and not the
-    // specific anchor, extract the latter from the url and append
-    // it to the title
-    if (u.contains ('#'))
-      {
-        // Get the anchor from the url
-        QString anchor = u.split ('#').last ();
-        // Remove internal string parts
-        anchor.remove (QRegExp ("^index-"));
-        anchor.remove (QRegExp ("^SEC_"));
-        anchor.remove (QRegExp ("^XREF"));
-        anchor.remove ("Concept-Index_cp_letter-");
-        anchor.replace ("-", " ");
+  // Since the title only contains the section name and not the
+  // specific anchor, extract the latter from the url and append
+  // it to the title
+  if (u.contains ('#'))
+    {
+      // Get the anchor from the url
+      QString anchor = u.split ('#').last ();
+      // Remove internal string parts
+      anchor.remove (QRegExp ("^index-"));
+      anchor.remove (QRegExp ("^SEC_"));
+      anchor.remove (QRegExp ("^XREF"));
+      anchor.remove ("Concept-Index_cp_letter-");
+      anchor.replace ("-", " ");
 
-        // replace encoded special chars by their unencoded versions
-        QRegExp rx = QRegExp ("_00([0-7][0-9a-f])");
-        int pos = 0;
-        while ((pos = rx.indexIn(anchor, pos)) != -1)
-          {
-            anchor.replace ("_00"+rx.cap (1), QChar (rx.cap (1).toInt (nullptr, 16)));
-            pos += rx.matchedLength();
-          }
+      // replace encoded special chars by their unencoded versions
+      QRegExp rx = QRegExp ("_00([0-7][0-9a-f])");
+      int pos = 0;
+      while ((pos = rx.indexIn(anchor, pos)) != -1)
+        {
+          anchor.replace ("_00"+rx.cap (1), QChar (rx.cap (1).toInt (nullptr, 16)));
+          pos += rx.matchedLength();
+        }
 
-        if (retval != anchor)
-          retval = retval + ": " + anchor;
-      }
+      if (retval != anchor)
+        retval = retval + ": " + anchor;
+    }
 
-    return retval;
-  }
+  return retval;
+}
 
-  //
-  // The documentation browser
-  //
+//
+// The documentation browser
+//
 
-  documentation_browser::documentation_browser (QHelpEngine *he, QWidget *p)
-    : QTextBrowser (p), m_help_engine (he), m_zoom_level (max_zoom_level+1)
-  {
-    setOpenLinks (false);
-    connect (this, &documentation_browser::anchorClicked,
-             this, [=] (const QUrl& url) { handle_index_clicked (url); });
+documentation_browser::documentation_browser (QHelpEngine *he, QWidget *p)
+  : QTextBrowser (p), m_help_engine (he), m_zoom_level (max_zoom_level+1)
+{
+  setOpenLinks (false);
+  connect (this, &documentation_browser::anchorClicked,
+           this, [=] (const QUrl& url) { handle_index_clicked (url); });
 
-    // Make sure we have access to one of the monospace fonts listed in
-    // octave.css for rendering formated code blocks
-    QStringList fonts = {"Fantasque Sans Mono", "FreeMono", "Courier New",
-                         "Cousine", "Courier"};
+  // Make sure we have access to one of the monospace fonts listed in
+  // octave.css for rendering formated code blocks
+  QStringList fonts = {"Fantasque Sans Mono", "FreeMono", "Courier New",
+                       "Cousine", "Courier"};
 
-    bool load_default_font = true;
+  bool load_default_font = true;
 
-    for (int i = 0; i < fonts.size (); ++i)
-      {
-        QFont font (fonts.at (i));
-        if (font.exactMatch ())
-          {
-            load_default_font = false;
-            break;
-          }
-      }
+  for (int i = 0; i < fonts.size (); ++i)
+    {
+      QFont font (fonts.at (i));
+      if (font.exactMatch ())
+        {
+          load_default_font = false;
+          break;
+        }
+    }
 
-    if (load_default_font)
-      {
-        QString fonts_dir =
-          QString::fromStdString (sys::env::getenv ("OCTAVE_FONTS_DIR")
-                                  + sys::file_ops::dir_sep_str ());
+  if (load_default_font)
+    {
+      QString fonts_dir =
+        QString::fromStdString (sys::env::getenv ("OCTAVE_FONTS_DIR")
+                                + sys::file_ops::dir_sep_str ());
 
-        QStringList default_fonts = {"FreeMono", "FreeMonoBold",
-                                     "FreeMonoBoldOblique", "FreeMonoOblique"};
+      QStringList default_fonts = {"FreeMono", "FreeMonoBold",
+                                   "FreeMonoBoldOblique", "FreeMonoOblique"};
 
-        for (int i = 0; i < default_fonts.size (); ++i)
-          {
-            QString fontpath =
-              fonts_dir + default_fonts.at(i) + QString (".otf");
-            QFontDatabase::addApplicationFont (fontpath);
-          }
-      }
-  }
+      for (int i = 0; i < default_fonts.size (); ++i)
+        {
+          QString fontpath =
+            fonts_dir + default_fonts.at(i) + QString (".otf");
+          QFontDatabase::addApplicationFont (fontpath);
+        }
+    }
+}
 
-  void documentation_browser::handle_index_clicked (const QUrl& url,
-                                                    const QString&)
-  {
-    if (url.scheme () == "qthelp")
-      setSource (url);
-    else
-      QDesktopServices::openUrl (url);
-  }
+void documentation_browser::handle_index_clicked (const QUrl& url,
+                                                  const QString&)
+{
+  if (url.scheme () == "qthelp")
+    setSource (url);
+  else
+    QDesktopServices::openUrl (url);
+}
 
-  void documentation_browser::notice_settings ()
-  {
-    gui_settings settings;
+void documentation_browser::notice_settings ()
+{
+  gui_settings settings;
 
-    // Zoom level only at startup, not when other settings have changed
-    if (m_zoom_level > max_zoom_level)
-      {
-        m_zoom_level = settings.int_value (dc_browser_zoom_level);
-        zoomIn (m_zoom_level);
-      }
-  }
+  // Zoom level only at startup, not when other settings have changed
+  if (m_zoom_level > max_zoom_level)
+    {
+      m_zoom_level = settings.int_value (dc_browser_zoom_level);
+      zoomIn (m_zoom_level);
+    }
+}
 
-  QVariant documentation_browser::loadResource (int type, const QUrl& url)
-  {
-    if (m_help_engine && url.scheme () == "qthelp")
-      return QVariant (m_help_engine->fileData(url));
-    else
-      return QTextBrowser::loadResource(type, url);
-  }
+QVariant documentation_browser::loadResource (int type, const QUrl& url)
+{
+  if (m_help_engine && url.scheme () == "qthelp")
+    return QVariant (m_help_engine->fileData(url));
+  else
+    return QTextBrowser::loadResource(type, url);
+}
 
-  void documentation_browser::save_settings ()
-  {
-    gui_settings settings;
+void documentation_browser::save_settings ()
+{
+  gui_settings settings;
 
-    settings.setValue (dc_browser_zoom_level.settings_key (), m_zoom_level);
+  settings.setValue (dc_browser_zoom_level.settings_key (), m_zoom_level);
 
-    settings.sync ();
-  }
+  settings.sync ();
+}
 
-  void documentation_browser::zoom_in ()
-  {
-    if (m_zoom_level < max_zoom_level)
-      {
-        zoomIn ();
-        m_zoom_level++;
-      }
-  }
+void documentation_browser::zoom_in ()
+{
+  if (m_zoom_level < max_zoom_level)
+    {
+      zoomIn ();
+      m_zoom_level++;
+    }
+}
 
-  void documentation_browser::zoom_out ()
-  {
-    if (m_zoom_level > min_zoom_level)
-      {
-        zoomOut ();
-        m_zoom_level--;
-      }
-  }
+void documentation_browser::zoom_out ()
+{
+  if (m_zoom_level > min_zoom_level)
+    {
+      zoomOut ();
+      m_zoom_level--;
+    }
+}
 
-  void documentation_browser::zoom_original ()
-  {
-    zoomIn (- m_zoom_level);
-    m_zoom_level = 0;
-  }
+void documentation_browser::zoom_original ()
+{
+  zoomIn (- m_zoom_level);
+  m_zoom_level = 0;
+}
 
-  void documentation_browser::wheelEvent (QWheelEvent *we)
-  {
-    if (we->modifiers () == Qt::ControlModifier)
-      {
-        if (we->angleDelta().y () > 0)
-          zoom_in ();
-        else
-          zoom_out ();
+void documentation_browser::wheelEvent (QWheelEvent *we)
+{
+  if (we->modifiers () == Qt::ControlModifier)
+    {
+      if (we->angleDelta().y () > 0)
+        zoom_in ();
+      else
+        zoom_out ();
 
-        we->accept ();
-      }
-    else
-      QTextEdit::wheelEvent (we);
-  }
+      we->accept ();
+    }
+  else
+    QTextEdit::wheelEvent (we);
+}
 
 OCTAVE_END_NAMESPACE(octave)
--- a/libgui/src/documentation.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/documentation.h	Thu Feb 02 12:25:51 2023 -0800
@@ -39,164 +39,164 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class documentation;
-  class documentation_bookmarks;
+class documentation;
+class documentation_bookmarks;
 
-  //! Documentation browser derived from Textbrowser
+//! Documentation browser derived from Textbrowser
 
-  class documentation_browser : public QTextBrowser
-  {
-    Q_OBJECT
+class documentation_browser : public QTextBrowser
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    documentation_browser (QHelpEngine *help_engine, QWidget *parent = nullptr);
-    ~documentation_browser () = default;
+  documentation_browser (QHelpEngine *help_engine, QWidget *parent = nullptr);
+  ~documentation_browser () = default;
 
-    virtual QVariant loadResource (int type, const QUrl& url);
+  virtual QVariant loadResource (int type, const QUrl& url);
 
-  public slots:
+public slots:
 
-    void handle_index_clicked (const QUrl& url,
-                               const QString& keyword = QString ());
-    void notice_settings ();
-    void save_settings ();
+  void handle_index_clicked (const QUrl& url,
+                             const QString& keyword = QString ());
+  void notice_settings ();
+  void save_settings ();
 
-    //! Zooming in and out while taking care of the zoom level
-    //!@{
-    void zoom_in ();
-    void zoom_out ();
-    void zoom_original ();
-    //!@}
+  //! Zooming in and out while taking care of the zoom level
+  //!@{
+  void zoom_in ();
+  void zoom_out ();
+  void zoom_original ();
+  //!@}
 
-  protected:
+protected:
 
-    void wheelEvent (QWheelEvent *we);
+  void wheelEvent (QWheelEvent *we);
 
-  private:
+private:
 
-    QHelpEngine *m_help_engine;
+  QHelpEngine *m_help_engine;
 
-    //! Store the current zoom level
-    int m_zoom_level;
+  //! Store the current zoom level
+  int m_zoom_level;
 
-    //! Minimal and maximal zoom level avoiding calling
-    //! zoom_in and zoom_out without actually zooming but
-    //! with changing the stored zoom level
-    enum
-    {
-      min_zoom_level = -5,
-      max_zoom_level = 10
-    };
+  //! Minimal and maximal zoom level avoiding calling
+  //! zoom_in and zoom_out without actually zooming but
+  //! with changing the stored zoom level
+  enum
+  {
+    min_zoom_level = -5,
+    max_zoom_level = 10
   };
+};
 
-  //! The documentation main class derived from QSplitter
+//! The documentation main class derived from QSplitter
 
-  class documentation : public QSplitter
-  {
-    Q_OBJECT
+class documentation : public QSplitter
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    documentation (QWidget *parent);
-    ~documentation ();
+  documentation (QWidget *parent);
+  ~documentation ();
 
-    /*!
-        Generate a string with page name @p title and current anchor
-        from @p url for using in prev/next or bookmarks menu:
+  /*!
+      Generate a string with page name @p title and current anchor
+      from @p url for using in prev/next or bookmarks menu:
 
-          @param title current title of the page as QString
-          @param url   current url  as QUrl
+        @param title current title of the page as QString
+        @param url   current url  as QUrl
 
-          @return QString "title: anchor"
-    */
-    QString title_and_anchor (const QString& title, const QUrl& url);
+        @return QString "title: anchor"
+  */
+  QString title_and_anchor (const QString& title, const QUrl& url);
 
-  signals:
+signals:
 
-    void show_single_result (const QUrl&);
+  void show_single_result (const QUrl&);
 
-  public slots:
+public slots:
 
-    void notice_settings ();
-    void save_settings ();
+  void notice_settings ();
+  void save_settings ();
 
-    void copyClipboard ();
-    void pasteClipboard ();
-    void selectAll ();
+  void copyClipboard ();
+  void pasteClipboard ();
+  void selectAll ();
 
-    void load_index ();
-    void load_ref (const QString& name = QString ());
-    void registerDoc (const QString& name);
-    void unregisterDoc (const QString& name);
+  void load_index ();
+  void load_ref (const QString& name = QString ());
+  void registerDoc (const QString& name);
+  void unregisterDoc (const QString& name);
 
-  private slots:
+private slots:
 
-    void activate_find ();
-    void global_search ();
-    void global_search_started ();
-    void global_search_finished (int hits);
-    void filter_update (const QString& expression);
-    void filter_update_history ();
-    void find (bool backward = false);
-    void find_backward ();
-    void find_forward_from_anchor (const QString& text);
-    void record_anchor_position ();
-    void handle_cursor_position_change ();
-    void handle_search_result_clicked (const QUrl& url);
+  void activate_find ();
+  void global_search ();
+  void global_search_started ();
+  void global_search_finished (int hits);
+  void filter_update (const QString& expression);
+  void filter_update_history ();
+  void find (bool backward = false);
+  void find_backward ();
+  void find_forward_from_anchor (const QString& text);
+  void record_anchor_position ();
+  void handle_cursor_position_change ();
+  void handle_search_result_clicked (const QUrl& url);
 
-    void update_history_menus ();
-    void open_hist_url (QAction *a);
+  void update_history_menus ();
+  void open_hist_url (QAction *a);
 
-  private:
+private:
 
-    void construct_tool_bar ();
-    QAction * add_action (const QIcon& icon, const QString& text,
-                          const char *member, QWidget *receiver = nullptr,
-                          QToolBar *tool_bar = nullptr);
-    void update_history (int new_count, QAction **actions);
+  void construct_tool_bar ();
+  QAction * add_action (const QIcon& icon, const QString& text,
+                        const char *member, QWidget *receiver = nullptr,
+                        QToolBar *tool_bar = nullptr);
+  void update_history (int new_count, QAction **actions);
 
-    //! Select all occurrences of a string in the doc browser
-    void select_all_occurrences (const QString& text);
+  //! Select all occurrences of a string in the doc browser
+  void select_all_occurrences (const QString& text);
 
-    QHelpEngine *m_help_engine;
-    QString m_internal_search;
-    documentation_browser *m_doc_browser;
-    documentation_bookmarks *m_bookmarks;
-    QLineEdit *m_find_line_edit;
-    int m_search_anchor_position;
-    QComboBox *m_filter;
-    QString m_collection;
+  QHelpEngine *m_help_engine;
+  QString m_internal_search;
+  documentation_browser *m_doc_browser;
+  documentation_bookmarks *m_bookmarks;
+  QLineEdit *m_find_line_edit;
+  int m_search_anchor_position;
+  QComboBox *m_filter;
+  QString m_collection;
 
-    QWidget *m_doc_widget;
-    QToolBar *m_tool_bar;
-    QString m_query_string;
+  QWidget *m_doc_widget;
+  QToolBar *m_tool_bar;
+  QString m_query_string;
 
-    bool m_indexed;
-    QString m_current_ref_name;
+  bool m_indexed;
+  QString m_current_ref_name;
 
-    QAction *m_action_go_home;
-    QAction *m_action_go_prev;
-    QAction *m_action_go_next;
-    QMenu *m_prev_pages_menu;
-    QMenu *m_next_pages_menu;
-    int m_prev_pages_count;
-    int m_next_pages_count;
+  QAction *m_action_go_home;
+  QAction *m_action_go_prev;
+  QAction *m_action_go_next;
+  QMenu *m_prev_pages_menu;
+  QMenu *m_next_pages_menu;
+  int m_prev_pages_count;
+  int m_next_pages_count;
 
-    enum { max_history_entries = 10 };
-    QAction *m_prev_pages_actions[max_history_entries];
-    QAction *m_next_pages_actions[max_history_entries];
+  enum { max_history_entries = 10 };
+  QAction *m_prev_pages_actions[max_history_entries];
+  QAction *m_next_pages_actions[max_history_entries];
 
-    QAction *m_action_bookmark;
+  QAction *m_action_bookmark;
 
-    QAction *m_action_find;
-    QShortcut *m_findnext_shortcut;
-    QShortcut *m_findprev_shortcut;
+  QAction *m_action_find;
+  QShortcut *m_findnext_shortcut;
+  QShortcut *m_findprev_shortcut;
 
-    QAction *m_action_zoom_in;
-    QAction *m_action_zoom_out;
-    QAction *m_action_zoom_original;
-  };
+  QAction *m_action_zoom_in;
+  QAction *m_action_zoom_out;
+  QAction *m_action_zoom_original;
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/src/dw-main-window.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/dw-main-window.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -42,208 +42,208 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  dw_main_window::dw_main_window (QWidget *p)
-    : QMainWindow (p)
-  {
-    gui_settings settings;
+dw_main_window::dw_main_window (QWidget *p)
+  : QMainWindow (p)
+{
+  gui_settings settings;
 
-    // Adding the actions for closing the dock widgets
-    m_close_action
-      = add_action (nullptr, settings.icon ("window-close", false),
-                    tr ("&Close"), SLOT (request_close ()), this);
+  // Adding the actions for closing the dock widgets
+  m_close_action
+    = add_action (nullptr, settings.icon ("window-close", false),
+                  tr ("&Close"), SLOT (request_close ()), this);
 
-    m_close_all_action
-      = add_action (nullptr, settings.icon ("window-close", false),
-                    tr ("Close &All"), SLOT (request_close_all ()), this);
+  m_close_all_action
+    = add_action (nullptr, settings.icon ("window-close", false),
+                  tr ("Close &All"), SLOT (request_close_all ()), this);
 
-    m_close_others_action
-      = add_action (nullptr, settings.icon ("window-close", false),
-                    tr ("Close &Other"), SLOT (request_close_other ()), this);
+  m_close_others_action
+    = add_action (nullptr, settings.icon ("window-close", false),
+                  tr ("Close &Other"), SLOT (request_close_other ()), this);
 
-    m_switch_left_action
-      = add_action (nullptr, QIcon (), tr ("Switch to &Left Widget"),
-                    SLOT (request_switch_left ()), this);
+  m_switch_left_action
+    = add_action (nullptr, QIcon (), tr ("Switch to &Left Widget"),
+                  SLOT (request_switch_left ()), this);
 
-    m_switch_right_action
-      = add_action (nullptr, QIcon (), tr ("Switch to &Right Widget"),
-                    SLOT (request_switch_right ()), this);
+  m_switch_right_action
+    = add_action (nullptr, QIcon (), tr ("Switch to &Right Widget"),
+                  SLOT (request_switch_right ()), this);
 
-    // The list of actions for floating widgets
-    m_actions_list << m_close_action;
-    m_actions_list << m_close_others_action;
-    m_actions_list << m_close_all_action;
-    m_actions_list << m_switch_left_action;
-    m_actions_list << m_switch_right_action;
+  // The list of actions for floating widgets
+  m_actions_list << m_close_action;
+  m_actions_list << m_close_others_action;
+  m_actions_list << m_close_all_action;
+  m_actions_list << m_switch_left_action;
+  m_actions_list << m_switch_right_action;
 
-    notice_settings ();
-  }
+  notice_settings ();
+}
 
-  // Re-implementing the popup menu of the main window
-  QMenu *dw_main_window::createPopupMenu ()
-  {
-    QList<QAction *> new_actions = QList<QAction *> ();
-    new_actions.append (m_close_action);
-    new_actions.append (m_close_others_action);
-    new_actions.append (m_close_all_action);
+// Re-implementing the popup menu of the main window
+QMenu *dw_main_window::createPopupMenu ()
+{
+  QList<QAction *> new_actions = QList<QAction *> ();
+  new_actions.append (m_close_action);
+  new_actions.append (m_close_others_action);
+  new_actions.append (m_close_all_action);
 
-    QMenu *menu = QMainWindow::createPopupMenu ();
-    QList<QAction *> actions = menu->actions();
+  QMenu *menu = QMainWindow::createPopupMenu ();
+  QList<QAction *> actions = menu->actions();
 
-    if (actions.length () > 0)
-      {
-        QAction *sep = menu->insertSeparator (actions.at (0));
-        menu->insertActions (sep, new_actions);
-      }
-    else
-      menu->addActions (new_actions);
+  if (actions.length () > 0)
+    {
+      QAction *sep = menu->insertSeparator (actions.at (0));
+      menu->insertActions (sep, new_actions);
+    }
+  else
+    menu->addActions (new_actions);
 
-    return menu;
-  }
+  return menu;
+}
 
-  // Adding an action to the main window
-  QAction * dw_main_window::add_action (QMenu *menu, const QIcon& icon,
-                                        const QString& text, const char *member,
-                                        QWidget *receiver)
-  {
-    QAction *a;
-    QWidget *r = this;
+// Adding an action to the main window
+QAction * dw_main_window::add_action (QMenu *menu, const QIcon& icon,
+                                      const QString& text, const char *member,
+                                      QWidget *receiver)
+{
+  QAction *a;
+  QWidget *r = this;
 
-    if (receiver != nullptr)
-      r = receiver;
+  if (receiver != nullptr)
+    r = receiver;
 
-    if (menu)
-      a = menu->addAction (icon, text, r, member);
-    else
-      {
-        a = new QAction (icon, text, this);
-        a->setEnabled (true);
-        connect (a, SIGNAL (triggered ()), r, member);
-      }
+  if (menu)
+    a = menu->addAction (icon, text, r, member);
+  else
+    {
+      a = new QAction (icon, text, this);
+      a->setEnabled (true);
+      connect (a, SIGNAL (triggered ()), r, member);
+    }
 
-    addAction (a);  // important for shortcut context
-    a->setShortcutContext (Qt::WidgetWithChildrenShortcut);
+  addAction (a);  // important for shortcut context
+  a->setShortcutContext (Qt::WidgetWithChildrenShortcut);
 
-    return a;
-  }
+  return a;
+}
 
-  // Update the settings
-  void dw_main_window::notice_settings ()
-  {
-    gui_settings settings;
+// Update the settings
+void dw_main_window::notice_settings ()
+{
+  gui_settings settings;
 
-    settings.set_shortcut (m_close_action, sc_edit_file_close);
-    settings.set_shortcut (m_close_all_action, sc_edit_file_close_all);
-    settings.set_shortcut (m_close_others_action, sc_edit_file_close_other);
+  settings.set_shortcut (m_close_action, sc_edit_file_close);
+  settings.set_shortcut (m_close_all_action, sc_edit_file_close_all);
+  settings.set_shortcut (m_close_others_action, sc_edit_file_close_other);
 
-    settings.set_shortcut (m_switch_left_action, sc_edit_tabs_switch_left_tab);
-    settings.set_shortcut (m_switch_right_action, sc_edit_tabs_switch_right_tab);
-  }
+  settings.set_shortcut (m_switch_left_action, sc_edit_tabs_switch_left_tab);
+  settings.set_shortcut (m_switch_right_action, sc_edit_tabs_switch_right_tab);
+}
 
-  // Slots for handling actions
+// Slots for handling actions
 
-  // Close current widget
-  void dw_main_window::request_close ()
-  {
-    for (int i = 0; i < m_dw_list.length (); i++)
-      {
-        if (m_dw_list.at (i)->hasFocus ())
-          {
-            m_dw_list.at (i)->close ();
-            if (i > 0)
-              m_dw_list.at (i-1)->setFocus ();
-            break;
-          }
-      }
-  }
-
-  // Close other widgets
-  void dw_main_window::request_close_other ()
-  {
-    for (int i = m_dw_list.length () - 1; i >= 0; i--)
-      {
-        if (! m_dw_list.at (i)->hasFocus ())
+// Close current widget
+void dw_main_window::request_close ()
+{
+  for (int i = 0; i < m_dw_list.length (); i++)
+    {
+      if (m_dw_list.at (i)->hasFocus ())
+        {
           m_dw_list.at (i)->close ();
-      }
-  }
+          if (i > 0)
+            m_dw_list.at (i-1)->setFocus ();
+          break;
+        }
+    }
+}
 
-  // Close all widgets
-  void dw_main_window::request_close_all ()
-  {
-    for (int i = m_dw_list.length () - 1; i >= 0; i--)
-      m_dw_list.at (i)->close ();
-  }
+// Close other widgets
+void dw_main_window::request_close_other ()
+{
+  for (int i = m_dw_list.length () - 1; i >= 0; i--)
+    {
+      if (! m_dw_list.at (i)->hasFocus ())
+        m_dw_list.at (i)->close ();
+    }
+}
 
-  // Switch to left widget
-  void dw_main_window::request_switch_left ()
-  {
-    request_switch (-1);
-  }
+// Close all widgets
+void dw_main_window::request_close_all ()
+{
+  for (int i = m_dw_list.length () - 1; i >= 0; i--)
+    m_dw_list.at (i)->close ();
+}
 
-  // Switch to right widget
-  void dw_main_window::request_switch_right ()
-  {
-    request_switch (1);
-  }
+// Switch to left widget
+void dw_main_window::request_switch_left ()
+{
+  request_switch (-1);
+}
 
-  // Switch to left/right widget
-  void dw_main_window::request_switch (int direction)
-  {
-    int active = -1, next;
+// Switch to right widget
+void dw_main_window::request_switch_right ()
+{
+  request_switch (1);
+}
+
+// Switch to left/right widget
+void dw_main_window::request_switch (int direction)
+{
+  int active = -1, next;
 
-    for (int i = m_dw_list.length () - 1; i >= 0; i--)
-      {
-        if (m_dw_list.at (i)->hasFocus ())
-          {
-            active = i;
-            break;
-          }
-      }
+  for (int i = m_dw_list.length () - 1; i >= 0; i--)
+    {
+      if (m_dw_list.at (i)->hasFocus ())
+        {
+          active = i;
+          break;
+        }
+    }
 
-    if (active == -1)
-      return;
+  if (active == -1)
+    return;
 
-    if (direction == -1 && active == 0)
-      next = m_dw_list.length () - 1;
-    else if (direction == 1 && active == m_dw_list.length () - 1)
-      next = 0;
-    else
-      next = active + direction;
+  if (direction == -1 && active == 0)
+    next = m_dw_list.length () - 1;
+  else if (direction == 1 && active == m_dw_list.length () - 1)
+    next = 0;
+  else
+    next = active + direction;
 
-    m_dw_list.at (next)->raise ();
-    m_dw_list.at (next)->activateWindow ();
-    m_dw_list.at (next)->setFocus ();
-  }
+  m_dw_list.at (next)->raise ();
+  m_dw_list.at (next)->activateWindow ();
+  m_dw_list.at (next)->setFocus ();
+}
 
-  // Reimplemented Event
-  bool dw_main_window::event (QEvent *ev)
-  {
-    if (ev->type () == QEvent::ChildAdded
-        || ev->type () == QEvent::ChildRemoved)
-      {
-        // Adding or Removing a child indicates that a dock widget was
-        // created or removed.
-        // In all cases, the list of dock widgets has to be updated.
-        m_dw_list = findChildren<QDockWidget *>();
-      }
+// Reimplemented Event
+bool dw_main_window::event (QEvent *ev)
+{
+  if (ev->type () == QEvent::ChildAdded
+      || ev->type () == QEvent::ChildRemoved)
+    {
+      // Adding or Removing a child indicates that a dock widget was
+      // created or removed.
+      // In all cases, the list of dock widgets has to be updated.
+      m_dw_list = findChildren<QDockWidget *>();
+    }
 
-    if (ev->type () == QEvent::StyleChange)
-      {
-        // This might indicate un- or re-docking a widget: Make sure
-        // floating widgets get a copy of our actions
-        for (int i = m_dw_list.length () - 1; i >= 0; i--)
-          {
-            // First remove possibly existing actions
-            for (int j = m_actions_list.length () - 1; j >0; j--)
-              m_dw_list.at (i)->removeAction (m_actions_list.at (j));
+  if (ev->type () == QEvent::StyleChange)
+    {
+      // This might indicate un- or re-docking a widget: Make sure
+      // floating widgets get a copy of our actions
+      for (int i = m_dw_list.length () - 1; i >= 0; i--)
+        {
+          // First remove possibly existing actions
+          for (int j = m_actions_list.length () - 1; j >0; j--)
+            m_dw_list.at (i)->removeAction (m_actions_list.at (j));
 
-            // Then add our actions for floating widgets
-            if (m_dw_list.at (i)->isFloating ())
-              m_dw_list.at (i)->addActions (m_actions_list);
-          }
-      }
+          // Then add our actions for floating widgets
+          if (m_dw_list.at (i)->isFloating ())
+            m_dw_list.at (i)->addActions (m_actions_list);
+        }
+    }
 
-    return QMainWindow::event (ev);
-  }
+  return QMainWindow::event (ev);
+}
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/src/dw-main-window.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/dw-main-window.h	Thu Feb 02 12:25:51 2023 -0800
@@ -30,59 +30,59 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class dw_main_window : public QMainWindow
-  {
-    Q_OBJECT
+class dw_main_window : public QMainWindow
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    dw_main_window (QWidget *parent = nullptr);
+  dw_main_window (QWidget *parent = nullptr);
 
-    ~dw_main_window () = default;
+  ~dw_main_window () = default;
 
-    // No copying!
+  // No copying!
 
-    dw_main_window (const dw_main_window&) = delete;
+  dw_main_window (const dw_main_window&) = delete;
 
-    dw_main_window& operator = (const dw_main_window&) = delete;
+  dw_main_window& operator = (const dw_main_window&) = delete;
 
-  public slots:
+public slots:
 
-    void notice_settings ();
+  void notice_settings ();
 
-  protected slots:
+protected slots:
 
-    virtual QMenu * createPopupMenu ();
+  virtual QMenu * createPopupMenu ();
 
-    virtual bool event (QEvent *ev);
+  virtual bool event (QEvent *ev);
 
-  private slots:
+private slots:
 
-    void request_close ();
-    void request_close_all ();
-    void request_close_other ();
+  void request_close ();
+  void request_close_all ();
+  void request_close_other ();
 
-    void request_switch_left ();
-    void request_switch_right ();
+  void request_switch_left ();
+  void request_switch_right ();
 
-  private:
+private:
 
-    void request_switch (int direction);
+  void request_switch (int direction);
 
-    QAction * add_action (QMenu *menu, const QIcon& icon, const QString& text,
-                          const char *member, QWidget *receiver);
+  QAction * add_action (QMenu *menu, const QIcon& icon, const QString& text,
+                        const char *member, QWidget *receiver);
 
-    QList<QDockWidget *> m_dw_list;
+  QList<QDockWidget *> m_dw_list;
 
-    QAction *m_close_action;
-    QAction *m_close_all_action;
-    QAction *m_close_others_action;
+  QAction *m_close_action;
+  QAction *m_close_all_action;
+  QAction *m_close_others_action;
 
-    QAction *m_switch_left_action;
-    QAction *m_switch_right_action;
+  QAction *m_switch_left_action;
+  QAction *m_switch_right_action;
 
-    QList<QAction *> m_actions_list;
-  };
+  QList<QAction *> m_actions_list;
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/src/external-editor-interface.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/external-editor-interface.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -36,94 +36,94 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  external_editor_interface::external_editor_interface (QWidget *p)
-    : QWidget (p)
-  { }
+external_editor_interface::external_editor_interface (QWidget *p)
+  : QWidget (p)
+{ }
 
-  // Calling the external editor
-  bool
-  external_editor_interface::call_custom_editor (const QString& file, int line)
-  {
-    QString editor = external_editor ();
-    if (editor.isEmpty ())
-      return true;
+// Calling the external editor
+bool
+external_editor_interface::call_custom_editor (const QString& file, int line)
+{
+  QString editor = external_editor ();
+  if (editor.isEmpty ())
+    return true;
 
-    if (line < 0)
-      line = 0;
+  if (line < 0)
+    line = 0;
 
-    // replace macros
-    editor.replace ("%f", file);
-    editor.replace ("%l", QString::number (line));
+  // replace macros
+  editor.replace ("%f", file);
+  editor.replace ("%l", QString::number (line));
 
-    QStringList arguments = editor.split (QRegExp("\\s+"));
-    editor = arguments.takeFirst ();
+  QStringList arguments = editor.split (QRegExp("\\s+"));
+  editor = arguments.takeFirst ();
 
-    // start the process and check for success
-    bool started_ok = QProcess::startDetached (editor, arguments);
+  // start the process and check for success
+  bool started_ok = QProcess::startDetached (editor, arguments);
 
-    if (started_ok != true)
-      {
-        QMessageBox *msgBox = new QMessageBox (QMessageBox::Critical,
-                                               tr ("Octave Editor"),
-                                               tr ("Could not start custom file editor\n%1").
-                                               arg (editor),
-                                               QMessageBox::Ok);
+  if (started_ok != true)
+    {
+      QMessageBox *msgBox = new QMessageBox (QMessageBox::Critical,
+                                             tr ("Octave Editor"),
+                                             tr ("Could not start custom file editor\n%1").
+                                             arg (editor),
+                                             QMessageBox::Ok);
 
-        msgBox->setWindowModality (Qt::NonModal);
-        msgBox->setAttribute (Qt::WA_DeleteOnClose);
-        msgBox->show ();
-      }
+      msgBox->setWindowModality (Qt::NonModal);
+      msgBox->setAttribute (Qt::WA_DeleteOnClose);
+      msgBox->show ();
+    }
 
-    return started_ok;
-  }
+  return started_ok;
+}
 
-  // Slots for the several signals for invoking the editor
+// Slots for the several signals for invoking the editor
 
-  void external_editor_interface::request_new_file (const QString&)
-  {
-    call_custom_editor ();
-  }
+void external_editor_interface::request_new_file (const QString&)
+{
+  call_custom_editor ();
+}
 
-  void external_editor_interface::request_open_file (const QString& file_name,
-                                                     const QString&, int line,
-                                                     bool, bool, bool,
-                                                     const QString&)
-  {
-    call_custom_editor (file_name, line);
-  }
+void external_editor_interface::request_open_file (const QString& file_name,
+                                                   const QString&, int line,
+                                                   bool, bool, bool,
+                                                   const QString&)
+{
+  call_custom_editor (file_name, line);
+}
 
-  void external_editor_interface::handle_edit_file_request (const QString& file)
-  {
-    call_custom_editor (file);
-  }
+void external_editor_interface::handle_edit_file_request (const QString& file)
+{
+  call_custom_editor (file);
+}
 
-  // Get and verify the settings of the external editor program
-  QString external_editor_interface::external_editor ()
-  {
-    gui_settings settings;
+// Get and verify the settings of the external editor program
+QString external_editor_interface::external_editor ()
+{
+  gui_settings settings;
 
-    QString editor = settings.value (global_custom_editor.settings_key (),
-                                     global_custom_editor.def ()).toString ();
+  QString editor = settings.value (global_custom_editor.settings_key (),
+                                   global_custom_editor.def ()).toString ();
 
-    // check the settings (avoid an empty string)
-    if (editor.trimmed ().isEmpty ())
-      {
-        QMessageBox *msgBox
-          = new QMessageBox (QMessageBox::Warning,
-                             tr ("Octave Editor"),
-                             tr ("There is no custom editor configured yet.\n"
-                                 "Do you want to open the preferences?"),
-                             QMessageBox::No | QMessageBox::Yes);
-        msgBox->setDefaultButton (QMessageBox::Yes);
-        msgBox->setAttribute (Qt::WA_DeleteOnClose);
+  // check the settings (avoid an empty string)
+  if (editor.trimmed ().isEmpty ())
+    {
+      QMessageBox *msgBox
+        = new QMessageBox (QMessageBox::Warning,
+                           tr ("Octave Editor"),
+                           tr ("There is no custom editor configured yet.\n"
+                               "Do you want to open the preferences?"),
+                           QMessageBox::No | QMessageBox::Yes);
+      msgBox->setDefaultButton (QMessageBox::Yes);
+      msgBox->setAttribute (Qt::WA_DeleteOnClose);
 
-        int button = msgBox->exec ();
+      int button = msgBox->exec ();
 
-        if (button == QMessageBox::Yes)
-          emit request_settings_dialog ("editor");
-      }
+      if (button == QMessageBox::Yes)
+        emit request_settings_dialog ("editor");
+    }
 
-    return editor;
-  }
+  return editor;
+}
 
 OCTAVE_END_NAMESPACE(octave)
--- a/libgui/src/external-editor-interface.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/external-editor-interface.h	Thu Feb 02 12:25:51 2023 -0800
@@ -31,38 +31,38 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class external_editor_interface : public QWidget
-  {
-    Q_OBJECT
+class external_editor_interface : public QWidget
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    external_editor_interface (QWidget *main_win);
+  external_editor_interface (QWidget *main_win);
 
-    ~external_editor_interface () = default;
+  ~external_editor_interface () = default;
 
-  signals:
+signals:
 
-    void request_settings_dialog (const QString&);
+  void request_settings_dialog (const QString&);
 
-  public slots:
+public slots:
 
-    bool call_custom_editor (const QString& file = QString (), int line = -1);
+  bool call_custom_editor (const QString& file = QString (), int line = -1);
 
-    void request_open_file (const QString& fileName,
-                            const QString& encoding = QString (),
-                            int line = -1, bool debug_pointer = false,
-                            bool breakpoint_marker = false, bool insert = true,
-                            const QString& cond = "");
+  void request_open_file (const QString& fileName,
+                          const QString& encoding = QString (),
+                          int line = -1, bool debug_pointer = false,
+                          bool breakpoint_marker = false, bool insert = true,
+                          const QString& cond = "");
 
-    void request_new_file (const QString&);
+  void request_new_file (const QString&);
 
-    void handle_edit_file_request (const QString& file);
+  void handle_edit_file_request (const QString& file);
 
-  private:
+private:
 
-    QString external_editor ();
-  };
+  QString external_editor ();
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/src/files-dock-widget.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/files-dock-widget.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -56,1117 +56,1117 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class FileTreeViewer : public QTreeView
-  {
-  public:
-
-    FileTreeViewer (QWidget *p) : QTreeView (p) { }
-
-    ~FileTreeViewer () = default;
-
-    void mousePressEvent (QMouseEvent *e)
-    {
-      if (e->button () != Qt::RightButton)
-        QTreeView::mousePressEvent (e);
-    }
-  };
-
-  // to have file renamed in the file tree, it has to be renamed in
-  // QFileSystemModel::setData.
-  // For the editor to behave correctly, some signals must be sent before
-  // and after the rename
-  class file_system_model : public QFileSystemModel
-  {
-  public:
-    file_system_model (files_dock_widget *p) : QFileSystemModel (p) {}
-
-    ~file_system_model () = default;
+class FileTreeViewer : public QTreeView
+{
+public:
 
-    bool setData (const QModelIndex &idx, const QVariant &value,
-                  int role) override
-    {
-      if (!idx.isValid () || idx.column () != 0 || role != Qt::EditRole
-          || (flags (idx) & Qt::ItemIsEditable) == 0)
-        {
-          return false;
-        }
-
-      QString new_name = value.toString ();
-      QString old_name = idx.data ().toString ();
-      if (new_name == old_name)
-        return true;
-      if (new_name.isEmpty ()
-          || QDir::toNativeSeparators (new_name).contains (QDir::separator ()))
-        {
-          display_rename_failed_message (old_name, new_name);
-          return false;
-        }
-
-      auto parent_dir = QDir(filePath (parent (idx)));
-
-      files_dock_widget *fdw = static_cast<files_dock_widget*>(parent());
-
-      fdw->file_remove_signal(parent_dir.filePath(old_name), parent_dir.filePath(new_name));
-
-      if (!parent_dir.rename (old_name, new_name))
-        {
-          display_rename_failed_message (old_name, new_name);
-          fdw->file_renamed_signal(false);
-          return false;
-        }
+  FileTreeViewer (QWidget *p) : QTreeView (p) { }
 
-      fdw->file_renamed_signal(true);
-
-      emit fileRenamed(parent_dir.absolutePath(), old_name, new_name);
-      revert();
-
-      return true;
-    }
+  ~FileTreeViewer () = default;
 
-  private:
-    void display_rename_failed_message (const QString &old_name,
-                                        const QString &new_name)
-    {
-      const QString message =
-
-          files_dock_widget::tr ("Could not rename file \"%1\" to \"%2\".")
-              .arg (old_name)
-              .arg (new_name);
-      QMessageBox::information (static_cast<QWidget *> (parent ()),
-                                QFileSystemModel::tr ("Invalid filename"),
-                                message, QMessageBox::Ok);
-    }
-  };
-
-  // Delegate to improve ergonomy of file renaming by pre-selecting the text
-  // before the extension.
-  class RenameItemDelegate : public QStyledItemDelegate
+  void mousePressEvent (QMouseEvent *e)
   {
-  public:
-    RenameItemDelegate (QObject *parent = nullptr)
-        : QStyledItemDelegate{ parent }
-    {
-    }
-
-    void setEditorData (QWidget *editor,
-                        const QModelIndex &index) const override
-    {
-      QLineEdit *line_edit = qobject_cast<QLineEdit *> (editor);
-
-      if (!line_edit)
-        {
-          QStyledItemDelegate::setEditorData (editor, index);
-          return;
-        }
-
-      QString filename = index.data (Qt::EditRole).toString ();
-
-      int select_len = filename.indexOf (QChar ('.'));
-      if (select_len == -1)
-        select_len = filename.size ();
-
-      line_edit->setText (filename);
-
-      // Qt calls QLineEdit::selectAll after this function is called, so to
-      // actually restrict the selection, we have to post the modification at
-      // the end of the event loop.
-      // QTimer allows this easily with 0 as timeout.
-      QTimer::singleShot (0, [=] () {
-        line_edit->setSelection (0, select_len);
-      });
-    }
-  };
+    if (e->button () != Qt::RightButton)
+      QTreeView::mousePressEvent (e);
+  }
+};
 
-  files_dock_widget::files_dock_widget (QWidget *p)
-    : octave_dock_widget ("FilesDockWidget", p)
-  {
-    set_title (tr ("File Browser"));
-    setToolTip (tr ("Browse your files"));
-
-    m_sig_mapper = nullptr;
-
-    m_columns_shown = QStringList ();
-    m_columns_shown.append (tr ("File size"));
-    m_columns_shown.append (tr ("File type"));
-    m_columns_shown.append (tr ("Date modified"));
-    m_columns_shown.append (tr ("Show hidden"));
-    m_columns_shown.append (tr ("Alternating row colors"));
-
-    m_columns_shown_keys = QStringList ();
-    m_columns_shown_keys.append (fb_show_size.settings_key ());
-    m_columns_shown_keys.append (fb_show_type.settings_key ());
-    m_columns_shown_keys.append (fb_show_date.settings_key ());
-    m_columns_shown_keys.append (fb_show_hidden.settings_key ());
-    m_columns_shown_keys.append (fb_show_altcol.settings_key ());
-
-    m_columns_shown_defs = QList <QVariant> ();
-    m_columns_shown_defs.append (fb_show_size.def ());
-    m_columns_shown_defs.append (fb_show_type.def ());
-    m_columns_shown_defs.append (fb_show_date.def ());
-    m_columns_shown_defs.append (fb_show_hidden.def ());
-    m_columns_shown_defs.append (fb_show_altcol.def ());
-
-    QWidget *container = new QWidget (this);
-
-    setWidget (container);
-
-    // Create a toolbar
-    m_navigation_tool_bar = new QToolBar ("", container);
-    m_navigation_tool_bar->setAllowedAreas (Qt::TopToolBarArea);
-    m_navigation_tool_bar->setMovable (false);
-
-    m_current_directory = new QComboBox (m_navigation_tool_bar);
-    m_current_directory->setToolTip (tr ("Enter the path or filename"));
-    m_current_directory->setEditable (true);
-    m_current_directory->setMaxCount (MaxMRUDirs);
-    m_current_directory->setInsertPolicy (QComboBox::NoInsert);
-    m_current_directory->setSizeAdjustPolicy (QComboBox::AdjustToMinimumContentsLengthWithIcon);
-    QSizePolicy sizePol (QSizePolicy::Expanding, QSizePolicy::Preferred);
-    m_current_directory->setSizePolicy (sizePol);
-
-    gui_settings settings;
-
-    QAction *directory_up_action
-      = new QAction (settings.icon ("folder-up", false, "go-up"), "",
-                     m_navigation_tool_bar);
-    directory_up_action->setToolTip (tr ("One directory up"));
-
-    m_sync_browser_directory_action
-      = new QAction (settings.icon ("go-first"), tr ("Show Octave directory"),
-                     m_navigation_tool_bar);
-    m_sync_browser_directory_action->setToolTip (tr ("Go to current Octave directory"));
-    m_sync_browser_directory_action->setEnabled (false);
+// to have file renamed in the file tree, it has to be renamed in
+// QFileSystemModel::setData.
+// For the editor to behave correctly, some signals must be sent before
+// and after the rename
+class file_system_model : public QFileSystemModel
+{
+public:
+  file_system_model (files_dock_widget *p) : QFileSystemModel (p) {}
 
-    m_sync_octave_directory_action
-      = new QAction (settings.icon ("go-last"), tr ("Set Octave directory"),
-                     m_navigation_tool_bar);
-    m_sync_octave_directory_action->setToolTip (tr ("Set Octave directory to current browser directory"));
-    m_sync_octave_directory_action->setEnabled (false);
-
-    QToolButton *popdown_button = new QToolButton ();
-    popdown_button->setToolTip (tr ("Actions on current directory"));
-    QMenu *popdown_menu = new QMenu ();
-    popdown_menu->addAction (settings.icon ("user-home"),
-                             tr ("Show Home Directory"), this,
-                             SLOT (popdownmenu_home (bool)));
-    popdown_menu->addAction (m_sync_browser_directory_action);
-    popdown_menu->addAction (m_sync_octave_directory_action);
-    popdown_button->setMenu (popdown_menu);
-    popdown_button->setPopupMode (QToolButton::InstantPopup);
-    popdown_button->setDefaultAction
-      (new QAction (settings.icon ("folder-settings", false,
-                                   "applications-system"),
-                    "", m_navigation_tool_bar));
+  ~file_system_model () = default;
 
-    popdown_menu->addSeparator ();
-    popdown_menu->addAction (settings.icon ("folder"),
-                             tr ("Set Browser Directory..."),
-                             this, &files_dock_widget::popdownmenu_search_dir);
-    popdown_menu->addSeparator ();
-    popdown_menu->addAction (settings.icon ("edit-find"),
-                             tr ("Find Files..."),
-                             this, &files_dock_widget::popdownmenu_findfiles);
-    popdown_menu->addSeparator ();
-    popdown_menu->addAction (settings.icon ("document-new"),
-                             tr ("New File..."),
-                             this, &files_dock_widget::popdownmenu_newfile);
-    popdown_menu->addAction (settings.icon ("folder-new"),
-                             tr ("New Directory..."),
-                             this, &files_dock_widget::popdownmenu_newdir);
-
-    m_navigation_tool_bar->addWidget (m_current_directory);
-    m_navigation_tool_bar->addAction (directory_up_action);
-    m_navigation_tool_bar->addWidget (popdown_button);
-
-    connect (directory_up_action, &QAction::triggered,
-             this, &files_dock_widget::change_directory_up);
-    connect (m_sync_octave_directory_action, &QAction::triggered,
-             this, &files_dock_widget::do_sync_octave_directory);
-    connect (m_sync_browser_directory_action, &QAction::triggered,
-             this, &files_dock_widget::do_sync_browser_directory);
-
-    // Create the QFileSystemModel starting in the desired directory
-    QDir startup_dir;  // take current dir
-
-    if (settings.bool_value (fb_restore_last_dir))
+  bool setData (const QModelIndex &idx, const QVariant &value,
+                int role) override
+  {
+    if (!idx.isValid () || idx.column () != 0 || role != Qt::EditRole
+        || (flags (idx) & Qt::ItemIsEditable) == 0)
       {
-        // restore last dir from previous session
-        QStringList last_dirs
-          = settings.value (fb_mru_list.settings_key ()).toStringList ();
-        if (last_dirs.length () > 0)
-          startup_dir = QDir (last_dirs.at (0));  // last dir in previous session
-      }
-    else if (! settings.string_value (fb_startup_dir).isEmpty ())
-      {
-        // do not restore but there is a startup dir configured
-        startup_dir = QDir (settings.value (fb_startup_dir.settings_key ()).toString ());
+        return false;
       }
 
-    if (! startup_dir.exists ())
+    QString new_name = value.toString ();
+    QString old_name = idx.data ().toString ();
+    if (new_name == old_name)
+      return true;
+    if (new_name.isEmpty ()
+        || QDir::toNativeSeparators (new_name).contains (QDir::separator ()))
       {
-        // the configured startup dir does not exist, take actual one
-        startup_dir = QDir ();
+        display_rename_failed_message (old_name, new_name);
+        return false;
       }
 
-    m_file_system_model = new file_system_model (this);
-    m_file_system_model->setResolveSymlinks (false);
-    m_file_system_model->setFilter
-      (QDir::System | QDir::NoDotAndDotDot | QDir::AllEntries);
-    QModelIndex rootPathIndex
-      = m_file_system_model->setRootPath (startup_dir.absolutePath ());
-
-    // Attach the model to the QTreeView and set the root index
-    m_file_tree_view = new FileTreeViewer (container);
-    m_file_tree_view->setSelectionMode (QAbstractItemView::ExtendedSelection);
-    m_file_tree_view->setModel (m_file_system_model);
-    m_file_tree_view->setRootIndex (rootPathIndex);
-    m_file_tree_view->setSortingEnabled (true);
-    m_file_tree_view->setAlternatingRowColors (true);
-    m_file_tree_view->setAnimated (true);
-    m_file_tree_view->setToolTip (tr ("Double-click to open file/folder, right click for alternatives"));
+    auto parent_dir = QDir(filePath (parent (idx)));
 
-    // allow renaming directly in the tree view with
-    // m_file_tree_view->edit(index)
-    m_file_system_model->setReadOnly (false);
-    // delegate to improve rename ergonomy by pre-selecting text up to the
-    // extension
-    auto *rename_delegate = new RenameItemDelegate (this);
-    m_file_tree_view->setItemDelegateForColumn (0, rename_delegate);
-    // prevent the tree view to override Octave's double-click behavior
-    m_file_tree_view->setEditTriggers (QAbstractItemView::NoEditTriggers);
-    // create the rename action (that will be added to context menu)
-    // and associate to F2 key shortcut
-    m_rename_action = new QAction (tr ("Rename..."), this);
-    m_rename_action->setShortcut (Qt::Key_F2);
-    m_rename_action->setShortcutContext(Qt::WidgetWithChildrenShortcut);
-    connect (m_rename_action, &QAction::triggered, this,
-             &files_dock_widget::contextmenu_rename);
-    addAction(m_rename_action);
-
-    // get sort column and order as well as column state (order and width)
+    files_dock_widget *fdw = static_cast<files_dock_widget*>(parent());
 
-    m_file_tree_view->sortByColumn
-      (settings.int_value (fb_sort_column),
-       static_cast<Qt::SortOrder> (settings.uint_value (fb_sort_order)));
-       // FIXME: use value<Qt::SortOrder> instead of static cast after
-       //        dropping support of Qt 5.4
-
-    if (settings.contains (fb_column_state.settings_key ()))
-      m_file_tree_view->header ()->restoreState
-        (settings.value (fb_column_state.settings_key ()).toByteArray ());
-
-    // Set header properties for sorting
-    m_file_tree_view->header ()->setSectionsClickable (true);
-    m_file_tree_view->header ()->setSectionsMovable (true);
-    m_file_tree_view->header ()->setSortIndicatorShown (true);
-
-    QStringList mru_dirs =
-      settings.value (fb_mru_list.settings_key ()).toStringList ();
-    m_current_directory->addItems (mru_dirs);
-
-    m_current_directory->setEditText
-      (m_file_system_model->fileInfo (rootPathIndex). absoluteFilePath ());
-
-    connect (m_file_tree_view, &FileTreeViewer::activated,
-             this, &files_dock_widget::item_double_clicked);
-
-    // add context menu to tree_view
-    m_file_tree_view->setContextMenuPolicy (Qt::CustomContextMenu);
-    connect (m_file_tree_view, &FileTreeViewer::customContextMenuRequested,
-             this, &files_dock_widget::contextmenu_requested);
+    fdw->file_remove_signal(parent_dir.filePath(old_name), parent_dir.filePath(new_name));
 
-    m_file_tree_view->header ()->setContextMenuPolicy (Qt::CustomContextMenu);
-    connect (m_file_tree_view->header (),
-             &QHeaderView::customContextMenuRequested,
-             this, &files_dock_widget::headercontextmenu_requested);
-
-    // Layout the widgets vertically with the toolbar on top
-    QVBoxLayout *vbox_layout = new QVBoxLayout ();
-    vbox_layout->setSpacing (0);
-    vbox_layout->addWidget (m_navigation_tool_bar);
-    vbox_layout->addWidget (m_file_tree_view);
-    vbox_layout->setMargin (1);
-
-    container->setLayout (vbox_layout);
-
-    // FIXME: Add right-click contextual menus for copying, pasting,
-    //        deleting files (and others).
-
-    connect (m_current_directory->lineEdit (), &QLineEdit::returnPressed,
-             this, &files_dock_widget::accept_directory_line_edit);
-
-    // FIXME: We could use
-    //
-    //    connect (m_current_directory,
-    //             QOverload<const QString&>::of (&QComboBox::activated),
-    //             this, &files_dock_widget::set_current_directory);
-    //
-    // but referring to QComboBox::activated will generate deprecated
-    // function warnings from GCC.  We could also use
-    //
-    //    connect (m_current_directory, &QComboBox::textActivated,
-    //             this, &files_dock_widget::set_current_directory);
-    //
-    // but the function textActivated was not introduced until Qt 5.14
-    // so we'll need a feature test.
+    if (!parent_dir.rename (old_name, new_name))
+      {
+        display_rename_failed_message (old_name, new_name);
+        fdw->file_renamed_signal(false);
+        return false;
+      }
 
-    connect (m_current_directory, SIGNAL (activated (const QString&)),
-             this, SLOT (set_current_directory (const QString&)));
-
-    QCompleter *completer = new QCompleter (m_file_system_model, this);
-    m_current_directory->setCompleter (completer);
-
-    setFocusProxy (m_current_directory);
-
-    m_sync_octave_dir = true;   // default, overwritten with notice_settings ()
-    m_octave_dir = "";
-
-    if (! p)
-      make_window ();
-  }
-
-  void files_dock_widget::save_settings ()
-  {
-    gui_settings settings;
+    fdw->file_renamed_signal(true);
 
-    int sort_column = m_file_tree_view->header ()->sortIndicatorSection ();
-    Qt::SortOrder sort_order = m_file_tree_view->header ()->sortIndicatorOrder ();
-    settings.setValue (fb_sort_column.settings_key (), sort_column);
-    settings.setValue (fb_sort_order.settings_key (), sort_order);
-    settings.setValue (fb_column_state.settings_key (),
-                       m_file_tree_view->header ()->saveState ());
+    emit fileRenamed(parent_dir.absolutePath(), old_name, new_name);
+    revert();
 
-    QStringList dirs;
-    for (int i=0; i< m_current_directory->count (); i++)
-      {
-        dirs.append (m_current_directory->itemText (i));
-      }
-    settings.setValue (fb_mru_list.settings_key (), dirs);
-
-    settings.sync ();
-
-    octave_dock_widget::save_settings ();
-
-    if (m_sig_mapper)
-      delete m_sig_mapper;
+    return true;
   }
 
-  void files_dock_widget::item_double_clicked (const QModelIndex& index)
-  {
-    // Retrieve the file info associated with the model index.
-    QFileInfo fileInfo = m_file_system_model->fileInfo (index);
-    set_current_directory (fileInfo.absoluteFilePath ());
-  }
-
-  void files_dock_widget::set_current_directory (const QString& dir)
+private:
+  void display_rename_failed_message (const QString &old_name,
+                                      const QString &new_name)
   {
-    display_directory (dir);
-  }
-
-  void files_dock_widget::accept_directory_line_edit ()
-  {
-    display_directory (m_current_directory->currentText ());
-  }
-
-  void files_dock_widget::change_directory_up ()
-  {
-    QDir dir
-      = QDir (m_file_system_model->filePath (m_file_tree_view->rootIndex ()));
+    const QString message =
 
-    dir.cdUp ();
-    display_directory (dir.absolutePath ());
-  }
-
-  void files_dock_widget::do_sync_octave_directory ()
-  {
-    QDir dir
-      = QDir (m_file_system_model->filePath (m_file_tree_view->rootIndex ()));
-
-    emit displayed_directory_changed (dir.absolutePath ());
+        files_dock_widget::tr ("Could not rename file \"%1\" to \"%2\".")
+            .arg (old_name)
+            .arg (new_name);
+    QMessageBox::information (static_cast<QWidget *> (parent ()),
+                              QFileSystemModel::tr ("Invalid filename"),
+                              message, QMessageBox::Ok);
   }
-
-  void files_dock_widget::do_sync_browser_directory ()
-  {
-    display_directory (m_octave_dir, false); // false: no sync of octave dir
-  }
+};
 
-  void files_dock_widget::update_octave_directory (const QString& dir)
+// Delegate to improve ergonomy of file renaming by pre-selecting the text
+// before the extension.
+class RenameItemDelegate : public QStyledItemDelegate
+{
+public:
+  RenameItemDelegate (QObject *parent = nullptr)
+      : QStyledItemDelegate{ parent }
   {
-    m_octave_dir = dir;
-    if (m_sync_octave_dir)
-      display_directory (m_octave_dir, false); // false: no sync of octave dir
   }
 
-  void files_dock_widget::display_directory (const QString& dir,
-                                             bool set_octave_dir)
-  {
-    QFileInfo fileInfo (dir);
-    if (fileInfo.exists ())
-      {
-        if (fileInfo.isDir ())
-          {
-            m_file_tree_view->setRootIndex (m_file_system_model->
-                                            index (fileInfo.absoluteFilePath ()));
-            m_file_system_model->setRootPath (fileInfo.absoluteFilePath ());
-            if (m_sync_octave_dir && set_octave_dir)
-              process_set_current_dir (fileInfo.absoluteFilePath ());
-
-            // see if it's in the list, and if it is,
-            // remove it and then put at top of the list
-            int index
-              = m_current_directory->findText (fileInfo.absoluteFilePath ());
-            if (index != -1)
-              {
-                m_current_directory->removeItem (index);
-              }
-            m_current_directory->insertItem (0, fileInfo.absoluteFilePath ());
-            m_current_directory->setCurrentIndex (0);
-          }
-        else
-          {
-            QString abs_fname = fileInfo.absoluteFilePath ();
-
-            QString suffix = fileInfo.suffix ().toLower ();
-
-            gui_settings settings;
-
-            QString ext = settings.string_value (fb_txt_file_ext);
-#if defined (HAVE_QT_SPLITBEHAVIOR_ENUM)
-            QStringList extensions = ext.split (";", Qt::SkipEmptyParts);
-#else
-            QStringList extensions = ext.split (";", QString::SkipEmptyParts);
-#endif
-            if (QFile::exists (abs_fname))
-              {
-                if (extensions.contains (suffix))
-                  emit open_file (fileInfo.absoluteFilePath ());
-                else
-                  emit open_any_signal (abs_fname);
-              }
-          }
-      }
-  }
-
-  void files_dock_widget::open_item_in_app (const QModelIndex& index)
+  void setEditorData (QWidget *editor,
+                      const QModelIndex &index) const override
   {
-    // Retrieve the file info associated with the model index.
-    QFileInfo fileInfo = m_file_system_model->fileInfo (index);
-
-    QString file = fileInfo.absoluteFilePath ();
-
-    QDesktopServices::openUrl (QUrl::fromLocalFile (file));
-  }
+    QLineEdit *line_edit = qobject_cast<QLineEdit *> (editor);
 
-  void files_dock_widget::toggle_header (int col)
-  {
-    gui_settings settings;
-
-    QString key = m_columns_shown_keys.at (col);
-    bool shown = settings.value (key, false).toBool ();
-    settings.setValue (key, ! shown);
-    settings.sync ();
-
-    switch (col)
+    if (!line_edit)
       {
-      case 0:
-      case 1:
-      case 2:
-        // toggle column visibility
-        m_file_tree_view->setColumnHidden (col + 1, shown);
-        break;
-      case 3:
-      case 4:
-        // other actions depending on new settings
-        notice_settings ();
-        break;
-      }
-  }
-
-  void files_dock_widget::headercontextmenu_requested (const QPoint& mpos)
-  {
-    QMenu menu (this);
-
-    if (m_sig_mapper)
-      delete m_sig_mapper;
-    m_sig_mapper = new QSignalMapper (this);
-
-    gui_settings settings;
-
-    for (int i = 0; i < m_columns_shown.size (); i++)
-      {
-        QAction *action = menu.addAction (m_columns_shown.at (i),
-                                          m_sig_mapper, SLOT (map ()));
-        m_sig_mapper->setMapping (action, i);
-        action->setCheckable (true);
-        action->setChecked
-          (settings.value (m_columns_shown_keys.at (i),
-                           m_columns_shown_defs.at (i)).toBool ());
+        QStyledItemDelegate::setEditorData (editor, index);
+        return;
       }
 
-    // FIXME: We could use
-    //
-    //   connect (&m_sig_mapper, QOverload<int>::of (&QSignalMapper::mapped),
-    //            this, &workspace_view::toggle_header);
-    //
-    // but referring to QSignalMapper::mapped will generate deprecated
-    // function warnings from GCC.  We could also use
-    //
-    //   connect (&m_sig_mapper, &QSignalMapper::mappedInt,
-    //            this, &workspace_view::toggle_header);
-    //
-    // but the function mappedInt was not introduced until Qt 5.15 so
-    // we'll need a feature test.
+    QString filename = index.data (Qt::EditRole).toString ();
+
+    int select_len = filename.indexOf (QChar ('.'));
+    if (select_len == -1)
+      select_len = filename.size ();
+
+    line_edit->setText (filename);
+
+    // Qt calls QLineEdit::selectAll after this function is called, so to
+    // actually restrict the selection, we have to post the modification at
+    // the end of the event loop.
+    // QTimer allows this easily with 0 as timeout.
+    QTimer::singleShot (0, [=] () {
+      line_edit->setSelection (0, select_len);
+    });
+  }
+};
+
+files_dock_widget::files_dock_widget (QWidget *p)
+  : octave_dock_widget ("FilesDockWidget", p)
+{
+  set_title (tr ("File Browser"));
+  setToolTip (tr ("Browse your files"));
+
+  m_sig_mapper = nullptr;
+
+  m_columns_shown = QStringList ();
+  m_columns_shown.append (tr ("File size"));
+  m_columns_shown.append (tr ("File type"));
+  m_columns_shown.append (tr ("Date modified"));
+  m_columns_shown.append (tr ("Show hidden"));
+  m_columns_shown.append (tr ("Alternating row colors"));
 
-    connect (m_sig_mapper, SIGNAL (mapped (int)),
-             this, SLOT (toggle_header (int)));
+  m_columns_shown_keys = QStringList ();
+  m_columns_shown_keys.append (fb_show_size.settings_key ());
+  m_columns_shown_keys.append (fb_show_type.settings_key ());
+  m_columns_shown_keys.append (fb_show_date.settings_key ());
+  m_columns_shown_keys.append (fb_show_hidden.settings_key ());
+  m_columns_shown_keys.append (fb_show_altcol.settings_key ());
 
-    menu.exec (m_file_tree_view->mapToGlobal (mpos));
-  }
+  m_columns_shown_defs = QList <QVariant> ();
+  m_columns_shown_defs.append (fb_show_size.def ());
+  m_columns_shown_defs.append (fb_show_type.def ());
+  m_columns_shown_defs.append (fb_show_date.def ());
+  m_columns_shown_defs.append (fb_show_hidden.def ());
+  m_columns_shown_defs.append (fb_show_altcol.def ());
+
+  QWidget *container = new QWidget (this);
+
+  setWidget (container);
 
-  void files_dock_widget::contextmenu_requested (const QPoint& mpos)
-  {
+  // Create a toolbar
+  m_navigation_tool_bar = new QToolBar ("", container);
+  m_navigation_tool_bar->setAllowedAreas (Qt::TopToolBarArea);
+  m_navigation_tool_bar->setMovable (false);
 
-    QMenu menu (this);
+  m_current_directory = new QComboBox (m_navigation_tool_bar);
+  m_current_directory->setToolTip (tr ("Enter the path or filename"));
+  m_current_directory->setEditable (true);
+  m_current_directory->setMaxCount (MaxMRUDirs);
+  m_current_directory->setInsertPolicy (QComboBox::NoInsert);
+  m_current_directory->setSizeAdjustPolicy (QComboBox::AdjustToMinimumContentsLengthWithIcon);
+  QSizePolicy sizePol (QSizePolicy::Expanding, QSizePolicy::Preferred);
+  m_current_directory->setSizePolicy (sizePol);
+
+  gui_settings settings;
 
-    QModelIndex index = m_file_tree_view->indexAt (mpos);
+  QAction *directory_up_action
+    = new QAction (settings.icon ("folder-up", false, "go-up"), "",
+                   m_navigation_tool_bar);
+  directory_up_action->setToolTip (tr ("One directory up"));
+
+  m_sync_browser_directory_action
+    = new QAction (settings.icon ("go-first"), tr ("Show Octave directory"),
+                   m_navigation_tool_bar);
+  m_sync_browser_directory_action->setToolTip (tr ("Go to current Octave directory"));
+  m_sync_browser_directory_action->setEnabled (false);
 
-    if (index.isValid ())
-      {
-        QFileInfo info = m_file_system_model->fileInfo (index);
+  m_sync_octave_directory_action
+    = new QAction (settings.icon ("go-last"), tr ("Set Octave directory"),
+                   m_navigation_tool_bar);
+  m_sync_octave_directory_action->setToolTip (tr ("Set Octave directory to current browser directory"));
+  m_sync_octave_directory_action->setEnabled (false);
 
-        QItemSelectionModel *m = m_file_tree_view->selectionModel ();
-        QModelIndexList sel = m->selectedRows ();
+  QToolButton *popdown_button = new QToolButton ();
+  popdown_button->setToolTip (tr ("Actions on current directory"));
+  QMenu *popdown_menu = new QMenu ();
+  popdown_menu->addAction (settings.icon ("user-home"),
+                           tr ("Show Home Directory"), this,
+                           SLOT (popdownmenu_home (bool)));
+  popdown_menu->addAction (m_sync_browser_directory_action);
+  popdown_menu->addAction (m_sync_octave_directory_action);
+  popdown_button->setMenu (popdown_menu);
+  popdown_button->setPopupMode (QToolButton::InstantPopup);
+  popdown_button->setDefaultAction
+    (new QAction (settings.icon ("folder-settings", false,
+                                 "applications-system"),
+                  "", m_navigation_tool_bar));
+
+  popdown_menu->addSeparator ();
+  popdown_menu->addAction (settings.icon ("folder"),
+                           tr ("Set Browser Directory..."),
+                           this, &files_dock_widget::popdownmenu_search_dir);
+  popdown_menu->addSeparator ();
+  popdown_menu->addAction (settings.icon ("edit-find"),
+                           tr ("Find Files..."),
+                           this, &files_dock_widget::popdownmenu_findfiles);
+  popdown_menu->addSeparator ();
+  popdown_menu->addAction (settings.icon ("document-new"),
+                           tr ("New File..."),
+                           this, &files_dock_widget::popdownmenu_newfile);
+  popdown_menu->addAction (settings.icon ("folder-new"),
+                           tr ("New Directory..."),
+                           this, &files_dock_widget::popdownmenu_newdir);
 
-        // check if item at mouse position is seleccted
-        if (! sel.contains (index))
-          {
-            // is not selected -> clear actual selection and select this item
-            m->setCurrentIndex (index,
-                                QItemSelectionModel::Clear
-                                | QItemSelectionModel::Select
-                                | QItemSelectionModel::Rows);
-          }
+  m_navigation_tool_bar->addWidget (m_current_directory);
+  m_navigation_tool_bar->addAction (directory_up_action);
+  m_navigation_tool_bar->addWidget (popdown_button);
 
-        gui_settings settings;
+  connect (directory_up_action, &QAction::triggered,
+           this, &files_dock_widget::change_directory_up);
+  connect (m_sync_octave_directory_action, &QAction::triggered,
+           this, &files_dock_widget::do_sync_octave_directory);
+  connect (m_sync_browser_directory_action, &QAction::triggered,
+           this, &files_dock_widget::do_sync_browser_directory);
+
+  // Create the QFileSystemModel starting in the desired directory
+  QDir startup_dir;  // take current dir
 
-        // construct the context menu depending on item
-        menu.addAction (settings.icon ("document-open"), tr ("Open"),
-                        this, &files_dock_widget::contextmenu_open);
+  if (settings.bool_value (fb_restore_last_dir))
+    {
+      // restore last dir from previous session
+      QStringList last_dirs
+        = settings.value (fb_mru_list.settings_key ()).toStringList ();
+      if (last_dirs.length () > 0)
+        startup_dir = QDir (last_dirs.at (0));  // last dir in previous session
+    }
+  else if (! settings.string_value (fb_startup_dir).isEmpty ())
+    {
+      // do not restore but there is a startup dir configured
+      startup_dir = QDir (settings.value (fb_startup_dir.settings_key ()).toString ());
+    }
 
-        if (info.isDir ())
-          {
-            menu.addAction (tr ("Open in System File Explorer"),
-                            this, &files_dock_widget::contextmenu_open_in_app);
-          }
+  if (! startup_dir.exists ())
+    {
+      // the configured startup dir does not exist, take actual one
+      startup_dir = QDir ();
+    }
 
-        if (info.isFile ())
-          menu.addAction (tr ("Open in Text Editor"),
-                          this, &files_dock_widget::contextmenu_open_in_editor);
+  m_file_system_model = new file_system_model (this);
+  m_file_system_model->setResolveSymlinks (false);
+  m_file_system_model->setFilter
+    (QDir::System | QDir::NoDotAndDotDot | QDir::AllEntries);
+  QModelIndex rootPathIndex
+    = m_file_system_model->setRootPath (startup_dir.absolutePath ());
 
-        menu.addAction (tr ("Copy Selection to Clipboard"),
-                        this, &files_dock_widget::contextmenu_copy_selection);
+  // Attach the model to the QTreeView and set the root index
+  m_file_tree_view = new FileTreeViewer (container);
+  m_file_tree_view->setSelectionMode (QAbstractItemView::ExtendedSelection);
+  m_file_tree_view->setModel (m_file_system_model);
+  m_file_tree_view->setRootIndex (rootPathIndex);
+  m_file_tree_view->setSortingEnabled (true);
+  m_file_tree_view->setAlternatingRowColors (true);
+  m_file_tree_view->setAnimated (true);
+  m_file_tree_view->setToolTip (tr ("Double-click to open file/folder, right click for alternatives"));
 
-        if (info.isFile () && info.suffix () == "m")
-          menu.addAction (settings.icon ("media-playback-start"), tr ("Run"),
-                          this, &files_dock_widget::contextmenu_run);
+  // allow renaming directly in the tree view with
+  // m_file_tree_view->edit(index)
+  m_file_system_model->setReadOnly (false);
+  // delegate to improve rename ergonomy by pre-selecting text up to the
+  // extension
+  auto *rename_delegate = new RenameItemDelegate (this);
+  m_file_tree_view->setItemDelegateForColumn (0, rename_delegate);
+  // prevent the tree view to override Octave's double-click behavior
+  m_file_tree_view->setEditTriggers (QAbstractItemView::NoEditTriggers);
+  // create the rename action (that will be added to context menu)
+  // and associate to F2 key shortcut
+  m_rename_action = new QAction (tr ("Rename..."), this);
+  m_rename_action->setShortcut (Qt::Key_F2);
+  m_rename_action->setShortcutContext(Qt::WidgetWithChildrenShortcut);
+  connect (m_rename_action, &QAction::triggered, this,
+           &files_dock_widget::contextmenu_rename);
+  addAction(m_rename_action);
 
-        if (info.isFile ())
-          menu.addAction (tr ("Load Data"),
-                          this, &files_dock_widget::contextmenu_load);
+  // get sort column and order as well as column state (order and width)
+
+  m_file_tree_view->sortByColumn
+    (settings.int_value (fb_sort_column),
+     static_cast<Qt::SortOrder> (settings.uint_value (fb_sort_order)));
+     // FIXME: use value<Qt::SortOrder> instead of static cast after
+     //        dropping support of Qt 5.4
+
+  if (settings.contains (fb_column_state.settings_key ()))
+    m_file_tree_view->header ()->restoreState
+      (settings.value (fb_column_state.settings_key ()).toByteArray ());
 
-        if (info.isDir ())
-          {
-            menu.addSeparator ();
-            menu.addAction (settings.icon ("go-first"), tr ("Set Current Directory"),
-                            this, &files_dock_widget::contextmenu_setcurrentdir);
+  // Set header properties for sorting
+  m_file_tree_view->header ()->setSectionsClickable (true);
+  m_file_tree_view->header ()->setSectionsMovable (true);
+  m_file_tree_view->header ()->setSortIndicatorShown (true);
+
+  QStringList mru_dirs =
+    settings.value (fb_mru_list.settings_key ()).toStringList ();
+  m_current_directory->addItems (mru_dirs);
+
+  m_current_directory->setEditText
+    (m_file_system_model->fileInfo (rootPathIndex). absoluteFilePath ());
+
+  connect (m_file_tree_view, &FileTreeViewer::activated,
+           this, &files_dock_widget::item_double_clicked);
+
+  // add context menu to tree_view
+  m_file_tree_view->setContextMenuPolicy (Qt::CustomContextMenu);
+  connect (m_file_tree_view, &FileTreeViewer::customContextMenuRequested,
+           this, &files_dock_widget::contextmenu_requested);
 
-            QMenu *add_path_menu = menu.addMenu (tr ("Add to Path"));
+  m_file_tree_view->header ()->setContextMenuPolicy (Qt::CustomContextMenu);
+  connect (m_file_tree_view->header (),
+           &QHeaderView::customContextMenuRequested,
+           this, &files_dock_widget::headercontextmenu_requested);
 
-            add_path_menu->addAction (tr ("Selected Directories"),
-                                      this, [=] (bool checked) { contextmenu_add_to_path (checked); });
-            add_path_menu->addAction (tr ("Selected Directories and Subdirectories"),
-                                      this, &files_dock_widget::contextmenu_add_to_path_subdirs);
+  // Layout the widgets vertically with the toolbar on top
+  QVBoxLayout *vbox_layout = new QVBoxLayout ();
+  vbox_layout->setSpacing (0);
+  vbox_layout->addWidget (m_navigation_tool_bar);
+  vbox_layout->addWidget (m_file_tree_view);
+  vbox_layout->setMargin (1);
 
-            QMenu *rm_path_menu = menu.addMenu (tr ("Remove from Path"));
+  container->setLayout (vbox_layout);
+
+  // FIXME: Add right-click contextual menus for copying, pasting,
+  //        deleting files (and others).
+
+  connect (m_current_directory->lineEdit (), &QLineEdit::returnPressed,
+           this, &files_dock_widget::accept_directory_line_edit);
 
-            rm_path_menu->addAction (tr ("Selected Directories"),
-                                     this, &files_dock_widget::contextmenu_rm_from_path);
-            rm_path_menu->addAction (tr ("Selected Directories and Subdirectories"),
-                                     this, &files_dock_widget::contextmenu_rm_from_path_subdirs);
+  // FIXME: We could use
+  //
+  //    connect (m_current_directory,
+  //             QOverload<const QString&>::of (&QComboBox::activated),
+  //             this, &files_dock_widget::set_current_directory);
+  //
+  // but referring to QComboBox::activated will generate deprecated
+  // function warnings from GCC.  We could also use
+  //
+  //    connect (m_current_directory, &QComboBox::textActivated,
+  //             this, &files_dock_widget::set_current_directory);
+  //
+  // but the function textActivated was not introduced until Qt 5.14
+  // so we'll need a feature test.
 
-            menu.addSeparator ();
+  connect (m_current_directory, SIGNAL (activated (const QString&)),
+           this, SLOT (set_current_directory (const QString&)));
 
-            menu.addAction (settings.icon ("edit-find"), tr ("Find Files..."),
-                            this, &files_dock_widget::contextmenu_findfiles);
-          }
+  QCompleter *completer = new QCompleter (m_file_system_model, this);
+  m_current_directory->setCompleter (completer);
+
+  setFocusProxy (m_current_directory);
+
+  m_sync_octave_dir = true;   // default, overwritten with notice_settings ()
+  m_octave_dir = "";
 
-        menu.addSeparator ();
-        menu.addAction (m_rename_action);
-        menu.addAction (settings.icon ("edit-delete"), tr ("Delete..."),
-                        this, &files_dock_widget::contextmenu_delete);
+  if (! p)
+    make_window ();
+}
+
+void files_dock_widget::save_settings ()
+{
+  gui_settings settings;
+
+  int sort_column = m_file_tree_view->header ()->sortIndicatorSection ();
+  Qt::SortOrder sort_order = m_file_tree_view->header ()->sortIndicatorOrder ();
+  settings.setValue (fb_sort_column.settings_key (), sort_column);
+  settings.setValue (fb_sort_order.settings_key (), sort_order);
+  settings.setValue (fb_column_state.settings_key (),
+                     m_file_tree_view->header ()->saveState ());
 
-        if (info.isDir ())
-          {
-            menu.addSeparator ();
-            menu.addAction (settings.icon ("document-new"), tr ("New File..."),
-                            this, &files_dock_widget::contextmenu_newfile);
-            menu.addAction (settings.icon ("folder-new"), tr ("New Directory..."),
-                            this, &files_dock_widget::contextmenu_newdir);
-          }
+  QStringList dirs;
+  for (int i=0; i< m_current_directory->count (); i++)
+    {
+      dirs.append (m_current_directory->itemText (i));
+    }
+  settings.setValue (fb_mru_list.settings_key (), dirs);
+
+  settings.sync ();
+
+  octave_dock_widget::save_settings ();
+
+  if (m_sig_mapper)
+    delete m_sig_mapper;
+}
+
+void files_dock_widget::item_double_clicked (const QModelIndex& index)
+{
+  // Retrieve the file info associated with the model index.
+  QFileInfo fileInfo = m_file_system_model->fileInfo (index);
+  set_current_directory (fileInfo.absoluteFilePath ());
+}
+
+void files_dock_widget::set_current_directory (const QString& dir)
+{
+  display_directory (dir);
+}
 
-        // show the menu
-        menu.exec (m_file_tree_view->mapToGlobal (mpos));
+void files_dock_widget::accept_directory_line_edit ()
+{
+  display_directory (m_current_directory->currentText ());
+}
+
+void files_dock_widget::change_directory_up ()
+{
+  QDir dir
+    = QDir (m_file_system_model->filePath (m_file_tree_view->rootIndex ()));
 
-      }
-  }
+  dir.cdUp ();
+  display_directory (dir.absolutePath ());
+}
 
-  void files_dock_widget::contextmenu_open (bool)
-  {
+void files_dock_widget::do_sync_octave_directory ()
+{
+  QDir dir
+    = QDir (m_file_system_model->filePath (m_file_tree_view->rootIndex ()));
+
+  emit displayed_directory_changed (dir.absolutePath ());
+}
+
+void files_dock_widget::do_sync_browser_directory ()
+{
+  display_directory (m_octave_dir, false); // false: no sync of octave dir
+}
 
-    QItemSelectionModel *m = m_file_tree_view->selectionModel ();
-    QModelIndexList rows = m->selectedRows ();
+void files_dock_widget::update_octave_directory (const QString& dir)
+{
+  m_octave_dir = dir;
+  if (m_sync_octave_dir)
+    display_directory (m_octave_dir, false); // false: no sync of octave dir
+}
 
-    for (const auto& it : rows)
-      {
-        QFileInfo file = m_file_system_model->fileInfo (it);
-        if (file.exists ())
-          display_directory (file.absoluteFilePath ());
-      }
-  }
+void files_dock_widget::display_directory (const QString& dir,
+                                           bool set_octave_dir)
+{
+  QFileInfo fileInfo (dir);
+  if (fileInfo.exists ())
+    {
+      if (fileInfo.isDir ())
+        {
+          m_file_tree_view->setRootIndex (m_file_system_model->
+                                          index (fileInfo.absoluteFilePath ()));
+          m_file_system_model->setRootPath (fileInfo.absoluteFilePath ());
+          if (m_sync_octave_dir && set_octave_dir)
+            process_set_current_dir (fileInfo.absoluteFilePath ());
+
+          // see if it's in the list, and if it is,
+          // remove it and then put at top of the list
+          int index
+            = m_current_directory->findText (fileInfo.absoluteFilePath ());
+          if (index != -1)
+            {
+              m_current_directory->removeItem (index);
+            }
+          m_current_directory->insertItem (0, fileInfo.absoluteFilePath ());
+          m_current_directory->setCurrentIndex (0);
+        }
+      else
+        {
+          QString abs_fname = fileInfo.absoluteFilePath ();
+
+          QString suffix = fileInfo.suffix ().toLower ();
 
-  void files_dock_widget::contextmenu_open_in_editor (bool)
-  {
+          gui_settings settings;
 
-    QItemSelectionModel *m = m_file_tree_view->selectionModel ();
-    QModelIndexList rows = m->selectedRows ();
+          QString ext = settings.string_value (fb_txt_file_ext);
+#if defined (HAVE_QT_SPLITBEHAVIOR_ENUM)
+          QStringList extensions = ext.split (";", Qt::SkipEmptyParts);
+#else
+          QStringList extensions = ext.split (";", QString::SkipEmptyParts);
+#endif
+          if (QFile::exists (abs_fname))
+            {
+              if (extensions.contains (suffix))
+                emit open_file (fileInfo.absoluteFilePath ());
+              else
+                emit open_any_signal (abs_fname);
+            }
+        }
+    }
+}
 
-    for (const auto& it : rows)
-      {
-        QFileInfo file = m_file_system_model->fileInfo (it);
-        if (file.exists ())
-          emit open_file (file.absoluteFilePath ());
-      }
-  }
+void files_dock_widget::open_item_in_app (const QModelIndex& index)
+{
+  // Retrieve the file info associated with the model index.
+  QFileInfo fileInfo = m_file_system_model->fileInfo (index);
+
+  QString file = fileInfo.absoluteFilePath ();
+
+  QDesktopServices::openUrl (QUrl::fromLocalFile (file));
+}
+
+void files_dock_widget::toggle_header (int col)
+{
+  gui_settings settings;
+
+  QString key = m_columns_shown_keys.at (col);
+  bool shown = settings.value (key, false).toBool ();
+  settings.setValue (key, ! shown);
+  settings.sync ();
 
-  void files_dock_widget::contextmenu_open_in_app (bool)
-  {
-    QItemSelectionModel *m = m_file_tree_view->selectionModel ();
-    QModelIndexList rows = m->selectedRows ();
+  switch (col)
+    {
+    case 0:
+    case 1:
+    case 2:
+      // toggle column visibility
+      m_file_tree_view->setColumnHidden (col + 1, shown);
+      break;
+    case 3:
+    case 4:
+      // other actions depending on new settings
+      notice_settings ();
+      break;
+    }
+}
 
-    for (const auto& it : rows)
-      open_item_in_app (it);
-  }
+void files_dock_widget::headercontextmenu_requested (const QPoint& mpos)
+{
+  QMenu menu (this);
+
+  if (m_sig_mapper)
+    delete m_sig_mapper;
+  m_sig_mapper = new QSignalMapper (this);
+
+  gui_settings settings;
 
-  void files_dock_widget::contextmenu_copy_selection (bool)
-  {
-    QItemSelectionModel *m = m_file_tree_view->selectionModel ();
-    QModelIndexList rows = m->selectedRows ();
-
-    QStringList selection;
+  for (int i = 0; i < m_columns_shown.size (); i++)
+    {
+      QAction *action = menu.addAction (m_columns_shown.at (i),
+                                        m_sig_mapper, SLOT (map ()));
+      m_sig_mapper->setMapping (action, i);
+      action->setCheckable (true);
+      action->setChecked
+        (settings.value (m_columns_shown_keys.at (i),
+                         m_columns_shown_defs.at (i)).toBool ());
+    }
 
-    for (const auto& it : rows)
-      {
-        QFileInfo info = m_file_system_model->fileInfo (it);
-        selection << info.fileName ();
-      }
+  // FIXME: We could use
+  //
+  //   connect (&m_sig_mapper, QOverload<int>::of (&QSignalMapper::mapped),
+  //            this, &workspace_view::toggle_header);
+  //
+  // but referring to QSignalMapper::mapped will generate deprecated
+  // function warnings from GCC.  We could also use
+  //
+  //   connect (&m_sig_mapper, &QSignalMapper::mappedInt,
+  //            this, &workspace_view::toggle_header);
+  //
+  // but the function mappedInt was not introduced until Qt 5.15 so
+  // we'll need a feature test.
 
-    QClipboard *clipboard = QApplication::clipboard ();
+  connect (m_sig_mapper, SIGNAL (mapped (int)),
+           this, SLOT (toggle_header (int)));
+
+  menu.exec (m_file_tree_view->mapToGlobal (mpos));
+}
+
+void files_dock_widget::contextmenu_requested (const QPoint& mpos)
+{
+
+  QMenu menu (this);
+
+  QModelIndex index = m_file_tree_view->indexAt (mpos);
 
-    clipboard->setText (selection.join ("\n"));
-  }
+  if (index.isValid ())
+    {
+      QFileInfo info = m_file_system_model->fileInfo (index);
+
+      QItemSelectionModel *m = m_file_tree_view->selectionModel ();
+      QModelIndexList sel = m->selectedRows ();
 
-  void files_dock_widget::contextmenu_load (bool)
-  {
-    QItemSelectionModel *m = m_file_tree_view->selectionModel ();
-    QModelIndexList rows = m->selectedRows ();
+      // check if item at mouse position is seleccted
+      if (! sel.contains (index))
+        {
+          // is not selected -> clear actual selection and select this item
+          m->setCurrentIndex (index,
+                              QItemSelectionModel::Clear
+                              | QItemSelectionModel::Select
+                              | QItemSelectionModel::Rows);
+        }
+
+      gui_settings settings;
+
+      // construct the context menu depending on item
+      menu.addAction (settings.icon ("document-open"), tr ("Open"),
+                      this, &files_dock_widget::contextmenu_open);
+
+      if (info.isDir ())
+        {
+          menu.addAction (tr ("Open in System File Explorer"),
+                          this, &files_dock_widget::contextmenu_open_in_app);
+        }
 
-    if (rows.size () > 0)
-      {
-        QModelIndex index = rows[0];
+      if (info.isFile ())
+        menu.addAction (tr ("Open in Text Editor"),
+                        this, &files_dock_widget::contextmenu_open_in_editor);
+
+      menu.addAction (tr ("Copy Selection to Clipboard"),
+                      this, &files_dock_widget::contextmenu_copy_selection);
+
+      if (info.isFile () && info.suffix () == "m")
+        menu.addAction (settings.icon ("media-playback-start"), tr ("Run"),
+                        this, &files_dock_widget::contextmenu_run);
+
+      if (info.isFile ())
+        menu.addAction (tr ("Load Data"),
+                        this, &files_dock_widget::contextmenu_load);
 
-        QFileInfo info = m_file_system_model->fileInfo (index);
+      if (info.isDir ())
+        {
+          menu.addSeparator ();
+          menu.addAction (settings.icon ("go-first"), tr ("Set Current Directory"),
+                          this, &files_dock_widget::contextmenu_setcurrentdir);
+
+          QMenu *add_path_menu = menu.addMenu (tr ("Add to Path"));
 
-        emit load_file_signal (info.fileName ());
-      }
-  }
+          add_path_menu->addAction (tr ("Selected Directories"),
+                                    this, [=] (bool checked) { contextmenu_add_to_path (checked); });
+          add_path_menu->addAction (tr ("Selected Directories and Subdirectories"),
+                                    this, &files_dock_widget::contextmenu_add_to_path_subdirs);
+
+          QMenu *rm_path_menu = menu.addMenu (tr ("Remove from Path"));
+
+          rm_path_menu->addAction (tr ("Selected Directories"),
+                                   this, &files_dock_widget::contextmenu_rm_from_path);
+          rm_path_menu->addAction (tr ("Selected Directories and Subdirectories"),
+                                   this, &files_dock_widget::contextmenu_rm_from_path_subdirs);
+
+          menu.addSeparator ();
 
-  void files_dock_widget::contextmenu_run (bool)
-  {
-    QItemSelectionModel *m = m_file_tree_view->selectionModel ();
-    QModelIndexList rows = m->selectedRows ();
+          menu.addAction (settings.icon ("edit-find"), tr ("Find Files..."),
+                          this, &files_dock_widget::contextmenu_findfiles);
+        }
+
+      menu.addSeparator ();
+      menu.addAction (m_rename_action);
+      menu.addAction (settings.icon ("edit-delete"), tr ("Delete..."),
+                      this, &files_dock_widget::contextmenu_delete);
+
+      if (info.isDir ())
+        {
+          menu.addSeparator ();
+          menu.addAction (settings.icon ("document-new"), tr ("New File..."),
+                          this, &files_dock_widget::contextmenu_newfile);
+          menu.addAction (settings.icon ("folder-new"), tr ("New Directory..."),
+                          this, &files_dock_widget::contextmenu_newdir);
+        }
+
+      // show the menu
+      menu.exec (m_file_tree_view->mapToGlobal (mpos));
 
-    if (rows.size () > 0)
-      {
-        QModelIndex index = rows[0];
+    }
+}
+
+void files_dock_widget::contextmenu_open (bool)
+{
+
+  QItemSelectionModel *m = m_file_tree_view->selectionModel ();
+  QModelIndexList rows = m->selectedRows ();
 
-        QFileInfo info = m_file_system_model->fileInfo (index);
-        emit run_file_signal (info);
-      }
-  }
+  for (const auto& it : rows)
+    {
+      QFileInfo file = m_file_system_model->fileInfo (it);
+      if (file.exists ())
+        display_directory (file.absoluteFilePath ());
+    }
+}
+
+void files_dock_widget::contextmenu_open_in_editor (bool)
+{
+
+  QItemSelectionModel *m = m_file_tree_view->selectionModel ();
+  QModelIndexList rows = m->selectedRows ();
 
-  void files_dock_widget::contextmenu_rename (bool)
-  {
-    QItemSelectionModel *m = m_file_tree_view->selectionModel ();
-    QModelIndexList rows = m->selectedRows ();
-    if (rows.size () > 0)
-      {
-        QModelIndex index = rows[0];
-        m_file_tree_view->edit(index);
-      }
-  }
+  for (const auto& it : rows)
+    {
+      QFileInfo file = m_file_system_model->fileInfo (it);
+      if (file.exists ())
+        emit open_file (file.absoluteFilePath ());
+    }
+}
+
+void files_dock_widget::contextmenu_open_in_app (bool)
+{
+  QItemSelectionModel *m = m_file_tree_view->selectionModel ();
+  QModelIndexList rows = m->selectedRows ();
+
+  for (const auto& it : rows)
+    open_item_in_app (it);
+}
+
+void files_dock_widget::contextmenu_copy_selection (bool)
+{
+  QItemSelectionModel *m = m_file_tree_view->selectionModel ();
+  QModelIndexList rows = m->selectedRows ();
 
-  void files_dock_widget::contextmenu_delete (bool)
-  {
-    QItemSelectionModel *m = m_file_tree_view->selectionModel ();
-    QModelIndexList rows = m->selectedRows ();
+  QStringList selection;
+
+  for (const auto& it : rows)
+    {
+      QFileInfo info = m_file_system_model->fileInfo (it);
+      selection << info.fileName ();
+    }
+
+  QClipboard *clipboard = QApplication::clipboard ();
 
-    int file_cnt = rows.size ();
-    bool multiple_files = (file_cnt > 1);
+  clipboard->setText (selection.join ("\n"));
+}
+
+void files_dock_widget::contextmenu_load (bool)
+{
+  QItemSelectionModel *m = m_file_tree_view->selectionModel ();
+  QModelIndexList rows = m->selectedRows ();
+
+  if (rows.size () > 0)
+    {
+      QModelIndex index = rows[0];
+
+      QFileInfo info = m_file_system_model->fileInfo (index);
 
-    for (auto it = rows.begin (); it != rows.end (); it++)
-      {
-        QModelIndex index = *it;
+      emit load_file_signal (info.fileName ());
+    }
+}
+
+void files_dock_widget::contextmenu_run (bool)
+{
+  QItemSelectionModel *m = m_file_tree_view->selectionModel ();
+  QModelIndexList rows = m->selectedRows ();
 
-        QFileInfo info = m_file_system_model->fileInfo (index);
+  if (rows.size () > 0)
+    {
+      QModelIndex index = rows[0];
+
+      QFileInfo info = m_file_system_model->fileInfo (index);
+      emit run_file_signal (info);
+    }
+}
 
-        QMessageBox::StandardButton dlg_answer;
-        if (multiple_files)
-          if (it == rows.begin ())
-            {
-              dlg_answer = QMessageBox::question (this,
-                                                  tr ("Delete file/directory"),
-                                                  tr ("Are you sure you want to delete all %1 selected files?\n").arg (file_cnt),
-                                                  QMessageBox::Yes | QMessageBox::No);
-              if (dlg_answer != QMessageBox::Yes)
-                return;
-            }
-          else
-            dlg_answer = QMessageBox::Yes;
-        else
+void files_dock_widget::contextmenu_rename (bool)
+{
+  QItemSelectionModel *m = m_file_tree_view->selectionModel ();
+  QModelIndexList rows = m->selectedRows ();
+  if (rows.size () > 0)
+    {
+      QModelIndex index = rows[0];
+      m_file_tree_view->edit(index);
+    }
+}
+
+void files_dock_widget::contextmenu_delete (bool)
+{
+  QItemSelectionModel *m = m_file_tree_view->selectionModel ();
+  QModelIndexList rows = m->selectedRows ();
+
+  int file_cnt = rows.size ();
+  bool multiple_files = (file_cnt > 1);
+
+  for (auto it = rows.begin (); it != rows.end (); it++)
+    {
+      QModelIndex index = *it;
+
+      QFileInfo info = m_file_system_model->fileInfo (index);
+
+      QMessageBox::StandardButton dlg_answer;
+      if (multiple_files)
+        if (it == rows.begin ())
           {
             dlg_answer = QMessageBox::question (this,
-                           tr ("Delete file/directory"),
-                           tr ("Are you sure you want to delete\n")
-                           + info.filePath (),
-                           QMessageBox::Yes | QMessageBox::No);
+                                                tr ("Delete file/directory"),
+                                                tr ("Are you sure you want to delete all %1 selected files?\n").arg (file_cnt),
+                                                QMessageBox::Yes | QMessageBox::No);
+            if (dlg_answer != QMessageBox::Yes)
+              return;
           }
-
-        if (dlg_answer == QMessageBox::Yes)
-          {
-            if (info.isDir ())
-              {
-                // see if directory is empty
-                QDir path (info.absoluteFilePath ());
-                QList<QFileInfo> fileLst
-                  = path.entryInfoList (QDir::Hidden | QDir::AllEntries
-                                        | QDir::NoDotAndDotDot | QDir::System);
+        else
+          dlg_answer = QMessageBox::Yes;
+      else
+        {
+          dlg_answer = QMessageBox::question (this,
+                         tr ("Delete file/directory"),
+                         tr ("Are you sure you want to delete\n")
+                         + info.filePath (),
+                         QMessageBox::Yes | QMessageBox::No);
+        }
 
-                if (fileLst.count () != 0)
-                  QMessageBox::warning (this, tr ("Delete file/directory"),
-                                        tr ("Can not delete a directory that is not empty"));
-                else
-                  m_file_system_model->rmdir (index);
-              }
-            else
-              {
-                // Close the file in the editor if open
-                emit file_remove_signal (info.filePath (), QString ());
-                // Remove the file.
-                bool st = m_file_system_model->remove (index);
-                if (! st)
-                  {
-                    QMessageBox::warning (this, tr ("Deletion error"),
-                                          tr ("Could not delete file \"%1\".").
-                                          arg (info.filePath ()));
-                    // Reload the old file
-                  }
-                emit file_renamed_signal (st);
-              }
+      if (dlg_answer == QMessageBox::Yes)
+        {
+          if (info.isDir ())
+            {
+              // see if directory is empty
+              QDir path (info.absoluteFilePath ());
+              QList<QFileInfo> fileLst
+                = path.entryInfoList (QDir::Hidden | QDir::AllEntries
+                                      | QDir::NoDotAndDotDot | QDir::System);
 
-            m_file_system_model->revert ();
-
-          }
-      }
-  }
+              if (fileLst.count () != 0)
+                QMessageBox::warning (this, tr ("Delete file/directory"),
+                                      tr ("Can not delete a directory that is not empty"));
+              else
+                m_file_system_model->rmdir (index);
+            }
+          else
+            {
+              // Close the file in the editor if open
+              emit file_remove_signal (info.filePath (), QString ());
+              // Remove the file.
+              bool st = m_file_system_model->remove (index);
+              if (! st)
+                {
+                  QMessageBox::warning (this, tr ("Deletion error"),
+                                        tr ("Could not delete file \"%1\".").
+                                        arg (info.filePath ()));
+                  // Reload the old file
+                }
+              emit file_renamed_signal (st);
+            }
 
-  // Get the currently selected files/dirs and return their file info
-  // in a list.
-  QList<QFileInfo> files_dock_widget::get_selected_items_info (bool dir)
-  {
-    QItemSelectionModel *m = m_file_tree_view->selectionModel ();
-    QModelIndexList rows = m->selectedRows ();
-
-    QList<QFileInfo> infos;
-
-    for (const auto& idx : rows)
-      {
-        QFileInfo info = m_file_system_model->fileInfo (idx);
+          m_file_system_model->revert ();
 
-        if (info.exists () &&
-            ((dir & info.isDir ()) || (! dir && info.isFile ())))
-          infos.append (info);
-      }
+        }
+    }
+}
 
-    return infos;
-  }
+// Get the currently selected files/dirs and return their file info
+// in a list.
+QList<QFileInfo> files_dock_widget::get_selected_items_info (bool dir)
+{
+  QItemSelectionModel *m = m_file_tree_view->selectionModel ();
+  QModelIndexList rows = m->selectedRows ();
+
+  QList<QFileInfo> infos;
 
-  void files_dock_widget::contextmenu_newfile (bool)
-  {
-    QItemSelectionModel *m = m_file_tree_view->selectionModel ();
-    QModelIndexList rows = m->selectedRows ();
+  for (const auto& idx : rows)
+    {
+      QFileInfo info = m_file_system_model->fileInfo (idx);
 
-    if (rows.size () > 0)
-      {
-        QModelIndex index = rows[0];
+      if (info.exists () &&
+          ((dir & info.isDir ()) || (! dir && info.isFile ())))
+        infos.append (info);
+    }
 
-        QFileInfo info = m_file_system_model->fileInfo (index);
-        QString parent_dir = info.filePath ();
+  return infos;
+}
+
+void files_dock_widget::contextmenu_newfile (bool)
+{
+  QItemSelectionModel *m = m_file_tree_view->selectionModel ();
+  QModelIndexList rows = m->selectedRows ();
 
-        process_new_file (parent_dir);
-      }
-  }
+  if (rows.size () > 0)
+    {
+      QModelIndex index = rows[0];
 
-  void files_dock_widget::contextmenu_newdir (bool)
-  {
-    QItemSelectionModel *m = m_file_tree_view->selectionModel ();
-    QModelIndexList rows = m->selectedRows ();
+      QFileInfo info = m_file_system_model->fileInfo (index);
+      QString parent_dir = info.filePath ();
 
-    if (rows.size () > 0)
-      {
-        QModelIndex index = rows[0];
+      process_new_file (parent_dir);
+    }
+}
 
-        QFileInfo info = m_file_system_model->fileInfo (index);
-        QString parent_dir = info.filePath ();
+void files_dock_widget::contextmenu_newdir (bool)
+{
+  QItemSelectionModel *m = m_file_tree_view->selectionModel ();
+  QModelIndexList rows = m->selectedRows ();
 
-        process_new_dir (parent_dir);
-      }
-  }
+  if (rows.size () > 0)
+    {
+      QModelIndex index = rows[0];
 
-  void files_dock_widget::contextmenu_setcurrentdir (bool)
-  {
-    QList<QFileInfo> infos = get_selected_items_info (true);
+      QFileInfo info = m_file_system_model->fileInfo (index);
+      QString parent_dir = info.filePath ();
 
-    if (infos.length () > 0 && infos.first ().isDir ())
-      process_set_current_dir (infos.first ().absoluteFilePath ());
-  }
+      process_new_dir (parent_dir);
+    }
+}
 
-  void files_dock_widget::contextmenu_add_to_path (bool, bool rm, bool subdirs)
-  {
-    QList<QFileInfo> infos = get_selected_items_info (true);
-
-    QStringList dir_list;
+void files_dock_widget::contextmenu_setcurrentdir (bool)
+{
+  QList<QFileInfo> infos = get_selected_items_info (true);
 
-    for (int i = 0; i < infos.length (); i++)
-      dir_list.append (infos.at (i).absoluteFilePath ());
+  if (infos.length () > 0 && infos.first ().isDir ())
+    process_set_current_dir (infos.first ().absoluteFilePath ());
+}
 
-    if (infos.length () > 0)
-      emit modify_path_signal (dir_list, rm, subdirs);
-  }
+void files_dock_widget::contextmenu_add_to_path (bool, bool rm, bool subdirs)
+{
+  QList<QFileInfo> infos = get_selected_items_info (true);
+
+  QStringList dir_list;
 
-  void files_dock_widget::contextmenu_add_to_path_subdirs (bool)
-  {
-    contextmenu_add_to_path (true, false, true);
-  }
+  for (int i = 0; i < infos.length (); i++)
+    dir_list.append (infos.at (i).absoluteFilePath ());
 
-  void files_dock_widget::contextmenu_rm_from_path (bool)
-  {
-    contextmenu_add_to_path (true, true, false);
-  }
+  if (infos.length () > 0)
+    emit modify_path_signal (dir_list, rm, subdirs);
+}
 
-  void files_dock_widget::contextmenu_rm_from_path_subdirs (bool)
-  {
-    contextmenu_add_to_path (true, true, true);
-  }
+void files_dock_widget::contextmenu_add_to_path_subdirs (bool)
+{
+  contextmenu_add_to_path (true, false, true);
+}
 
-  void files_dock_widget::contextmenu_findfiles (bool)
-  {
-    QItemSelectionModel *m = m_file_tree_view->selectionModel ();
-    QModelIndexList rows = m->selectedRows ();
+void files_dock_widget::contextmenu_rm_from_path (bool)
+{
+  contextmenu_add_to_path (true, true, false);
+}
+
+void files_dock_widget::contextmenu_rm_from_path_subdirs (bool)
+{
+  contextmenu_add_to_path (true, true, true);
+}
 
-    if (rows.size () > 0)
-      {
-        QModelIndex index = rows[0];
+void files_dock_widget::contextmenu_findfiles (bool)
+{
+  QItemSelectionModel *m = m_file_tree_view->selectionModel ();
+  QModelIndexList rows = m->selectedRows ();
 
-        QFileInfo info = m_file_system_model->fileInfo (index);
+  if (rows.size () > 0)
+    {
+      QModelIndex index = rows[0];
+
+      QFileInfo info = m_file_system_model->fileInfo (index);
 
-        if (info.isDir ())
-          {
-            process_find_files (info.absoluteFilePath ());
-          }
-      }
-  }
+      if (info.isDir ())
+        {
+          process_find_files (info.absoluteFilePath ());
+        }
+    }
+}
 
-  void files_dock_widget::notice_settings ()
-  {
-    gui_settings settings;
-
-    // QSettings pointer is checked before emitting.
-
-    int size_idx = settings.int_value (global_icon_size);
-    size_idx = (size_idx > 0) - (size_idx < 0) + 1;  // Make valid index from 0 to 2
+void files_dock_widget::notice_settings ()
+{
+  gui_settings settings;
 
-    QStyle *st = style ();
-    int icon_size = st->pixelMetric (global_icon_sizes[size_idx]);
-    m_navigation_tool_bar->setIconSize (QSize (icon_size, icon_size));
+  // QSettings pointer is checked before emitting.
 
-    // filenames are always shown, other columns can be hidden by settings
-    for (int i = 0; i < 3; i++)
-      m_file_tree_view->setColumnHidden (i + 1,
-                                         ! settings.value (m_columns_shown_keys.at (i),false).toBool ());
+  int size_idx = settings.int_value (global_icon_size);
+  size_idx = (size_idx > 0) - (size_idx < 0) + 1;  // Make valid index from 0 to 2
+
+  QStyle *st = style ();
+  int icon_size = st->pixelMetric (global_icon_sizes[size_idx]);
+  m_navigation_tool_bar->setIconSize (QSize (icon_size, icon_size));
 
-    QDir::Filters current_filter = m_file_system_model->filter ();
-    if (settings.value (m_columns_shown_keys.at (3), false).toBool ())
-      m_file_system_model->setFilter (current_filter | QDir::Hidden);
-    else
-      m_file_system_model->setFilter (current_filter & (~QDir::Hidden));
+  // filenames are always shown, other columns can be hidden by settings
+  for (int i = 0; i < 3; i++)
+    m_file_tree_view->setColumnHidden (i + 1,
+                                       ! settings.value (m_columns_shown_keys.at (i),false).toBool ());
 
-    m_file_tree_view->setAlternatingRowColors
-      (settings.value (m_columns_shown_keys.at (4),true).toBool ());
-    m_file_tree_view->setModel (m_file_system_model);
+  QDir::Filters current_filter = m_file_system_model->filter ();
+  if (settings.value (m_columns_shown_keys.at (3), false).toBool ())
+    m_file_system_model->setFilter (current_filter | QDir::Hidden);
+  else
+    m_file_system_model->setFilter (current_filter & (~QDir::Hidden));
 
-    // enable the buttons to sync octave/browser dir
-    // only if this is not done by default
-    m_sync_octave_dir
-      = settings.bool_value (fb_sync_octdir);
-    m_sync_octave_directory_action->setEnabled (! m_sync_octave_dir);
-    m_sync_browser_directory_action->setEnabled (! m_sync_octave_dir);
+  m_file_tree_view->setAlternatingRowColors
+    (settings.value (m_columns_shown_keys.at (4),true).toBool ());
+  m_file_tree_view->setModel (m_file_system_model);
 
-    // If m_sync_octave_dir is enabled, then we want the file browser to
-    // update to match the current working directory of the
-    // interpreter.  We don't want to queue any signal to change the
-    // interpreter's current working directory.  In this case, we just
-    // want the GUI to match the state of the interpreter.
+  // enable the buttons to sync octave/browser dir
+  // only if this is not done by default
+  m_sync_octave_dir
+    = settings.bool_value (fb_sync_octdir);
+  m_sync_octave_directory_action->setEnabled (! m_sync_octave_dir);
+  m_sync_browser_directory_action->setEnabled (! m_sync_octave_dir);
 
-    if (m_sync_octave_dir)
-      do_sync_browser_directory ();
-  }
+  // If m_sync_octave_dir is enabled, then we want the file browser to
+  // update to match the current working directory of the
+  // interpreter.  We don't want to queue any signal to change the
+  // interpreter's current working directory.  In this case, we just
+  // want the GUI to match the state of the interpreter.
 
-  void files_dock_widget::popdownmenu_home (bool)
-  {
-    QString dir = QString::fromStdString (sys::env::get_home_directory ());
+  if (m_sync_octave_dir)
+    do_sync_browser_directory ();
+}
 
-    if (dir.isEmpty ())
-      dir = QDir::homePath ();
+void files_dock_widget::popdownmenu_home (bool)
+{
+  QString dir = QString::fromStdString (sys::env::get_home_directory ());
 
-    set_current_directory (dir);
-  }
+  if (dir.isEmpty ())
+    dir = QDir::homePath ();
+
+  set_current_directory (dir);
+}
 
-  void files_dock_widget::popdownmenu_search_dir (bool)
-  {
-    // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
-    int opts = QFileDialog::ShowDirsOnly;
+void files_dock_widget::popdownmenu_search_dir (bool)
+{
+  // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
+  int opts = QFileDialog::ShowDirsOnly;
 
-    gui_settings settings;
+  gui_settings settings;
 
-    if (! settings.bool_value (global_use_native_dialogs))
-      opts |= QFileDialog::DontUseNativeDialog;
+  if (! settings.bool_value (global_use_native_dialogs))
+    opts |= QFileDialog::DontUseNativeDialog;
 
-    QString dir = QFileDialog::getExistingDirectory (this,
-                     tr ("Set directory of file browser"),
-                     m_file_system_model->rootPath (),
-                     QFileDialog::Option (opts));
-    set_current_directory (dir);
-  }
-
-  void files_dock_widget::popdownmenu_findfiles (bool)
-  {
-    process_find_files (m_file_system_model->rootPath ());
-  }
+  QString dir = QFileDialog::getExistingDirectory (this,
+                   tr ("Set directory of file browser"),
+                   m_file_system_model->rootPath (),
+                   QFileDialog::Option (opts));
+  set_current_directory (dir);
+}
 
-  void files_dock_widget::popdownmenu_newdir (bool)
-  {
-    process_new_dir (m_file_system_model->rootPath ());
-  }
+void files_dock_widget::popdownmenu_findfiles (bool)
+{
+  process_find_files (m_file_system_model->rootPath ());
+}
 
-  void files_dock_widget::popdownmenu_newfile (bool)
-  {
-    process_new_file (m_file_system_model->rootPath ());
-  }
+void files_dock_widget::popdownmenu_newdir (bool)
+{
+  process_new_dir (m_file_system_model->rootPath ());
+}
 
-  void files_dock_widget::process_new_file (const QString& parent_dir)
-  {
-    bool ok;
+void files_dock_widget::popdownmenu_newfile (bool)
+{
+  process_new_file (m_file_system_model->rootPath ());
+}
 
-    QString name = QInputDialog::getText (this, tr ("Create File"),
-                                          tr ("Create file in\n", "String ends with \\n!") + parent_dir,
-                                          QLineEdit::Normal,
-                                          tr ("New File.txt"), &ok);
-    if (ok && name.length () > 0)
-      {
-        name = parent_dir + '/' + name;
+void files_dock_widget::process_new_file (const QString& parent_dir)
+{
+  bool ok;
 
-        QFile file (name);
-        file.open (QIODevice::WriteOnly);
-        m_file_system_model->revert ();
-      }
-  }
+  QString name = QInputDialog::getText (this, tr ("Create File"),
+                                        tr ("Create file in\n", "String ends with \\n!") + parent_dir,
+                                        QLineEdit::Normal,
+                                        tr ("New File.txt"), &ok);
+  if (ok && name.length () > 0)
+    {
+      name = parent_dir + '/' + name;
 
-  void files_dock_widget::process_new_dir (const QString& parent_dir)
-  {
-    bool ok;
+      QFile file (name);
+      file.open (QIODevice::WriteOnly);
+      m_file_system_model->revert ();
+    }
+}
 
-    QString name = QInputDialog::getText (this, tr ("Create Directory"),
-                                          tr ("Create folder in\n", "String ends with \\n!") + parent_dir,
-                                          QLineEdit::Normal,
-                                          tr ("New Directory"), &ok);
-    if (ok && name.length () > 0)
-      {
-        QDir dir (parent_dir);
-        dir.mkdir (name);
-        m_file_system_model->revert ();
-      }
-  }
+void files_dock_widget::process_new_dir (const QString& parent_dir)
+{
+  bool ok;
 
-  void files_dock_widget::process_set_current_dir (const QString& dir)
-  {
-    emit displayed_directory_changed (dir);
-  }
+  QString name = QInputDialog::getText (this, tr ("Create Directory"),
+                                        tr ("Create folder in\n", "String ends with \\n!") + parent_dir,
+                                        QLineEdit::Normal,
+                                        tr ("New Directory"), &ok);
+  if (ok && name.length () > 0)
+    {
+      QDir dir (parent_dir);
+      dir.mkdir (name);
+      m_file_system_model->revert ();
+    }
+}
 
-  void files_dock_widget::process_find_files (const QString& dir)
-  {
-    emit find_files_signal (dir);
-  }
+void files_dock_widget::process_set_current_dir (const QString& dir)
+{
+  emit displayed_directory_changed (dir);
+}
 
-  void files_dock_widget::copyClipboard ()
-  {
-    if (m_file_tree_view->hasFocus ())
-      contextmenu_copy_selection (true);
-    if (m_current_directory->hasFocus ())
-      {
-        QClipboard *clipboard = QApplication::clipboard ();
+void files_dock_widget::process_find_files (const QString& dir)
+{
+  emit find_files_signal (dir);
+}
 
-        QLineEdit *edit = m_current_directory->lineEdit ();
-        if (edit && edit->hasSelectedText ())
-          {
-            clipboard->setText (edit->selectedText ());
-          }
-      }
-  }
+void files_dock_widget::copyClipboard ()
+{
+  if (m_file_tree_view->hasFocus ())
+    contextmenu_copy_selection (true);
+  if (m_current_directory->hasFocus ())
+    {
+      QClipboard *clipboard = QApplication::clipboard ();
+
+      QLineEdit *edit = m_current_directory->lineEdit ();
+      if (edit && edit->hasSelectedText ())
+        {
+          clipboard->setText (edit->selectedText ());
+        }
+    }
+}
 
-  void files_dock_widget::pasteClipboard ()
-  {
-    if (m_current_directory->hasFocus ())
-      {
-        QClipboard *clipboard = QApplication::clipboard ();
-        QString str = clipboard->text ();
-        QLineEdit *edit = m_current_directory->lineEdit ();
-        if (edit && str.length () > 0)
-          edit->insert (str);
-      }
-  }
+void files_dock_widget::pasteClipboard ()
+{
+  if (m_current_directory->hasFocus ())
+    {
+      QClipboard *clipboard = QApplication::clipboard ();
+      QString str = clipboard->text ();
+      QLineEdit *edit = m_current_directory->lineEdit ();
+      if (edit && str.length () > 0)
+        edit->insert (str);
+    }
+}
 
-  void files_dock_widget::selectAll ()
-  {
-    if (m_file_tree_view->hasFocus ())
-      m_file_tree_view->selectAll ();
-    if (m_current_directory->hasFocus ())
-      {
-        QLineEdit *edit = m_current_directory->lineEdit ();
-        if (edit)
-          {
-            edit->selectAll ();
-          }
-      }
-  }
+void files_dock_widget::selectAll ()
+{
+  if (m_file_tree_view->hasFocus ())
+    m_file_tree_view->selectAll ();
+  if (m_current_directory->hasFocus ())
+    {
+      QLineEdit *edit = m_current_directory->lineEdit ();
+      if (edit)
+        {
+          edit->selectAll ();
+        }
+    }
+}
 
 OCTAVE_END_NAMESPACE(octave)
--- a/libgui/src/files-dock-widget.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/files-dock-widget.h	Thu Feb 02 12:25:51 2023 -0800
@@ -46,192 +46,192 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  //!  Dock widget to display files in the current directory.
+//!  Dock widget to display files in the current directory.
 
-  class files_dock_widget : public octave_dock_widget
-  {
-    Q_OBJECT
+class files_dock_widget : public octave_dock_widget
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    files_dock_widget (QWidget *parent);
+  files_dock_widget (QWidget *parent);
 
-    ~files_dock_widget () = default;
+  ~files_dock_widget () = default;
 
-  signals:
+signals:
 
-    //! Emitted, whenever the user requested to open a file.
+  //! Emitted, whenever the user requested to open a file.
 
-    void open_file (const QString& fileName);
+  void open_file (const QString& fileName);
 
-    //! Emitted, whenever the currently displayed directory changed.
+  //! Emitted, whenever the currently displayed directory changed.
 
-    void displayed_directory_changed (const QString& dir);
+  void displayed_directory_changed (const QString& dir);
 
-    //! Emitted, whenever the user requested to load a file in the text editor.
+  //! Emitted, whenever the user requested to load a file in the text editor.
 
-    void load_file_signal (const QString& fileName);
+  void load_file_signal (const QString& fileName);
 
-    //! Emitted, whenever the user requested to open an unknown type file.
+  //! Emitted, whenever the user requested to open an unknown type file.
 
-    void open_any_signal (const QString& fileName);
+  void open_any_signal (const QString& fileName);
 
-    //! Emitted, whenever the user requested to run a file.
+  //! Emitted, whenever the user requested to run a file.
 
-    void run_file_signal (const QFileInfo& info);
+  void run_file_signal (const QFileInfo& info);
 
-    //! Emitted, whenever wants to search for a file .
+  //! Emitted, whenever wants to search for a file .
 
-    void find_files_signal (const QString& startdir);
+  void find_files_signal (const QString& startdir);
 
-    //! Emitted, whenever the user removes or renames a file.
+  //! Emitted, whenever the user removes or renames a file.
 
-    void file_remove_signal (const QString& old_name, const QString& new_name);
+  void file_remove_signal (const QString& old_name, const QString& new_name);
 
-    //! Emitted, when a file or directory is renamed.
+  //! Emitted, when a file or directory is renamed.
 
-    void file_renamed_signal (bool);
+  void file_renamed_signal (bool);
 
-    //! Emitted, when the path has to be modified
+  //! Emitted, when the path has to be modified
 
-    void modify_path_signal (const QStringList& dir_list, bool rm,
-                             bool subdirs);
+  void modify_path_signal (const QStringList& dir_list, bool rm,
+                           bool subdirs);
 
-  public slots:
+public slots:
 
-    //! Slot for handling a change in directory via double click.
+  //! Slot for handling a change in directory via double click.
 
-    void item_double_clicked (const QModelIndex& index);
+  void item_double_clicked (const QModelIndex& index);
 
-    //! Slot for handling the up-directory button in the toolbar.
+  //! Slot for handling the up-directory button in the toolbar.
 
-    void change_directory_up ();
+  void change_directory_up ();
 
-    //! Slot for handling the sync octave directory button in the toolbar.
+  //! Slot for handling the sync octave directory button in the toolbar.
 
-    void do_sync_octave_directory ();
+  void do_sync_octave_directory ();
 
-    //! Slot for handling the sync browser directory button in the toolbar.
+  //! Slot for handling the sync browser directory button in the toolbar.
 
-    void do_sync_browser_directory ();
+  void do_sync_browser_directory ();
 
-    //! Sets the current directory being displayed.
+  //! Sets the current directory being displayed.
 
-    void set_current_directory (const QString& dir);
+  void set_current_directory (const QString& dir);
 
-    //! Accepts user input a the line edit for the current directory.
+  //! Accepts user input a the line edit for the current directory.
 
-    void accept_directory_line_edit ();
+  void accept_directory_line_edit ();
 
-    //! Set the internal variable that holds the actual octave variable.
+  //! Set the internal variable that holds the actual octave variable.
 
-    void update_octave_directory (const QString& dir);
+  void update_octave_directory (const QString& dir);
 
-    //! Tells the widget to react on changed settings.
+  //! Tells the widget to react on changed settings.
 
-    void notice_settings ();
+  void notice_settings ();
 
-    void save_settings ();
+  void save_settings ();
 
-  private slots:
+private slots:
 
-    void headercontextmenu_requested (const QPoint& pos);
-    void toggle_header (int col);
+  void headercontextmenu_requested (const QPoint& pos);
+  void toggle_header (int col);
 
-    //! Context menu wanted.
+  //! Context menu wanted.
 
-    void contextmenu_requested (const QPoint& pos);
+  void contextmenu_requested (const QPoint& pos);
 
-    //! Context menu actions.
-    //!@{
-    void contextmenu_open (bool);
-    void contextmenu_open_in_editor (bool);
-    void contextmenu_open_in_app (bool);
-    void contextmenu_copy_selection (bool);
-    void contextmenu_run (bool);
-    void contextmenu_load (bool);
-    void contextmenu_rename (bool);
-    void contextmenu_delete (bool);
-    void contextmenu_newfile (bool);
-    void contextmenu_newdir (bool);
-    void contextmenu_setcurrentdir (bool);
-    void contextmenu_add_to_path (bool, bool rm=false, bool subdirs=false);
-    void contextmenu_add_to_path_subdirs (bool);
-    void contextmenu_rm_from_path (bool);
-    void contextmenu_rm_from_path_subdirs (bool);
-    void contextmenu_findfiles (bool);
-    //!@}
+  //! Context menu actions.
+  //!@{
+  void contextmenu_open (bool);
+  void contextmenu_open_in_editor (bool);
+  void contextmenu_open_in_app (bool);
+  void contextmenu_copy_selection (bool);
+  void contextmenu_run (bool);
+  void contextmenu_load (bool);
+  void contextmenu_rename (bool);
+  void contextmenu_delete (bool);
+  void contextmenu_newfile (bool);
+  void contextmenu_newdir (bool);
+  void contextmenu_setcurrentdir (bool);
+  void contextmenu_add_to_path (bool, bool rm=false, bool subdirs=false);
+  void contextmenu_add_to_path_subdirs (bool);
+  void contextmenu_rm_from_path (bool);
+  void contextmenu_rm_from_path_subdirs (bool);
+  void contextmenu_findfiles (bool);
+  //!@}
 
-    //! Popdown menu options.
-    //!@{
-    void popdownmenu_newfile (bool);
-    void popdownmenu_newdir (bool);
-    void popdownmenu_search_dir (bool);
-    void popdownmenu_findfiles (bool);
-    void popdownmenu_home (bool);
-    //!@}
+  //! Popdown menu options.
+  //!@{
+  void popdownmenu_newfile (bool);
+  void popdownmenu_newdir (bool);
+  void popdownmenu_search_dir (bool);
+  void popdownmenu_findfiles (bool);
+  void popdownmenu_home (bool);
+  //!@}
 
-    //! Inherited from octave_doc_widget.
-    //!@{
-    void copyClipboard ();
-    void pasteClipboard ();
-    void selectAll ();
-    //!@}
+  //! Inherited from octave_doc_widget.
+  //!@{
+  void copyClipboard ();
+  void pasteClipboard ();
+  void selectAll ();
+  //!@}
 
-  private:
+private:
 
-    //! Get currently selected QFileInfo object.
+  //! Get currently selected QFileInfo object.
 
-    QList<QFileInfo> get_selected_items_info (bool);
+  QList<QFileInfo> get_selected_items_info (bool);
 
-    //! Process new file/directory actions
+  //! Process new file/directory actions
 
-    void process_new_file (const QString& parent_name);
-    void process_new_dir (const QString& parent_name);
+  void process_new_file (const QString& parent_name);
+  void process_new_dir (const QString& parent_name);
 
-    //! Process setting current dir or find in files
+  //! Process setting current dir or find in files
 
-    void process_set_current_dir (const QString& parent_name);
-    void process_find_files (const QString& dir_name);
+  void process_set_current_dir (const QString& parent_name);
+  void process_find_files (const QString& dir_name);
 
-    //! set a new directory or open a file
+  //! set a new directory or open a file
 
-    void display_directory (const QString& dir, bool set_octave_dir = true);
+  void display_directory (const QString& dir, bool set_octave_dir = true);
 
-    void open_item_in_app (const QModelIndex& index);
+  void open_item_in_app (const QModelIndex& index);
 
-    //! Variables for the actions
+  //! Variables for the actions
 
-    QToolBar *m_navigation_tool_bar;
-    QAction *m_sync_octave_directory_action;
-    QAction *m_sync_browser_directory_action;
-    QAction *m_rename_action;
+  QToolBar *m_navigation_tool_bar;
+  QAction *m_sync_octave_directory_action;
+  QAction *m_sync_browser_directory_action;
+  QAction *m_rename_action;
 
-    //! The file system model.
+  //! The file system model.
 
-    QFileSystemModel *m_file_system_model;
+  QFileSystemModel *m_file_system_model;
 
-    //! The file system view.
-    //!@{
-    QTreeView *m_file_tree_view;
-    QComboBox *m_current_directory;
-    //!@}
+  //! The file system view.
+  //!@{
+  QTreeView *m_file_tree_view;
+  QComboBox *m_current_directory;
+  //!@}
 
-    //! Flag if syncing with Octave.
+  //! Flag if syncing with Octave.
 
-    bool m_sync_octave_dir;
+  bool m_sync_octave_dir;
 
-    //! The actual Octave directory.
+  //! The actual Octave directory.
 
-    QString m_octave_dir;
+  QString m_octave_dir;
 
-    enum { MaxMRUDirs = 10 };
+  enum { MaxMRUDirs = 10 };
 
-    QStringList m_columns_shown;
-    QStringList m_columns_shown_keys;
-    QList <QVariant> m_columns_shown_defs;
-    QSignalMapper *m_sig_mapper;
-  };
+  QStringList m_columns_shown;
+  QStringList m_columns_shown_keys;
+  QList <QVariant> m_columns_shown_defs;
+  QSignalMapper *m_sig_mapper;
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/src/find-files-dialog.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/find-files-dialog.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -53,359 +53,359 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  find_files_dialog::find_files_dialog (QWidget *p)
-    : QDialog (p)
-  {
-    gui_settings settings;
+find_files_dialog::find_files_dialog (QWidget *p)
+  : QDialog (p)
+{
+  gui_settings settings;
 
-    setWindowTitle (tr ("Find Files"));
-    setWindowIcon (settings.icon ("edit-find"));
+  setWindowTitle (tr ("Find Files"));
+  setWindowIcon (settings.icon ("edit-find"));
 
-    m_dir_iterator = nullptr;
+  m_dir_iterator = nullptr;
 
-    m_timer = new QTimer (this);
-    connect (m_timer, &QTimer::timeout,
-             this, &find_files_dialog::look_for_files);
+  m_timer = new QTimer (this);
+  connect (m_timer, &QTimer::timeout,
+           this, &find_files_dialog::look_for_files);
 
-    QLabel *file_name_label = new QLabel (tr ("Named:"));
-    m_file_name_edit = new QLineEdit;
-    m_file_name_edit->setToolTip (tr ("Enter the filename search expression"));
+  QLabel *file_name_label = new QLabel (tr ("Named:"));
+  m_file_name_edit = new QLineEdit;
+  m_file_name_edit->setToolTip (tr ("Enter the filename search expression"));
 
-    m_file_name_edit->setText (settings.string_value (ff_file_name));
-    file_name_label->setBuddy (m_file_name_edit);
+  m_file_name_edit->setText (settings.string_value (ff_file_name));
+  file_name_label->setBuddy (m_file_name_edit);
 
-    QLabel *start_dir_label = new QLabel (tr ("Start in:"));
+  QLabel *start_dir_label = new QLabel (tr ("Start in:"));
 
-    m_start_dir_edit = new QLineEdit;
-    m_start_dir_edit->setText (settings.value (ff_start_dir.settings_key (),
-                                               QDir::currentPath ()).toString ());
-    m_start_dir_edit->setToolTip (tr ("Enter the start directory"));
-    start_dir_label->setBuddy (m_start_dir_edit);
+  m_start_dir_edit = new QLineEdit;
+  m_start_dir_edit->setText (settings.value (ff_start_dir.settings_key (),
+                                             QDir::currentPath ()).toString ());
+  m_start_dir_edit->setToolTip (tr ("Enter the start directory"));
+  start_dir_label->setBuddy (m_start_dir_edit);
 
-    m_browse_button = new QPushButton (tr ("Browse..."));
-    m_browse_button->setToolTip (tr ("Browse for start directory"));
-    connect (m_browse_button, &QPushButton::clicked,
-             this, &find_files_dialog::browse_folders);
+  m_browse_button = new QPushButton (tr ("Browse..."));
+  m_browse_button->setToolTip (tr ("Browse for start directory"));
+  connect (m_browse_button, &QPushButton::clicked,
+           this, &find_files_dialog::browse_folders);
 
-    m_recurse_dirs_check = new QCheckBox (tr ("Search subdirectories"));
-    m_recurse_dirs_check->setChecked (settings.bool_value (ff_recurse_dirs));
-    m_recurse_dirs_check->setToolTip (tr ("Search recursively through directories for matching files"));
+  m_recurse_dirs_check = new QCheckBox (tr ("Search subdirectories"));
+  m_recurse_dirs_check->setChecked (settings.bool_value (ff_recurse_dirs));
+  m_recurse_dirs_check->setToolTip (tr ("Search recursively through directories for matching files"));
 
-    m_include_dirs_check = new QCheckBox (tr ("Include directory names"));
-    m_include_dirs_check->setChecked (settings.bool_value (ff_include_dirs));
-    m_include_dirs_check->setToolTip (tr ("Include matching directories in search results"));
+  m_include_dirs_check = new QCheckBox (tr ("Include directory names"));
+  m_include_dirs_check->setChecked (settings.bool_value (ff_include_dirs));
+  m_include_dirs_check->setToolTip (tr ("Include matching directories in search results"));
 
-    m_name_case_check = new QCheckBox (tr ("Name case insensitive"));
-    m_name_case_check->setChecked (settings.bool_value (ff_name_case));
-    m_name_case_check->setToolTip (tr ("Set matching name is case insensitive"));
+  m_name_case_check = new QCheckBox (tr ("Name case insensitive"));
+  m_name_case_check->setChecked (settings.bool_value (ff_name_case));
+  m_name_case_check->setToolTip (tr ("Set matching name is case insensitive"));
 
-    m_contains_text_check = new QCheckBox (tr ("Contains text:"));
-    m_contains_text_check->setToolTip (tr ("Enter the file content search expression"));
-    m_contains_text_check->setChecked (settings.bool_value (ff_check_text));
+  m_contains_text_check = new QCheckBox (tr ("Contains text:"));
+  m_contains_text_check->setToolTip (tr ("Enter the file content search expression"));
+  m_contains_text_check->setChecked (settings.bool_value (ff_check_text));
 
-    m_contains_text_edit = new QLineEdit ();
-    m_contains_text_edit->setToolTip (tr ("Text to match"));
-    m_contains_text_edit->setText (settings.string_value (ff_contains_text));
+  m_contains_text_edit = new QLineEdit ();
+  m_contains_text_edit->setToolTip (tr ("Text to match"));
+  m_contains_text_edit->setText (settings.string_value (ff_contains_text));
 
-    m_content_case_check = new QCheckBox (tr ("Text case insensitive"));
-    m_content_case_check->setChecked (settings.bool_value (ff_content_case));
-    m_content_case_check->setToolTip (tr ("Set text content is case insensitive"));
+  m_content_case_check = new QCheckBox (tr ("Text case insensitive"));
+  m_content_case_check->setChecked (settings.bool_value (ff_content_case));
+  m_content_case_check->setToolTip (tr ("Set text content is case insensitive"));
 
-    find_files_model *model = new find_files_model (this);
+  find_files_model *model = new find_files_model (this);
 
-    m_file_list = new QTableView;
-    m_file_list->setWordWrap (false);
-    m_file_list->setModel (model);
-    m_file_list->setShowGrid (false);
-    m_file_list->setSelectionBehavior (QAbstractItemView::SelectRows);
-    m_file_list->setSelectionMode (QAbstractItemView::SingleSelection);
-    m_file_list->setAlternatingRowColors (true);
-    m_file_list->setToolTip (tr ("Search results"));
-    m_file_list->setSortingEnabled (true);
-    m_file_list->horizontalHeader ()->restoreState (settings.value (ff_column_state.settings_key ()).toByteArray ());
-    m_file_list->horizontalHeader ()->setSortIndicatorShown (true);
-    m_file_list->horizontalHeader ()->setSectionsClickable (true);
-    m_file_list->horizontalHeader ()->setStretchLastSection (true);
-    m_file_list->sortByColumn (settings.int_value (ff_sort_files_by_column),
-                               static_cast<Qt::SortOrder>
-                               (settings.uint_value (ff_sort_files_by_order)));
-                // FIXME: use value<Qt::SortOrder> instead of static cast after
-                //        dropping support of Qt 5.4
+  m_file_list = new QTableView;
+  m_file_list->setWordWrap (false);
+  m_file_list->setModel (model);
+  m_file_list->setShowGrid (false);
+  m_file_list->setSelectionBehavior (QAbstractItemView::SelectRows);
+  m_file_list->setSelectionMode (QAbstractItemView::SingleSelection);
+  m_file_list->setAlternatingRowColors (true);
+  m_file_list->setToolTip (tr ("Search results"));
+  m_file_list->setSortingEnabled (true);
+  m_file_list->horizontalHeader ()->restoreState (settings.value (ff_column_state.settings_key ()).toByteArray ());
+  m_file_list->horizontalHeader ()->setSortIndicatorShown (true);
+  m_file_list->horizontalHeader ()->setSectionsClickable (true);
+  m_file_list->horizontalHeader ()->setStretchLastSection (true);
+  m_file_list->sortByColumn (settings.int_value (ff_sort_files_by_column),
+                             static_cast<Qt::SortOrder>
+                             (settings.uint_value (ff_sort_files_by_order)));
+              // FIXME: use value<Qt::SortOrder> instead of static cast after
+              //        dropping support of Qt 5.4
 
-    connect (m_file_list, &QTableView::doubleClicked,
-             this, &find_files_dialog::item_double_clicked);
+  connect (m_file_list, &QTableView::doubleClicked,
+           this, &find_files_dialog::item_double_clicked);
 
-    m_status_bar = new QStatusBar;
-    m_status_bar->showMessage (tr ("Idle."));
+  m_status_bar = new QStatusBar;
+  m_status_bar->showMessage (tr ("Idle."));
 
-    m_find_button = new QPushButton (tr ("Find"));
-    m_find_button->setToolTip (tr ("Start search for matching files"));
-    connect (m_find_button, &QPushButton::clicked,
-             this, &find_files_dialog::start_find);
+  m_find_button = new QPushButton (tr ("Find"));
+  m_find_button->setToolTip (tr ("Start search for matching files"));
+  connect (m_find_button, &QPushButton::clicked,
+           this, &find_files_dialog::start_find);
 
-    m_stop_button = new QPushButton (tr ("Stop"));
-    m_stop_button->setToolTip (tr ("Stop searching"));
-    m_stop_button->setEnabled (false);
-    connect (m_stop_button, &QPushButton::clicked,
-             this, &find_files_dialog::stop_find);
+  m_stop_button = new QPushButton (tr ("Stop"));
+  m_stop_button->setToolTip (tr ("Stop searching"));
+  m_stop_button->setEnabled (false);
+  connect (m_stop_button, &QPushButton::clicked,
+           this, &find_files_dialog::stop_find);
 
-    // layout everything
-    QDialogButtonBox *button_box = new QDialogButtonBox (Qt::Vertical);
-    button_box->addButton (m_find_button, QDialogButtonBox::ActionRole);
-    button_box->addButton (m_stop_button, QDialogButtonBox::ActionRole);
+  // layout everything
+  QDialogButtonBox *button_box = new QDialogButtonBox (Qt::Vertical);
+  button_box->addButton (m_find_button, QDialogButtonBox::ActionRole);
+  button_box->addButton (m_stop_button, QDialogButtonBox::ActionRole);
 
-    // add dialog close button
-    m_close_button = button_box->addButton (QDialogButtonBox::Close);
-    connect (button_box, &QDialogButtonBox::rejected,
-             this, &find_files_dialog::close);
+  // add dialog close button
+  m_close_button = button_box->addButton (QDialogButtonBox::Close);
+  connect (button_box, &QDialogButtonBox::rejected,
+           this, &find_files_dialog::close);
 
-    // name options
-    QGroupBox *name_group = new QGroupBox (tr ("Filename/location"));
-    QGridLayout *name_layout = new QGridLayout;
-    name_group->setLayout (name_layout);
+  // name options
+  QGroupBox *name_group = new QGroupBox (tr ("Filename/location"));
+  QGridLayout *name_layout = new QGridLayout;
+  name_group->setLayout (name_layout);
 
-    name_layout->addWidget (file_name_label, 1, 1, 1, 1);
-    name_layout->addWidget (m_file_name_edit, 1, 2, 1, -1);
+  name_layout->addWidget (file_name_label, 1, 1, 1, 1);
+  name_layout->addWidget (m_file_name_edit, 1, 2, 1, -1);
 
-    name_layout->addWidget (start_dir_label, 2, 1);
-    name_layout->addWidget (m_start_dir_edit, 2, 2, 1, 3);
-    name_layout->addWidget (m_browse_button, 2, 5);
-    name_layout->setColumnStretch (2, 1);
+  name_layout->addWidget (start_dir_label, 2, 1);
+  name_layout->addWidget (m_start_dir_edit, 2, 2, 1, 3);
+  name_layout->addWidget (m_browse_button, 2, 5);
+  name_layout->setColumnStretch (2, 1);
 
-    name_layout->addWidget (m_recurse_dirs_check, 3, 1);
-    name_layout->addWidget (m_include_dirs_check, 3, 2);
-    name_layout->addWidget (m_name_case_check, 3, 3);
+  name_layout->addWidget (m_recurse_dirs_check, 3, 1);
+  name_layout->addWidget (m_include_dirs_check, 3, 2);
+  name_layout->addWidget (m_name_case_check, 3, 3);
 
-    // content options
-    QGroupBox *content_group = new QGroupBox (tr ("File contents"));
-    QGridLayout *content_layout = new QGridLayout;
-    content_group->setLayout (content_layout);
-    content_layout->addWidget (m_contains_text_check, 4, 1);
-    content_layout->addWidget (m_contains_text_edit, 4, 2, 1, 3);
-    content_layout->setColumnStretch (2, 1);
-    content_layout->addWidget (m_content_case_check, 5, 1);
+  // content options
+  QGroupBox *content_group = new QGroupBox (tr ("File contents"));
+  QGridLayout *content_layout = new QGridLayout;
+  content_group->setLayout (content_layout);
+  content_layout->addWidget (m_contains_text_check, 4, 1);
+  content_layout->addWidget (m_contains_text_edit, 4, 2, 1, 3);
+  content_layout->setColumnStretch (2, 1);
+  content_layout->addWidget (m_content_case_check, 5, 1);
 
-    QGridLayout *main_layout = new QGridLayout;
-    main_layout->setSizeConstraint (QLayout::SetFixedSize);
-    main_layout->addWidget (name_group, 0, 0);
-    main_layout->addWidget (content_group, 1, 0);
-    main_layout->addWidget (button_box, 0, 1, 3, 1);
-    main_layout->addWidget (m_file_list, 2, 0);
-    main_layout->setRowStretch (2, 1);
-    main_layout->addWidget (m_status_bar, 3, 0, 1, -1);
+  QGridLayout *main_layout = new QGridLayout;
+  main_layout->setSizeConstraint (QLayout::SetFixedSize);
+  main_layout->addWidget (name_group, 0, 0);
+  main_layout->addWidget (content_group, 1, 0);
+  main_layout->addWidget (button_box, 0, 1, 3, 1);
+  main_layout->addWidget (m_file_list, 2, 0);
+  main_layout->setRowStretch (2, 1);
+  main_layout->addWidget (m_status_bar, 3, 0, 1, -1);
 
-    setLayout (main_layout);
+  setLayout (main_layout);
 
-    connect (this, &find_files_dialog::finished,
-             this, &find_files_dialog::handle_done);
-  }
+  connect (this, &find_files_dialog::finished,
+           this, &find_files_dialog::handle_done);
+}
 
-  find_files_dialog::~find_files_dialog ()
-  {
-    delete m_dir_iterator;
-  }
+find_files_dialog::~find_files_dialog ()
+{
+  delete m_dir_iterator;
+}
 
-  void find_files_dialog::save_settings ()
-  {
-    gui_settings settings;
+void find_files_dialog::save_settings ()
+{
+  gui_settings settings;
 
-    int sort_column = m_file_list->horizontalHeader ()->sortIndicatorSection ();
-    Qt::SortOrder sort_order
-      = m_file_list->horizontalHeader ()->sortIndicatorOrder ();
-    settings.setValue (ff_sort_files_by_column.settings_key (), sort_column);
-    settings.setValue (ff_sort_files_by_order.settings_key (), sort_order);
-    settings.setValue (ff_column_state.settings_key (), m_file_list->horizontalHeader ()->saveState ());
+  int sort_column = m_file_list->horizontalHeader ()->sortIndicatorSection ();
+  Qt::SortOrder sort_order
+    = m_file_list->horizontalHeader ()->sortIndicatorOrder ();
+  settings.setValue (ff_sort_files_by_column.settings_key (), sort_column);
+  settings.setValue (ff_sort_files_by_order.settings_key (), sort_order);
+  settings.setValue (ff_column_state.settings_key (), m_file_list->horizontalHeader ()->saveState ());
 
-    settings.setValue (ff_file_name.settings_key (), m_file_name_edit->text ());
+  settings.setValue (ff_file_name.settings_key (), m_file_name_edit->text ());
 
-    settings.setValue (ff_start_dir.settings_key (), m_start_dir_edit->text ());
+  settings.setValue (ff_start_dir.settings_key (), m_start_dir_edit->text ());
 
-    settings.setValue (ff_recurse_dirs.settings_key (), m_recurse_dirs_check->text ());
-    settings.setValue (ff_include_dirs.settings_key (), m_include_dirs_check->text ());
-    settings.setValue (ff_name_case.settings_key (), m_name_case_check->text ());
+  settings.setValue (ff_recurse_dirs.settings_key (), m_recurse_dirs_check->text ());
+  settings.setValue (ff_include_dirs.settings_key (), m_include_dirs_check->text ());
+  settings.setValue (ff_name_case.settings_key (), m_name_case_check->text ());
 
-    settings.setValue (ff_contains_text.settings_key (), m_contains_text_edit->text ());
-    settings.setValue (ff_check_text.settings_key (), m_contains_text_check->isChecked ());
-    settings.setValue (ff_content_case.settings_key (), m_content_case_check->isChecked ());
+  settings.setValue (ff_contains_text.settings_key (), m_contains_text_edit->text ());
+  settings.setValue (ff_check_text.settings_key (), m_contains_text_check->isChecked ());
+  settings.setValue (ff_content_case.settings_key (), m_content_case_check->isChecked ());
 
-    settings.sync ();
-  }
+  settings.sync ();
+}
 
-  void find_files_dialog::set_search_dir (const QString& dir)
-  {
-    stop_find ();
-    m_start_dir_edit->setText (dir);
-  }
+void find_files_dialog::set_search_dir (const QString& dir)
+{
+  stop_find ();
+  m_start_dir_edit->setText (dir);
+}
 
-  void find_files_dialog::start_find ()
-  {
-    stop_find ();
+void find_files_dialog::start_find ()
+{
+  stop_find ();
 
-    find_files_model *m = static_cast<find_files_model *> (m_file_list->model ());
-    m->clear ();
+  find_files_model *m = static_cast<find_files_model *> (m_file_list->model ());
+  m->clear ();
 
-    QDirIterator::IteratorFlags flags = QDirIterator::NoIteratorFlags;
-    if (m_recurse_dirs_check->isChecked ())
-      flags |= QDirIterator::Subdirectories;
+  QDirIterator::IteratorFlags flags = QDirIterator::NoIteratorFlags;
+  if (m_recurse_dirs_check->isChecked ())
+    flags |= QDirIterator::Subdirectories;
 
-    QDir::Filters filters = QDir::Dirs | QDir::NoDotAndDotDot | QDir::Files;
-    if (! m_name_case_check->isChecked ())
-      filters |= QDir::CaseSensitive;
+  QDir::Filters filters = QDir::Dirs | QDir::NoDotAndDotDot | QDir::Files;
+  if (! m_name_case_check->isChecked ())
+    filters |= QDir::CaseSensitive;
 
-    QStringList nameFilters;
-    nameFilters.append (m_file_name_edit->text ());
+  QStringList nameFilters;
+  nameFilters.append (m_file_name_edit->text ());
 
-    if (m_dir_iterator)
-      delete m_dir_iterator;
+  if (m_dir_iterator)
+    delete m_dir_iterator;
 
-    m_dir_iterator = new QDirIterator (m_start_dir_edit->text (), nameFilters,
-                                       filters, flags);
+  m_dir_iterator = new QDirIterator (m_start_dir_edit->text (), nameFilters,
+                                     filters, flags);
 
-    // enable/disable widgets
-    m_find_button->setEnabled (false);
-    m_stop_button->setEnabled (true);
-    m_close_button->setEnabled (false);
-    m_browse_button->setEnabled (false);
-    m_start_dir_edit->setEnabled (false);
-    m_file_name_edit->setEnabled (false);
-    m_recurse_dirs_check->setEnabled (false);
-    m_include_dirs_check->setEnabled (false);
-    m_name_case_check->setEnabled (false);
-    m_contains_text_check->setEnabled (false);
-    m_content_case_check->setEnabled (false);
-    m_contains_text_edit->setEnabled (false);
+  // enable/disable widgets
+  m_find_button->setEnabled (false);
+  m_stop_button->setEnabled (true);
+  m_close_button->setEnabled (false);
+  m_browse_button->setEnabled (false);
+  m_start_dir_edit->setEnabled (false);
+  m_file_name_edit->setEnabled (false);
+  m_recurse_dirs_check->setEnabled (false);
+  m_include_dirs_check->setEnabled (false);
+  m_name_case_check->setEnabled (false);
+  m_contains_text_check->setEnabled (false);
+  m_content_case_check->setEnabled (false);
+  m_contains_text_edit->setEnabled (false);
 
-    m_status_bar->showMessage (tr ("Searching..."));
-    m_timer->start (0);
-  }
+  m_status_bar->showMessage (tr ("Searching..."));
+  m_timer->start (0);
+}
 
-  void find_files_dialog::stop_find ()
-  {
-    m_timer->stop ();
+void find_files_dialog::stop_find ()
+{
+  m_timer->stop ();
 
-    m_find_button->setEnabled (true);
-    m_stop_button->setEnabled (false);
-    m_close_button->setEnabled (true);
-    m_browse_button->setEnabled (true);
-    m_start_dir_edit->setEnabled (true);
-    m_file_name_edit->setEnabled (true);
-    m_recurse_dirs_check->setEnabled (true);
-    m_include_dirs_check->setEnabled (true);
-    m_name_case_check->setEnabled (true);
-    m_contains_text_check->setEnabled (true);
-    m_content_case_check->setEnabled (true);
-    m_contains_text_edit->setEnabled (true);
+  m_find_button->setEnabled (true);
+  m_stop_button->setEnabled (false);
+  m_close_button->setEnabled (true);
+  m_browse_button->setEnabled (true);
+  m_start_dir_edit->setEnabled (true);
+  m_file_name_edit->setEnabled (true);
+  m_recurse_dirs_check->setEnabled (true);
+  m_include_dirs_check->setEnabled (true);
+  m_name_case_check->setEnabled (true);
+  m_contains_text_check->setEnabled (true);
+  m_content_case_check->setEnabled (true);
+  m_contains_text_edit->setEnabled (true);
 
-    find_files_model *m = static_cast<find_files_model *> (m_file_list->model ());
-    QString res_str = QString (tr ("%1 match (es)")).arg (m->rowCount ());
+  find_files_model *m = static_cast<find_files_model *> (m_file_list->model ());
+  QString res_str = QString (tr ("%1 match (es)")).arg (m->rowCount ());
 
-    m_status_bar->showMessage (res_str);
-  }
+  m_status_bar->showMessage (res_str);
+}
 
-  void find_files_dialog::browse_folders ()
-  {
-    int opts = 0;  // No options by default.
+void find_files_dialog::browse_folders ()
+{
+  int opts = 0;  // No options by default.
 
-    // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
+  // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
 
-    gui_settings settings;
+  gui_settings settings;
 
-    if (! settings.bool_value (global_use_native_dialogs))
-      opts = QFileDialog::DontUseNativeDialog;
+  if (! settings.bool_value (global_use_native_dialogs))
+    opts = QFileDialog::DontUseNativeDialog;
 
-    QString dir =
-      QFileDialog::getExistingDirectory (this, tr ("Set search directory"),
-                                         m_start_dir_edit->text (),
-                                         QFileDialog::Option (opts));
+  QString dir =
+    QFileDialog::getExistingDirectory (this, tr ("Set search directory"),
+                                       m_start_dir_edit->text (),
+                                       QFileDialog::Option (opts));
 
-    if (! dir.isEmpty ())
-      m_start_dir_edit->setText (dir);
-  }
+  if (! dir.isEmpty ())
+    m_start_dir_edit->setText (dir);
+}
 
-  void find_files_dialog::item_double_clicked (const QModelIndex& idx)
-  {
-    find_files_model *m = static_cast<find_files_model *> (m_file_list->model ());
+void find_files_dialog::item_double_clicked (const QModelIndex& idx)
+{
+  find_files_model *m = static_cast<find_files_model *> (m_file_list->model ());
 
-    QFileInfo info = m->fileInfo (idx);
+  QFileInfo info = m->fileInfo (idx);
 
-    if (idx.column () == 1)
-      {
-        // clicked in directory part
-        emit dir_selected (info.absolutePath ());
-      }
-    else
-      {
-        // clicked in filename part
-        if (info.isDir ())
-          emit dir_selected (info.absoluteFilePath ());
-        else
-          emit file_selected (info.absoluteFilePath ());
-      }
-  }
+  if (idx.column () == 1)
+    {
+      // clicked in directory part
+      emit dir_selected (info.absolutePath ());
+    }
+  else
+    {
+      // clicked in filename part
+      if (info.isDir ())
+        emit dir_selected (info.absoluteFilePath ());
+      else
+        emit file_selected (info.absoluteFilePath ());
+    }
+}
 
-  void find_files_dialog::look_for_files ()
-  {
-    if (m_dir_iterator && m_dir_iterator->hasNext ())
-      {
-        QFileInfo info (m_dir_iterator->next ());
+void find_files_dialog::look_for_files ()
+{
+  if (m_dir_iterator && m_dir_iterator->hasNext ())
+    {
+      QFileInfo info (m_dir_iterator->next ());
 
-        find_files_model *m
-          = static_cast<find_files_model *> (m_file_list->model ());
+      find_files_model *m
+        = static_cast<find_files_model *> (m_file_list->model ());
 
-        if (is_match (info))
-          m->addFile (info);
-      }
-    else
-      {
-        stop_find ();
-      }
-  }
+      if (is_match (info))
+        m->addFile (info);
+    }
+  else
+    {
+      stop_find ();
+    }
+}
 
-  void find_files_dialog::handle_done (int)
-  {
-    // make sure we stopped processing
-    stop_find ();
-  }
+void find_files_dialog::handle_done (int)
+{
+  // make sure we stopped processing
+  stop_find ();
+}
 
-  bool find_files_dialog::is_match (const QFileInfo& info)
-  {
-    bool match = true;
-    if (info.isDir ())
-      {
-        if (! m_include_dirs_check->isChecked ()) match = false;
-        if (m_contains_text_check->isChecked ()) match = false;
-      }
-    else
-      {
-        // a file
-        if (m_contains_text_check->isChecked ())
-          {
-            match = false;
+bool find_files_dialog::is_match (const QFileInfo& info)
+{
+  bool match = true;
+  if (info.isDir ())
+    {
+      if (! m_include_dirs_check->isChecked ()) match = false;
+      if (m_contains_text_check->isChecked ()) match = false;
+    }
+  else
+    {
+      // a file
+      if (m_contains_text_check->isChecked ())
+        {
+          match = false;
 
-            QFile file (info.absoluteFilePath ());
-            if (file.open (QIODevice::ReadOnly))
-              {
-                QTextStream stream (&file);
+          QFile file (info.absoluteFilePath ());
+          if (file.open (QIODevice::ReadOnly))
+            {
+              QTextStream stream (&file);
 
-                QString line;
-                QString match_str = m_contains_text_edit->text ();
+              QString line;
+              QString match_str = m_contains_text_edit->text ();
 
-                Qt::CaseSensitivity cs = m_content_case_check->isChecked ()
-                                         ? Qt::CaseInsensitive
-                                         : Qt::CaseSensitive;
+              Qt::CaseSensitivity cs = m_content_case_check->isChecked ()
+                                       ? Qt::CaseInsensitive
+                                       : Qt::CaseSensitive;
 
-                do
-                  {
-                    line = stream.readLine ();
-                    match = line.contains (match_str, cs);
-                  }
-                while (! line.isNull () && match == false);
-              }
+              do
+                {
+                  line = stream.readLine ();
+                  match = line.contains (match_str, cs);
+                }
+              while (! line.isNull () && match == false);
+            }
 
-          }
-      }
+        }
+    }
 
-    return match;
-  }
+  return match;
+}
 
 OCTAVE_END_NAMESPACE(octave)
--- a/libgui/src/find-files-dialog.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/find-files-dialog.h	Thu Feb 02 12:25:51 2023 -0800
@@ -39,57 +39,57 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class find_files_dialog : public QDialog
-  {
-    Q_OBJECT
+class find_files_dialog : public QDialog
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    find_files_dialog (QWidget *parent);
+  find_files_dialog (QWidget *parent);
 
-    virtual ~find_files_dialog ();
+  virtual ~find_files_dialog ();
 
-    void save_settings ();
+  void save_settings ();
 
-  signals:
+signals:
 
-    void file_selected (const QString& fileName);
-    void dir_selected (const QString& fileName);
+  void file_selected (const QString& fileName);
+  void dir_selected (const QString& fileName);
 
-  public slots:
+public slots:
 
-    void set_search_dir (const QString& dir);
+  void set_search_dir (const QString& dir);
 
-  private slots:
+private slots:
 
-    void start_find ();
-    void stop_find ();
-    void browse_folders ();
-    void look_for_files ();
-    void item_double_clicked (const QModelIndex&);
-    void handle_done (int);
+  void start_find ();
+  void stop_find ();
+  void browse_folders ();
+  void look_for_files ();
+  void item_double_clicked (const QModelIndex&);
+  void handle_done (int);
 
-  private:
+private:
 
-    bool is_match (const QFileInfo& info);
+  bool is_match (const QFileInfo& info);
 
-    QLineEdit *m_start_dir_edit;
-    QLineEdit *m_file_name_edit;
-    QPushButton *m_stop_button;
-    QPushButton *m_find_button;
-    QPushButton *m_close_button;
-    QPushButton *m_browse_button;
-    QTableView *m_file_list;
-    QTimer *m_timer;
-    QCheckBox *m_recurse_dirs_check;
-    QCheckBox *m_include_dirs_check;
-    QCheckBox *m_name_case_check;
-    QCheckBox *m_contains_text_check;
-    QCheckBox *m_content_case_check;
-    QLineEdit *m_contains_text_edit;
-    QDirIterator *m_dir_iterator;
-    QStatusBar *m_status_bar;
-  };
+  QLineEdit *m_start_dir_edit;
+  QLineEdit *m_file_name_edit;
+  QPushButton *m_stop_button;
+  QPushButton *m_find_button;
+  QPushButton *m_close_button;
+  QPushButton *m_browse_button;
+  QTableView *m_file_list;
+  QTimer *m_timer;
+  QCheckBox *m_recurse_dirs_check;
+  QCheckBox *m_include_dirs_check;
+  QCheckBox *m_name_case_check;
+  QCheckBox *m_contains_text_check;
+  QCheckBox *m_content_case_check;
+  QLineEdit *m_contains_text_edit;
+  QDirIterator *m_dir_iterator;
+  QStatusBar *m_status_bar;
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/src/graphics-init.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/graphics-init.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -41,29 +41,29 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  void graphics_init (interpreter& interp)
-  {
-    gh_manager& gh_mgr = interp.get_gh_manager ();
+void graphics_init (interpreter& interp)
+{
+  gh_manager& gh_mgr = interp.get_gh_manager ();
 
-    autolock guard (gh_mgr.graphics_lock ());
+  autolock guard (gh_mgr.graphics_lock ());
 
-    qRegisterMetaType<graphics_object> ("graphics_object");
+  qRegisterMetaType<graphics_object> ("graphics_object");
 
-    gh_mgr.enable_event_processing (true);
+  gh_mgr.enable_event_processing (true);
 
-    qt_graphics_toolkit *qt_gtk = new qt_graphics_toolkit (interp);
+  qt_graphics_toolkit *qt_gtk = new qt_graphics_toolkit (interp);
 
-    if (QThread::currentThread ()
-        != QApplication::instance ()->thread ())
-      qt_gtk->moveToThread (QApplication::instance ()->thread ());
+  if (QThread::currentThread ()
+      != QApplication::instance ()->thread ())
+    qt_gtk->moveToThread (QApplication::instance ()->thread ());
 
-    graphics_toolkit tk (qt_gtk);
+  graphics_toolkit tk (qt_gtk);
 
-    gtk_manager& gtk_mgr = interp.get_gtk_manager ();
+  gtk_manager& gtk_mgr = interp.get_gtk_manager ();
 
-    gtk_mgr.register_toolkit ("qt");
+  gtk_mgr.register_toolkit ("qt");
 
-    gtk_mgr.load_toolkit (tk);
-  }
+  gtk_mgr.load_toolkit (tk);
+}
 
 OCTAVE_END_NAMESPACE(octave)
--- a/libgui/src/graphics-init.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/graphics-init.h	Thu Feb 02 12:25:51 2023 -0800
@@ -32,9 +32,9 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class interpreter;
+class interpreter;
 
-  extern void graphics_init (interpreter& interp);
+extern void graphics_init (interpreter& interp);
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/src/gui-settings.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/gui-settings.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -66,720 +66,720 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  QString gui_settings::file_name () const
-  {
-    return fileName ();
-  }
+QString gui_settings::file_name () const
+{
+  return fileName ();
+}
 
-  QString gui_settings::directory_name () const
-  {
-    QFileInfo sfile (fileName ());
+QString gui_settings::directory_name () const
+{
+  QFileInfo sfile (fileName ());
 
-    return sfile.absolutePath ();
-  }
+  return sfile.absolutePath ();
+}
 
-  bool gui_settings::bool_value (const gui_pref& pref) const
-  {
-    return value (pref).toBool ();
-  }
+bool gui_settings::bool_value (const gui_pref& pref) const
+{
+  return value (pref).toBool ();
+}
 
-  QByteArray gui_settings::byte_array_value (const gui_pref& pref) const
-  {
-    return value (pref).toByteArray ();
-  }
+QByteArray gui_settings::byte_array_value (const gui_pref& pref) const
+{
+  return value (pref).toByteArray ();
+}
 
-  QColor gui_settings::color_value (const gui_pref& pref) const
-  {
-    return value (pref).value<QColor> ();
-  }
+QColor gui_settings::color_value (const gui_pref& pref) const
+{
+  return value (pref).value<QColor> ();
+}
 
-  QDateTime gui_settings::date_time_value (const gui_pref& pref) const
-  {
-    return value (pref).toDateTime ();
-  }
+QDateTime gui_settings::date_time_value (const gui_pref& pref) const
+{
+  return value (pref).toDateTime ();
+}
 
-  int gui_settings::int_value (const gui_pref& pref) const
-  {
-    return value (pref).toInt ();
-  }
+int gui_settings::int_value (const gui_pref& pref) const
+{
+  return value (pref).toInt ();
+}
 
-  QString gui_settings::string_value (const gui_pref& pref) const
-  {
-    return value (pref).toString ();
-  }
+QString gui_settings::string_value (const gui_pref& pref) const
+{
+  return value (pref).toString ();
+}
 
-  QStringList gui_settings::string_list_value (const gui_pref& pref) const
-  {
-    return value (pref).toStringList ();
-  }
+QStringList gui_settings::string_list_value (const gui_pref& pref) const
+{
+  return value (pref).toStringList ();
+}
 
-  uint gui_settings::uint_value (const gui_pref& pref) const
-  {
-    return value (pref).toUInt ();
-  }
+uint gui_settings::uint_value (const gui_pref& pref) const
+{
+  return value (pref).toUInt ();
+}
 
-  QColor gui_settings::get_color_value (const QVariant& def, int mode) const
-  {
-    QColor default_color;
+QColor gui_settings::get_color_value (const QVariant& def, int mode) const
+{
+  QColor default_color;
 
-    // Determine whether the default value in pref is given as
-    // QPalette::ColorRole or as QColor
-    if (def.canConvert (QMetaType::QColor))
-      default_color = def.value<QColor> ();
-    else
-      {
-        // The default colors are given as color roles for
-        // the application's palette
-        default_color = QApplication::palette ().color
-                        (static_cast<QPalette::ColorRole> (def.toInt ()));
-                  // FIXME: use value<QPalette::ColorRole> instead of static cast after
-                  //        dropping support of Qt 5.4
-      }
+  // Determine whether the default value in pref is given as
+  // QPalette::ColorRole or as QColor
+  if (def.canConvert (QMetaType::QColor))
+    default_color = def.value<QColor> ();
+  else
+    {
+      // The default colors are given as color roles for
+      // the application's palette
+      default_color = QApplication::palette ().color
+                      (static_cast<QPalette::ColorRole> (def.toInt ()));
+                // FIXME: use value<QPalette::ColorRole> instead of static cast after
+                //        dropping support of Qt 5.4
+    }
 
-    if ((mode == 1) && (default_color != settings_color_no_change))
-      {
-        // In second mode, determine the default color from the first mode
-        qreal h, s, l, a;
-        default_color.getHslF (&h, &s, &l, &a);
-        qreal l_new = 1.0-l*0.85;
-        if (l < 0.3)
-          l_new = 1.0-l*0.7;  // convert darker into lighter colors
-        default_color.setHslF (h, s, l_new, a);
-      }
+  if ((mode == 1) && (default_color != settings_color_no_change))
+    {
+      // In second mode, determine the default color from the first mode
+      qreal h, s, l, a;
+      default_color.getHslF (&h, &s, &l, &a);
+      qreal l_new = 1.0-l*0.85;
+      if (l < 0.3)
+        l_new = 1.0-l*0.7;  // convert darker into lighter colors
+      default_color.setHslF (h, s, l_new, a);
+    }
 
-    return default_color;
-  }
+  return default_color;
+}
 
-  QColor gui_settings::color_value (const gui_pref& pref, int mode) const
-  {
-    QColor default_color = get_color_value (pref.def (), mode);
+QColor gui_settings::color_value (const gui_pref& pref, int mode) const
+{
+  QColor default_color = get_color_value (pref.def (), mode);
 
-    return value (pref.settings_key () + settings_color_modes_ext[mode],
-                  QVariant (default_color)).value<QColor> ();
-  }
+  return value (pref.settings_key () + settings_color_modes_ext[mode],
+                QVariant (default_color)).value<QColor> ();
+}
 
-  void gui_settings::set_color_value (const gui_pref& pref,
-                                      const QColor& color, int mode)
-  {
-    int m = mode;
-    if (m > 1)
-      m = 1;
+void gui_settings::set_color_value (const gui_pref& pref,
+                                    const QColor& color, int mode)
+{
+  int m = mode;
+  if (m > 1)
+    m = 1;
 
-    setValue (pref.settings_key () + settings_color_modes_ext[m],
-              QVariant (color));
-  }
+  setValue (pref.settings_key () + settings_color_modes_ext[m],
+            QVariant (color));
+}
 
-  QString gui_settings::sc_value (const sc_pref& scpref) const
-  {
-    QKeySequence key_seq = sc_def_value (scpref);
+QString gui_settings::sc_value (const sc_pref& scpref) const
+{
+  QKeySequence key_seq = sc_def_value (scpref);
 
-    // Get the value from the settings where the key sequences are stored
-    // as strings
-    return value (sc_group + "/" + scpref.settings_key (),
-                  key_seq.toString ()).toString ();
-  }
+  // Get the value from the settings where the key sequences are stored
+  // as strings
+  return value (sc_group + "/" + scpref.settings_key (),
+                key_seq.toString ()).toString ();
+}
 
-  QKeySequence gui_settings::sc_def_value (const sc_pref& scpref) const
-  {
-    return scpref.def_value ();
-  }
+QKeySequence gui_settings::sc_def_value (const sc_pref& scpref) const
+{
+  return scpref.def_value ();
+}
 
-  void gui_settings::set_shortcut (QAction *action, const sc_pref& scpref,
-                                   bool enable)
-  {
-    if (! enable)
-      {
-        // Disable => remove existing shortcut from the action
-        action->setShortcut (QKeySequence ());
-        return;
-      }
+void gui_settings::set_shortcut (QAction *action, const sc_pref& scpref,
+                                 bool enable)
+{
+  if (! enable)
+    {
+      // Disable => remove existing shortcut from the action
+      action->setShortcut (QKeySequence ());
+      return;
+    }
 
-    QString shortcut = sc_value (scpref);
+  QString shortcut = sc_value (scpref);
 
-    if (! shortcut.isEmpty ())
-      action->setShortcut (QKeySequence (shortcut));
-    else
-      qDebug () << "Key: " << scpref.settings_key ()
-                << " not found in settings";
-  }
+  if (! shortcut.isEmpty ())
+    action->setShortcut (QKeySequence (shortcut));
+  else
+    qDebug () << "Key: " << scpref.settings_key ()
+              << " not found in settings";
+}
 
-  void gui_settings::shortcut (QShortcut *sc, const sc_pref& scpref)
-  {
-    QString shortcut = sc_value (scpref);
+void gui_settings::shortcut (QShortcut *sc, const sc_pref& scpref)
+{
+  QString shortcut = sc_value (scpref);
 
-    if (! shortcut.isEmpty ())
-      sc->setKey (QKeySequence (shortcut));
-    else
-      qDebug () << "Key: " << scpref.settings_key ()
-                << " not found in settings";
-  }
+  if (! shortcut.isEmpty ())
+    sc->setKey (QKeySequence (shortcut));
+  else
+    qDebug () << "Key: " << scpref.settings_key ()
+              << " not found in settings";
+}
 
-  void gui_settings::config_icon_theme ()
-  {
-    int theme_index;
+void gui_settings::config_icon_theme ()
+{
+  int theme_index;
 
-    if (contains (global_icon_theme_index.settings_key ()))
-      theme_index = int_value (global_icon_theme_index);
-    else
-      {
-        // New pref does not exist.  Use old if required.  Add new and
-        // remove deprecated key.
+  if (contains (global_icon_theme_index.settings_key ()))
+    theme_index = int_value (global_icon_theme_index);
+  else
+    {
+      // New pref does not exist.  Use old if required.  Add new and
+      // remove deprecated key.
 
-        if (bool_value (global_icon_theme))
-          theme_index = ICON_THEME_SYSTEM;
-        else
-          theme_index = ICON_THEME_OCTAVE;
+      if (bool_value (global_icon_theme))
+        theme_index = ICON_THEME_SYSTEM;
+      else
+        theme_index = ICON_THEME_OCTAVE;
 
-        setValue (global_icon_theme_index.settings_key (), theme_index);
-        remove (global_icon_theme.settings_key ());
-      }
+      setValue (global_icon_theme_index.settings_key (), theme_index);
+      remove (global_icon_theme.settings_key ());
+    }
 
-    QIcon::setThemeName (global_all_icon_themes.at (theme_index));
+  QIcon::setThemeName (global_all_icon_themes.at (theme_index));
 
-    QStringList icon_fallbacks;
+  QStringList icon_fallbacks;
 
-    // Set the required fallback search paths.
+  // Set the required fallback search paths.
 
-    switch (theme_index)
-      {
-      case ICON_THEME_SYSTEM:
-        icon_fallbacks << global_icon_paths.at (ICON_THEME_OCTAVE);
-        icon_fallbacks << global_icon_paths.at (ICON_THEME_TANGO);
-        break;
-      case ICON_THEME_TANGO:
-        icon_fallbacks << global_icon_paths.at (ICON_THEME_OCTAVE);
-        break;
-      case ICON_THEME_OCTAVE:
-        icon_fallbacks << global_icon_paths.at (ICON_THEME_TANGO);
-        break;
-      }
+  switch (theme_index)
+    {
+    case ICON_THEME_SYSTEM:
+      icon_fallbacks << global_icon_paths.at (ICON_THEME_OCTAVE);
+      icon_fallbacks << global_icon_paths.at (ICON_THEME_TANGO);
+      break;
+    case ICON_THEME_TANGO:
+      icon_fallbacks << global_icon_paths.at (ICON_THEME_OCTAVE);
+      break;
+    case ICON_THEME_OCTAVE:
+      icon_fallbacks << global_icon_paths.at (ICON_THEME_TANGO);
+      break;
+    }
 
-    icon_fallbacks << global_icon_paths.at (ICON_THEME_CURSORS);
+  icon_fallbacks << global_icon_paths.at (ICON_THEME_CURSORS);
 
-    setValue (global_icon_fallbacks.settings_key (), icon_fallbacks);
-  }
+  setValue (global_icon_fallbacks.settings_key (), icon_fallbacks);
+}
 
-  QIcon gui_settings::icon (const QString& icon_name, bool octave_only,
-                            const QString& icon_alt_name)
-  {
-    if (octave_only)
-      return QIcon (global_icon_paths.at (ICON_THEME_OCTAVE) + icon_name + ".png");
+QIcon gui_settings::icon (const QString& icon_name, bool octave_only,
+                          const QString& icon_alt_name)
+{
+  if (octave_only)
+    return QIcon (global_icon_paths.at (ICON_THEME_OCTAVE) + icon_name + ".png");
 
-    if (QIcon::hasThemeIcon (icon_name))
-      return QIcon (QIcon::fromTheme (icon_name));
-    else if ((! icon_alt_name.isEmpty ()) && QIcon::hasThemeIcon (icon_alt_name))
-      return QIcon (QIcon::fromTheme (icon_alt_name));
+  if (QIcon::hasThemeIcon (icon_name))
+    return QIcon (QIcon::fromTheme (icon_name));
+  else if ((! icon_alt_name.isEmpty ()) && QIcon::hasThemeIcon (icon_alt_name))
+    return QIcon (QIcon::fromTheme (icon_alt_name));
 
-    QStringList icon_fallbacks
-      = value (global_icon_fallbacks.settings_key ()).toStringList ();
+  QStringList icon_fallbacks
+    = value (global_icon_fallbacks.settings_key ()).toStringList ();
 
-    for (int i = 0; i < icon_fallbacks.length (); i++ )
-      {
-        QString icon_file (icon_fallbacks.at (i) + icon_name + ".png");
-        if (QFile (icon_file).exists ())
-          return QIcon (icon_file);
-      }
+  for (int i = 0; i < icon_fallbacks.length (); i++ )
+    {
+      QString icon_file (icon_fallbacks.at (i) + icon_name + ".png");
+      if (QFile (icon_file).exists ())
+        return QIcon (icon_file);
+    }
 
-      //QIcon::setThemeName (current_theme);
-      return QIcon ();
-  }
+    //QIcon::setThemeName (current_theme);
+    return QIcon ();
+}
 
-  QString gui_settings::get_default_font_family ()
-  {
-    // Get all available fixed width fonts from the Qt font database.
+QString gui_settings::get_default_font_family ()
+{
+  // Get all available fixed width fonts from the Qt font database.
 
-    QFontDatabase font_database;
-    QStringList fonts;
+  QFontDatabase font_database;
+  QStringList fonts;
 
-    for (QString font : font_database.families ())
-      {
-        if (font_database.isFixedPitch (font))
-          fonts << font;
-      }
+  for (QString font : font_database.families ())
+    {
+      if (font_database.isFixedPitch (font))
+        fonts << font;
+    }
 
-    QString default_family;
+  QString default_family;
 
 #if defined (Q_OS_MAC)
-    // Use hard coded default on macOS, since selection of fixed width
-    // default font is unreliable (see bug #59128).
-    // Test for macOS default fixed width font
-    if (fonts.contains (global_mono_font.def ().toString ()))
-      default_family = global_mono_font.def ().toString ();
+  // Use hard coded default on macOS, since selection of fixed width
+  // default font is unreliable (see bug #59128).
+  // Test for macOS default fixed width font
+  if (fonts.contains (global_mono_font.def ().toString ()))
+    default_family = global_mono_font.def ().toString ();
 #endif
 
-    // If default font is still empty (on all other platforms or
-    // if macOS default font is not available): use QFontDatabase
-    if (default_family.isEmpty ())
-      {
-        // Get the system's default monospaced font
-        QFont fixed_font = QFontDatabase::systemFont (QFontDatabase::FixedFont);
-        default_family = fixed_font.defaultFamily ();
+  // If default font is still empty (on all other platforms or
+  // if macOS default font is not available): use QFontDatabase
+  if (default_family.isEmpty ())
+    {
+      // Get the system's default monospaced font
+      QFont fixed_font = QFontDatabase::systemFont (QFontDatabase::FixedFont);
+      default_family = fixed_font.defaultFamily ();
 
-        // Since this might be unreliable, test all available fixed width fonts
-        if (! fonts.contains (default_family))
-          {
-            // Font returned by QFontDatabase is not in fixed fonts list.
-            // Fallback: take first from this list
-            default_family = fonts[0];
-          }
-      }
+      // Since this might be unreliable, test all available fixed width fonts
+      if (! fonts.contains (default_family))
+        {
+          // Font returned by QFontDatabase is not in fixed fonts list.
+          // Fallback: take first from this list
+          default_family = fonts[0];
+        }
+    }
 
-    // Test env variable which has preference
-    std::string env_default_family = sys::env::getenv ("OCTAVE_DEFAULT_FONT");
-    if (! env_default_family.empty ())
-      default_family = QString::fromStdString (env_default_family);
+  // Test env variable which has preference
+  std::string env_default_family = sys::env::getenv ("OCTAVE_DEFAULT_FONT");
+  if (! env_default_family.empty ())
+    default_family = QString::fromStdString (env_default_family);
 
-    return default_family;
-  }
+  return default_family;
+}
 
-  QStringList gui_settings::get_default_font ()
-  {
-    QString default_family = get_default_font_family ();
+QStringList gui_settings::get_default_font ()
+{
+  QString default_family = get_default_font_family ();
 
-    // determine the fefault font size of the system
-    // FIXME: QApplication::font () does not return the monospace font,
-    //        but the size should be probably near to the monospace font
-    QFont font = QApplication::font ();
+  // determine the fefault font size of the system
+  // FIXME: QApplication::font () does not return the monospace font,
+  //        but the size should be probably near to the monospace font
+  QFont font = QApplication::font ();
 
-    int font_size = font.pointSize ();
-    if (font_size == -1)
-      font_size = static_cast <int> (std::floor(font.pointSizeF ()));
+  int font_size = font.pointSize ();
+  if (font_size == -1)
+    font_size = static_cast <int> (std::floor(font.pointSizeF ()));
 
-    // check for valid font size, otherwise take default 10
-    QString default_font_size = "10";
-    if (font_size > 0)
-      default_font_size = QString::number (font_size);
+  // check for valid font size, otherwise take default 10
+  QString default_font_size = "10";
+  if (font_size > 0)
+    default_font_size = QString::number (font_size);
 
-    std::string env_default_font_size
-      = sys::env::getenv ("OCTAVE_DEFAULT_FONT_SIZE");
+  std::string env_default_font_size
+    = sys::env::getenv ("OCTAVE_DEFAULT_FONT_SIZE");
 
-    if (! env_default_font_size.empty ())
-      default_font_size = QString::fromStdString (env_default_font_size);
+  if (! env_default_font_size.empty ())
+    default_font_size = QString::fromStdString (env_default_font_size);
 
-    QStringList result;
-    result << default_family;
-    result << default_font_size;
-    return result;
-  }
+  QStringList result;
+  result << default_family;
+  result << default_font_size;
+  return result;
+}
 
-  QString gui_settings::get_gui_translation_dir ()
-  {
-    // get environment variable for the locale dir (e.g. from run-octave)
-    std::string dldir = sys::env::getenv ("OCTAVE_LOCALE_DIR");
-    if (dldir.empty ())
-      dldir = config::oct_locale_dir ();  // env-var empty, load the default location
-    return QString::fromStdString (dldir);
-  }
+QString gui_settings::get_gui_translation_dir ()
+{
+  // get environment variable for the locale dir (e.g. from run-octave)
+  std::string dldir = sys::env::getenv ("OCTAVE_LOCALE_DIR");
+  if (dldir.empty ())
+    dldir = config::oct_locale_dir ();  // env-var empty, load the default location
+  return QString::fromStdString (dldir);
+}
 
-  void gui_settings::config_translators (QTranslator *qt_tr,
-                                         QTranslator *qsci_tr,
-                                         QTranslator *gui_tr)
-  {
-    bool loaded;
+void gui_settings::config_translators (QTranslator *qt_tr,
+                                       QTranslator *qsci_tr,
+                                       QTranslator *gui_tr)
+{
+  bool loaded;
 
-    QString qt_trans_dir
-      = QLibraryInfo::location (QLibraryInfo::TranslationsPath);
+  QString qt_trans_dir
+    = QLibraryInfo::location (QLibraryInfo::TranslationsPath);
 
-    QString language = "SYSTEM";  // take system language per default
+  QString language = "SYSTEM";  // take system language per default
 
-    // FIXME: can we somehow ensure that the settings object will always
-    // be initialize and valid?
+  // FIXME: can we somehow ensure that the settings object will always
+  // be initialize and valid?
 
-    // get the locale from the settings if already available
-    language = string_value (global_language);
+  // get the locale from the settings if already available
+  language = string_value (global_language);
 
-    // load the translations depending on the settings
-    if (language == "SYSTEM")
-      {
-        // get the system locale and pass it to the translators for loading
-        // the suitable translation files
-        QLocale sys_locale = QLocale::system ();
+  // load the translations depending on the settings
+  if (language == "SYSTEM")
+    {
+      // get the system locale and pass it to the translators for loading
+      // the suitable translation files
+      QLocale sys_locale = QLocale::system ();
 
-        qt_tr->load (sys_locale, "qt", "_", qt_trans_dir);
-        qsci_tr->load (sys_locale, "qscintilla", "_", qt_trans_dir);
-        gui_tr->load (sys_locale, "", "", get_gui_translation_dir ());
-      }
-    else
-      {
-        // load the translation files depending on the given locale name
-        loaded = qt_tr->load ("qt_" + language, qt_trans_dir);
-        if (! loaded)  // try lower case
-          qt_tr->load ("qt_" + language.toLower (), qt_trans_dir);
+      qt_tr->load (sys_locale, "qt", "_", qt_trans_dir);
+      qsci_tr->load (sys_locale, "qscintilla", "_", qt_trans_dir);
+      gui_tr->load (sys_locale, "", "", get_gui_translation_dir ());
+    }
+  else
+    {
+      // load the translation files depending on the given locale name
+      loaded = qt_tr->load ("qt_" + language, qt_trans_dir);
+      if (! loaded)  // try lower case
+        qt_tr->load ("qt_" + language.toLower (), qt_trans_dir);
 
-        loaded = qsci_tr->load ("qscintilla_" + language, qt_trans_dir);
-        if (! loaded)  // try lower case
-          qsci_tr->load ("qscintilla_" + language.toLower (), qt_trans_dir);
+      loaded = qsci_tr->load ("qscintilla_" + language, qt_trans_dir);
+      if (! loaded)  // try lower case
+        qsci_tr->load ("qscintilla_" + language.toLower (), qt_trans_dir);
 
-        gui_tr->load (language, get_gui_translation_dir ());
-      }
+      gui_tr->load (language, get_gui_translation_dir ());
+    }
 
-  }
+}
 
 #if defined (HAVE_QSCINTILLA)
-  int gui_settings::get_valid_lexer_styles (QsciLexer *lexer, int *styles)
-  {
-    int max_style = 0;
-    int actual_style = 0;
-    while (actual_style < ed_max_style_number && max_style < ed_max_lexer_styles)
-      {
-        if ((lexer->description (actual_style)) != "")  // valid style
-          styles[max_style++] = actual_style;
-        actual_style++;
-      }
-    return max_style;
-  }
+int gui_settings::get_valid_lexer_styles (QsciLexer *lexer, int *styles)
+{
+  int max_style = 0;
+  int actual_style = 0;
+  while (actual_style < ed_max_style_number && max_style < ed_max_lexer_styles)
+    {
+      if ((lexer->description (actual_style)) != "")  // valid style
+        styles[max_style++] = actual_style;
+      actual_style++;
+    }
+  return max_style;
+}
 #endif
 
-  /*!
-   * Copys the attributes bold, italic and underline from QFont
-   * @p attr to the font @p base and returns the result without
-   * changing @p base,
-   * @param attr QFont with the desired attributes
-   * @param base QFont with desired family and size
-   */
-  static QFont copy_font_attributes (const QFont& attr, const QFont& base)
-  {
-    QFont dest (base);
+/*!
+ * Copys the attributes bold, italic and underline from QFont
+ * @p attr to the font @p base and returns the result without
+ * changing @p base,
+ * @param attr QFont with the desired attributes
+ * @param base QFont with desired family and size
+ */
+static QFont copy_font_attributes (const QFont& attr, const QFont& base)
+{
+  QFont dest (base);
 
-    dest.setBold (attr.bold ());
-    dest.setItalic (attr.italic ());
-    dest.setUnderline (attr.underline ());
+  dest.setBold (attr.bold ());
+  dest.setItalic (attr.italic ());
+  dest.setUnderline (attr.underline ());
 
-    return dest;
-  }
+  return dest;
+}
 
 #if defined (HAVE_QSCINTILLA)
-  void gui_settings::read_lexer_settings (QsciLexer *lexer, int mode, int def)
-  {
-    // Test whether the settings for lexer is already contained in the
-    // given gui settings file. If yes, load them, if not copy them from the
-    // default settings file.
-    // This is useful when a new language support is implemented and the
-    // existing settings file is used (which is of course the common case).
-    int m = mode;
-    if (m > 1)
-      m = 1;
+void gui_settings::read_lexer_settings (QsciLexer *lexer, int mode, int def)
+{
+  // Test whether the settings for lexer is already contained in the
+  // given gui settings file. If yes, load them, if not copy them from the
+  // default settings file.
+  // This is useful when a new language support is implemented and the
+  // existing settings file is used (which is of course the common case).
+  int m = mode;
+  if (m > 1)
+    m = 1;
 
-    QString group ("Scintilla" + settings_color_modes_ext[m]);
+  QString group ("Scintilla" + settings_color_modes_ext[m]);
 
-    beginGroup (group);
-    beginGroup (lexer->language ());
+  beginGroup (group);
+  beginGroup (lexer->language ());
 
-    QStringList lexer_keys = allKeys ();
+  QStringList lexer_keys = allKeys ();
 
-    endGroup ();
-    endGroup ();
+  endGroup ();
+  endGroup ();
 
-    if (def == settings_reload_default_colors_flag || lexer_keys.count () == 0)
-      {
-        // We have to reload the default values or no Lexer keys found:
-        // If mode == 0, take all settings except font from default lexer
-        // If Mode == 1, take all settings except font from default lexer
-        //               and convert the color by inverting the lightness
+  if (def == settings_reload_default_colors_flag || lexer_keys.count () == 0)
+    {
+      // We have to reload the default values or no Lexer keys found:
+      // If mode == 0, take all settings except font from default lexer
+      // If Mode == 1, take all settings except font from default lexer
+      //               and convert the color by inverting the lightness
 
-        // Get the default font
-        QStringList def_font = get_default_font ();
-        QFont df (def_font[0], def_font[1].toInt ());
-        QFont dfa = copy_font_attributes (lexer->defaultFont (), df);
-        lexer->setDefaultFont (dfa);
+      // Get the default font
+      QStringList def_font = get_default_font ();
+      QFont df (def_font[0], def_font[1].toInt ());
+      QFont dfa = copy_font_attributes (lexer->defaultFont (), df);
+      lexer->setDefaultFont (dfa);
 
-        QColor c, p;
+      QColor c, p;
 
-        int styles[ed_max_lexer_styles];  // array for saving valid styles
-        int max_style = get_valid_lexer_styles (lexer, styles);
+      int styles[ed_max_lexer_styles];  // array for saving valid styles
+      int max_style = get_valid_lexer_styles (lexer, styles);
 
-        for (int i = 0; i < max_style; i++)
-          {
-            c = get_color_value (QVariant (lexer->color (styles[i])), m);
-            lexer->setColor (c, styles[i]);
-            p = get_color_value (QVariant (lexer->paper (styles[i])), m);
-            lexer->setPaper (p, styles[i]);
-            dfa = copy_font_attributes (lexer->font (styles[i]), df);
-            lexer->setFont (dfa, styles[i]);
-          }
-        // Set defaults last for not changing the defaults of the styles
-        lexer->setDefaultColor (lexer->color (styles[0]));
-        lexer->setDefaultPaper (lexer->paper (styles[0]));
+      for (int i = 0; i < max_style; i++)
+        {
+          c = get_color_value (QVariant (lexer->color (styles[i])), m);
+          lexer->setColor (c, styles[i]);
+          p = get_color_value (QVariant (lexer->paper (styles[i])), m);
+          lexer->setPaper (p, styles[i]);
+          dfa = copy_font_attributes (lexer->font (styles[i]), df);
+          lexer->setFont (dfa, styles[i]);
+        }
+      // Set defaults last for not changing the defaults of the styles
+      lexer->setDefaultColor (lexer->color (styles[0]));
+      lexer->setDefaultPaper (lexer->paper (styles[0]));
 
-        // Write settings if not just reload the default values
-        if (def != settings_reload_default_colors_flag)
-          {
-            const std::string group_str = group.toStdString ();
-            lexer->writeSettings (*this, group_str.c_str ());
-            sync ();
-          }
-      }
-    else
-      {
-        // Found lexer keys, read the settings
-        const std::string group_str = group.toStdString ();
-        lexer->readSettings (*this, group_str.c_str ());
-      }
-  }
+      // Write settings if not just reload the default values
+      if (def != settings_reload_default_colors_flag)
+        {
+          const std::string group_str = group.toStdString ();
+          lexer->writeSettings (*this, group_str.c_str ());
+          sync ();
+        }
+    }
+  else
+    {
+      // Found lexer keys, read the settings
+      const std::string group_str = group.toStdString ();
+      lexer->readSettings (*this, group_str.c_str ());
+    }
+}
 #endif
 
-  bool gui_settings::update_settings_key (const QString& old_key,
-                                          const QString& new_key)
-  {
-    if (contains (old_key))
-      {
-        QVariant preference = value (old_key);
-        setValue (new_key, preference);
-        remove (old_key);
-        return true;
-      }
+bool gui_settings::update_settings_key (const QString& old_key,
+                                        const QString& new_key)
+{
+  if (contains (old_key))
+    {
+      QVariant preference = value (old_key);
+      setValue (new_key, preference);
+      remove (old_key);
+      return true;
+    }
 
-    return false;
-  }
+  return false;
+}
 
-  void gui_settings::update_network_settings ()
-  {
-    QNetworkProxy proxy;
+void gui_settings::update_network_settings ()
+{
+  QNetworkProxy proxy;
 
-    // Assume no proxy and empty proxy data
-    QNetworkProxy::ProxyType proxy_type = QNetworkProxy::NoProxy;
-    QString scheme;
-    QString host;
-    int port = 0;
-    QString user;
-    QString pass;
-    QUrl proxy_url = QUrl ();
+  // Assume no proxy and empty proxy data
+  QNetworkProxy::ProxyType proxy_type = QNetworkProxy::NoProxy;
+  QString scheme;
+  QString host;
+  int port = 0;
+  QString user;
+  QString pass;
+  QUrl proxy_url = QUrl ();
 
-    if (bool_value (global_use_proxy))
-      {
-        // Use a proxy, collect all required information
-        QString proxy_type_string = string_value (global_proxy_type);
+  if (bool_value (global_use_proxy))
+    {
+      // Use a proxy, collect all required information
+      QString proxy_type_string = string_value (global_proxy_type);
 
-        // The proxy type for the Qt proxy settings
-        if (proxy_type_string == "Socks5Proxy")
-          proxy_type = QNetworkProxy::Socks5Proxy;
-        else if (proxy_type_string == "HttpProxy")
-          proxy_type = QNetworkProxy::HttpProxy;
+      // The proxy type for the Qt proxy settings
+      if (proxy_type_string == "Socks5Proxy")
+        proxy_type = QNetworkProxy::Socks5Proxy;
+      else if (proxy_type_string == "HttpProxy")
+        proxy_type = QNetworkProxy::HttpProxy;
 
-        // The proxy data from the settings
-        if (proxy_type_string == "HttpProxy"
-            || proxy_type_string == "Socks5Proxy")
-          {
-            host = string_value (global_proxy_host);
-            port = int_value (global_proxy_port);
-            user = string_value (global_proxy_user);
-            pass = string_value (global_proxy_pass);
-            if (proxy_type_string == "HttpProxy")
-              scheme = "http";
-            else if (proxy_type_string == "Socks5Proxy")
-              scheme = "socks5";
+      // The proxy data from the settings
+      if (proxy_type_string == "HttpProxy"
+          || proxy_type_string == "Socks5Proxy")
+        {
+          host = string_value (global_proxy_host);
+          port = int_value (global_proxy_port);
+          user = string_value (global_proxy_user);
+          pass = string_value (global_proxy_pass);
+          if (proxy_type_string == "HttpProxy")
+            scheme = "http";
+          else if (proxy_type_string == "Socks5Proxy")
+            scheme = "socks5";
 
-            QUrl env_var_url = QUrl ();
-            proxy_url.setScheme (scheme);
-            proxy_url.setHost (host);
-            proxy_url.setPort (port);
-            if (! user.isEmpty ())
-              proxy_url.setUserName (user);
-            if (! pass.isEmpty ())
-              proxy_url.setPassword (pass);
-          }
+          QUrl env_var_url = QUrl ();
+          proxy_url.setScheme (scheme);
+          proxy_url.setHost (host);
+          proxy_url.setPort (port);
+          if (! user.isEmpty ())
+            proxy_url.setUserName (user);
+          if (! pass.isEmpty ())
+            proxy_url.setPassword (pass);
+        }
 
-        // The proxy data from environment variables
-        if (proxy_type_string == global_proxy_all_types.at (2))
+      // The proxy data from environment variables
+      if (proxy_type_string == global_proxy_all_types.at (2))
+        {
+          const std::array<std::string, 6> env_vars =
           {
-            const std::array<std::string, 6> env_vars =
-            {
-              "ALL_PROXY", "all_proxy",
-              "HTTP_PROXY", "http_proxy",
-              "HTTPS_PROXY", "https_proxy"
-            };
+            "ALL_PROXY", "all_proxy",
+            "HTTP_PROXY", "http_proxy",
+            "HTTPS_PROXY", "https_proxy"
+          };
 
-            unsigned int count = 0;
-            while (! proxy_url.isValid () && count < env_vars.size ())
-              {
-                proxy_url = QUrl (QString::fromStdString
-                                    (sys::env::getenv (env_vars[count])));
-                count++;
-              }
+          unsigned int count = 0;
+          while (! proxy_url.isValid () && count < env_vars.size ())
+            {
+              proxy_url = QUrl (QString::fromStdString
+                                  (sys::env::getenv (env_vars[count])));
+              count++;
+            }
 
-            if (proxy_url.isValid ())
-              {
-                // Found an entry, get the data from the string
-                scheme = proxy_url.scheme ();
+          if (proxy_url.isValid ())
+            {
+              // Found an entry, get the data from the string
+              scheme = proxy_url.scheme ();
 
-                if (scheme.contains ("socks", Qt::CaseInsensitive))
-                  proxy_type = QNetworkProxy::Socks5Proxy;
-                else
-                  proxy_type = QNetworkProxy::HttpProxy;
+              if (scheme.contains ("socks", Qt::CaseInsensitive))
+                proxy_type = QNetworkProxy::Socks5Proxy;
+              else
+                proxy_type = QNetworkProxy::HttpProxy;
 
-                host = proxy_url.host ();
-                port = proxy_url.port ();
-                user = proxy_url.userName ();
-                pass = proxy_url.password ();
-              }
-          }
-      }
+              host = proxy_url.host ();
+              port = proxy_url.port ();
+              user = proxy_url.userName ();
+              pass = proxy_url.password ();
+            }
+        }
+    }
 
-    // Set proxy for Qt framework
-    proxy.setType (proxy_type);
-    proxy.setHostName (host);
-    proxy.setPort (port);
-    proxy.setUser (user);
-    proxy.setPassword (pass);
+  // Set proxy for Qt framework
+  proxy.setType (proxy_type);
+  proxy.setHostName (host);
+  proxy.setPort (port);
+  proxy.setUser (user);
+  proxy.setPassword (pass);
 
-    QNetworkProxy::setApplicationProxy (proxy);
+  QNetworkProxy::setApplicationProxy (proxy);
 
-    // Set proxy for curl library if not based on environment variables
-    std::string proxy_url_str = proxy_url.toString().toStdString ();
-    sys::env::putenv ("http_proxy", proxy_url_str);
-    sys::env::putenv ("HTTP_PROXY", proxy_url_str);
-    sys::env::putenv ("https_proxy", proxy_url_str);
-    sys::env::putenv ("HTTPS_PROXY", proxy_url_str);
-  }
+  // Set proxy for curl library if not based on environment variables
+  std::string proxy_url_str = proxy_url.toString().toStdString ();
+  sys::env::putenv ("http_proxy", proxy_url_str);
+  sys::env::putenv ("HTTP_PROXY", proxy_url_str);
+  sys::env::putenv ("https_proxy", proxy_url_str);
+  sys::env::putenv ("HTTPS_PROXY", proxy_url_str);
+}
 
-  // get a list of all available encodings
-  void gui_settings::get_codecs (QStringList *codecs)
-  {
-    // get the codec name for each mib
-    QList<int> all_mibs = QTextCodec::availableMibs ();
-    for (auto mib : all_mibs)
-      {
-        QTextCodec *c = QTextCodec::codecForMib (mib);
-        codecs->append (c->name ().toUpper ());
-      }
+// get a list of all available encodings
+void gui_settings::get_codecs (QStringList *codecs)
+{
+  // get the codec name for each mib
+  QList<int> all_mibs = QTextCodec::availableMibs ();
+  for (auto mib : all_mibs)
+    {
+      QTextCodec *c = QTextCodec::codecForMib (mib);
+      codecs->append (c->name ().toUpper ());
+    }
 
-    // Append SYSTEM
-    codecs->append (QString ("SYSTEM (") +
-                    QString (octave_locale_charset_wrapper ()).toUpper () +
-                    QString (")"));
+  // Append SYSTEM
+  codecs->append (QString ("SYSTEM (") +
+                  QString (octave_locale_charset_wrapper ()).toUpper () +
+                  QString (")"));
 
-    // Clean up and sort list of codecs
-    codecs->removeDuplicates ();
-    std::sort (codecs->begin (), codecs->end ());
-  }
+  // Clean up and sort list of codecs
+  codecs->removeDuplicates ();
+  std::sort (codecs->begin (), codecs->end ());
+}
 
-  // initialize a given combo box with available text encodings
-  void gui_settings::combo_encoding (QComboBox *combo, const QString& current)
-  {
-    QStringList all_codecs;
-    get_codecs (&all_codecs);
+// initialize a given combo box with available text encodings
+void gui_settings::combo_encoding (QComboBox *combo, const QString& current)
+{
+  QStringList all_codecs;
+  get_codecs (&all_codecs);
 
-    // get the value from the settings file if no current encoding is given
-    QString enc = current;
+  // get the value from the settings file if no current encoding is given
+  QString enc = current;
 
-    // Check for valid codec for the default.  If this fails, "SYSTEM" (i.e.
-    // locale_charset) will be chosen.
-    // FIXME: The default is "SYSTEM" on all platforms.  So can this fallback
-    // logic be removed completely?
-    bool default_exists = false;
-    bool show_system = false;
-    if (ed_default_enc.def ().toString ().startsWith ("SYSTEM"))
-      show_system = true;
-    else if (QTextCodec::codecForName (ed_default_enc.def ().toString ().toLatin1 ()))
-      default_exists = true;
+  // Check for valid codec for the default.  If this fails, "SYSTEM" (i.e.
+  // locale_charset) will be chosen.
+  // FIXME: The default is "SYSTEM" on all platforms.  So can this fallback
+  // logic be removed completely?
+  bool default_exists = false;
+  bool show_system = false;
+  if (ed_default_enc.def ().toString ().startsWith ("SYSTEM"))
+    show_system = true;
+  else if (QTextCodec::codecForName (ed_default_enc.def ().toString ().toLatin1 ()))
+    default_exists = true;
 
-    QString default_enc =
-      QString ("SYSTEM (") +
-      QString (octave_locale_charset_wrapper ()).toUpper () + QString (")");
+  QString default_enc =
+    QString ("SYSTEM (") +
+    QString (octave_locale_charset_wrapper ()).toUpper () + QString (")");
 
-    if (enc.isEmpty ())
-      {
-        enc = string_value (ed_default_enc);
+  if (enc.isEmpty ())
+    {
+      enc = string_value (ed_default_enc);
 
-        if (enc.isEmpty ())  // still empty?
-          {
-            if (default_exists)
-              enc = ed_default_enc.def ().toString ();
-            else
-              enc = default_enc;
-          }
-      }
+      if (enc.isEmpty ())  // still empty?
+        {
+          if (default_exists)
+            enc = ed_default_enc.def ().toString ();
+          else
+            enc = default_enc;
+        }
+    }
 
-    // fill the combo box
-    for (const auto& c : all_codecs)
-      combo->addItem (c);
+  // fill the combo box
+  for (const auto& c : all_codecs)
+    combo->addItem (c);
 
-    // prepend the default item
-    combo->insertSeparator (0);
-    if (show_system || ! default_exists)
-      combo->insertItem (0, default_enc);
-    else
-      combo->insertItem (0, ed_default_enc.def ().toString ());
+  // prepend the default item
+  combo->insertSeparator (0);
+  if (show_system || ! default_exists)
+    combo->insertItem (0, default_enc);
+  else
+    combo->insertItem (0, ed_default_enc.def ().toString ());
 
-    // select the default or the current one
-    int idx = combo->findText (enc, Qt::MatchExactly);
-    if (idx >= 0)
-      combo->setCurrentIndex (idx);
-    else
-      combo->setCurrentIndex (0);
+  // select the default or the current one
+  int idx = combo->findText (enc, Qt::MatchExactly);
+  if (idx >= 0)
+    combo->setCurrentIndex (idx);
+  else
+    combo->setCurrentIndex (0);
 
-    combo->setMaxVisibleItems (12);
-  }
+  combo->setMaxVisibleItems (12);
+}
 
-  void gui_settings::reload ()
-  {
-    // Declare some empty options, which may be set at first startup for
-    // writing them into the newly created settings file
-    QString custom_editor;
-    QStringList def_font;
+void gui_settings::reload ()
+{
+  // Declare some empty options, which may be set at first startup for
+  // writing them into the newly created settings file
+  QString custom_editor;
+  QStringList def_font;
 
-    // Check whether the settings file does not yet exist
-    if (! QFile::exists (file_name ()))
-      {
-        // Get the default font (for terminal)
-        def_font = get_default_font ();
+  // Check whether the settings file does not yet exist
+  if (! QFile::exists (file_name ()))
+    {
+      // Get the default font (for terminal)
+      def_font = get_default_font ();
 
-        // Get a custom editor defined as env variable
-        std::string env_default_editor
-          = sys::env::getenv ("OCTAVE_DEFAULT_EDITOR");
+      // Get a custom editor defined as env variable
+      std::string env_default_editor
+        = sys::env::getenv ("OCTAVE_DEFAULT_EDITOR");
 
-        if (! env_default_editor.empty ())
-          custom_editor = QString::fromStdString (env_default_editor);
-      }
+      if (! env_default_editor.empty ())
+        custom_editor = QString::fromStdString (env_default_editor);
+    }
 
-    check ();
+  check ();
 
-    // Write some settings that were dynamically determined at first startup
+  // Write some settings that were dynamically determined at first startup
 
-    // Custom editor
-    if (! custom_editor.isEmpty ())
-      setValue (global_custom_editor.settings_key (), custom_editor);
+  // Custom editor
+  if (! custom_editor.isEmpty ())
+    setValue (global_custom_editor.settings_key (), custom_editor);
 
-    // Default monospace font for the terminal
-    if (def_font.count () > 1)
-      {
-        setValue (cs_font.settings_key (), def_font[0]);
-        setValue (cs_font_size.settings_key (), def_font[1].toInt ());
-      }
+  // Default monospace font for the terminal
+  if (def_font.count () > 1)
+    {
+      setValue (cs_font.settings_key (), def_font[0]);
+      setValue (cs_font_size.settings_key (), def_font[1].toInt ());
+    }
 
-    // Write the default monospace font into the settings for later use by
-    // console and editor as fallbacks of their font preferences.
-    setValue (global_mono_font.settings_key (), get_default_font_family ());
-  }
+  // Write the default monospace font into the settings for later use by
+  // console and editor as fallbacks of their font preferences.
+  setValue (global_mono_font.settings_key (), get_default_font_family ());
+}
 
-  void gui_settings::check ()
-  {
-    if (status () == QSettings::NoError)
-      {
-        // Test usability (force file to be really created)
-        setValue ("dummy", 0);
-        sync ();
-      }
+void gui_settings::check ()
+{
+  if (status () == QSettings::NoError)
+    {
+      // Test usability (force file to be really created)
+      setValue ("dummy", 0);
+      sync ();
+    }
 
-    if (! (QFile::exists (file_name ())
-           && isWritable ()
-           && status () == QSettings::NoError))
-      {
-        QString msg
-          = QString (QT_TR_NOOP ("Error %1 creating the settings file\n%2\n"
-                                 "Make sure you have read and write permissions to\n%3\n\n"
-                                 "Octave GUI must be closed now."));
+  if (! (QFile::exists (file_name ())
+         && isWritable ()
+         && status () == QSettings::NoError))
+    {
+      QString msg
+        = QString (QT_TR_NOOP ("Error %1 creating the settings file\n%2\n"
+                               "Make sure you have read and write permissions to\n%3\n\n"
+                               "Octave GUI must be closed now."));
 
-        QMessageBox::critical (nullptr,
-                               QString (QT_TR_NOOP ("Octave Critical Error")),
-                               msg.arg (status ())
-                                  .arg (file_name ())
-                                  .arg (directory_name ()));
+      QMessageBox::critical (nullptr,
+                             QString (QT_TR_NOOP ("Octave Critical Error")),
+                             msg.arg (status ())
+                                .arg (file_name ())
+                                .arg (directory_name ()));
 
-        exit (1);
-      }
-    else
-      remove ("dummy");  // Remove test entry
-  }
+      exit (1);
+    }
+  else
+    remove ("dummy");  // Remove test entry
+}
 
 OCTAVE_END_NAMESPACE(octave)
--- a/libgui/src/gui-settings.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/gui-settings.h	Thu Feb 02 12:25:51 2023 -0800
@@ -44,177 +44,177 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class gui_settings : public QSettings
-  {
-    Q_OBJECT
+class gui_settings : public QSettings
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    // Location, name, and format of settings file determined by
-    // settings in qt_application class construtor.
+  // Location, name, and format of settings file determined by
+  // settings in qt_application class construtor.
 
-    gui_settings (QObject *parent = nullptr)
-      : QSettings (parent)
-    { }
+  gui_settings (QObject *parent = nullptr)
+    : QSettings (parent)
+  { }
 
-    gui_settings (const QString& file_name, QSettings::Format format,
-                  QObject *parent = nullptr)
-      : QSettings (file_name, format, parent)
-    { }
+  gui_settings (const QString& file_name, QSettings::Format format,
+                QObject *parent = nullptr)
+    : QSettings (file_name, format, parent)
+  { }
 
-    gui_settings (QSettings::Format format, QSettings::Scope scope,
-                  const QString& organization,
-                  const QString& application = QString (),
-                  QObject *parent = nullptr)
-      : QSettings (format, scope, organization, application, parent)
-    { }
+  gui_settings (QSettings::Format format, QSettings::Scope scope,
+                const QString& organization,
+                const QString& application = QString (),
+                QObject *parent = nullptr)
+    : QSettings (format, scope, organization, application, parent)
+  { }
 
-    // No copying!
+  // No copying!
 
-    gui_settings (const gui_settings&) = delete;
+  gui_settings (const gui_settings&) = delete;
 
-    gui_settings& operator = (const gui_settings&) = delete;
+  gui_settings& operator = (const gui_settings&) = delete;
 
-    ~gui_settings () = default;
+  ~gui_settings () = default;
 
-    QString file_name () const;
+  QString file_name () const;
 
-    QString directory_name () const;
+  QString directory_name () const;
 
-    using QSettings::value;
+  using QSettings::value;
 
-    QVariant value (const gui_pref& pref) const
-    {
-      if (pref.ignore ())
-        return pref.def ();  // ignore the current pref and always use default
+  QVariant value (const gui_pref& pref) const
+  {
+    if (pref.ignore ())
+      return pref.def ();  // ignore the current pref and always use default
 
-      return value (pref.settings_key (), pref.def ());
-    }
+    return value (pref.settings_key (), pref.def ());
+  }
 
-    // Convenience functions to (slightly) reduce clutter by allowing us
-    // to write
-    //
-    //   settings.bool_value (gui_pref_name)
-    //
-    // instead of
-    //
-    //   settings.value (gui_pref_name).toBool ()
+  // Convenience functions to (slightly) reduce clutter by allowing us
+  // to write
+  //
+  //   settings.bool_value (gui_pref_name)
+  //
+  // instead of
+  //
+  //   settings.value (gui_pref_name).toBool ()
 
-    bool bool_value (const gui_pref& pref) const;
+  bool bool_value (const gui_pref& pref) const;
 
-    QByteArray byte_array_value (const gui_pref& pref) const;
+  QByteArray byte_array_value (const gui_pref& pref) const;
 
-    QColor color_value (const gui_pref& pref) const;
+  QColor color_value (const gui_pref& pref) const;
 
-    QDateTime date_time_value (const gui_pref& pref) const;
+  QDateTime date_time_value (const gui_pref& pref) const;
 
-    int int_value (const gui_pref& pref) const;
+  int int_value (const gui_pref& pref) const;
 
-    QString string_value (const gui_pref& pref) const;
+  QString string_value (const gui_pref& pref) const;
 
-    QStringList string_list_value (const gui_pref& pref) const;
+  QStringList string_list_value (const gui_pref& pref) const;
 
-    uint uint_value (const gui_pref& pref) const;
+  uint uint_value (const gui_pref& pref) const;
 
-    /*!
-      Reading a color from the given QVaraitn @p def taking different
-      color modes into account. The default value for a second color mode
-      @p mode=1 is deterimined from the standard default value @p mode=0
-      by inverting the lightness
-        \f{eqnarray*}{
-           H_1 &=& H_0\\
-           S_1 &=& S_0\\
-           L_1 &=& 1.0 - 0.85 L_0    L_0 > 0.3
-           L_1 &=& 1.0 - 0.70 L_0    L_0 < 0.3
-        \f}
+  /*!
+    Reading a color from the given QVaraitn @p def taking different
+    color modes into account. The default value for a second color mode
+    @p mode=1 is deterimined from the standard default value @p mode=0
+    by inverting the lightness
+      \f{eqnarray*}{
+         H_1 &=& H_0\\
+         S_1 &=& S_0\\
+         L_1 &=& 1.0 - 0.85 L_0    L_0 > 0.3
+         L_1 &=& 1.0 - 0.70 L_0    L_0 < 0.3
+      \f}
 
-      @param def  Color default value given by a QVariant of QColor
-                  or QPalette::ColorRole
-      @param mode Color mode (currently 0 or 1, default is 0)
+    @param def  Color default value given by a QVariant of QColor
+                or QPalette::ColorRole
+    @param mode Color mode (currently 0 or 1, default is 0)
 
-      @return Color as QColor
-    */
-    QColor get_color_value (const QVariant& def, int mode) const;
+    @return Color as QColor
+  */
+  QColor get_color_value (const QVariant& def, int mode) const;
 
-    /*!
-      Reading a color from the gui_settings taking possible color modes
-      into account. The default value for a second color mode @p mode=1 is
-      deterimined from the standard default value @p mode=0 by inverting
-      the lightness (see get_color_value())
+  /*!
+    Reading a color from the gui_settings taking possible color modes
+    into account. The default value for a second color mode @p mode=1 is
+    deterimined from the standard default value @p mode=0 by inverting
+    the lightness (see get_color_value())
 
-      @param pref gui preference (key string, default value); the default
-                  value can be given by QColor or QPalette::ColorRole
-      @param mode Color mode (currently 0 or 1, default is 0)
+    @param pref gui preference (key string, default value); the default
+                value can be given by QColor or QPalette::ColorRole
+    @param mode Color mode (currently 0 or 1, default is 0)
 
-      @return Color as QColor
-    */
-    QColor color_value (const gui_pref& pref, int mode) const;
+    @return Color as QColor
+  */
+  QColor color_value (const gui_pref& pref, int mode) const;
 
-    /*!
-      Writing a color to the gui_settings taking possible color modes
-      into account. When @p mode is not zero (standard mode), the
-      extension related to the mode is appended to the settings key string
+  /*!
+    Writing a color to the gui_settings taking possible color modes
+    into account. When @p mode is not zero (standard mode), the
+    extension related to the mode is appended to the settings key string
 
-      @param pref gui preference where the color should be written
-      @param color QColor to write to the settings
-      @param mode Color mode (currently 0 or 1, default is 0)
+    @param pref gui preference where the color should be written
+    @param color QColor to write to the settings
+    @param mode Color mode (currently 0 or 1, default is 0)
 
-    */
-    void set_color_value (const gui_pref& pref, const QColor& color,
-                          int mode);
+  */
+  void set_color_value (const gui_pref& pref, const QColor& color,
+                        int mode);
 
-    QString sc_value (const sc_pref& pref) const;
+  QString sc_value (const sc_pref& pref) const;
 
-    QKeySequence sc_def_value (const sc_pref& pref) const;
+  QKeySequence sc_def_value (const sc_pref& pref) const;
 
-    void set_shortcut (QAction *action, const sc_pref& scpref,
-                       bool enable = true);
+  void set_shortcut (QAction *action, const sc_pref& scpref,
+                     bool enable = true);
 
-    void shortcut (QShortcut *sc, const sc_pref& scpref);
+  void shortcut (QShortcut *sc, const sc_pref& scpref);
 
-    // config_icon_theme, icon, get_default_font_family,
-    // get_default_font, and possibly reload and check could be global
-    // functions instead of member functions.  But at least for the icon
-    // function, defining it as a member function means that we can
-    // create a single gui_settings object and access multiple icon
-    // objects rather than having to create a separate settings object
-    // each time that an icon is needed.  OTOH, creating the base
-    // QSettings object is supposed to be fast, so that may not matter.
-    // Hmm.
+  // config_icon_theme, icon, get_default_font_family,
+  // get_default_font, and possibly reload and check could be global
+  // functions instead of member functions.  But at least for the icon
+  // function, defining it as a member function means that we can
+  // create a single gui_settings object and access multiple icon
+  // objects rather than having to create a separate settings object
+  // each time that an icon is needed.  OTOH, creating the base
+  // QSettings object is supposed to be fast, so that may not matter.
+  // Hmm.
 
-    void config_icon_theme ();
+  void config_icon_theme ();
 
-    QIcon icon (const QString& icon_name, bool octave_only = false,
-                const QString& icon_alt_name = QString ());
+  QIcon icon (const QString& icon_name, bool octave_only = false,
+              const QString& icon_alt_name = QString ());
 
-    QString get_default_font_family ();
+  QString get_default_font_family ();
 
-    QStringList get_default_font ();
+  QStringList get_default_font ();
 
-    QString get_gui_translation_dir ();
+  QString get_gui_translation_dir ();
 
-    void config_translators (QTranslator *qt_tr, QTranslator *qsci_tr,
-                             QTranslator *gui_tr);
+  void config_translators (QTranslator *qt_tr, QTranslator *qsci_tr,
+                           QTranslator *gui_tr);
 
 #if defined (HAVE_QSCINTILLA)
-    int get_valid_lexer_styles (QsciLexer *lexer, int *styles);
-    void read_lexer_settings (QsciLexer *lexer, int mode = 0, int def = 0);
+  int get_valid_lexer_styles (QsciLexer *lexer, int *styles);
+  void read_lexer_settings (QsciLexer *lexer, int mode = 0, int def = 0);
 #endif
 
-    bool update_settings_key (const QString& new_key, const QString& old_key);
+  bool update_settings_key (const QString& new_key, const QString& old_key);
 
-    void update_network_settings ();
+  void update_network_settings ();
 
-    void get_codecs (QStringList *codecs);
+  void get_codecs (QStringList *codecs);
 
-    void combo_encoding (QComboBox *combo, const QString& current = QString ());
+  void combo_encoding (QComboBox *combo, const QString& current = QString ());
 
-    void reload ();
+  void reload ();
 
-  private:
+private:
 
-    void check ();
-  };
+  void check ();
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/src/history-dock-widget.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/history-dock-widget.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -47,323 +47,323 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  history_dock_widget::history_dock_widget (QWidget *p)
-    : octave_dock_widget ("HistoryDockWidget", p)
-  {
-    setStatusTip (tr ("Browse and search the command history."));
+history_dock_widget::history_dock_widget (QWidget *p)
+  : octave_dock_widget ("HistoryDockWidget", p)
+{
+  setStatusTip (tr ("Browse and search the command history."));
 
-    construct ();
+  construct ();
+
+  if (! p)
+    make_window ();
+}
 
-    if (! p)
-      make_window ();
-  }
+void history_dock_widget::set_history (const QStringList& hist)
+{
+  m_history_model->setStringList (hist);
+  m_history_list_view->scrollToBottom ();
+}
 
-  void history_dock_widget::set_history (const QStringList& hist)
-  {
-    m_history_model->setStringList (hist);
+void history_dock_widget::append_history (const QString& hist_entry)
+{
+  QStringList lst = m_history_model->stringList ();
+  lst.append (hist_entry);
+
+  QScrollBar *scroll_bar = m_history_list_view->verticalScrollBar ();
+
+  bool at_bottom = scroll_bar->maximum () - scroll_bar->value () < 1;
+
+  m_history_model->setStringList (lst);
+
+  // Scroll if slider position at bottom.
+  if (at_bottom)
     m_history_list_view->scrollToBottom ();
-  }
-
-  void history_dock_widget::append_history (const QString& hist_entry)
-  {
-    QStringList lst = m_history_model->stringList ();
-    lst.append (hist_entry);
-
-    QScrollBar *scroll_bar = m_history_list_view->verticalScrollBar ();
-
-    bool at_bottom = scroll_bar->maximum () - scroll_bar->value () < 1;
-
-    m_history_model->setStringList (lst);
-
-    // Scroll if slider position at bottom.
-    if (at_bottom)
-      m_history_list_view->scrollToBottom ();
-  }
+}
 
-  void history_dock_widget::clear_history ()
-  {
-    m_history_model->setStringList (QStringList ());
-  }
+void history_dock_widget::clear_history ()
+{
+  m_history_model->setStringList (QStringList ());
+}
 
-  void history_dock_widget::save_settings ()
-  {
-    gui_settings settings;
+void history_dock_widget::save_settings ()
+{
+  gui_settings settings;
 
-    settings.setValue (hw_filter_active.settings_key (), m_filter_checkbox->isChecked ());
-    settings.setValue (hw_filter_shown.settings_key (), m_filter_shown);
+  settings.setValue (hw_filter_active.settings_key (), m_filter_checkbox->isChecked ());
+  settings.setValue (hw_filter_shown.settings_key (), m_filter_shown);
 
-    QStringList mru;
-    for (int i = 0; i < m_filter->count (); i++)
-      mru.append (m_filter->itemText (i));
-    settings.setValue (hw_mru_list.settings_key (), mru);
+  QStringList mru;
+  for (int i = 0; i < m_filter->count (); i++)
+    mru.append (m_filter->itemText (i));
+  settings.setValue (hw_mru_list.settings_key (), mru);
 
-    settings.sync ();
+  settings.sync ();
 
-    octave_dock_widget::save_settings ();
-  }
+  octave_dock_widget::save_settings ();
+}
 
-  void history_dock_widget::update_filter_history ()
-  {
-    QString text = m_filter->currentText ();   // get current text
-    int index = m_filter->findText (text);     // and its actual index
+void history_dock_widget::update_filter_history ()
+{
+  QString text = m_filter->currentText ();   // get current text
+  int index = m_filter->findText (text);     // and its actual index
 
-    if (index > -1)
-      m_filter->removeItem (index);    // remove if already existing
+  if (index > -1)
+    m_filter->removeItem (index);    // remove if already existing
 
-    m_filter->insertItem (0, text);    // (re)insert at beginning
-    m_filter->setCurrentIndex (0);
-  }
+  m_filter->insertItem (0, text);    // (re)insert at beginning
+  m_filter->setCurrentIndex (0);
+}
 
-  void history_dock_widget::set_filter_focus (bool focus)
-  {
-    if (focus)
-      {
-        m_filter->setFocus ();
-        setFocusProxy (m_filter);
-      }
-    else
-      {
-        m_history_list_view->setFocus ();
-        setFocusProxy (m_history_list_view);
-      }
-  }
+void history_dock_widget::set_filter_focus (bool focus)
+{
+  if (focus)
+    {
+      m_filter->setFocus ();
+      setFocusProxy (m_filter);
+    }
+  else
+    {
+      m_history_list_view->setFocus ();
+      setFocusProxy (m_history_list_view);
+    }
+}
 
-  void history_dock_widget::filter_activate (bool state)
-  {
-    m_filter->setEnabled (state);
-    m_sort_filter_proxy_model.setDynamicSortFilter (state);
+void history_dock_widget::filter_activate (bool state)
+{
+  m_filter->setEnabled (state);
+  m_sort_filter_proxy_model.setDynamicSortFilter (state);
 
-    if (state)
-      m_sort_filter_proxy_model.setFilterWildcard (m_filter->currentText ());
-    else
-      m_sort_filter_proxy_model.setFilterWildcard (QString ());
+  if (state)
+    m_sort_filter_proxy_model.setFilterWildcard (m_filter->currentText ());
+  else
+    m_sort_filter_proxy_model.setFilterWildcard (QString ());
 
-    set_filter_focus (state);
-  }
+  set_filter_focus (state);
+}
 
-  void history_dock_widget::ctxMenu (const QPoint& xpos)
-  {
-    QMenu menu (this);
+void history_dock_widget::ctxMenu (const QPoint& xpos)
+{
+  QMenu menu (this);
 
-    QModelIndex index = m_history_list_view->indexAt (xpos);
+  QModelIndex index = m_history_list_view->indexAt (xpos);
 
-    if (index.isValid () && index.column () == 0)
-      {
-        gui_settings settings;
+  if (index.isValid () && index.column () == 0)
+    {
+      gui_settings settings;
 
-        menu.addAction (settings.icon ("edit-copy"), tr ("Copy"), this,
-                        &history_dock_widget::handle_contextmenu_copy);
-        menu.addAction (tr ("Evaluate"), this,
-                        &history_dock_widget::handle_contextmenu_evaluate);
-        menu.addAction (settings.icon ("document-new"), tr ("Create script"), this,
-                        &history_dock_widget::handle_contextmenu_create_script);
-      }
-    if (m_filter_shown)
-      menu.addAction (tr ("Hide filter"), this,
-                      &history_dock_widget::handle_contextmenu_filter);
-    else
-      menu.addAction (tr ("Show filter"), this,
-                      &history_dock_widget::handle_contextmenu_filter);
+      menu.addAction (settings.icon ("edit-copy"), tr ("Copy"), this,
+                      &history_dock_widget::handle_contextmenu_copy);
+      menu.addAction (tr ("Evaluate"), this,
+                      &history_dock_widget::handle_contextmenu_evaluate);
+      menu.addAction (settings.icon ("document-new"), tr ("Create script"), this,
+                      &history_dock_widget::handle_contextmenu_create_script);
+    }
+  if (m_filter_shown)
+    menu.addAction (tr ("Hide filter"), this,
+                    &history_dock_widget::handle_contextmenu_filter);
+  else
+    menu.addAction (tr ("Show filter"), this,
+                    &history_dock_widget::handle_contextmenu_filter);
 
-    menu.exec (m_history_list_view->mapToGlobal (xpos));
-  }
+  menu.exec (m_history_list_view->mapToGlobal (xpos));
+}
 
-  void history_dock_widget::handle_double_click (QModelIndex modelIndex)
-  {
-    emit command_double_clicked (modelIndex.data ().toString ());
-  }
+void history_dock_widget::handle_double_click (QModelIndex modelIndex)
+{
+  emit command_double_clicked (modelIndex.data ().toString ());
+}
 
-  void history_dock_widget::handle_contextmenu_copy (bool)
-  {
-    QString text;
-    QItemSelectionModel *selectionModel = m_history_list_view->selectionModel ();
-    QModelIndexList rows = selectionModel->selectedRows ();
-    bool prev_valid_row = false;
-    for (const auto& it : rows)
-      {
-        if (it.isValid ())
-          {
-            if (prev_valid_row)
-              text += '\n';
-            text += it.data ().toString ();
-            prev_valid_row = true;
-          }
-      }
-    QApplication::clipboard ()->setText (text);
-  }
+void history_dock_widget::handle_contextmenu_copy (bool)
+{
+  QString text;
+  QItemSelectionModel *selectionModel = m_history_list_view->selectionModel ();
+  QModelIndexList rows = selectionModel->selectedRows ();
+  bool prev_valid_row = false;
+  for (const auto& it : rows)
+    {
+      if (it.isValid ())
+        {
+          if (prev_valid_row)
+            text += '\n';
+          text += it.data ().toString ();
+          prev_valid_row = true;
+        }
+    }
+  QApplication::clipboard ()->setText (text);
+}
 
-  void history_dock_widget::handle_contextmenu_evaluate (bool)
-  {
-    QItemSelectionModel *selectionModel = m_history_list_view->selectionModel ();
-    QModelIndexList rows = selectionModel->selectedRows ();
-    for (const auto& it : rows)
-      if (it.isValid ())
-        emit command_double_clicked (it.data ().toString ());
-  }
+void history_dock_widget::handle_contextmenu_evaluate (bool)
+{
+  QItemSelectionModel *selectionModel = m_history_list_view->selectionModel ();
+  QModelIndexList rows = selectionModel->selectedRows ();
+  for (const auto& it : rows)
+    if (it.isValid ())
+      emit command_double_clicked (it.data ().toString ());
+}
 
-  void history_dock_widget::handle_contextmenu_create_script (bool)
-  {
-    QString text;
-    QItemSelectionModel *selectionModel = m_history_list_view->selectionModel ();
-    QModelIndexList rows = selectionModel->selectedRows ();
+void history_dock_widget::handle_contextmenu_create_script (bool)
+{
+  QString text;
+  QItemSelectionModel *selectionModel = m_history_list_view->selectionModel ();
+  QModelIndexList rows = selectionModel->selectedRows ();
 
-    bool prev_valid_row = false;
-    for (const auto& it : rows)
-      {
-        if (it.isValid ())
-          {
-            if (prev_valid_row)
-              text += '\n';
-            text += it.data ().toString ();
-            prev_valid_row = true;
-          }
-      }
+  bool prev_valid_row = false;
+  for (const auto& it : rows)
+    {
+      if (it.isValid ())
+        {
+          if (prev_valid_row)
+            text += '\n';
+          text += it.data ().toString ();
+          prev_valid_row = true;
+        }
+    }
 
-    if (text.length () > 0)
-      emit command_create_script (text);
-  }
+  if (text.length () > 0)
+    emit command_create_script (text);
+}
 
-  void history_dock_widget::handle_contextmenu_filter ()
-  {
-    m_filter_shown = ! m_filter_shown;
-    m_filter_widget->setVisible (m_filter_shown);
+void history_dock_widget::handle_contextmenu_filter ()
+{
+  m_filter_shown = ! m_filter_shown;
+  m_filter_widget->setVisible (m_filter_shown);
 
-    set_filter_focus (m_filter_shown && m_filter_checkbox->isChecked ()) ;
-  }
+  set_filter_focus (m_filter_shown && m_filter_checkbox->isChecked ()) ;
+}
 
-  void history_dock_widget::copyClipboard ()
-  {
-    if (m_history_list_view->hasFocus ())
-      handle_contextmenu_copy (true);
-    if (m_filter->lineEdit ()->hasFocus ()
-        && m_filter->lineEdit ()->hasSelectedText ())
-      {
-        QClipboard *clipboard = QApplication::clipboard ();
-        clipboard->setText (m_filter->lineEdit ()->selectedText ());
-      }
-  }
+void history_dock_widget::copyClipboard ()
+{
+  if (m_history_list_view->hasFocus ())
+    handle_contextmenu_copy (true);
+  if (m_filter->lineEdit ()->hasFocus ()
+      && m_filter->lineEdit ()->hasSelectedText ())
+    {
+      QClipboard *clipboard = QApplication::clipboard ();
+      clipboard->setText (m_filter->lineEdit ()->selectedText ());
+    }
+}
 
-  void history_dock_widget::pasteClipboard ()
-  {
-    if (m_filter->lineEdit ()->hasFocus ())
-      {
-        QClipboard *clipboard = QApplication::clipboard ();
-        QString str = clipboard->text ();
-        if (str.length () > 0)
-          m_filter->lineEdit ()->insert (str);
-      }
-  }
+void history_dock_widget::pasteClipboard ()
+{
+  if (m_filter->lineEdit ()->hasFocus ())
+    {
+      QClipboard *clipboard = QApplication::clipboard ();
+      QString str = clipboard->text ();
+      if (str.length () > 0)
+        m_filter->lineEdit ()->insert (str);
+    }
+}
 
-  void history_dock_widget::selectAll ()
-  {
-    if (m_filter->lineEdit ()->hasFocus ())
-      m_filter->lineEdit ()->selectAll ();
+void history_dock_widget::selectAll ()
+{
+  if (m_filter->lineEdit ()->hasFocus ())
+    m_filter->lineEdit ()->selectAll ();
 
-    if (m_history_list_view->hasFocus ())
-      m_history_list_view->selectAll ();
-  }
+  if (m_history_list_view->hasFocus ())
+    m_history_list_view->selectAll ();
+}
 
-  void history_dock_widget::handle_visibility (bool visible)
-  {
-    octave_dock_widget::handle_visibility (visible);
+void history_dock_widget::handle_visibility (bool visible)
+{
+  octave_dock_widget::handle_visibility (visible);
 
-    if (visible)
-      {
-        int filter_state = m_filter_checkbox->isChecked ();
-        filter_activate (filter_state);
-      }
-  }
+  if (visible)
+    {
+      int filter_state = m_filter_checkbox->isChecked ();
+      filter_activate (filter_state);
+    }
+}
 
-  void history_dock_widget::construct ()
-  {
-    m_history_model = new QStringListModel ();
-    m_sort_filter_proxy_model.setSourceModel (m_history_model);
-    m_history_list_view = new QListView (this);
-    m_history_list_view->setModel (&m_sort_filter_proxy_model);
-    m_history_list_view->setAlternatingRowColors (true);
-    m_history_list_view->setEditTriggers (QAbstractItemView::NoEditTriggers);
-    m_history_list_view->setStatusTip
-      (tr ("Double-click a command to transfer it to the Command Window."));
-    m_history_list_view->setSelectionMode (QAbstractItemView::ExtendedSelection);
-    m_history_list_view->setContextMenuPolicy (Qt::CustomContextMenu);
-    connect (m_history_list_view, &QListView::customContextMenuRequested,
-             this, &history_dock_widget::ctxMenu);
+void history_dock_widget::construct ()
+{
+  m_history_model = new QStringListModel ();
+  m_sort_filter_proxy_model.setSourceModel (m_history_model);
+  m_history_list_view = new QListView (this);
+  m_history_list_view->setModel (&m_sort_filter_proxy_model);
+  m_history_list_view->setAlternatingRowColors (true);
+  m_history_list_view->setEditTriggers (QAbstractItemView::NoEditTriggers);
+  m_history_list_view->setStatusTip
+    (tr ("Double-click a command to transfer it to the Command Window."));
+  m_history_list_view->setSelectionMode (QAbstractItemView::ExtendedSelection);
+  m_history_list_view->setContextMenuPolicy (Qt::CustomContextMenu);
+  connect (m_history_list_view, &QListView::customContextMenuRequested,
+           this, &history_dock_widget::ctxMenu);
 
-    m_filter = new QComboBox (this);
-    m_filter->setToolTip (tr ("Enter text to filter the command history"));
-    m_filter->setEditable (true);
-    m_filter->setMaxCount (MaxFilterHistory);
-    m_filter->setInsertPolicy (QComboBox::NoInsert);
-    m_filter->setSizeAdjustPolicy
-      (QComboBox::AdjustToMinimumContentsLengthWithIcon);
-    QSizePolicy sizePol (QSizePolicy::Expanding, QSizePolicy::Preferred);
-    m_filter->setSizePolicy (sizePol);
-    m_filter->completer ()->setCaseSensitivity (Qt::CaseSensitive);
+  m_filter = new QComboBox (this);
+  m_filter->setToolTip (tr ("Enter text to filter the command history"));
+  m_filter->setEditable (true);
+  m_filter->setMaxCount (MaxFilterHistory);
+  m_filter->setInsertPolicy (QComboBox::NoInsert);
+  m_filter->setSizeAdjustPolicy
+    (QComboBox::AdjustToMinimumContentsLengthWithIcon);
+  QSizePolicy sizePol (QSizePolicy::Expanding, QSizePolicy::Preferred);
+  m_filter->setSizePolicy (sizePol);
+  m_filter->completer ()->setCaseSensitivity (Qt::CaseSensitive);
 
-    QLabel *filter_label = new QLabel (tr ("Filter"));
+  QLabel *filter_label = new QLabel (tr ("Filter"));
 
-    m_filter_checkbox = new QCheckBox ();
+  m_filter_checkbox = new QCheckBox ();
 
-    set_title (tr ("Command History"));
-    setWidget (new QWidget ());
+  set_title (tr ("Command History"));
+  setWidget (new QWidget ());
 
-    m_filter_widget = new QWidget (this);
-    QHBoxLayout *filter_layout = new QHBoxLayout ();
-    filter_layout->addWidget (filter_label);
-    filter_layout->addWidget (m_filter_checkbox);
-    filter_layout->addWidget (m_filter);
-    filter_layout->setMargin(0);
-    m_filter_widget->setLayout (filter_layout);
+  m_filter_widget = new QWidget (this);
+  QHBoxLayout *filter_layout = new QHBoxLayout ();
+  filter_layout->addWidget (filter_label);
+  filter_layout->addWidget (m_filter_checkbox);
+  filter_layout->addWidget (m_filter);
+  filter_layout->setMargin(0);
+  m_filter_widget->setLayout (filter_layout);
 
-    QVBoxLayout *hist_layout = new QVBoxLayout ();
-    hist_layout->addWidget (m_filter_widget);
-    hist_layout->addWidget (m_history_list_view);
+  QVBoxLayout *hist_layout = new QVBoxLayout ();
+  hist_layout->addWidget (m_filter_widget);
+  hist_layout->addWidget (m_history_list_view);
 
-    hist_layout->setMargin (2);
-    hist_layout->setSpacing (0);
-    widget ()->setLayout (hist_layout);
+  hist_layout->setMargin (2);
+  hist_layout->setSpacing (0);
+  widget ()->setLayout (hist_layout);
 
-    // Init state of the filter
+  // Init state of the filter
 
-    gui_settings settings;
+  gui_settings settings;
 
-    m_filter_shown = settings.bool_value (hw_filter_shown);
-    m_filter_widget->setVisible (m_filter_shown);
+  m_filter_shown = settings.bool_value (hw_filter_shown);
+  m_filter_widget->setVisible (m_filter_shown);
 
-    m_filter->addItems (settings.string_list_value (hw_mru_list));
+  m_filter->addItems (settings.string_list_value (hw_mru_list));
 
-    bool filter_state = settings.bool_value (hw_filter_active);
-    m_filter_checkbox->setChecked (filter_state);
-    filter_activate (filter_state);
+  bool filter_state = settings.bool_value (hw_filter_active);
+  m_filter_checkbox->setChecked (filter_state);
+  filter_activate (filter_state);
 
-    // Connect signals and slots
-    connect (m_filter, &QComboBox::editTextChanged,
-             &m_sort_filter_proxy_model,
-             &QSortFilterProxyModel::setFilterWildcard);
-    connect (m_filter_checkbox, &QCheckBox::toggled,
-             this, &history_dock_widget::filter_activate);
-    connect (m_filter->lineEdit (), &QLineEdit::editingFinished,
-             this, &history_dock_widget::update_filter_history);
+  // Connect signals and slots
+  connect (m_filter, &QComboBox::editTextChanged,
+           &m_sort_filter_proxy_model,
+           &QSortFilterProxyModel::setFilterWildcard);
+  connect (m_filter_checkbox, &QCheckBox::toggled,
+           this, &history_dock_widget::filter_activate);
+  connect (m_filter->lineEdit (), &QLineEdit::editingFinished,
+           this, &history_dock_widget::update_filter_history);
 
-    connect (m_history_list_view, &QListView::doubleClicked,
-             this, &history_dock_widget::handle_double_click);
+  connect (m_history_list_view, &QListView::doubleClicked,
+           this, &history_dock_widget::handle_double_click);
 
-    m_history_list_view->setTextElideMode (Qt::ElideRight);
-  }
+  m_history_list_view->setTextElideMode (Qt::ElideRight);
+}
 
-  void history_dock_widget::notice_settings ()
-  {
-    gui_settings settings;
+void history_dock_widget::notice_settings ()
+{
+  gui_settings settings;
 
-    QFont font = QFont ();
+  QFont font = QFont ();
 
-    font.setStyleHint (QFont::TypeWriter);
-    QString default_font = settings.string_value (global_mono_font);
+  font.setStyleHint (QFont::TypeWriter);
+  QString default_font = settings.string_value (global_mono_font);
 
-    font.setFamily (settings.value (cs_font.settings_key (), default_font).toString ());
-    font.setPointSize (settings.int_value (cs_font_size));
+  font.setFamily (settings.value (cs_font.settings_key (), default_font).toString ());
+  font.setPointSize (settings.int_value (cs_font_size));
 
-    m_history_list_view->setFont (font);
-  }
+  m_history_list_view->setFont (font);
+}
 
 OCTAVE_END_NAMESPACE(octave)
--- a/libgui/src/history-dock-widget.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/history-dock-widget.h	Thu Feb 02 12:25:51 2023 -0800
@@ -37,73 +37,73 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class history_dock_widget : public octave_dock_widget
-  {
-    Q_OBJECT
+class history_dock_widget : public octave_dock_widget
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    history_dock_widget (QWidget *parent);
+  history_dock_widget (QWidget *parent);
 
-    ~history_dock_widget () = default;
+  ~history_dock_widget () = default;
 
-  signals:
+signals:
 
-    //! Signal emitted whenever the user double-clicks a command in the
-    //! history.
+  //! Signal emitted whenever the user double-clicks a command in the
+  //! history.
 
-    void command_double_clicked (const QString& command);
+  void command_double_clicked (const QString& command);
 
-    //! Signal emitted whenever the user selects commands and chooses
-    //! "Create script" from the popup menu.
+  //! Signal emitted whenever the user selects commands and chooses
+  //! "Create script" from the popup menu.
 
-    void command_create_script (const QString& commands);
+  void command_create_script (const QString& commands);
 
-  public slots:
+public slots:
 
-    void set_history (const QStringList& hist);
-    void append_history (const QString& hist_entry);
-    void clear_history ();
-    void save_settings ();
-    void notice_settings ();
+  void set_history (const QStringList& hist);
+  void append_history (const QString& hist_entry);
+  void clear_history ();
+  void save_settings ();
+  void notice_settings ();
 
-  private slots:
+private slots:
 
-    void update_filter_history ();
-    void filter_activate (bool enable);
+  void update_filter_history ();
+  void filter_activate (bool enable);
 
-    void ctxMenu (const QPoint& pos);
-    void handle_double_click (QModelIndex modelIndex);
-    void handle_contextmenu_copy (bool flag);
-    void handle_contextmenu_evaluate (bool flag);
-    void handle_contextmenu_create_script (bool flag);
-    void handle_contextmenu_filter ();
+  void ctxMenu (const QPoint& pos);
+  void handle_double_click (QModelIndex modelIndex);
+  void handle_contextmenu_copy (bool flag);
+  void handle_contextmenu_evaluate (bool flag);
+  void handle_contextmenu_create_script (bool flag);
+  void handle_contextmenu_filter ();
 
-    void copyClipboard ();
-    void pasteClipboard ();
-    void selectAll ();
+  void copyClipboard ();
+  void pasteClipboard ();
+  void selectAll ();
 
-    virtual void handle_visibility (bool visible);
+  virtual void handle_visibility (bool visible);
 
-  private:
+private:
 
-    void construct ();
-    void set_filter_focus (bool focus);
+  void construct ();
+  void set_filter_focus (bool focus);
 
-    QListView *m_history_list_view;
-    QSortFilterProxyModel m_sort_filter_proxy_model;
+  QListView *m_history_list_view;
+  QSortFilterProxyModel m_sort_filter_proxy_model;
 
-    //! Stores the current history_model.
+  //! Stores the current history_model.
 
-    QStringListModel *m_history_model;
+  QStringListModel *m_history_model;
 
-    QCheckBox *m_filter_checkbox;
-    QComboBox *m_filter;
-    QWidget *m_filter_widget;
-    bool m_filter_shown;
+  QCheckBox *m_filter_checkbox;
+  QComboBox *m_filter;
+  QWidget *m_filter_widget;
+  bool m_filter_shown;
 
-    enum { MaxFilterHistory = 10 };
-  };
+  enum { MaxFilterHistory = 10 };
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/src/interpreter-qobject.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/interpreter-qobject.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -38,164 +38,164 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  interpreter_qobject::interpreter_qobject (base_qobject& oct_qobj)
-    : QObject (), m_octave_qobj (oct_qobj), m_interpreter (nullptr)
-  { }
+interpreter_qobject::interpreter_qobject (base_qobject& oct_qobj)
+  : QObject (), m_octave_qobj (oct_qobj), m_interpreter (nullptr)
+{ }
 
-  void interpreter_qobject::execute ()
-  {
-    // The Octave application context owns the interpreter.
+void interpreter_qobject::execute ()
+{
+  // The Octave application context owns the interpreter.
 
-    qt_application& app_context = m_octave_qobj.app_context ();
+  qt_application& app_context = m_octave_qobj.app_context ();
 
-    interpreter& interp = app_context.create_interpreter ();
+  interpreter& interp = app_context.create_interpreter ();
 
-    event_manager& evmgr = interp.get_event_manager ();
+  event_manager& evmgr = interp.get_event_manager ();
 
-    evmgr.connect_link (m_octave_qobj.get_qt_interpreter_events ());
-    evmgr.install_qt_event_handlers (m_octave_qobj.get_qt_interpreter_events ());
-    evmgr.enable ();
+  evmgr.connect_link (m_octave_qobj.get_qt_interpreter_events ());
+  evmgr.install_qt_event_handlers (m_octave_qobj.get_qt_interpreter_events ());
+  evmgr.enable ();
 
-    int exit_status = 0;
+  int exit_status = 0;
 
-    try
-      {
-        // Final initialization.
+  try
+    {
+      // Final initialization.
 
-        interp.initialize ();
+      interp.initialize ();
 
-        if (app_context.start_gui_p ()
-            && ! m_octave_qobj.experimental_terminal_widget ())
-          {
-            interp.PS1 (">> ");
-            interp.PS2 ("");
-          }
+      if (app_context.start_gui_p ()
+          && ! m_octave_qobj.experimental_terminal_widget ())
+        {
+          interp.PS1 (">> ");
+          interp.PS2 ("");
+        }
 
-        if (interp.initialized ())
-          {
-            // The interpreter should be completely ready at this point so let
-            // the GUI know.
+      if (interp.initialized ())
+        {
+          // The interpreter should be completely ready at this point so let
+          // the GUI know.
 
-            m_interpreter = &interp;
+          m_interpreter = &interp;
 
-            emit ready ();
+          emit ready ();
 
-            graphics_init (interp);
+          graphics_init (interp);
 
-            // Start executing commands in the command window.
+          // Start executing commands in the command window.
 
-            exit_status = interp.execute ();
-          }
-      }
-    catch (const exit_exception& xe)
-      {
-        exit_status = xe.exit_status ();
-      }
+          exit_status = interp.execute ();
+        }
+    }
+  catch (const exit_exception& xe)
+    {
+      exit_status = xe.exit_status ();
+    }
 
-    // FIXME: The following comment doesn't seem to make sense now.
+  // FIXME: The following comment doesn't seem to make sense now.
 
-    // Signal that the interpreter is done executing code in the
-    // main REPL, from script files, or command line eval arguments.
-    // By using a signal here, we give the GUI a chance to process
-    // any pending events, then signal that it is safe to shutdown
-    // the interpreter.  Our notification here allows the GUI to
-    // insert the request to shutdown the interpreter in the event
-    // queue after any other pending signals.  The application
-    // context owns the interpreter and will be responsible for
-    // deleting it later, when the application object destructor is
-    // executed.
+  // Signal that the interpreter is done executing code in the
+  // main REPL, from script files, or command line eval arguments.
+  // By using a signal here, we give the GUI a chance to process
+  // any pending events, then signal that it is safe to shutdown
+  // the interpreter.  Our notification here allows the GUI to
+  // insert the request to shutdown the interpreter in the event
+  // queue after any other pending signals.  The application
+  // context owns the interpreter and will be responsible for
+  // deleting it later, when the application object destructor is
+  // executed.
 
-    emit shutdown_finished (exit_status);
-  }
+  emit shutdown_finished (exit_status);
+}
 
-  void interpreter_qobject::interpreter_event (const fcn_callback& fcn)
-  {
-    if (! m_interpreter)
-      return;
+void interpreter_qobject::interpreter_event (const fcn_callback& fcn)
+{
+  if (! m_interpreter)
+    return;
 
-    event_manager& evmgr = m_interpreter->get_event_manager ();
+  event_manager& evmgr = m_interpreter->get_event_manager ();
 
-    evmgr.post_event (fcn);
-  }
+  evmgr.post_event (fcn);
+}
 
-  void interpreter_qobject::interpreter_event (const meth_callback& meth)
-  {
-    if (! m_interpreter)
-      return;
+void interpreter_qobject::interpreter_event (const meth_callback& meth)
+{
+  if (! m_interpreter)
+    return;
 
-    event_manager& evmgr = m_interpreter->get_event_manager ();
+  event_manager& evmgr = m_interpreter->get_event_manager ();
 
-    evmgr.post_event (meth);
-  }
+  evmgr.post_event (meth);
+}
 
-  void interpreter_qobject::interrupt ()
-  {
-    if (! m_interpreter)
-      return;
+void interpreter_qobject::interrupt ()
+{
+  if (! m_interpreter)
+    return;
 
-    // The following is a direct function call across threads.
-    // We need to ensure that it uses thread-safe functions.
+  // The following is a direct function call across threads.
+  // We need to ensure that it uses thread-safe functions.
 
-    m_interpreter->interrupt ();
-  }
+  m_interpreter->interrupt ();
+}
 
-  void interpreter_qobject::pause ()
-  {
-    // FIXME: Should we make this action work with the old terminal
-    // widget?
+void interpreter_qobject::pause ()
+{
+  // FIXME: Should we make this action work with the old terminal
+  // widget?
 
-    if (m_octave_qobj.experimental_terminal_widget ())
-      {
-        if (! m_interpreter)
-          return;
+  if (m_octave_qobj.experimental_terminal_widget ())
+    {
+      if (! m_interpreter)
+        return;
 
-        // The following is a direct function call across threads.
-        // We need to ensure that it uses thread-safe functions.
+      // The following is a direct function call across threads.
+      // We need to ensure that it uses thread-safe functions.
 
-        m_interpreter->pause ();
-      }
-  }
+      m_interpreter->pause ();
+    }
+}
 
-  void interpreter_qobject::stop ()
-  {
-    // FIXME: Should we make this action work with the old terminal
-    // widget?
+void interpreter_qobject::stop ()
+{
+  // FIXME: Should we make this action work with the old terminal
+  // widget?
 
-    if (m_octave_qobj.experimental_terminal_widget ())
-      {
-        if (! m_interpreter)
-          return;
+  if (m_octave_qobj.experimental_terminal_widget ())
+    {
+      if (! m_interpreter)
+        return;
 
-        // The following is a direct function call across threads.
-        // We need to ensure that it uses thread-safe functions.
+      // The following is a direct function call across threads.
+      // We need to ensure that it uses thread-safe functions.
 
-        m_interpreter->stop ();
-      }
-  }
+      m_interpreter->stop ();
+    }
+}
 
-  void interpreter_qobject::resume ()
-  {
-    // FIXME: Should we make this action work with the old terminal
-    // widget?
+void interpreter_qobject::resume ()
+{
+  // FIXME: Should we make this action work with the old terminal
+  // widget?
 
-    if (m_octave_qobj.experimental_terminal_widget ())
-      {
-        // FIXME: This action should only be available when the
-        // interpreter is paused.
+  if (m_octave_qobj.experimental_terminal_widget ())
+    {
+      // FIXME: This action should only be available when the
+      // interpreter is paused.
 
-        interpreter_event
-          ([=] (interpreter& interp)
-          {
-            // INTERPRETER THREAD
+      interpreter_event
+        ([=] (interpreter& interp)
+        {
+          // INTERPRETER THREAD
 
-            interp.resume ();
-          });
-      }
-  }
+          interp.resume ();
+        });
+    }
+}
 
-  qt_interpreter_events *interpreter_qobject::qt_link ()
-  {
-    return m_octave_qobj.qt_link ();
-  }
+qt_interpreter_events *interpreter_qobject::qt_link ()
+{
+  return m_octave_qobj.qt_link ();
+}
 
 OCTAVE_END_NAMESPACE(octave)
--- a/libgui/src/m-editor/file-editor-interface.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/m-editor/file-editor-interface.h	Thu Feb 02 12:25:51 2023 -0800
@@ -34,70 +34,70 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class file_editor_interface : public octave_dock_widget
-  {
-    Q_OBJECT
+class file_editor_interface : public octave_dock_widget
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    file_editor_interface (QWidget *p)
-      : octave_dock_widget ("FileEditor", p)
-    { }
+  file_editor_interface (QWidget *p)
+    : octave_dock_widget ("FileEditor", p)
+  { }
 
-    virtual ~file_editor_interface () = default;
+  virtual ~file_editor_interface () = default;
 
-    virtual QMenu * get_mru_menu () = 0;
-    virtual QMenu * debug_menu () = 0;
-    virtual QToolBar * toolbar () = 0;
-    virtual QMenuBar * menubar () = 0;
+  virtual QMenu * get_mru_menu () = 0;
+  virtual QMenu * debug_menu () = 0;
+  virtual QToolBar * toolbar () = 0;
+  virtual QMenuBar * menubar () = 0;
 
-    virtual void insert_global_actions (QList<QAction *>) = 0;
-    virtual void handle_enter_debug_mode () = 0;
-    virtual void handle_exit_debug_mode () = 0;
+  virtual void insert_global_actions (QList<QAction *>) = 0;
+  virtual void handle_enter_debug_mode () = 0;
+  virtual void handle_exit_debug_mode () = 0;
 
-    virtual void
-    handle_insert_debugger_pointer_request (const QString& file, int line) = 0;
+  virtual void
+  handle_insert_debugger_pointer_request (const QString& file, int line) = 0;
 
-    virtual void
-    handle_delete_debugger_pointer_request (const QString& file, int line) = 0;
+  virtual void
+  handle_delete_debugger_pointer_request (const QString& file, int line) = 0;
 
-    virtual void
-    handle_update_breakpoint_marker_request (bool insert, const QString& file,
-                                             int line, const QString& cond) = 0;
+  virtual void
+  handle_update_breakpoint_marker_request (bool insert, const QString& file,
+                                           int line, const QString& cond) = 0;
 
-    virtual void handle_edit_file_request (const QString& file) = 0;
+  virtual void handle_edit_file_request (const QString& file) = 0;
 
-    virtual bool check_closing () = 0;
+  virtual bool check_closing () = 0;
 
-    virtual void empty_script (bool, bool) = 0;
+  virtual void empty_script (bool, bool) = 0;
 
-    virtual void restore_session () = 0;
+  virtual void restore_session () = 0;
 
-    virtual void enable_menu_shortcuts (bool enable) = 0;
+  virtual void enable_menu_shortcuts (bool enable) = 0;
 
-  signals:
+signals:
 
-    void interpreter_event (const fcn_callback& fcn);
-    void interpreter_event (const meth_callback& meth);
+  void interpreter_event (const fcn_callback& fcn);
+  void interpreter_event (const meth_callback& meth);
 
-  public slots:
+public slots:
 
-    virtual void toplevel_change (bool) = 0;
+  virtual void toplevel_change (bool) = 0;
 
-    virtual void handle_file_remove (const QString& o, const QString& n) = 0;
+  virtual void handle_file_remove (const QString& o, const QString& n) = 0;
 
-    virtual void request_new_file (const QString& command = QString ()) = 0;
+  virtual void request_new_file (const QString& command = QString ()) = 0;
 
-    virtual void request_open_file (const QString& openFileName,
-                                    const QString& encoding = QString (),
-                                    int line = -1,
-                                    bool debug_pointer = false,
-                                    bool breakpoint_marker = false,
-                                    bool insert = true,
-                                    const QString& cond = "",
-                                    int index = -1,
-                                    const QString& bookmarks = QString ()) = 0;
-  };
+  virtual void request_open_file (const QString& openFileName,
+                                  const QString& encoding = QString (),
+                                  int line = -1,
+                                  bool debug_pointer = false,
+                                  bool breakpoint_marker = false,
+                                  bool insert = true,
+                                  const QString& cond = "",
+                                  int index = -1,
+                                  const QString& bookmarks = QString ()) = 0;
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/src/m-editor/file-editor-tab.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/m-editor/file-editor-tab.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -96,3277 +96,3277 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  //! A file_editor_tab object consists of a text area and three left margins.
-  //! The first holds breakpoints, bookmarks, and the debug program counter.
-  //! The second holds line numbers.  The third holds "fold" marks, to hide
-  //! sections of text.
-
-  // Make parent null for the file editor tab so that warning WindowModal
-  // messages don't affect grandparents.
-  file_editor_tab::file_editor_tab (const QString& directory_arg)
-  {
-    m_lexer_apis = nullptr;
-    m_is_octave_file = true;
-    m_lines_changed = false;
-    m_autoc_active = false;
-
-    m_ced = directory_arg;
-
-    m_file_name = "";
-    m_file_system_watcher.setObjectName ("_qt_autotest_force_engine_poller");
-
-    m_edit_area = new octave_qscintilla (this);
-    m_line = 0;
-    m_col  = 0;
-
-    m_bp_lines.clear ();      // start with empty lists of breakpoints
-    m_bp_conditions.clear ();
-    m_bp_restore_count = 0;
-
-    m_breakpoint_info.remove_next = false;
-    m_breakpoint_info.remove_line = -1;
-
-    // Initialize last modification date to now
-    m_last_modified = QDateTime::currentDateTimeUtc();
-
-    connect (m_edit_area, SIGNAL (cursorPositionChanged (int, int)),
-             this, SLOT (handle_cursor_moved (int,int)));
-
-    connect (m_edit_area, SIGNAL (SCN_CHARADDED (int)),
-             this, SLOT (handle_char_added (int)));
-
-    connect (m_edit_area, SIGNAL (SCN_DOUBLECLICK (int, int, int)),
-             this, SLOT (handle_double_click (int, int, int)));
-
-    connect (m_edit_area, SIGNAL (linesChanged ()),
-             this, SLOT (handle_lines_changed ()));
-
-    connect (m_edit_area, &octave_qscintilla::context_menu_edit_signal,
-             this, &file_editor_tab::handle_context_menu_edit);
-
-    connect (m_edit_area, &octave_qscintilla::update_rowcol_indicator_signal,
-             this, &file_editor_tab::update_rowcol_indicator);
-
-    // create statusbar for row/col indicator and eol mode
-    m_status_bar = new QStatusBar (this);
-
-    // row- and col-indicator
-    m_row_indicator = new QLabel ("", this);
-    QFontMetrics fm = m_row_indicator->fontMetrics ();
-    m_row_indicator->setMinimumSize (4.5*fm.averageCharWidth (), 0);
-    QLabel *row_label = new QLabel (tr ("line:"), this);
-    m_col_indicator = new QLabel ("", this);
-    m_col_indicator->setMinimumSize (4*fm.averageCharWidth (), 0);
-    QLabel *col_label = new QLabel (tr ("col:"), this);
-    m_status_bar->addWidget (row_label, 0);
-    m_status_bar->addWidget (m_row_indicator, 0);
-    m_status_bar->addWidget (col_label, 0);
-    m_status_bar->addWidget (m_col_indicator, 0);
-
-    // status bar: encoding
-    QLabel *enc_label = new QLabel (tr ("encoding:"), this);
-    m_enc_indicator = new QLabel ("", this);
-    m_status_bar->addWidget (enc_label, 0);
-    m_status_bar->addWidget (m_enc_indicator, 0);
-    m_status_bar->addWidget (new QLabel (" ", this), 0);
-
-    // status bar: eol mode
-    QLabel *eol_label = new QLabel (tr ("eol:"), this);
-    m_eol_indicator = new QLabel ("", this);
-    m_status_bar->addWidget (eol_label, 0);
-    m_status_bar->addWidget (m_eol_indicator, 0);
-    m_status_bar->addWidget (new QLabel (" ", this), 0);
-
-    // symbols
-    m_edit_area->setMarginType (1, QsciScintilla::SymbolMargin);
-    m_edit_area->setMarginSensitivity (1, true);
-    m_edit_area->markerDefine (QsciScintilla::RightTriangle, marker::bookmark);
-    m_edit_area->setMarkerBackgroundColor (QColor (0, 0, 232), marker::bookmark);
-    m_edit_area->markerDefine (QsciScintilla::Circle, marker::breakpoint);
-    m_edit_area->setMarkerBackgroundColor (QColor (192, 0, 0), marker::breakpoint);
-    m_edit_area->markerDefine (QsciScintilla::Circle, marker::cond_break);
-    m_edit_area->setMarkerBackgroundColor (QColor (255, 127, 0), marker::cond_break);
-    m_edit_area->markerDefine (QsciScintilla::RightArrow,
-                               marker::debugger_position);
-    m_edit_area->setMarkerBackgroundColor (QColor (255, 255, 0),
-                                           marker::debugger_position);
-    m_edit_area->markerDefine (QsciScintilla::RightArrow,
-                               marker::unsure_debugger_position);
-    m_edit_area->setMarkerBackgroundColor (QColor (192, 192, 192),
-                                           marker::unsure_debugger_position);
-
-    connect (m_edit_area, SIGNAL (marginClicked (int, int,
-                                  Qt::KeyboardModifiers)),
-             this, SLOT (handle_margin_clicked (int, int,
-                                                Qt::KeyboardModifiers)));
-
-    connect (m_edit_area, &octave_qscintilla::context_menu_break_condition_signal,
-             this, &file_editor_tab::handle_context_menu_break_condition);
-
-    // line numbers
-    m_edit_area->setMarginsForegroundColor (QColor (96, 96, 96));
-    m_edit_area->setMarginsBackgroundColor (QColor (232, 232, 220));
-    m_edit_area->setMarginType (2, QsciScintilla::TextMargin);
-
-    // other features
-    m_edit_area->setBraceMatching (QsciScintilla::StrictBraceMatch);
-    m_edit_area->setAutoIndent (true);
-    m_edit_area->setIndentationWidth (2);
-    m_edit_area->setIndentationsUseTabs (false);
-
-    m_edit_area->setUtf8 (true);
-
-    // auto completion
-    m_edit_area->SendScintilla (QsciScintillaBase::SCI_AUTOCSETCANCELATSTART, false);
-
-    QVBoxLayout *edit_area_layout = new QVBoxLayout ();
-    edit_area_layout->addWidget (m_edit_area);
-    edit_area_layout->addWidget (m_status_bar);
-    edit_area_layout->setMargin (0);
-    edit_area_layout->setSpacing (0);
-    setLayout (edit_area_layout);
-
-    // Any interpreter_event signal from a file_editor_tab_widget is
-    // handled the same as for the parent main_window object.
-
-    connect (m_edit_area, QOverload<const fcn_callback&>::of (&octave_qscintilla::interpreter_event),
-             this, QOverload<const fcn_callback&>::of (&file_editor_tab::interpreter_event));
-
-    connect (m_edit_area, QOverload<const meth_callback&>::of (&octave_qscintilla::interpreter_event),
-             this, QOverload<const meth_callback&>::of (&file_editor_tab::interpreter_event));
-
-    // connect modified signal
-    connect (m_edit_area, SIGNAL (modificationChanged (bool)),
-             this, SLOT (update_window_title (bool)));
-
-    connect (m_edit_area, SIGNAL (copyAvailable (bool)),
-             this, SLOT (handle_copy_available (bool)));
-
-    connect (&m_file_system_watcher, &QFileSystemWatcher::fileChanged,
-             this, [=] (const QString& path) { file_has_changed (path); });
-
-    connect (this, &file_editor_tab::maybe_remove_next,
-             this, &file_editor_tab::handle_remove_next);
-
-    connect (this, &file_editor_tab::dbstop_if,
-             this, &file_editor_tab::handle_dbstop_if);
-
-    connect (this, &file_editor_tab::request_add_breakpoint,
-             this, &file_editor_tab::handle_request_add_breakpoint);
-
-    connect (this, &file_editor_tab::api_entries_added,
-             this, &file_editor_tab::handle_api_entries_added);
-
-    connect (this, &file_editor_tab::confirm_dbquit_and_save_signal,
-             this, &file_editor_tab::confirm_dbquit_and_save);
-
-    connect (this, &file_editor_tab::do_save_file_signal,
-             this, &file_editor_tab::do_save_file);
-
-    notice_settings (true);
-
-    gui_settings settings;
-
-    // encoding, not updated with the settings
-    m_encoding = settings.value (ed_default_enc.settings_key (), "UTF-8").toString ();
-    m_enc_indicator->setText (m_encoding);
-    // no changes in encoding yet
-    m_new_encoding = m_encoding;
-  }
-
-  file_editor_tab::~file_editor_tab ()
-  {
-    // Tell all connected markers to self-destruct.
-    emit remove_all_breakpoints_signal ();
-    emit remove_all_positions ();
-
-    // Destroy lexer attached to m_edit_area, which is not the parent
-    // of lexer
-    QsciLexer *lexer = m_edit_area->lexer ();
-    if (lexer)
-      {
-        delete lexer;
-        m_edit_area->setLexer (nullptr);
-      }
-  }
-
-  void file_editor_tab::set_encoding (const QString& new_encoding)
-  {
-    if (new_encoding.isEmpty ())
+//! A file_editor_tab object consists of a text area and three left margins.
+//! The first holds breakpoints, bookmarks, and the debug program counter.
+//! The second holds line numbers.  The third holds "fold" marks, to hide
+//! sections of text.
+
+// Make parent null for the file editor tab so that warning WindowModal
+// messages don't affect grandparents.
+file_editor_tab::file_editor_tab (const QString& directory_arg)
+{
+  m_lexer_apis = nullptr;
+  m_is_octave_file = true;
+  m_lines_changed = false;
+  m_autoc_active = false;
+
+  m_ced = directory_arg;
+
+  m_file_name = "";
+  m_file_system_watcher.setObjectName ("_qt_autotest_force_engine_poller");
+
+  m_edit_area = new octave_qscintilla (this);
+  m_line = 0;
+  m_col  = 0;
+
+  m_bp_lines.clear ();      // start with empty lists of breakpoints
+  m_bp_conditions.clear ();
+  m_bp_restore_count = 0;
+
+  m_breakpoint_info.remove_next = false;
+  m_breakpoint_info.remove_line = -1;
+
+  // Initialize last modification date to now
+  m_last_modified = QDateTime::currentDateTimeUtc();
+
+  connect (m_edit_area, SIGNAL (cursorPositionChanged (int, int)),
+           this, SLOT (handle_cursor_moved (int,int)));
+
+  connect (m_edit_area, SIGNAL (SCN_CHARADDED (int)),
+           this, SLOT (handle_char_added (int)));
+
+  connect (m_edit_area, SIGNAL (SCN_DOUBLECLICK (int, int, int)),
+           this, SLOT (handle_double_click (int, int, int)));
+
+  connect (m_edit_area, SIGNAL (linesChanged ()),
+           this, SLOT (handle_lines_changed ()));
+
+  connect (m_edit_area, &octave_qscintilla::context_menu_edit_signal,
+           this, &file_editor_tab::handle_context_menu_edit);
+
+  connect (m_edit_area, &octave_qscintilla::update_rowcol_indicator_signal,
+           this, &file_editor_tab::update_rowcol_indicator);
+
+  // create statusbar for row/col indicator and eol mode
+  m_status_bar = new QStatusBar (this);
+
+  // row- and col-indicator
+  m_row_indicator = new QLabel ("", this);
+  QFontMetrics fm = m_row_indicator->fontMetrics ();
+  m_row_indicator->setMinimumSize (4.5*fm.averageCharWidth (), 0);
+  QLabel *row_label = new QLabel (tr ("line:"), this);
+  m_col_indicator = new QLabel ("", this);
+  m_col_indicator->setMinimumSize (4*fm.averageCharWidth (), 0);
+  QLabel *col_label = new QLabel (tr ("col:"), this);
+  m_status_bar->addWidget (row_label, 0);
+  m_status_bar->addWidget (m_row_indicator, 0);
+  m_status_bar->addWidget (col_label, 0);
+  m_status_bar->addWidget (m_col_indicator, 0);
+
+  // status bar: encoding
+  QLabel *enc_label = new QLabel (tr ("encoding:"), this);
+  m_enc_indicator = new QLabel ("", this);
+  m_status_bar->addWidget (enc_label, 0);
+  m_status_bar->addWidget (m_enc_indicator, 0);
+  m_status_bar->addWidget (new QLabel (" ", this), 0);
+
+  // status bar: eol mode
+  QLabel *eol_label = new QLabel (tr ("eol:"), this);
+  m_eol_indicator = new QLabel ("", this);
+  m_status_bar->addWidget (eol_label, 0);
+  m_status_bar->addWidget (m_eol_indicator, 0);
+  m_status_bar->addWidget (new QLabel (" ", this), 0);
+
+  // symbols
+  m_edit_area->setMarginType (1, QsciScintilla::SymbolMargin);
+  m_edit_area->setMarginSensitivity (1, true);
+  m_edit_area->markerDefine (QsciScintilla::RightTriangle, marker::bookmark);
+  m_edit_area->setMarkerBackgroundColor (QColor (0, 0, 232), marker::bookmark);
+  m_edit_area->markerDefine (QsciScintilla::Circle, marker::breakpoint);
+  m_edit_area->setMarkerBackgroundColor (QColor (192, 0, 0), marker::breakpoint);
+  m_edit_area->markerDefine (QsciScintilla::Circle, marker::cond_break);
+  m_edit_area->setMarkerBackgroundColor (QColor (255, 127, 0), marker::cond_break);
+  m_edit_area->markerDefine (QsciScintilla::RightArrow,
+                             marker::debugger_position);
+  m_edit_area->setMarkerBackgroundColor (QColor (255, 255, 0),
+                                         marker::debugger_position);
+  m_edit_area->markerDefine (QsciScintilla::RightArrow,
+                             marker::unsure_debugger_position);
+  m_edit_area->setMarkerBackgroundColor (QColor (192, 192, 192),
+                                         marker::unsure_debugger_position);
+
+  connect (m_edit_area, SIGNAL (marginClicked (int, int,
+                                Qt::KeyboardModifiers)),
+           this, SLOT (handle_margin_clicked (int, int,
+                                              Qt::KeyboardModifiers)));
+
+  connect (m_edit_area, &octave_qscintilla::context_menu_break_condition_signal,
+           this, &file_editor_tab::handle_context_menu_break_condition);
+
+  // line numbers
+  m_edit_area->setMarginsForegroundColor (QColor (96, 96, 96));
+  m_edit_area->setMarginsBackgroundColor (QColor (232, 232, 220));
+  m_edit_area->setMarginType (2, QsciScintilla::TextMargin);
+
+  // other features
+  m_edit_area->setBraceMatching (QsciScintilla::StrictBraceMatch);
+  m_edit_area->setAutoIndent (true);
+  m_edit_area->setIndentationWidth (2);
+  m_edit_area->setIndentationsUseTabs (false);
+
+  m_edit_area->setUtf8 (true);
+
+  // auto completion
+  m_edit_area->SendScintilla (QsciScintillaBase::SCI_AUTOCSETCANCELATSTART, false);
+
+  QVBoxLayout *edit_area_layout = new QVBoxLayout ();
+  edit_area_layout->addWidget (m_edit_area);
+  edit_area_layout->addWidget (m_status_bar);
+  edit_area_layout->setMargin (0);
+  edit_area_layout->setSpacing (0);
+  setLayout (edit_area_layout);
+
+  // Any interpreter_event signal from a file_editor_tab_widget is
+  // handled the same as for the parent main_window object.
+
+  connect (m_edit_area, QOverload<const fcn_callback&>::of (&octave_qscintilla::interpreter_event),
+           this, QOverload<const fcn_callback&>::of (&file_editor_tab::interpreter_event));
+
+  connect (m_edit_area, QOverload<const meth_callback&>::of (&octave_qscintilla::interpreter_event),
+           this, QOverload<const meth_callback&>::of (&file_editor_tab::interpreter_event));
+
+  // connect modified signal
+  connect (m_edit_area, SIGNAL (modificationChanged (bool)),
+           this, SLOT (update_window_title (bool)));
+
+  connect (m_edit_area, SIGNAL (copyAvailable (bool)),
+           this, SLOT (handle_copy_available (bool)));
+
+  connect (&m_file_system_watcher, &QFileSystemWatcher::fileChanged,
+           this, [=] (const QString& path) { file_has_changed (path); });
+
+  connect (this, &file_editor_tab::maybe_remove_next,
+           this, &file_editor_tab::handle_remove_next);
+
+  connect (this, &file_editor_tab::dbstop_if,
+           this, &file_editor_tab::handle_dbstop_if);
+
+  connect (this, &file_editor_tab::request_add_breakpoint,
+           this, &file_editor_tab::handle_request_add_breakpoint);
+
+  connect (this, &file_editor_tab::api_entries_added,
+           this, &file_editor_tab::handle_api_entries_added);
+
+  connect (this, &file_editor_tab::confirm_dbquit_and_save_signal,
+           this, &file_editor_tab::confirm_dbquit_and_save);
+
+  connect (this, &file_editor_tab::do_save_file_signal,
+           this, &file_editor_tab::do_save_file);
+
+  notice_settings (true);
+
+  gui_settings settings;
+
+  // encoding, not updated with the settings
+  m_encoding = settings.value (ed_default_enc.settings_key (), "UTF-8").toString ();
+  m_enc_indicator->setText (m_encoding);
+  // no changes in encoding yet
+  m_new_encoding = m_encoding;
+}
+
+file_editor_tab::~file_editor_tab ()
+{
+  // Tell all connected markers to self-destruct.
+  emit remove_all_breakpoints_signal ();
+  emit remove_all_positions ();
+
+  // Destroy lexer attached to m_edit_area, which is not the parent
+  // of lexer
+  QsciLexer *lexer = m_edit_area->lexer ();
+  if (lexer)
+    {
+      delete lexer;
+      m_edit_area->setLexer (nullptr);
+    }
+}
+
+void file_editor_tab::set_encoding (const QString& new_encoding)
+{
+  if (new_encoding.isEmpty ())
+    return;
+
+  m_encoding = new_encoding;
+  m_enc_indicator->setText (m_encoding);
+  if (! m_edit_area->text ().isEmpty ())
+    set_modified (true);
+}
+
+void file_editor_tab::closeEvent (QCloseEvent *e)
+{
+  int save_dialog = check_file_modified (true);
+  if ((save_dialog == QMessageBox::Cancel) ||
+      (save_dialog == QMessageBox::Save))
+    {
+      // Ignore close event if file is saved or user cancels
+      // closing this window.  In case of saving, tab is closed after
+      // successful saving.
+      e->ignore ();
+    }
+  else
+    {
+      e->accept ();
+      emit tab_remove_request ();
+    }
+}
+
+void file_editor_tab::set_current_directory (const QString& dir)
+{
+  m_ced = dir;
+}
+
+void file_editor_tab::handle_context_menu_edit (const QString& word_at_cursor)
+{
+  // Search for a subfunction in actual file (this is done first because
+  // Octave finds this function before others with the same name in the
+  // search path.
+  QRegExp rxfun1 ("^[\t ]*function[^=]+=[\t ]*"
+                  + word_at_cursor + "[\t ]*\\([^\\)]*\\)[\t ]*$");
+  QRegExp rxfun2 ("^[\t ]*function[\t ]+"
+                  + word_at_cursor + "[\t ]*\\([^\\)]*\\)[\t ]*$");
+  QRegExp rxfun3 ("^[\t ]*function[\t ]+"
+                  + word_at_cursor + "[\t ]*$");
+  QRegExp rxfun4 ("^[\t ]*function[^=]+=[\t ]*"
+                  + word_at_cursor + "[\t ]*$");
+
+  int pos_fct = -1;
+  QStringList lines = m_edit_area->text ().split ("\n");
+
+  int line;
+  for (line = 0; line < lines.count (); line++)
+    {
+      if ((pos_fct = rxfun1.indexIn (lines.at (line))) != -1)
+        break;
+      if ((pos_fct = rxfun2.indexIn (lines.at (line))) != -1)
+        break;
+      if ((pos_fct = rxfun3.indexIn (lines.at (line))) != -1)
+        break;
+      if ((pos_fct = rxfun4.indexIn (lines.at (line))) != -1)
+        break;
+    }
+
+  if (pos_fct > -1)
+    {
+      // reg expr. found: it is an internal function
+      m_edit_area->setCursorPosition (line, pos_fct);
+      m_edit_area->SendScintilla (2232, line);     // SCI_ENSUREVISIBLE
+      // SCI_VISIBLEFROMDOCLINE
+      int vis_line = m_edit_area->SendScintilla (2220, line);
+      m_edit_area->SendScintilla (2613, vis_line); // SCI_SETFIRSTVISIBLELINE
       return;
-
-    m_encoding = new_encoding;
-    m_enc_indicator->setText (m_encoding);
-    if (! m_edit_area->text ().isEmpty ())
-      set_modified (true);
-  }
-
-  void file_editor_tab::closeEvent (QCloseEvent *e)
-  {
-    int save_dialog = check_file_modified (true);
-    if ((save_dialog == QMessageBox::Cancel) ||
-        (save_dialog == QMessageBox::Save))
-      {
-        // Ignore close event if file is saved or user cancels
-        // closing this window.  In case of saving, tab is closed after
-        // successful saving.
-        e->ignore ();
-      }
-    else
-      {
-        e->accept ();
-        emit tab_remove_request ();
-      }
-  }
-
-  void file_editor_tab::set_current_directory (const QString& dir)
-  {
-    m_ced = dir;
-  }
-
-  void file_editor_tab::handle_context_menu_edit (const QString& word_at_cursor)
-  {
-    // Search for a subfunction in actual file (this is done first because
-    // Octave finds this function before others with the same name in the
-    // search path.
-    QRegExp rxfun1 ("^[\t ]*function[^=]+=[\t ]*"
-                    + word_at_cursor + "[\t ]*\\([^\\)]*\\)[\t ]*$");
-    QRegExp rxfun2 ("^[\t ]*function[\t ]+"
-                    + word_at_cursor + "[\t ]*\\([^\\)]*\\)[\t ]*$");
-    QRegExp rxfun3 ("^[\t ]*function[\t ]+"
-                    + word_at_cursor + "[\t ]*$");
-    QRegExp rxfun4 ("^[\t ]*function[^=]+=[\t ]*"
-                    + word_at_cursor + "[\t ]*$");
-
-    int pos_fct = -1;
-    QStringList lines = m_edit_area->text ().split ("\n");
-
-    int line;
-    for (line = 0; line < lines.count (); line++)
-      {
-        if ((pos_fct = rxfun1.indexIn (lines.at (line))) != -1)
-          break;
-        if ((pos_fct = rxfun2.indexIn (lines.at (line))) != -1)
-          break;
-        if ((pos_fct = rxfun3.indexIn (lines.at (line))) != -1)
-          break;
-        if ((pos_fct = rxfun4.indexIn (lines.at (line))) != -1)
-          break;
-      }
-
-    if (pos_fct > -1)
-      {
-        // reg expr. found: it is an internal function
-        m_edit_area->setCursorPosition (line, pos_fct);
-        m_edit_area->SendScintilla (2232, line);     // SCI_ENSUREVISIBLE
-        // SCI_VISIBLEFROMDOCLINE
-        int vis_line = m_edit_area->SendScintilla (2220, line);
-        m_edit_area->SendScintilla (2613, vis_line); // SCI_SETFIRSTVISIBLELINE
-        return;
-      }
-
-    emit edit_mfile_request (word_at_cursor, m_file_name, m_ced, -1);
-  }
-
-  // If "dbstop if ..." selected from context menu, create a conditional
-  // breakpoint.  The default condition is (a) the existing condition if there
-  // is already a breakpoint, (b) any selected text, or (c) empty
-  void file_editor_tab::handle_context_menu_break_condition (int linenr)
-  {
-    // Ensure editor line numbers match Octave core's line numbers.
-    // Give users the option to save modifications if necessary.
-    if (! unchanged_or_saved ())
-      return;
-
-    QString cond;
-
-    // Search for previous condition.  FIXME: is there a more direct way?
-    if (m_edit_area->markersAtLine (linenr) & (1 << marker::cond_break))
-      {
-        emit report_marker_linenr (m_bp_lines, m_bp_conditions);
-        for (int i = 0; i < m_bp_lines.length (); i++)
-          if (m_bp_lines.value (i) == linenr)
+    }
+
+  emit edit_mfile_request (word_at_cursor, m_file_name, m_ced, -1);
+}
+
+// If "dbstop if ..." selected from context menu, create a conditional
+// breakpoint.  The default condition is (a) the existing condition if there
+// is already a breakpoint, (b) any selected text, or (c) empty
+void file_editor_tab::handle_context_menu_break_condition (int linenr)
+{
+  // Ensure editor line numbers match Octave core's line numbers.
+  // Give users the option to save modifications if necessary.
+  if (! unchanged_or_saved ())
+    return;
+
+  QString cond;
+
+  // Search for previous condition.  FIXME: is there a more direct way?
+  if (m_edit_area->markersAtLine (linenr) & (1 << marker::cond_break))
+    {
+      emit report_marker_linenr (m_bp_lines, m_bp_conditions);
+      for (int i = 0; i < m_bp_lines.length (); i++)
+        if (m_bp_lines.value (i) == linenr)
+          {
+            cond = m_bp_conditions.value (i);
+            break;
+          }
+      m_bp_lines.clear ();
+      m_bp_conditions.clear ();
+    }
+
+  // If text selected by the mouse, default to that instead
+  // If both present, use the OR of them, to avoid accidental overwriting
+  // FIXME: If both are present, show old condition unselected and
+  //        the selection (in edit area) selected (in the dialog).
+  if (m_edit_area->hasSelectedText ())
+    {
+      if (cond == "")
+        cond = m_edit_area->selectedText ();
+      else
+        cond = '(' + cond + ") || (" + m_edit_area->selectedText () + ')';
+    }
+
+  emit dbstop_if ("dbstop if", linenr+1, cond);
+}
+
+// Display dialog in GUI thread to get condition, then emit
+// interpreter_event signal to check it in the interpreter thread.
+// If the dialog returns a valid condition, then either emit a signal
+// to add the breakpoint in the editor tab or a signal to display a
+// new dialog.
+
+void file_editor_tab::handle_dbstop_if (const QString& prompt, int line,
+                                        const QString& cond)
+{
+  bool ok;
+  QString new_cond
+    = QInputDialog::getText (this, tr ("Breakpoint condition"),
+                             prompt, QLineEdit::Normal, cond, &ok);
+
+  // If cancel, don't change breakpoint condition.
+
+  if (ok && ! new_cond.isEmpty ())
+    {
+      // The interpreter_event callback function below emits a signal.
+      // Because we don't control when that happens, use a guarded
+      // pointer so that the callback can abort if this object is no
+      // longer valid.
+
+      QPointer<file_editor_tab> this_fetab (this);
+
+      emit interpreter_event
+        ([=] (interpreter& interp)
+         {
+           // INTERPRETER THREAD
+
+           // We are intentionally skipping any side effects that may
+           // occur in the evaluation of NEW_COND if THIS_FETAB is no
+           // longer valid.
+
+           if (this_fetab.isNull ())
+             return;
+
+           error_system& es = interp.get_error_system ();
+
+           unwind_protect frame;
+
+           // Prevent an error in the evaluation here from sending us
+           // into the debugger.
+
+           es.interpreter_try (frame);
+
+           bool eval_error = false;
+           std::string msg;
+
+           try
+             {
+               tree_evaluator& tw = interp.get_evaluator ();
+               bp_table& bptab = tw.get_bp_table ();
+
+               bptab.condition_valid (new_cond.toStdString ());
+
+               // The condition seems OK, so set the conditional
+               // breakpoint.
+
+               emit request_add_breakpoint (line, new_cond);
+             }
+           catch (const execution_exception& ee)
+             {
+               interp.recover_from_exception ();
+
+               msg = ee.message ();
+               eval_error = true;
+             }
+           catch (const interrupt_exception&)
+             {
+               interp.recover_from_exception ();
+
+               msg = "evaluation interrupted";
+               eval_error = true;
+             }
+
+           if (eval_error)
+             {
+               // Try again with a prompt that indicates the last
+               // attempt was an error.
+
+               QString new_prompt = (tr ("ERROR: ")
+                                     + QString::fromStdString (msg)
+                                     + "\n\ndbstop if");
+
+               emit dbstop_if (new_prompt, line, "");
+             }
+         });
+    }
+}
+
+void file_editor_tab::set_file_name (const QString& fileName)
+{
+  // update tracked file if we really have a file on disk
+  QStringList trackedFiles = m_file_system_watcher.files ();
+  if (! trackedFiles.isEmpty ())
+    m_file_system_watcher.removePath (m_file_name);
+  if (! fileName.isEmpty () && QFile::exists (fileName))
+    {
+      m_file_system_watcher.addPath (fileName);
+      m_last_modified =  QFileInfo (fileName).lastModified ().toUTC ();
+    }
+
+  // update lexer and file name variable if file name changes
+  if (m_file_name != fileName)
+    {
+      m_file_name = fileName;
+      update_lexer ();
+    }
+
+  // set the window title to actual filename (not modified)
+  update_window_title (m_edit_area->isModified ());
+
+  // update the file editor with current editing directory
+  emit editor_state_changed (m_copy_available, m_is_octave_file,
+                             m_edit_area->isModified ());
+
+  // add the new file to the most-recently-used list
+  emit mru_add_file (m_file_name, m_encoding);
+}
+
+// valid_file_name (file): checks whether "file" names a file.
+// By default, "file" is empty; then m_file_name is checked
+bool file_editor_tab::valid_file_name (const QString& file)
+{
+  if (file.isEmpty ())
+    {
+      if (m_file_name.isEmpty ())
+        return false;
+      else
+        return true;
+    }
+
+  return true;
+}
+
+void file_editor_tab::enable_file_watcher (bool do_enable)
+{
+  if (do_enable)
+    m_file_system_watcher.addPath (m_file_name);
+  else
+    m_file_system_watcher.removePath (m_file_name);
+}
+
+// We cannot create a breakpoint when the file is modified
+// because the line number the editor is providing might
+// not match what Octave core is interpreting in the
+// file on disk.  This function gives the user the option
+// to save before creating the breakpoint.
+bool file_editor_tab::unchanged_or_saved ()
+{
+  bool retval = true;
+  if (m_edit_area->isModified () || ! valid_file_name ())
+    {
+      int ans = QMessageBox::question (nullptr, tr ("Octave Editor"),
+                                       tr ("Cannot add breakpoint to modified or unnamed file.\n"
+                                           "Save and add breakpoint, or cancel?"),
+                                       QMessageBox::Save | QMessageBox::Cancel, QMessageBox::Save);
+
+      if (ans == QMessageBox::Save)
+        save_file (m_file_name, false);
+      else
+        retval = false;
+    }
+
+  return retval;
+}
+
+// Toggle a breakpoint at the editor_linenr or, if this was called by
+// a click with CTRL pressed, toggle a bookmark at that point.
+void file_editor_tab::handle_margin_clicked (int margin, int editor_linenr,
+                                             Qt::KeyboardModifiers state)
+{
+  if (margin == 1)
+    {
+      unsigned int markers_mask = m_edit_area->markersAtLine (editor_linenr);
+
+      if (state & Qt::ControlModifier)
+        {
+          if (markers_mask & (1 << marker::bookmark))
+            m_edit_area->markerDelete (editor_linenr, marker::bookmark);
+          else
+            m_edit_area->markerAdd (editor_linenr, marker::bookmark);
+        }
+      else
+        {
+          if (markers_mask & ((1 << marker::breakpoint)
+                              | (1 << marker::cond_break)))
+            handle_request_remove_breakpoint (editor_linenr + 1);
+          else
             {
-              cond = m_bp_conditions.value (i);
-              break;
+              if (unchanged_or_saved ())
+                handle_request_add_breakpoint (editor_linenr + 1, "");
             }
-        m_bp_lines.clear ();
-        m_bp_conditions.clear ();
-      }
-
-    // If text selected by the mouse, default to that instead
-    // If both present, use the OR of them, to avoid accidental overwriting
-    // FIXME: If both are present, show old condition unselected and
-    //        the selection (in edit area) selected (in the dialog).
-    if (m_edit_area->hasSelectedText ())
-      {
-        if (cond == "")
-          cond = m_edit_area->selectedText ();
-        else
-          cond = '(' + cond + ") || (" + m_edit_area->selectedText () + ')';
-      }
-
-    emit dbstop_if ("dbstop if", linenr+1, cond);
-  }
-
-  // Display dialog in GUI thread to get condition, then emit
-  // interpreter_event signal to check it in the interpreter thread.
-  // If the dialog returns a valid condition, then either emit a signal
-  // to add the breakpoint in the editor tab or a signal to display a
-  // new dialog.
-
-  void file_editor_tab::handle_dbstop_if (const QString& prompt, int line,
-                                          const QString& cond)
-  {
-    bool ok;
-    QString new_cond
-      = QInputDialog::getText (this, tr ("Breakpoint condition"),
-                               prompt, QLineEdit::Normal, cond, &ok);
-
-    // If cancel, don't change breakpoint condition.
-
-    if (ok && ! new_cond.isEmpty ())
-      {
-        // The interpreter_event callback function below emits a signal.
-        // Because we don't control when that happens, use a guarded
-        // pointer so that the callback can abort if this object is no
-        // longer valid.
-
-        QPointer<file_editor_tab> this_fetab (this);
-
-        emit interpreter_event
-          ([=] (interpreter& interp)
-           {
-             // INTERPRETER THREAD
-
-             // We are intentionally skipping any side effects that may
-             // occur in the evaluation of NEW_COND if THIS_FETAB is no
-             // longer valid.
-
-             if (this_fetab.isNull ())
-               return;
-
-             error_system& es = interp.get_error_system ();
-
-             unwind_protect frame;
-
-             // Prevent an error in the evaluation here from sending us
-             // into the debugger.
-
-             es.interpreter_try (frame);
-
-             bool eval_error = false;
-             std::string msg;
-
-             try
-               {
-                 tree_evaluator& tw = interp.get_evaluator ();
-                 bp_table& bptab = tw.get_bp_table ();
-
-                 bptab.condition_valid (new_cond.toStdString ());
-
-                 // The condition seems OK, so set the conditional
-                 // breakpoint.
-
-                 emit request_add_breakpoint (line, new_cond);
-               }
-             catch (const execution_exception& ee)
-               {
-                 interp.recover_from_exception ();
-
-                 msg = ee.message ();
-                 eval_error = true;
-               }
-             catch (const interrupt_exception&)
-               {
-                 interp.recover_from_exception ();
-
-                 msg = "evaluation interrupted";
-                 eval_error = true;
-               }
-
-             if (eval_error)
-               {
-                 // Try again with a prompt that indicates the last
-                 // attempt was an error.
-
-                 QString new_prompt = (tr ("ERROR: ")
-                                       + QString::fromStdString (msg)
-                                       + "\n\ndbstop if");
-
-                 emit dbstop_if (new_prompt, line, "");
-               }
-           });
-      }
-  }
-
-  void file_editor_tab::set_file_name (const QString& fileName)
-  {
-    // update tracked file if we really have a file on disk
-    QStringList trackedFiles = m_file_system_watcher.files ();
-    if (! trackedFiles.isEmpty ())
-      m_file_system_watcher.removePath (m_file_name);
-    if (! fileName.isEmpty () && QFile::exists (fileName))
-      {
-        m_file_system_watcher.addPath (fileName);
-        m_last_modified =  QFileInfo (fileName).lastModified ().toUTC ();
-      }
-
-    // update lexer and file name variable if file name changes
-    if (m_file_name != fileName)
-      {
-        m_file_name = fileName;
-        update_lexer ();
-      }
-
-    // set the window title to actual filename (not modified)
-    update_window_title (m_edit_area->isModified ());
-
-    // update the file editor with current editing directory
-    emit editor_state_changed (m_copy_available, m_is_octave_file,
-                               m_edit_area->isModified ());
-
-    // add the new file to the most-recently-used list
-    emit mru_add_file (m_file_name, m_encoding);
-  }
-
-  // valid_file_name (file): checks whether "file" names a file.
-  // By default, "file" is empty; then m_file_name is checked
-  bool file_editor_tab::valid_file_name (const QString& file)
-  {
-    if (file.isEmpty ())
-      {
-        if (m_file_name.isEmpty ())
-          return false;
-        else
-          return true;
-      }
-
-    return true;
-  }
-
-  void file_editor_tab::enable_file_watcher (bool do_enable)
-  {
-    if (do_enable)
-      m_file_system_watcher.addPath (m_file_name);
-    else
-      m_file_system_watcher.removePath (m_file_name);
-  }
-
-  // We cannot create a breakpoint when the file is modified
-  // because the line number the editor is providing might
-  // not match what Octave core is interpreting in the
-  // file on disk.  This function gives the user the option
-  // to save before creating the breakpoint.
-  bool file_editor_tab::unchanged_or_saved ()
-  {
-    bool retval = true;
-    if (m_edit_area->isModified () || ! valid_file_name ())
-      {
-        int ans = QMessageBox::question (nullptr, tr ("Octave Editor"),
-                                         tr ("Cannot add breakpoint to modified or unnamed file.\n"
-                                             "Save and add breakpoint, or cancel?"),
-                                         QMessageBox::Save | QMessageBox::Cancel, QMessageBox::Save);
-
-        if (ans == QMessageBox::Save)
-          save_file (m_file_name, false);
-        else
-          retval = false;
-      }
-
-    return retval;
-  }
-
-  // Toggle a breakpoint at the editor_linenr or, if this was called by
-  // a click with CTRL pressed, toggle a bookmark at that point.
-  void file_editor_tab::handle_margin_clicked (int margin, int editor_linenr,
-                                               Qt::KeyboardModifiers state)
-  {
-    if (margin == 1)
-      {
-        unsigned int markers_mask = m_edit_area->markersAtLine (editor_linenr);
-
-        if (state & Qt::ControlModifier)
-          {
-            if (markers_mask & (1 << marker::bookmark))
-              m_edit_area->markerDelete (editor_linenr, marker::bookmark);
-            else
-              m_edit_area->markerAdd (editor_linenr, marker::bookmark);
-          }
-        else
-          {
-            if (markers_mask & ((1 << marker::breakpoint)
-                                | (1 << marker::cond_break)))
-              handle_request_remove_breakpoint (editor_linenr + 1);
-            else
-              {
-                if (unchanged_or_saved ())
-                  handle_request_add_breakpoint (editor_linenr + 1, "");
-              }
-          }
-      }
-  }
-
-  void file_editor_tab::update_lexer ()
-  {
-    // Create a new lexer
-    QsciLexer *lexer = nullptr;
-
-    m_is_octave_file = false;
-
-    // Find the required lexer from file extensions
-    if (m_file_name.endsWith (".m")
-        || m_file_name.endsWith ("octaverc")
-        || m_file_name.endsWith (".cc-tst"))
-      {
+        }
+    }
+}
+
+void file_editor_tab::update_lexer ()
+{
+  // Create a new lexer
+  QsciLexer *lexer = nullptr;
+
+  m_is_octave_file = false;
+
+  // Find the required lexer from file extensions
+  if (m_file_name.endsWith (".m")
+      || m_file_name.endsWith ("octaverc")
+      || m_file_name.endsWith (".cc-tst"))
+    {
+#if defined (HAVE_LEXER_OCTAVE)
+      lexer = new QsciLexerOctave ();
+#elif defined (HAVE_LEXER_MATLAB)
+      lexer = new QsciLexerMatlab ();
+#else
+      lexer = new octave_txt_lexer ();
+#endif
+      m_is_octave_file = true;
+    }
+
+  if (! lexer)
+    {
+      if (m_file_name.endsWith (".c")
+          || m_file_name.endsWith (".cc")
+          || m_file_name.endsWith (".cpp")
+          || m_file_name.endsWith (".cxx")
+          || m_file_name.endsWith (".c++")
+          || m_file_name.endsWith (".h")
+          || m_file_name.endsWith (".hh")
+          || m_file_name.endsWith (".hpp")
+          || m_file_name.endsWith (".h++"))
+        {
+          lexer = new QsciLexerCPP ();
+        }
+      else if (m_file_name.endsWith (".java"))
+        {
+          lexer = new QsciLexerJava ();
+        }
+      else if (m_file_name.endsWith (".pl"))
+        {
+          lexer = new QsciLexerPerl ();
+        }
+      else if (m_file_name.endsWith (".bat"))
+        {
+          lexer = new QsciLexerBatch ();
+        }
+      else if (m_file_name.endsWith (".diff"))
+        {
+          lexer = new QsciLexerDiff ();
+        }
+      else if (m_file_name.endsWith (".sh"))
+        {
+          lexer = new QsciLexerBash ();
+        }
+      else if (! valid_file_name ())
+        {
+          // new, not yet named file: let us assume it is octave
 #if defined (HAVE_LEXER_OCTAVE)
-        lexer = new QsciLexerOctave ();
+          lexer = new QsciLexerOctave ();
+          m_is_octave_file = true;
 #elif defined (HAVE_LEXER_MATLAB)
-        lexer = new QsciLexerMatlab ();
+          lexer = new QsciLexerMatlab ();
+          m_is_octave_file = true;
 #else
-        lexer = new octave_txt_lexer ();
-#endif
-        m_is_octave_file = true;
-      }
-
-    if (! lexer)
-      {
-        if (m_file_name.endsWith (".c")
-            || m_file_name.endsWith (".cc")
-            || m_file_name.endsWith (".cpp")
-            || m_file_name.endsWith (".cxx")
-            || m_file_name.endsWith (".c++")
-            || m_file_name.endsWith (".h")
-            || m_file_name.endsWith (".hh")
-            || m_file_name.endsWith (".hpp")
-            || m_file_name.endsWith (".h++"))
-          {
-            lexer = new QsciLexerCPP ();
-          }
-        else if (m_file_name.endsWith (".java"))
-          {
-            lexer = new QsciLexerJava ();
-          }
-        else if (m_file_name.endsWith (".pl"))
-          {
-            lexer = new QsciLexerPerl ();
-          }
-        else if (m_file_name.endsWith (".bat"))
-          {
-            lexer = new QsciLexerBatch ();
-          }
-        else if (m_file_name.endsWith (".diff"))
-          {
-            lexer = new QsciLexerDiff ();
-          }
-        else if (m_file_name.endsWith (".sh"))
-          {
-            lexer = new QsciLexerBash ();
-          }
-        else if (! valid_file_name ())
-          {
-            // new, not yet named file: let us assume it is octave
-#if defined (HAVE_LEXER_OCTAVE)
-            lexer = new QsciLexerOctave ();
-            m_is_octave_file = true;
-#elif defined (HAVE_LEXER_MATLAB)
-            lexer = new QsciLexerMatlab ();
-            m_is_octave_file = true;
-#else
-            lexer = new octave_txt_lexer ();
+          lexer = new octave_txt_lexer ();
 #endif
-          }
-        else
-          {
-            // other or no extension
-            lexer = new octave_txt_lexer ();
-          }
-      }
-
-    // Get any existing lexer
-    QsciLexer *old_lexer = m_edit_area->lexer ();
-
-    // If new file, no lexer, or lexer has changed,
-    // delete old one and set the newly created as current lexer
-    if (! old_lexer || ! valid_file_name ()
-        || QString(old_lexer->lexer ()) != QString(lexer->lexer ()))
-      {
-        // Delete and set new lexer
-        if (old_lexer)
-          delete old_lexer;
-        m_edit_area->setLexer (lexer);
-
-        // Build information for auto completion (APIs)
-        m_lexer_apis = new QsciAPIs (lexer);
-
-        connect (this, &file_editor_tab::request_add_octave_apis,
-                 this, &file_editor_tab::handle_add_octave_apis);
-
-        // Get the settings for this new lexer
-        update_lexer_settings ();
-      }
-    else
-      {
-        // Otherwise, delete the newly created lexer and
-        // use the old, existing one.
-        delete lexer;
-      }
-  }
-
-  // Update settings, which are lexer related and have to be updated
-  // when
-  //    a) the lexer changes,
-  //    b) the settings have changed, or
-  //    c) a package was loaded/unloaded
-  void file_editor_tab::update_lexer_settings (bool update_apis_only)
-  {
-    QsciLexer *lexer = m_edit_area->lexer ();
-
-    gui_settings settings;
-
-    if (m_lexer_apis)
-      {
-        m_lexer_apis->cancelPreparation ();  // stop preparing if apis exists
-
-        bool update_apis = false;  // flag, whether update of apis files
-
-        // Get path to prepared api info (cache).  Temporarily set the
-        // application name to 'octave' instead of 'GNU Octave' name for
-        // not having blanks in the path.
-        QString tmp_app_name = QCoreApplication::applicationName ();
-        QCoreApplication::setApplicationName ("octave");  // Set new name
+        }
+      else
+        {
+          // other or no extension
+          lexer = new octave_txt_lexer ();
+        }
+    }
+
+  // Get any existing lexer
+  QsciLexer *old_lexer = m_edit_area->lexer ();
+
+  // If new file, no lexer, or lexer has changed,
+  // delete old one and set the newly created as current lexer
+  if (! old_lexer || ! valid_file_name ()
+      || QString(old_lexer->lexer ()) != QString(lexer->lexer ()))
+    {
+      // Delete and set new lexer
+      if (old_lexer)
+        delete old_lexer;
+      m_edit_area->setLexer (lexer);
+
+      // Build information for auto completion (APIs)
+      m_lexer_apis = new QsciAPIs (lexer);
+
+      connect (this, &file_editor_tab::request_add_octave_apis,
+               this, &file_editor_tab::handle_add_octave_apis);
+
+      // Get the settings for this new lexer
+      update_lexer_settings ();
+    }
+  else
+    {
+      // Otherwise, delete the newly created lexer and
+      // use the old, existing one.
+      delete lexer;
+    }
+}
+
+// Update settings, which are lexer related and have to be updated
+// when
+//    a) the lexer changes,
+//    b) the settings have changed, or
+//    c) a package was loaded/unloaded
+void file_editor_tab::update_lexer_settings (bool update_apis_only)
+{
+  QsciLexer *lexer = m_edit_area->lexer ();
+
+  gui_settings settings;
+
+  if (m_lexer_apis)
+    {
+      m_lexer_apis->cancelPreparation ();  // stop preparing if apis exists
+
+      bool update_apis = false;  // flag, whether update of apis files
+
+      // Get path to prepared api info (cache).  Temporarily set the
+      // application name to 'octave' instead of 'GNU Octave' name for
+      // not having blanks in the path.
+      QString tmp_app_name = QCoreApplication::applicationName ();
+      QCoreApplication::setApplicationName ("octave");  // Set new name
 
 #if defined (HAVE_QSTANDARDPATHS)
-        QString local_data_path
-          = QStandardPaths::writableLocation (QStandardPaths::CacheLocation);
+      QString local_data_path
+        = QStandardPaths::writableLocation (QStandardPaths::CacheLocation);
 #else
-        QString local_data_path
-          = QDesktopServices::storageLocation (QDesktopServices::CacheLocation);
+      QString local_data_path
+        = QDesktopServices::storageLocation (QDesktopServices::CacheLocation);
 #endif
 
-        QCoreApplication::setApplicationName ("octave");  // Set temp. name
-
-        m_prep_apis_path
-          = local_data_path + "/" + QString (OCTAVE_VERSION) + "/qsci/";
-
-        // get settings which infos are used for octave
-        bool octave_builtins
-          = settings.bool_value (ed_code_completion_octave_builtins);
-        bool octave_functions
-          = settings.bool_value (ed_code_completion_octave_functions);
-
-        QCoreApplication::setApplicationName (tmp_app_name);  // Restore name
-
-        if (m_is_octave_file)
-          {
-            // Keywords and Builtins do not change, this information can be
-            // stored in prepared form in a file. Information on function are
-            // changing frequently, then if functions should also be auto-
-            // completed, the date of any existing file is checked.
-
-            // Keywords are always used
-            m_prep_apis_file = m_prep_apis_path + lexer->lexer () + "_k";
-
-            // Builtins are only used if the user settings say so
-            if (octave_builtins)
-              m_prep_apis_file += 'b';
-
-            if (octave_functions)
-              m_prep_apis_file += 'f';
-
-            m_prep_apis_file += ".pap"; // final name of apis file
-
-            // check whether the APIs info needs to be prepared and saved
-            QFileInfo apis_file = QFileInfo (m_prep_apis_file);
-
-            // flag whether apis file needs update
-            update_apis = ! apis_file.exists ();
-
-            if (octave_functions)
-              {
-                // Functions may change frequently.  Update the apis data
-                // if the file is older than a few minutes preventing from
-                // re-preparing data when the user opens several files.
-                QDateTime apis_time = apis_file.lastModified ();
-                if (update_apis_only
-                    || QDateTime::currentDateTime () > apis_time.addSecs (180))
-                  update_apis = true;
-              }
-
-          }
-        else
-          {
-            // No octave file, just add extension.
-            m_prep_apis_file = m_prep_apis_path + lexer->lexer () + ".pap";
-          }
-
-        // Make sure the apis file is usable, otherwise the gui might crash,
-        // e.g., in case of max. number of opened files
-        QFile f (m_prep_apis_file);
-
-        bool apis_usable = f.open (QIODevice::ReadOnly);
-        if (! apis_usable)
-          {
-            QDir ().mkpath (QFileInfo (f).absolutePath ());
-            apis_usable = f.open (QIODevice::WriteOnly);
-          }
-        if (apis_usable)
-          f.close ();
-
-        if (apis_usable
-            && (update_apis || ! m_lexer_apis->loadPrepared (m_prep_apis_file)))
-          {
-            // either we have decided to update the apis file or
-            // no prepared info was loaded, prepare and save if possible
-
-            // create raw apis info
-
-            m_lexer_apis->clear (); // Clear current contents
-
-            if (m_is_octave_file)
-              {
-                // The interpreter_event callback function below emits a
-                // signal.  Because we don't control when that happens,
-                // use a guarded pointer so that the callback can abort
-                // if this object is no longer valid.
-
-                QPointer<file_editor_tab> this_fetab (this);
-
-                emit interpreter_event
-                  ([=] (interpreter& interp)
-                   {
-                     // INTERPRETER THREAD
-
-                     // We can skip the entire callback function because
-                     // it does not make any changes to the interpreter
-                     // state.
-
-                     if (this_fetab.isNull ())
-                       return;
-
-                     QStringList api_entries;
-
-                     octave_value_list tmp = Fiskeyword ();
-                     const Cell ctmp = tmp(0).cell_value ();
-                     for (octave_idx_type i = 0; i < ctmp.numel (); i++)
-                       {
-                         std::string kw = ctmp(i).string_value ();
-                         api_entries.append (QString::fromStdString (kw));
-                       }
-
-                     if (octave_builtins)
-                       {
-                         symbol_table& symtab = interp.get_symbol_table ();
-
-                         string_vector bfl = symtab.built_in_function_names ();
-
-                         for (octave_idx_type i = 0; i < bfl.numel (); i++)
-                           api_entries.append (QString::fromStdString (bfl[i]));
-                       }
-
-                     if (octave_functions)
-                       {
-                         load_path& lp = interp.get_load_path ();
-
-                         string_vector ffl = lp.fcn_names ();
-                         string_vector afl = interp.autoloaded_functions ();
-
-                         for (octave_idx_type i = 0; i < ffl.numel (); i++)
-                           api_entries.append (QString::fromStdString (ffl[i]));
-
-                         for (octave_idx_type i = 0; i < afl.numel (); i++)
-                           api_entries.append (QString::fromStdString (afl[i]));
-                       }
-
-                     emit request_add_octave_apis (api_entries);
-                   });
-              }
-            else
-              {
-                for (int i = 1; i <= 3; i++)
-                  {
-                    // Get list, split, and add to API.
-
-                    QString keyword = QString (lexer->keywords (i));
-
-                    QStringList keyword_list
-                      = keyword.split (QRegExp (R"(\s+)"));
-
-                    for (int j = 0; j < keyword_list.size (); j++)
-                      m_lexer_apis->add (keyword_list.at (j));
-                  }
-
-                emit api_entries_added ();
-              }
-          }
-      }
-
-    if (update_apis_only)
-      return;   // We are done here
-
-    int mode = settings.int_value (ed_color_mode);
-    settings.read_lexer_settings (lexer, mode);
-
-    m_edit_area->setCaretForegroundColor (lexer->color (0));
-    m_edit_area->setIndentationGuidesForegroundColor (lexer->color (0));
-
-    // set some colors depending on selected background color of the lexer
-    QColor bg = lexer->paper (0);
-    QColor fg = lexer->color (0);
-
-    // margin and current line marker colors
-    QColor bgm, fgm;
-
-    bgm = interpolate_color (bg, fg, 0.5, 0.2);
-    m_edit_area->setEdgeColor (bgm);
-
-    m_edit_area->setMarkerForegroundColor (lexer->color (0));
-    m_edit_area->setMarginsForegroundColor (lexer->color (0));
-
-    bgm = interpolate_color (bg, fg, 0.5, 0.125);
-    fgm = interpolate_color (bg, fg, 0.5, 0.25);
-    m_edit_area->setMarginsBackgroundColor (bgm);
-    m_edit_area->setFoldMarginColors (bgm, fgm);
-
-    QColor current_line_bg
-      = settings.color_value (ed_highlight_current_line_color, mode);
-    if (current_line_bg == settings_color_no_change)
-       bgm = interpolate_color (bg, fg, 0.5, 0.1);  // It is the "auto" color
-     else
-       bgm = current_line_bg;  // Specific color given
-
-    m_edit_area->setCaretLineBackgroundColor (bgm);
-
-    // color indicator for highlighting all occurrences:
-    // applications highlight color with more transparency
-    QColor hg = QApplication::palette ().color (QPalette::Highlight);
-    m_edit_area->set_selection_marker_color (hg);
-
-    // fix line number width with respect to the font size of the lexer and
-    // set the line numbers font depending on the lexer's font
-    if (settings.bool_value (ed_show_line_numbers))
-      {
-        // Line numbers width
-        auto_margin_width ();
-
-        // Line numbers font
-        QFont line_numbers_font = lexer->defaultFont ();
-        int font_size = line_numbers_font.pointSize ();
-        font_size = font_size
-                    + settings.int_value (ed_line_numbers_size);
-        if (font_size < 4)
-          font_size = 4;
-        line_numbers_font.setPointSize (font_size);
-
-        m_edit_area->setMarginsFont (line_numbers_font);
-      }
-    else
-      m_edit_area->setMarginWidth (2, 0);
-  }
-
-  // function for adding entries to the octave lexer's APIs
-  void file_editor_tab::handle_add_octave_apis (const QStringList& api_entries)
-  {
-    for (int idx = 0; idx < api_entries.size (); idx++)
-      m_lexer_apis->add (api_entries.at (idx));
-
-    emit api_entries_added ();
-  }
-
-  void file_editor_tab::handle_api_entries_added ()
-  {
-    // disconnect slot for saving prepared info if already connected
-    disconnect (m_lexer_apis, &QsciAPIs::apiPreparationFinished,
-                nullptr, nullptr);
-
-    // check whether path for prepared info exists or can be created
-    if (QDir ("/").mkpath (m_prep_apis_path))
-      {
-        // path exists, apis info can be saved there
-        connect (m_lexer_apis, &QsciAPIs::apiPreparationFinished,
-                 this, &file_editor_tab::save_apis_info);
-      }
-
-    m_lexer_apis->prepare ();  // prepare apis info
-  }
-
-  void file_editor_tab::save_apis_info ()
-  {
-    m_lexer_apis->savePrepared (m_prep_apis_file);
-  }
-
-  // slot for fetab_set_focus: sets the focus to the current edit area
-  void file_editor_tab::set_focus (const QWidget *ID)
-  {
-    if (ID != this)
-      return;
-    m_edit_area->setFocus ();
-    emit edit_area_changed (m_edit_area); // update the edit area in find dlg
-  }
-
-  void file_editor_tab::context_help (const QWidget *ID, bool doc)
-  {
-    if (ID != this)
-      return;
-
-    m_edit_area->context_help_doc (doc);
-  }
-
-  void file_editor_tab::context_edit (const QWidget *ID)
-  {
-    if (ID != this)
-      return;
-
-    m_edit_area->context_edit ();
-  }
-
-  void file_editor_tab::save_file (const QWidget *ID)
-  {
-    if (ID != this)
-      return;
-
-    save_file (m_file_name);
-  }
-
-  void file_editor_tab::save_file (const QWidget *ID, const QString& fileName,
-                                   bool remove_on_success)
-  {
-    if (ID != this)
-      return;
-
-    save_file (fileName, remove_on_success);
-  }
-
-  void file_editor_tab::save_file_as (const QWidget *ID)
-  {
-    if (ID != this)
-      return;
-
-    save_file_as ();
-  }
-
-  void file_editor_tab::print_file (const QWidget *ID)
-  {
-    if (ID != this)
-      return;
-
-    QsciPrinter *printer = new QsciPrinter (QPrinter::HighResolution);
-
-    QPrintDialog printDlg (printer, this);
-
-    if (printDlg.exec () == QDialog::Accepted)
-      printer->printRange (m_edit_area);
-
-    delete printer;
-  }
-
-  void file_editor_tab::run_file (const QWidget *ID, bool step_into)
-  {
-    if (ID != this)
-      return;
-
-    if (m_edit_area->isModified () || ! valid_file_name ())
-      {
-        save_file (m_file_name);  // save file dialog
-
-        // Running a file is disabled for non-octave files. But when saving
-        // a new file, an octave file is assumed but might actually saved
-        // as another file or with an invalid file name.
-        if (! (m_is_octave_file && valid_file_name ()))
-          return;
-      }
-
-    if (step_into)
-      {
-        // Get current first breakpoint and set breakpoint waiting for
-        // the returned line number.  Store whether to remove this breakpoint
-        // afterwards.
-        int first_bp_line
-          = m_edit_area->markerFindNext (0, (1 << marker::breakpoint)) + 1;
-
-        // Set flag for storing the line number of the breakpoint
-        m_breakpoint_info.remove_next = true;
-        m_breakpoint_info.do_not_remove_line = first_bp_line;
-
-        // Add breakpoint, storing its line number
-        handle_request_add_breakpoint (1, QString ());
-      }
-
-    QFileInfo info (m_file_name);
-    emit run_file_signal (info);
-  }
-
-  void file_editor_tab::context_run (const QWidget *ID)
-  {
-    if (ID != this)
-      return;
-
-    m_edit_area->context_run ();
-  }
-
-  void file_editor_tab::toggle_bookmark (const QWidget *ID)
-  {
-    if (ID != this)
-      return;
-
-    int line, cur;
-    m_edit_area->getCursorPosition (&line, &cur);
-
-    if (m_edit_area->markersAtLine (line) & (1 << marker::bookmark))
-      m_edit_area->markerDelete (line, marker::bookmark);
-    else
-      m_edit_area->markerAdd (line, marker::bookmark);
-  }
-
-  // Move the text cursor to the closest bookmark
-  // after the current line.
-  void file_editor_tab::next_bookmark (const QWidget *ID)
-  {
-    if (ID != this)
-      return;
-
-    int line, cur;
-    m_edit_area->getCursorPosition (&line, &cur);
-
-    line++; // Find bookmark strictly after the current line.
-
-    int nextline = m_edit_area->markerFindNext (line, (1 << marker::bookmark));
-
-    // Wrap.
-    if (nextline == -1)
-      nextline = m_edit_area->markerFindNext (1, (1 << marker::bookmark));
-
-    m_edit_area->setCursorPosition (nextline, 0);
-  }
-
-  // Move the text cursor to the closest bookmark
-  // before the current line.
-  void file_editor_tab::previous_bookmark (const QWidget *ID)
-  {
-    if (ID != this)
-      return;
-
-    int line, cur;
-    m_edit_area->getCursorPosition (&line, &cur);
-
-    line--; // Find bookmark strictly before the current line.
-
-    int prevline = m_edit_area->markerFindPrevious (line, (1 << marker::bookmark));
-
-    // Wrap.  Should use the last line of the file, not 1<<15
-    if (prevline == -1)
-      prevline = m_edit_area->markerFindPrevious (m_edit_area->lines (),
-                                                 (1 << marker::bookmark));
-
-    m_edit_area->setCursorPosition (prevline, 0);
-  }
-
-  QString file_editor_tab::get_all_bookmarks ()
-  {
-    QString bmlist;
-    int line = 0;
-
-    while (line > -1)
-      {
-        line = m_edit_area->markerFindNext (line, (1 << marker::bookmark));
-        if (line > -1)
-          {
-            if (! bmlist.isEmpty ())
-              bmlist += ",";
-            bmlist += QString::number (line);
-            line++;   // search from next line, otherwise same line found again
-          }
-      }
-
-    return bmlist;
-  }
-
-  void file_editor_tab::remove_bookmark (const QWidget *ID)
-  {
-    if (ID != this)
-      return;
-
-    m_edit_area->markerDeleteAll (marker::bookmark);
-  }
-
-  void
-  file_editor_tab::handle_request_add_breakpoint (int line,
-                                                  const QString& condition)
-  {
-    if (! m_is_octave_file)
-      return;
-
-    add_breakpoint_event (line, condition);
-  }
-
-  void file_editor_tab::handle_request_remove_breakpoint (int line)
-  {
-    emit interpreter_event
-      ([=] (interpreter& interp)
-       {
-         // INTERPRETER THREAD
-
-         tree_evaluator& tw = interp.get_evaluator ();
-         bp_table& bptab = tw.get_bp_table ();
-
-         bptab.remove_breakpoint_from_file (m_file_name.toStdString (), line);
-       });
-  }
-
-  void file_editor_tab::toggle_breakpoint (const QWidget *ID)
-  {
-    if (ID != this)
-      return;
-
-    int editor_linenr, cur;
-    m_edit_area->getCursorPosition (&editor_linenr, &cur);
-
-    if (m_edit_area->markersAtLine (editor_linenr) & (1 << marker::breakpoint))
-      request_remove_breakpoint_via_editor_linenr (editor_linenr);
-    else
-      {
-        if (unchanged_or_saved ())
-          handle_request_add_breakpoint (editor_linenr + 1, "");
-      }
-  }
-
-  // Move the text cursor to the closest breakpoint (conditional or unconditional)
-  // after the current line.
-  void file_editor_tab::next_breakpoint (const QWidget *ID)
-  {
-    if (ID != this)
-      return;
-
-    int line, cur;
-    m_edit_area->getCursorPosition (&line, &cur);
-
-    line++; // Find breakpoint strictly after the current line.
-
-    int nextline = m_edit_area->markerFindNext (line, (1 << marker::breakpoint));
-    int nextcond = m_edit_area->markerFindNext (line, (1 << marker::cond_break));
-
-    // Check if the next conditional breakpoint is before next unconditional one.
-    if (nextcond != -1 && (nextcond < nextline || nextline == -1))
-      nextline = nextcond;
-
-    m_edit_area->setCursorPosition (nextline, 0);
-  }
-
-  // Move the text cursor to the closest breakpoint (conditional or unconditional)
-  // before the current line.
-  void file_editor_tab::previous_breakpoint (const QWidget *ID)
-  {
-    if (ID != this)
-      return;
-
-    int line, cur, prevline, prevcond;
-    m_edit_area->getCursorPosition (&line, &cur);
-
-    line--; // Find breakpoint strictly before the current line.
-
-    prevline = m_edit_area->markerFindPrevious (line, (1 << marker::breakpoint));
-    prevcond = m_edit_area->markerFindPrevious (line, (1 << marker::cond_break));
-
-    // Check if the prev conditional breakpoint is closer than the unconditional.
-    if (prevcond != -1 && prevcond > prevline)
-      prevline = prevcond;
-
-    m_edit_area->setCursorPosition (prevline, 0);
-  }
-
-  void file_editor_tab::remove_all_breakpoints (const QWidget *ID)
-  {
-    if (ID != this)
-      return;
-
-    emit interpreter_event
-      ([=] (interpreter& interp)
-       {
-         // INTERPRETER THREAD
-
-         tree_evaluator& tw = interp.get_evaluator ();
-         bp_table& bptab = tw.get_bp_table ();
-
-         bptab.remove_all_breakpoints_from_file (m_file_name.toStdString (),
-                                                 true);
-       });
-  }
-
-  void file_editor_tab::scintilla_command (const QWidget *ID,
-                                           unsigned int sci_msg)
-  {
-    if (ID != this)
-      return;
-
-    m_edit_area->SendScintilla (sci_msg);
-  }
-
-  void file_editor_tab::comment_selected_text (const QWidget *ID,
-                                               bool input_str)
-  {
-    if (ID != this)
-      return;
-
-    do_comment_selected_text (true, input_str);
-  }
-
-  void file_editor_tab::uncomment_selected_text (const QWidget *ID)
-  {
-    if (ID != this)
-      return;
-
-    do_comment_selected_text (false);
-  }
-
-  void file_editor_tab::indent_selected_text (const QWidget *ID)
-  {
-    if (ID != this)
-      return;
-
-    do_indent_selected_text (true);
-  }
-
-  void file_editor_tab::unindent_selected_text (const QWidget *ID)
-  {
-    if (ID != this)
-      return;
-
-    do_indent_selected_text (false);
-  }
-
-  void file_editor_tab::smart_indent_line_or_selected_text (const QWidget *ID)
-  {
-    if (ID != this)
-      return;
-
-    do_smart_indent_line_or_selected_text ();
-  }
-
-  void file_editor_tab::convert_eol (const QWidget *ID,
-                                     QsciScintilla::EolMode eol_mode)
-  {
-    if (ID != this)
-      return;
-
-    m_edit_area->convertEols (eol_mode);
-    m_edit_area->setEolMode (eol_mode);
-    update_eol_indicator ();
-  }
-
-  void file_editor_tab::zoom_in (const QWidget *ID)
-  {
-    if (ID != this)
-      return;
-
-    m_edit_area->zoomIn (1);
-    auto_margin_width ();
-  }
-
-  void file_editor_tab::zoom_out (const QWidget *ID)
-  {
-    if (ID != this)
-      return;
-
-    m_edit_area->zoomOut (1);
-    auto_margin_width ();
-  }
-
-  void file_editor_tab::zoom_normal (const QWidget *ID)
-  {
-    if (ID != this)
+      QCoreApplication::setApplicationName ("octave");  // Set temp. name
+
+      m_prep_apis_path
+        = local_data_path + "/" + QString (OCTAVE_VERSION) + "/qsci/";
+
+      // get settings which infos are used for octave
+      bool octave_builtins
+        = settings.bool_value (ed_code_completion_octave_builtins);
+      bool octave_functions
+        = settings.bool_value (ed_code_completion_octave_functions);
+
+      QCoreApplication::setApplicationName (tmp_app_name);  // Restore name
+
+      if (m_is_octave_file)
+        {
+          // Keywords and Builtins do not change, this information can be
+          // stored in prepared form in a file. Information on function are
+          // changing frequently, then if functions should also be auto-
+          // completed, the date of any existing file is checked.
+
+          // Keywords are always used
+          m_prep_apis_file = m_prep_apis_path + lexer->lexer () + "_k";
+
+          // Builtins are only used if the user settings say so
+          if (octave_builtins)
+            m_prep_apis_file += 'b';
+
+          if (octave_functions)
+            m_prep_apis_file += 'f';
+
+          m_prep_apis_file += ".pap"; // final name of apis file
+
+          // check whether the APIs info needs to be prepared and saved
+          QFileInfo apis_file = QFileInfo (m_prep_apis_file);
+
+          // flag whether apis file needs update
+          update_apis = ! apis_file.exists ();
+
+          if (octave_functions)
+            {
+              // Functions may change frequently.  Update the apis data
+              // if the file is older than a few minutes preventing from
+              // re-preparing data when the user opens several files.
+              QDateTime apis_time = apis_file.lastModified ();
+              if (update_apis_only
+                  || QDateTime::currentDateTime () > apis_time.addSecs (180))
+                update_apis = true;
+            }
+
+        }
+      else
+        {
+          // No octave file, just add extension.
+          m_prep_apis_file = m_prep_apis_path + lexer->lexer () + ".pap";
+        }
+
+      // Make sure the apis file is usable, otherwise the gui might crash,
+      // e.g., in case of max. number of opened files
+      QFile f (m_prep_apis_file);
+
+      bool apis_usable = f.open (QIODevice::ReadOnly);
+      if (! apis_usable)
+        {
+          QDir ().mkpath (QFileInfo (f).absolutePath ());
+          apis_usable = f.open (QIODevice::WriteOnly);
+        }
+      if (apis_usable)
+        f.close ();
+
+      if (apis_usable
+          && (update_apis || ! m_lexer_apis->loadPrepared (m_prep_apis_file)))
+        {
+          // either we have decided to update the apis file or
+          // no prepared info was loaded, prepare and save if possible
+
+          // create raw apis info
+
+          m_lexer_apis->clear (); // Clear current contents
+
+          if (m_is_octave_file)
+            {
+              // The interpreter_event callback function below emits a
+              // signal.  Because we don't control when that happens,
+              // use a guarded pointer so that the callback can abort
+              // if this object is no longer valid.
+
+              QPointer<file_editor_tab> this_fetab (this);
+
+              emit interpreter_event
+                ([=] (interpreter& interp)
+                 {
+                   // INTERPRETER THREAD
+
+                   // We can skip the entire callback function because
+                   // it does not make any changes to the interpreter
+                   // state.
+
+                   if (this_fetab.isNull ())
+                     return;
+
+                   QStringList api_entries;
+
+                   octave_value_list tmp = Fiskeyword ();
+                   const Cell ctmp = tmp(0).cell_value ();
+                   for (octave_idx_type i = 0; i < ctmp.numel (); i++)
+                     {
+                       std::string kw = ctmp(i).string_value ();
+                       api_entries.append (QString::fromStdString (kw));
+                     }
+
+                   if (octave_builtins)
+                     {
+                       symbol_table& symtab = interp.get_symbol_table ();
+
+                       string_vector bfl = symtab.built_in_function_names ();
+
+                       for (octave_idx_type i = 0; i < bfl.numel (); i++)
+                         api_entries.append (QString::fromStdString (bfl[i]));
+                     }
+
+                   if (octave_functions)
+                     {
+                       load_path& lp = interp.get_load_path ();
+
+                       string_vector ffl = lp.fcn_names ();
+                       string_vector afl = interp.autoloaded_functions ();
+
+                       for (octave_idx_type i = 0; i < ffl.numel (); i++)
+                         api_entries.append (QString::fromStdString (ffl[i]));
+
+                       for (octave_idx_type i = 0; i < afl.numel (); i++)
+                         api_entries.append (QString::fromStdString (afl[i]));
+                     }
+
+                   emit request_add_octave_apis (api_entries);
+                 });
+            }
+          else
+            {
+              for (int i = 1; i <= 3; i++)
+                {
+                  // Get list, split, and add to API.
+
+                  QString keyword = QString (lexer->keywords (i));
+
+                  QStringList keyword_list
+                    = keyword.split (QRegExp (R"(\s+)"));
+
+                  for (int j = 0; j < keyword_list.size (); j++)
+                    m_lexer_apis->add (keyword_list.at (j));
+                }
+
+              emit api_entries_added ();
+            }
+        }
+    }
+
+  if (update_apis_only)
+    return;   // We are done here
+
+  int mode = settings.int_value (ed_color_mode);
+  settings.read_lexer_settings (lexer, mode);
+
+  m_edit_area->setCaretForegroundColor (lexer->color (0));
+  m_edit_area->setIndentationGuidesForegroundColor (lexer->color (0));
+
+  // set some colors depending on selected background color of the lexer
+  QColor bg = lexer->paper (0);
+  QColor fg = lexer->color (0);
+
+  // margin and current line marker colors
+  QColor bgm, fgm;
+
+  bgm = interpolate_color (bg, fg, 0.5, 0.2);
+  m_edit_area->setEdgeColor (bgm);
+
+  m_edit_area->setMarkerForegroundColor (lexer->color (0));
+  m_edit_area->setMarginsForegroundColor (lexer->color (0));
+
+  bgm = interpolate_color (bg, fg, 0.5, 0.125);
+  fgm = interpolate_color (bg, fg, 0.5, 0.25);
+  m_edit_area->setMarginsBackgroundColor (bgm);
+  m_edit_area->setFoldMarginColors (bgm, fgm);
+
+  QColor current_line_bg
+    = settings.color_value (ed_highlight_current_line_color, mode);
+  if (current_line_bg == settings_color_no_change)
+     bgm = interpolate_color (bg, fg, 0.5, 0.1);  // It is the "auto" color
+   else
+     bgm = current_line_bg;  // Specific color given
+
+  m_edit_area->setCaretLineBackgroundColor (bgm);
+
+  // color indicator for highlighting all occurrences:
+  // applications highlight color with more transparency
+  QColor hg = QApplication::palette ().color (QPalette::Highlight);
+  m_edit_area->set_selection_marker_color (hg);
+
+  // fix line number width with respect to the font size of the lexer and
+  // set the line numbers font depending on the lexer's font
+  if (settings.bool_value (ed_show_line_numbers))
+    {
+      // Line numbers width
+      auto_margin_width ();
+
+      // Line numbers font
+      QFont line_numbers_font = lexer->defaultFont ();
+      int font_size = line_numbers_font.pointSize ();
+      font_size = font_size
+                  + settings.int_value (ed_line_numbers_size);
+      if (font_size < 4)
+        font_size = 4;
+      line_numbers_font.setPointSize (font_size);
+
+      m_edit_area->setMarginsFont (line_numbers_font);
+    }
+  else
+    m_edit_area->setMarginWidth (2, 0);
+}
+
+// function for adding entries to the octave lexer's APIs
+void file_editor_tab::handle_add_octave_apis (const QStringList& api_entries)
+{
+  for (int idx = 0; idx < api_entries.size (); idx++)
+    m_lexer_apis->add (api_entries.at (idx));
+
+  emit api_entries_added ();
+}
+
+void file_editor_tab::handle_api_entries_added ()
+{
+  // disconnect slot for saving prepared info if already connected
+  disconnect (m_lexer_apis, &QsciAPIs::apiPreparationFinished,
+              nullptr, nullptr);
+
+  // check whether path for prepared info exists or can be created
+  if (QDir ("/").mkpath (m_prep_apis_path))
+    {
+      // path exists, apis info can be saved there
+      connect (m_lexer_apis, &QsciAPIs::apiPreparationFinished,
+               this, &file_editor_tab::save_apis_info);
+    }
+
+  m_lexer_apis->prepare ();  // prepare apis info
+}
+
+void file_editor_tab::save_apis_info ()
+{
+  m_lexer_apis->savePrepared (m_prep_apis_file);
+}
+
+// slot for fetab_set_focus: sets the focus to the current edit area
+void file_editor_tab::set_focus (const QWidget *ID)
+{
+  if (ID != this)
+    return;
+  m_edit_area->setFocus ();
+  emit edit_area_changed (m_edit_area); // update the edit area in find dlg
+}
+
+void file_editor_tab::context_help (const QWidget *ID, bool doc)
+{
+  if (ID != this)
+    return;
+
+  m_edit_area->context_help_doc (doc);
+}
+
+void file_editor_tab::context_edit (const QWidget *ID)
+{
+  if (ID != this)
+    return;
+
+  m_edit_area->context_edit ();
+}
+
+void file_editor_tab::save_file (const QWidget *ID)
+{
+  if (ID != this)
+    return;
+
+  save_file (m_file_name);
+}
+
+void file_editor_tab::save_file (const QWidget *ID, const QString& fileName,
+                                 bool remove_on_success)
+{
+  if (ID != this)
+    return;
+
+  save_file (fileName, remove_on_success);
+}
+
+void file_editor_tab::save_file_as (const QWidget *ID)
+{
+  if (ID != this)
+    return;
+
+  save_file_as ();
+}
+
+void file_editor_tab::print_file (const QWidget *ID)
+{
+  if (ID != this)
+    return;
+
+  QsciPrinter *printer = new QsciPrinter (QPrinter::HighResolution);
+
+  QPrintDialog printDlg (printer, this);
+
+  if (printDlg.exec () == QDialog::Accepted)
+    printer->printRange (m_edit_area);
+
+  delete printer;
+}
+
+void file_editor_tab::run_file (const QWidget *ID, bool step_into)
+{
+  if (ID != this)
+    return;
+
+  if (m_edit_area->isModified () || ! valid_file_name ())
+    {
+      save_file (m_file_name);  // save file dialog
+
+      // Running a file is disabled for non-octave files. But when saving
+      // a new file, an octave file is assumed but might actually saved
+      // as another file or with an invalid file name.
+      if (! (m_is_octave_file && valid_file_name ()))
+        return;
+    }
+
+  if (step_into)
+    {
+      // Get current first breakpoint and set breakpoint waiting for
+      // the returned line number.  Store whether to remove this breakpoint
+      // afterwards.
+      int first_bp_line
+        = m_edit_area->markerFindNext (0, (1 << marker::breakpoint)) + 1;
+
+      // Set flag for storing the line number of the breakpoint
+      m_breakpoint_info.remove_next = true;
+      m_breakpoint_info.do_not_remove_line = first_bp_line;
+
+      // Add breakpoint, storing its line number
+      handle_request_add_breakpoint (1, QString ());
+    }
+
+  QFileInfo info (m_file_name);
+  emit run_file_signal (info);
+}
+
+void file_editor_tab::context_run (const QWidget *ID)
+{
+  if (ID != this)
+    return;
+
+  m_edit_area->context_run ();
+}
+
+void file_editor_tab::toggle_bookmark (const QWidget *ID)
+{
+  if (ID != this)
+    return;
+
+  int line, cur;
+  m_edit_area->getCursorPosition (&line, &cur);
+
+  if (m_edit_area->markersAtLine (line) & (1 << marker::bookmark))
+    m_edit_area->markerDelete (line, marker::bookmark);
+  else
+    m_edit_area->markerAdd (line, marker::bookmark);
+}
+
+// Move the text cursor to the closest bookmark
+// after the current line.
+void file_editor_tab::next_bookmark (const QWidget *ID)
+{
+  if (ID != this)
+    return;
+
+  int line, cur;
+  m_edit_area->getCursorPosition (&line, &cur);
+
+  line++; // Find bookmark strictly after the current line.
+
+  int nextline = m_edit_area->markerFindNext (line, (1 << marker::bookmark));
+
+  // Wrap.
+  if (nextline == -1)
+    nextline = m_edit_area->markerFindNext (1, (1 << marker::bookmark));
+
+  m_edit_area->setCursorPosition (nextline, 0);
+}
+
+// Move the text cursor to the closest bookmark
+// before the current line.
+void file_editor_tab::previous_bookmark (const QWidget *ID)
+{
+  if (ID != this)
+    return;
+
+  int line, cur;
+  m_edit_area->getCursorPosition (&line, &cur);
+
+  line--; // Find bookmark strictly before the current line.
+
+  int prevline = m_edit_area->markerFindPrevious (line, (1 << marker::bookmark));
+
+  // Wrap.  Should use the last line of the file, not 1<<15
+  if (prevline == -1)
+    prevline = m_edit_area->markerFindPrevious (m_edit_area->lines (),
+                                               (1 << marker::bookmark));
+
+  m_edit_area->setCursorPosition (prevline, 0);
+}
+
+QString file_editor_tab::get_all_bookmarks ()
+{
+  QString bmlist;
+  int line = 0;
+
+  while (line > -1)
+    {
+      line = m_edit_area->markerFindNext (line, (1 << marker::bookmark));
+      if (line > -1)
+        {
+          if (! bmlist.isEmpty ())
+            bmlist += ",";
+          bmlist += QString::number (line);
+          line++;   // search from next line, otherwise same line found again
+        }
+    }
+
+  return bmlist;
+}
+
+void file_editor_tab::remove_bookmark (const QWidget *ID)
+{
+  if (ID != this)
+    return;
+
+  m_edit_area->markerDeleteAll (marker::bookmark);
+}
+
+void
+file_editor_tab::handle_request_add_breakpoint (int line,
+                                                const QString& condition)
+{
+  if (! m_is_octave_file)
+    return;
+
+  add_breakpoint_event (line, condition);
+}
+
+void file_editor_tab::handle_request_remove_breakpoint (int line)
+{
+  emit interpreter_event
+    ([=] (interpreter& interp)
+     {
+       // INTERPRETER THREAD
+
+       tree_evaluator& tw = interp.get_evaluator ();
+       bp_table& bptab = tw.get_bp_table ();
+
+       bptab.remove_breakpoint_from_file (m_file_name.toStdString (), line);
+     });
+}
+
+void file_editor_tab::toggle_breakpoint (const QWidget *ID)
+{
+  if (ID != this)
+    return;
+
+  int editor_linenr, cur;
+  m_edit_area->getCursorPosition (&editor_linenr, &cur);
+
+  if (m_edit_area->markersAtLine (editor_linenr) & (1 << marker::breakpoint))
+    request_remove_breakpoint_via_editor_linenr (editor_linenr);
+  else
+    {
+      if (unchanged_or_saved ())
+        handle_request_add_breakpoint (editor_linenr + 1, "");
+    }
+}
+
+// Move the text cursor to the closest breakpoint (conditional or unconditional)
+// after the current line.
+void file_editor_tab::next_breakpoint (const QWidget *ID)
+{
+  if (ID != this)
+    return;
+
+  int line, cur;
+  m_edit_area->getCursorPosition (&line, &cur);
+
+  line++; // Find breakpoint strictly after the current line.
+
+  int nextline = m_edit_area->markerFindNext (line, (1 << marker::breakpoint));
+  int nextcond = m_edit_area->markerFindNext (line, (1 << marker::cond_break));
+
+  // Check if the next conditional breakpoint is before next unconditional one.
+  if (nextcond != -1 && (nextcond < nextline || nextline == -1))
+    nextline = nextcond;
+
+  m_edit_area->setCursorPosition (nextline, 0);
+}
+
+// Move the text cursor to the closest breakpoint (conditional or unconditional)
+// before the current line.
+void file_editor_tab::previous_breakpoint (const QWidget *ID)
+{
+  if (ID != this)
+    return;
+
+  int line, cur, prevline, prevcond;
+  m_edit_area->getCursorPosition (&line, &cur);
+
+  line--; // Find breakpoint strictly before the current line.
+
+  prevline = m_edit_area->markerFindPrevious (line, (1 << marker::breakpoint));
+  prevcond = m_edit_area->markerFindPrevious (line, (1 << marker::cond_break));
+
+  // Check if the prev conditional breakpoint is closer than the unconditional.
+  if (prevcond != -1 && prevcond > prevline)
+    prevline = prevcond;
+
+  m_edit_area->setCursorPosition (prevline, 0);
+}
+
+void file_editor_tab::remove_all_breakpoints (const QWidget *ID)
+{
+  if (ID != this)
+    return;
+
+  emit interpreter_event
+    ([=] (interpreter& interp)
+     {
+       // INTERPRETER THREAD
+
+       tree_evaluator& tw = interp.get_evaluator ();
+       bp_table& bptab = tw.get_bp_table ();
+
+       bptab.remove_all_breakpoints_from_file (m_file_name.toStdString (),
+                                               true);
+     });
+}
+
+void file_editor_tab::scintilla_command (const QWidget *ID,
+                                         unsigned int sci_msg)
+{
+  if (ID != this)
+    return;
+
+  m_edit_area->SendScintilla (sci_msg);
+}
+
+void file_editor_tab::comment_selected_text (const QWidget *ID,
+                                             bool input_str)
+{
+  if (ID != this)
+    return;
+
+  do_comment_selected_text (true, input_str);
+}
+
+void file_editor_tab::uncomment_selected_text (const QWidget *ID)
+{
+  if (ID != this)
+    return;
+
+  do_comment_selected_text (false);
+}
+
+void file_editor_tab::indent_selected_text (const QWidget *ID)
+{
+  if (ID != this)
+    return;
+
+  do_indent_selected_text (true);
+}
+
+void file_editor_tab::unindent_selected_text (const QWidget *ID)
+{
+  if (ID != this)
+    return;
+
+  do_indent_selected_text (false);
+}
+
+void file_editor_tab::smart_indent_line_or_selected_text (const QWidget *ID)
+{
+  if (ID != this)
+    return;
+
+  do_smart_indent_line_or_selected_text ();
+}
+
+void file_editor_tab::convert_eol (const QWidget *ID,
+                                   QsciScintilla::EolMode eol_mode)
+{
+  if (ID != this)
+    return;
+
+  m_edit_area->convertEols (eol_mode);
+  m_edit_area->setEolMode (eol_mode);
+  update_eol_indicator ();
+}
+
+void file_editor_tab::zoom_in (const QWidget *ID)
+{
+  if (ID != this)
+    return;
+
+  m_edit_area->zoomIn (1);
+  auto_margin_width ();
+}
+
+void file_editor_tab::zoom_out (const QWidget *ID)
+{
+  if (ID != this)
+    return;
+
+  m_edit_area->zoomOut (1);
+  auto_margin_width ();
+}
+
+void file_editor_tab::zoom_normal (const QWidget *ID)
+{
+  if (ID != this)
+    return;
+
+  m_edit_area->zoomTo (0);
+  auto_margin_width ();
+}
+
+void file_editor_tab::add_breakpoint_event (int line, const QString& cond)
+{
+  // The interpreter_event callback function below emits a signal.
+  // Because we don't control when that happens, use a guarded pointer
+  // so that the callback can abort if this object is no longer valid.
+
+  QPointer<file_editor_tab> this_fetab (this);
+
+  emit interpreter_event
+    ([=] (interpreter& interp)
+     {
+       // INTERPRETER THREAD
+
+       // If THIS_FETAB is no longer valid, we still want to set the
+       // breakpoint in the interpreter but we can't emit the signal
+       // associated with THIS_FETAB.
+
+       // FIXME: note duplication with the code in
+       // handle_context_menu_break_condition.
+
+       tree_evaluator& tw = interp.get_evaluator ();
+       bp_table& bptab = tw.get_bp_table ();
+
+       int lineno = bptab.add_breakpoint_in_file (m_file_name.toStdString (),
+                                                  line, cond.toStdString ());
+
+       if (this_fetab.isNull ())
+         return;
+
+       if (lineno)
+         emit maybe_remove_next (lineno);
+     });
+}
+
+void file_editor_tab::handle_remove_next (int remove_line)
+{
+  // Store some info breakpoint
+  if (m_breakpoint_info.remove_next)
+    {
+      m_breakpoint_info.remove_line = remove_line;
+      m_breakpoint_info.remove_next = false;
+    }
+}
+
+void file_editor_tab::goto_line (const QWidget *ID, int line)
+{
+  if (ID != this)
+    return;
+
+  if (m_bp_restore_count > 0)
+    {
+      // This goto-line request is invoked by restoring a breakpoint during
+      // saving the file, thus, do not go to the related line
+      m_bp_restore_count--;
       return;
-
-    m_edit_area->zoomTo (0);
-    auto_margin_width ();
-  }
-
-  void file_editor_tab::add_breakpoint_event (int line, const QString& cond)
-  {
-    // The interpreter_event callback function below emits a signal.
-    // Because we don't control when that happens, use a guarded pointer
-    // so that the callback can abort if this object is no longer valid.
-
-    QPointer<file_editor_tab> this_fetab (this);
-
-    emit interpreter_event
-      ([=] (interpreter& interp)
-       {
-         // INTERPRETER THREAD
-
-         // If THIS_FETAB is no longer valid, we still want to set the
-         // breakpoint in the interpreter but we can't emit the signal
-         // associated with THIS_FETAB.
-
-         // FIXME: note duplication with the code in
-         // handle_context_menu_break_condition.
-
-         tree_evaluator& tw = interp.get_evaluator ();
-         bp_table& bptab = tw.get_bp_table ();
-
-         int lineno = bptab.add_breakpoint_in_file (m_file_name.toStdString (),
-                                                    line, cond.toStdString ());
-
-         if (this_fetab.isNull ())
-           return;
-
-         if (lineno)
-           emit maybe_remove_next (lineno);
-       });
-  }
-
-  void file_editor_tab::handle_remove_next (int remove_line)
-  {
-    // Store some info breakpoint
-    if (m_breakpoint_info.remove_next)
-      {
-        m_breakpoint_info.remove_line = remove_line;
-        m_breakpoint_info.remove_next = false;
-      }
-  }
-
-  void file_editor_tab::goto_line (const QWidget *ID, int line)
-  {
-    if (ID != this)
-      return;
-
-    if (m_bp_restore_count > 0)
-      {
-        // This goto-line request is invoked by restoring a breakpoint during
-        // saving the file, thus, do not go to the related line
-        m_bp_restore_count--;
-        return;
-      }
-
-    if (line <= 0)  // ask for desired line
-      {
-        bool ok = false;
-        int index;
-        m_edit_area->getCursorPosition (&line, &index);
-        line = QInputDialog::getInt (m_edit_area, tr ("Goto line"),
-                                     tr ("Line number"), line+1, 1,
-                                     m_edit_area->lines (), 1, &ok);
-        if (ok)
-          m_edit_area->setCursorPosition (line-1, 0);
-      }
-    else  // go to given line without dialog
-      m_edit_area->setCursorPosition (line-1, 0);
-
-    center_current_line (false);  // only center line if at top or bottom
-  }
-
-  void file_editor_tab::move_match_brace (const QWidget *ID, bool select)
-  {
-    if (ID != this)
-      return;
-
-    if (select)
-      m_edit_area->selectToMatchingBrace ();
-    else
-      m_edit_area->moveToMatchingBrace ();
-  }
-
-  void file_editor_tab::show_auto_completion (const QWidget *ID)
-  {
-    if (ID != this)
-      return;
-
-    m_autoc_active = true;
-
-    QsciScintilla::AutoCompletionSource s = m_edit_area->autoCompletionSource ();
-    switch (s)
-      {
-      case QsciScintilla::AcsAll:
-        m_edit_area->autoCompleteFromAll ();
-        break;
-
-      case QsciScintilla::AcsAPIs:
-        m_edit_area->autoCompleteFromAPIs ();
-        break;
-
-      case QsciScintilla::AcsDocument:
-        m_edit_area->autoCompleteFromDocument ();
-        break;
-
-      case QsciScintilla::AcsNone:
-        break;
-      }
-  }
-
-  void file_editor_tab::do_indent_selected_text (bool indent)
-  {
-    // FIXME:
-    m_edit_area->beginUndoAction ();
-
-    if (m_edit_area->hasSelectedText ())
-      {
-        int lineFrom, lineTo, colFrom, colTo;
-        m_edit_area->getSelection (&lineFrom, &colFrom, &lineTo, &colTo);
-
-        if (colTo == 0)  // the beginning of last line is not selected
-          lineTo--;        // stop at line above
-
-        for (int i = lineFrom; i <= lineTo; i++)
-          {
-            if (indent)
-              m_edit_area->indent (i);
-            else
-              m_edit_area->unindent (i);
-          }
-        //set selection on (un)indented section
-        m_edit_area->setSelection (lineFrom, 0, lineTo,
-                                   m_edit_area->text (lineTo).length ()-1);
-      }
-    else
-      {
-        int cpline, col;
-        m_edit_area->getCursorPosition (&cpline, &col);
-        if (indent)
-          m_edit_area->indent (cpline);
-        else
-          m_edit_area->unindent (cpline);
-      }
-
-    m_edit_area->endUndoAction ();
-  }
-
-  void file_editor_tab::do_smart_indent_line_or_selected_text ()
-  {
-    m_edit_area->beginUndoAction ();
-
-    int lineFrom, lineTo;
-
-    if (m_edit_area->hasSelectedText ())
-      {
-        int colFrom, colTo;
-        m_edit_area->getSelection (&lineFrom, &colFrom, &lineTo, &colTo);
-
-        if (colTo == 0)  // the beginning of last line is not selected
-          lineTo--;        // stop at line above
-      }
-    else
-      {
-        int col;
-        m_edit_area->getCursorPosition (&lineFrom, &col);
-
-        lineTo = lineFrom;
-      }
-
-    m_edit_area->smart_indent_line_or_selected_text (lineFrom, lineTo);
-
-    m_edit_area->endUndoAction ();
-  }
-
-  void file_editor_tab::do_comment_selected_text (bool comment, bool input_str)
-  {
-    QRegExp rxc;
-    QString ws = "^(?:[ \\t]*)";
-    QStringList comment_str = m_edit_area->comment_string (comment);
-    QString used_comment_str = comment_str.at (0);
-
-    if (comment)
-      {
-        if (input_str)
-          {
-            bool ok;
-            gui_settings settings;
-
-            used_comment_str
-              = QInputDialog::getText (this, tr ("Comment selected text"),
-                                       tr ("Comment string to use:\n"),
-                                       QLineEdit::Normal,
-                                       settings.value (ed_last_comment_str, comment_str.at (0)).toString (),
-                                       &ok);
-
-            if ((! ok) || used_comment_str.isEmpty ())
-              return;  // No input, do nothing
-            else
-              settings.setValue (ed_last_comment_str, used_comment_str);  // Store last
-          }
-      }
-    else
-      {
-        // Uncommenting (several strings possible)
-
-        // Sort strings according their length
-        QStringList comment_str_sorted (comment_str.at (0));
-        bool inserted;
-
-        for (int i = 1; i < comment_str.length (); i++)
-          {
-            inserted = false;
-            for (int j = 0; j < comment_str_sorted.length (); j++)
-              {
-                if (comment_str.at (i).length () > comment_str_sorted.at (j).length ())
-                  {
-                    comment_str_sorted.insert (j, comment_str.at (i));
-                    inserted = true;
-                    break;
-                  }
-              }
-            if (! inserted)
-              comment_str_sorted << comment_str.at (i);
-          }
-
-        // Create regular expression
-        QString regexp;
-        for (int i = 0; i < comment_str_sorted.length (); i++)
-          {
-            if (i > 0)
-              regexp = regexp + QString ("|");
-            regexp = regexp + comment_str_sorted.at (i);
-          }
-        rxc = QRegExp (ws + "(" + regexp + ")");
-      }
-
-    // Do the commenting/uncommenting
-    int len = 0, lenc = 0;
-    m_edit_area->beginUndoAction ();
-
-    if (m_edit_area->hasSelectedText ())
-      {
-        int lineFrom, lineTo, colFrom, colTo;
-        int change_col_from = 1;
-        int change_col_to = 1;
-        bool removed;
-
-        m_edit_area->getSelection (&lineFrom, &colFrom, &lineTo, &colTo);
-
-        if (colTo == 0)  // the beginning of last line is not selected
-          lineTo--;        // stop at line above
-
-        for (int i = lineFrom; i <= lineTo; i++)
-          {
-            if (comment)
-              {
-                m_edit_area->insertAt (used_comment_str, i, 0);
-              }
-            else
-              {
-                QString line (m_edit_area->text (i));
-                if ((removed = line.contains (rxc)))
-                  {
-                    len = rxc.matchedLength ();   // complete length
-                    QString matched_text = rxc.capturedTexts ().at (0);
-                    lenc = matched_text.remove (QRegExp (ws)).length ();  // only comment string
-                    m_edit_area->setSelection (i, len-lenc, i, len);
-                    m_edit_area->removeSelectedText ();
-                  }
-
-                // handle case, where the selection remains unchanged
-                if (i == lineFrom && (colFrom < len-lenc || ! removed))
-                  change_col_from = 0;  // do not change start of selection
-                if (i == lineTo && (colTo < len-lenc || ! removed))
-                  change_col_to = 0;    // do not change end of selection
-              }
-          }
-
-        // update the selection area
-        if (comment)
-          {
-            colFrom = colFrom + lenc;   // shift start position by comment length
-            if (colTo > 0)
-              colTo = colTo + lenc;     // shift end position by comment length
-            else
-              lineTo++;                 // colTo == 0 , fully select previous line
-          }
-        else
-          {
-            if (colTo == 0)
-              lineTo++;                 // colTo == 0 , fully select previous line
-            colFrom = colFrom - change_col_from*lenc;
-            colTo = colTo - change_col_to*lenc;
-          }
-
-        // set updated selection area
-        m_edit_area->setSelection (lineFrom, colFrom, lineTo, colTo);
-      }
-    else
-      {
-        int cpline, col;
-        m_edit_area->getCursorPosition (&cpline, &col);
-        if (comment)
-          m_edit_area->insertAt (used_comment_str, cpline, 0);
-        else
-          {
-            QString line (m_edit_area->text (cpline));
-            if (line.contains (rxc))
-              {
-                len = rxc.matchedLength ();   // complete length
-                QString matched_text = rxc.capturedTexts ().at (0);
-                lenc = matched_text.remove (QRegExp (ws)).length ();  // only comment string
-                m_edit_area->setSelection (cpline, len-lenc, cpline, len);
-                m_edit_area->removeSelectedText ();
-              }
-          }
-      }
-    m_edit_area->endUndoAction ();
-  }
-
-  void file_editor_tab::update_window_title (bool modified)
-  {
-    QString title ("");
-    QString tooltip ("");
-
-    if (! valid_file_name ())
-      title = tr ("<unnamed>");
-    else
-      {
-        QFileInfo file (m_file_name);
-        title = file.fileName ();
-        tooltip = m_file_name;
-      }
-
-    emit file_name_changed (title, tooltip, modified);
-  }
-
-  void file_editor_tab::handle_copy_available (bool enableCopy)
-  {
-    m_copy_available = enableCopy;
-    emit editor_state_changed (m_copy_available, m_is_octave_file,
-                               m_edit_area->isModified ());
-  }
-
-  // show_dialog: shows a modal or non modal dialog depending on input arg
-  void file_editor_tab::show_dialog (QDialog *dlg, bool modal)
-  {
-    dlg->setAttribute (Qt::WA_DeleteOnClose);
-    if (modal)
-      dlg->exec ();
-    else
-      {
-        dlg->setWindowModality (Qt::NonModal);
-        dlg->show ();
-      }
-  }
-
-  int file_editor_tab::check_file_modified (bool remove)
-  {
-    int decision = QMessageBox::Yes;
-    if (m_edit_area->isModified ())
-      {
-        // File is modified but not saved, ask user what to do.  The file
-        // editor tab can't be made parent because it may be deleted depending
-        // upon the response.  Instead, change the m_edit_area to read only.
-        QMessageBox::StandardButtons buttons = QMessageBox::Save |
-                                               QMessageBox::Discard |
-                                               QMessageBox::Cancel;
-
-        // For now, just a warning message about closing a tab that has been
-        // modified seems sufficient.  Exit-condition-specific messages could
-        // be achieved by making 'available_actions' a function input string.
-        QString available_actions =
-          tr ("Do you want to cancel closing, save or discard the changes?");
-
-        QString file;
-        if (valid_file_name ())
-          file = m_file_name;
-        else
-          file = tr ("<unnamed>");
-
-        QMessageBox *msgBox
-          = new QMessageBox (QMessageBox::Warning, tr ("Octave Editor"),
-                             tr ("The file\n\n"
-                                 "  %1\n\n"
-                                 "is about to be closed but has been modified.  "
-                                 "%2").
-                             arg (file). arg (available_actions),
-                             buttons, qobject_cast<QWidget *> (parent ()));
-
-        msgBox->setDefaultButton (QMessageBox::Save);
-        m_edit_area->setReadOnly (true);
-
-        decision = msgBox->exec (); // show_dialog (msgBox, true);
-
-        if (decision == QMessageBox::Cancel)
-          m_edit_area->setReadOnly (false);
-        else if (decision == QMessageBox::Save)
-          save_file (m_file_name, remove, false);
-        else
-          emit tab_ready_to_close ();
-      }
-    else
-      {
+    }
+
+  if (line <= 0)  // ask for desired line
+    {
+      bool ok = false;
+      int index;
+      m_edit_area->getCursorPosition (&line, &index);
+      line = QInputDialog::getInt (m_edit_area, tr ("Goto line"),
+                                   tr ("Line number"), line+1, 1,
+                                   m_edit_area->lines (), 1, &ok);
+      if (ok)
+        m_edit_area->setCursorPosition (line-1, 0);
+    }
+  else  // go to given line without dialog
+    m_edit_area->setCursorPosition (line-1, 0);
+
+  center_current_line (false);  // only center line if at top or bottom
+}
+
+void file_editor_tab::move_match_brace (const QWidget *ID, bool select)
+{
+  if (ID != this)
+    return;
+
+  if (select)
+    m_edit_area->selectToMatchingBrace ();
+  else
+    m_edit_area->moveToMatchingBrace ();
+}
+
+void file_editor_tab::show_auto_completion (const QWidget *ID)
+{
+  if (ID != this)
+    return;
+
+  m_autoc_active = true;
+
+  QsciScintilla::AutoCompletionSource s = m_edit_area->autoCompletionSource ();
+  switch (s)
+    {
+    case QsciScintilla::AcsAll:
+      m_edit_area->autoCompleteFromAll ();
+      break;
+
+    case QsciScintilla::AcsAPIs:
+      m_edit_area->autoCompleteFromAPIs ();
+      break;
+
+    case QsciScintilla::AcsDocument:
+      m_edit_area->autoCompleteFromDocument ();
+      break;
+
+    case QsciScintilla::AcsNone:
+      break;
+    }
+}
+
+void file_editor_tab::do_indent_selected_text (bool indent)
+{
+  // FIXME:
+  m_edit_area->beginUndoAction ();
+
+  if (m_edit_area->hasSelectedText ())
+    {
+      int lineFrom, lineTo, colFrom, colTo;
+      m_edit_area->getSelection (&lineFrom, &colFrom, &lineTo, &colTo);
+
+      if (colTo == 0)  // the beginning of last line is not selected
+        lineTo--;        // stop at line above
+
+      for (int i = lineFrom; i <= lineTo; i++)
+        {
+          if (indent)
+            m_edit_area->indent (i);
+          else
+            m_edit_area->unindent (i);
+        }
+      //set selection on (un)indented section
+      m_edit_area->setSelection (lineFrom, 0, lineTo,
+                                 m_edit_area->text (lineTo).length ()-1);
+    }
+  else
+    {
+      int cpline, col;
+      m_edit_area->getCursorPosition (&cpline, &col);
+      if (indent)
+        m_edit_area->indent (cpline);
+      else
+        m_edit_area->unindent (cpline);
+    }
+
+  m_edit_area->endUndoAction ();
+}
+
+void file_editor_tab::do_smart_indent_line_or_selected_text ()
+{
+  m_edit_area->beginUndoAction ();
+
+  int lineFrom, lineTo;
+
+  if (m_edit_area->hasSelectedText ())
+    {
+      int colFrom, colTo;
+      m_edit_area->getSelection (&lineFrom, &colFrom, &lineTo, &colTo);
+
+      if (colTo == 0)  // the beginning of last line is not selected
+        lineTo--;        // stop at line above
+    }
+  else
+    {
+      int col;
+      m_edit_area->getCursorPosition (&lineFrom, &col);
+
+      lineTo = lineFrom;
+    }
+
+  m_edit_area->smart_indent_line_or_selected_text (lineFrom, lineTo);
+
+  m_edit_area->endUndoAction ();
+}
+
+void file_editor_tab::do_comment_selected_text (bool comment, bool input_str)
+{
+  QRegExp rxc;
+  QString ws = "^(?:[ \\t]*)";
+  QStringList comment_str = m_edit_area->comment_string (comment);
+  QString used_comment_str = comment_str.at (0);
+
+  if (comment)
+    {
+      if (input_str)
+        {
+          bool ok;
+          gui_settings settings;
+
+          used_comment_str
+            = QInputDialog::getText (this, tr ("Comment selected text"),
+                                     tr ("Comment string to use:\n"),
+                                     QLineEdit::Normal,
+                                     settings.value (ed_last_comment_str, comment_str.at (0)).toString (),
+                                     &ok);
+
+          if ((! ok) || used_comment_str.isEmpty ())
+            return;  // No input, do nothing
+          else
+            settings.setValue (ed_last_comment_str, used_comment_str);  // Store last
+        }
+    }
+  else
+    {
+      // Uncommenting (several strings possible)
+
+      // Sort strings according their length
+      QStringList comment_str_sorted (comment_str.at (0));
+      bool inserted;
+
+      for (int i = 1; i < comment_str.length (); i++)
+        {
+          inserted = false;
+          for (int j = 0; j < comment_str_sorted.length (); j++)
+            {
+              if (comment_str.at (i).length () > comment_str_sorted.at (j).length ())
+                {
+                  comment_str_sorted.insert (j, comment_str.at (i));
+                  inserted = true;
+                  break;
+                }
+            }
+          if (! inserted)
+            comment_str_sorted << comment_str.at (i);
+        }
+
+      // Create regular expression
+      QString regexp;
+      for (int i = 0; i < comment_str_sorted.length (); i++)
+        {
+          if (i > 0)
+            regexp = regexp + QString ("|");
+          regexp = regexp + comment_str_sorted.at (i);
+        }
+      rxc = QRegExp (ws + "(" + regexp + ")");
+    }
+
+  // Do the commenting/uncommenting
+  int len = 0, lenc = 0;
+  m_edit_area->beginUndoAction ();
+
+  if (m_edit_area->hasSelectedText ())
+    {
+      int lineFrom, lineTo, colFrom, colTo;
+      int change_col_from = 1;
+      int change_col_to = 1;
+      bool removed;
+
+      m_edit_area->getSelection (&lineFrom, &colFrom, &lineTo, &colTo);
+
+      if (colTo == 0)  // the beginning of last line is not selected
+        lineTo--;        // stop at line above
+
+      for (int i = lineFrom; i <= lineTo; i++)
+        {
+          if (comment)
+            {
+              m_edit_area->insertAt (used_comment_str, i, 0);
+            }
+          else
+            {
+              QString line (m_edit_area->text (i));
+              if ((removed = line.contains (rxc)))
+                {
+                  len = rxc.matchedLength ();   // complete length
+                  QString matched_text = rxc.capturedTexts ().at (0);
+                  lenc = matched_text.remove (QRegExp (ws)).length ();  // only comment string
+                  m_edit_area->setSelection (i, len-lenc, i, len);
+                  m_edit_area->removeSelectedText ();
+                }
+
+              // handle case, where the selection remains unchanged
+              if (i == lineFrom && (colFrom < len-lenc || ! removed))
+                change_col_from = 0;  // do not change start of selection
+              if (i == lineTo && (colTo < len-lenc || ! removed))
+                change_col_to = 0;    // do not change end of selection
+            }
+        }
+
+      // update the selection area
+      if (comment)
+        {
+          colFrom = colFrom + lenc;   // shift start position by comment length
+          if (colTo > 0)
+            colTo = colTo + lenc;     // shift end position by comment length
+          else
+            lineTo++;                 // colTo == 0 , fully select previous line
+        }
+      else
+        {
+          if (colTo == 0)
+            lineTo++;                 // colTo == 0 , fully select previous line
+          colFrom = colFrom - change_col_from*lenc;
+          colTo = colTo - change_col_to*lenc;
+        }
+
+      // set updated selection area
+      m_edit_area->setSelection (lineFrom, colFrom, lineTo, colTo);
+    }
+  else
+    {
+      int cpline, col;
+      m_edit_area->getCursorPosition (&cpline, &col);
+      if (comment)
+        m_edit_area->insertAt (used_comment_str, cpline, 0);
+      else
+        {
+          QString line (m_edit_area->text (cpline));
+          if (line.contains (rxc))
+            {
+              len = rxc.matchedLength ();   // complete length
+              QString matched_text = rxc.capturedTexts ().at (0);
+              lenc = matched_text.remove (QRegExp (ws)).length ();  // only comment string
+              m_edit_area->setSelection (cpline, len-lenc, cpline, len);
+              m_edit_area->removeSelectedText ();
+            }
+        }
+    }
+  m_edit_area->endUndoAction ();
+}
+
+void file_editor_tab::update_window_title (bool modified)
+{
+  QString title ("");
+  QString tooltip ("");
+
+  if (! valid_file_name ())
+    title = tr ("<unnamed>");
+  else
+    {
+      QFileInfo file (m_file_name);
+      title = file.fileName ();
+      tooltip = m_file_name;
+    }
+
+  emit file_name_changed (title, tooltip, modified);
+}
+
+void file_editor_tab::handle_copy_available (bool enableCopy)
+{
+  m_copy_available = enableCopy;
+  emit editor_state_changed (m_copy_available, m_is_octave_file,
+                             m_edit_area->isModified ());
+}
+
+// show_dialog: shows a modal or non modal dialog depending on input arg
+void file_editor_tab::show_dialog (QDialog *dlg, bool modal)
+{
+  dlg->setAttribute (Qt::WA_DeleteOnClose);
+  if (modal)
+    dlg->exec ();
+  else
+    {
+      dlg->setWindowModality (Qt::NonModal);
+      dlg->show ();
+    }
+}
+
+int file_editor_tab::check_file_modified (bool remove)
+{
+  int decision = QMessageBox::Yes;
+  if (m_edit_area->isModified ())
+    {
+      // File is modified but not saved, ask user what to do.  The file
+      // editor tab can't be made parent because it may be deleted depending
+      // upon the response.  Instead, change the m_edit_area to read only.
+      QMessageBox::StandardButtons buttons = QMessageBox::Save |
+                                             QMessageBox::Discard |
+                                             QMessageBox::Cancel;
+
+      // For now, just a warning message about closing a tab that has been
+      // modified seems sufficient.  Exit-condition-specific messages could
+      // be achieved by making 'available_actions' a function input string.
+      QString available_actions =
+        tr ("Do you want to cancel closing, save or discard the changes?");
+
+      QString file;
+      if (valid_file_name ())
+        file = m_file_name;
+      else
+        file = tr ("<unnamed>");
+
+      QMessageBox *msgBox
+        = new QMessageBox (QMessageBox::Warning, tr ("Octave Editor"),
+                           tr ("The file\n\n"
+                               "  %1\n\n"
+                               "is about to be closed but has been modified.  "
+                               "%2").
+                           arg (file). arg (available_actions),
+                           buttons, qobject_cast<QWidget *> (parent ()));
+
+      msgBox->setDefaultButton (QMessageBox::Save);
+      m_edit_area->setReadOnly (true);
+
+      decision = msgBox->exec (); // show_dialog (msgBox, true);
+
+      if (decision == QMessageBox::Cancel)
+        m_edit_area->setReadOnly (false);
+      else if (decision == QMessageBox::Save)
+        save_file (m_file_name, remove, false);
+      else
         emit tab_ready_to_close ();
-      }
-
-    return decision;
-  }
-
-  void file_editor_tab::set_modified (bool modified)
-  {
-    m_edit_area->setModified (modified);
-  }
-
-  void file_editor_tab::recover_from_exit ()
-  {
-    // reset the possibly still existing read only state
-    m_edit_area->setReadOnly (false);
-
-    // if we are in this slot and the list of breakpoints is not empty,
-    // then this tab was saved during an exit of the applications (not
-    // restoring the breakpoints and not emptying the list) and the user
-    // canceled this closing late on.
-    check_restore_breakpoints ();
-  }
-
-  void file_editor_tab::check_restore_breakpoints ()
-  {
-    if (! m_bp_lines.isEmpty ())
-      {
-        // At least one breakpoint is present.
-        // Get rid of breakpoints at old (now possibly invalid) linenumbers
-        remove_all_breakpoints (this);
-
-        // and set breakpoints at the new linenumbers
-        m_bp_restore_count = m_bp_lines.length ();
-        for (int i = 0; i < m_bp_lines.length (); i++)
-          handle_request_add_breakpoint (m_bp_lines.value (i) + 1,
-                                         m_bp_conditions.value (i));
-
-        // Keep the list of breakpoints empty, except after explicit requests.
-        m_bp_lines.clear ();
-        m_bp_conditions.clear ();
-      }
-  }
-
-  QString file_editor_tab::load_file (const QString& fileName)
-  {
-    // get the absolute path
-    QFileInfo file_info = QFileInfo (fileName);
-    QString file_to_load;
-    if (file_info.exists ())
-      file_to_load = file_info.canonicalFilePath ();
-    else
-      file_to_load = fileName;
-    QFile file (file_to_load);
-    if (!file.open(QIODevice::ReadOnly))
-      return file.errorString ();
-
-    int col = 0, line = 0;
-    if (fileName == m_file_name)
-      {
-        // We have to reload the current file, thus get current cursor position
-        line = m_line;
-        col = m_col;
-      }
-
-    QApplication::setOverrideCursor (Qt::WaitCursor);
-
-    // read the file binary, decoding later
-    QByteArray text_data = file.readAll ();
-
-    // remove newline at end of file if we add one again when saving
-
-    gui_settings settings;
-
-    if (settings.bool_value (ed_force_newline))
-      {
-        const QByteArray eol_lf = QByteArray (1, 0x0a);
-        const QByteArray eol_cr = QByteArray (1, 0x0d);
-
-        if (text_data.endsWith (eol_lf))
-          text_data.chop (1);   // remove LF
-
-        if (text_data.endsWith (eol_cr)) // remove CR (altogether CRLF, too)
-          text_data.chop (1);
-      }
-
-    // decode
-    QTextCodec::ConverterState st;
-    QTextCodec *codec = QTextCodec::codecForName (m_encoding.toLatin1 ());
-    if (codec == nullptr)
-      codec = QTextCodec::codecForLocale ();
-
-    const QString text = codec->toUnicode(text_data.constData(),
-                                          text_data.size(), &st);
-
-    // Decoding with invalid characters?
-    if (st.invalidChars > 0)
-      {
-        // Set read only
-        m_edit_area->setReadOnly (true);
-
-        // Message box for user decision
-        QString msg = tr ("There were problems reading the file\n"
-                          "%1\n"
-                          "with the selected encoding %2.\n\n"
-                          "Modifying and saving the file might "
-                          "cause data loss!")
-                          .arg (file_to_load).arg (m_encoding);
-        QMessageBox *msg_box = new QMessageBox ();
-        msg_box->setIcon (QMessageBox::Warning);
-        msg_box->setText (msg);
-        msg_box->setWindowTitle (tr ("Octave Editor"));
-        msg_box->addButton (tr ("&Edit anyway"), QMessageBox::YesRole);
-        msg_box->addButton (tr ("Chan&ge encoding"), QMessageBox::AcceptRole);
-        msg_box->addButton (tr ("&Close"), QMessageBox::RejectRole);
-
-        connect (msg_box, &QMessageBox::buttonClicked,
-                 this, &file_editor_tab::handle_decode_warning_answer);
-
-        msg_box->setWindowModality (Qt::WindowModal);
-        msg_box->setAttribute (Qt::WA_DeleteOnClose);
-        msg_box->show ();
-      }
-
-    m_edit_area->setText (text);
-    m_edit_area->setEolMode (detect_eol_mode ());
-
-    QApplication::restoreOverrideCursor ();
-
-    m_copy_available = false;     // no selection yet available
-    m_edit_area->setModified (false); // loaded file is not modified yet
-    set_file_name (file_to_load);
-
-    update_eol_indicator ();
-
-    m_edit_area->setCursorPosition (line, col);
-
-    return QString ();
-  }
-
-  void file_editor_tab::handle_decode_warning_answer (QAbstractButton *btn)
-  {
-    QString txt = btn->text ();
-
-    if (txt == tr ("&Close"))
-      {
-        // Just close the file
-        close ();
-        return;
-      }
-
-    if (txt == tr ("Chan&ge encoding"))
-      {
-        // Dialog for reloading the file with another encoding
-        QDialog dlg;
-        dlg.setWindowTitle (tr ("Select new default encoding"));
-
-        QLabel *text
-          = new QLabel (tr ("Please select a new encoding\n"
-                            "for reloading the current file.\n\n"
-                            "This does not change the default encoding.\n"));
-
-        QComboBox *enc_combo = new QComboBox ();
-        gui_settings settings;
-        settings.combo_encoding (enc_combo);
-        m_new_encoding = enc_combo->currentText ();
-        connect (enc_combo, &QComboBox::currentTextChanged,
-                 this, &file_editor_tab::handle_current_enc_changed);
-
-        QDialogButtonBox *buttons
-          = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
-                                  Qt::Horizontal);
-        connect (buttons, &QDialogButtonBox::accepted, &dlg, &QDialog::accept);
-        connect (buttons, &QDialogButtonBox::rejected, &dlg, &QDialog::reject);
-
-        QGridLayout *main_layout = new QGridLayout;
-        main_layout->setSizeConstraint (QLayout::SetFixedSize);
-        main_layout->addWidget (text, 0, 0);
-        main_layout->addWidget (enc_combo, 1, 0);
-        main_layout->addWidget (buttons, 2, 0);
-        dlg.setLayout (main_layout);
-
-        int answer = dlg.exec ();
-
-        if (answer == QDialog::Accepted)
-          {
-            // Reload the file with new encoding but using the same tab
-            QString reload_file_name = m_file_name;  // store file name
-            m_file_name = "";  // force reuse of this tab when opening a new file
-            emit request_open_file (reload_file_name, m_new_encoding);
-          }
-      }
-
-    // Continue editing, set writable again
-    m_edit_area->setReadOnly (false);
-  }
-
-  void file_editor_tab::handle_current_enc_changed (const QString& enc)
-  {
-    m_new_encoding = enc;
-  }
-
-  QsciScintilla::EolMode file_editor_tab::detect_eol_mode ()
-  {
-    QByteArray text = m_edit_area->text ().toLatin1 ();
-
-    QByteArray eol_lf = QByteArray (1, 0x0a);
-    QByteArray eol_cr = QByteArray (1, 0x0d);
-    QByteArray eol_crlf = eol_cr;
-    eol_crlf.append (eol_lf);
-
-    int count_crlf = text.count (eol_crlf);
-    int count_lf = text.count (eol_lf) - count_crlf;  // isolated lf
-    int count_cr = text.count (eol_cr) - count_crlf;  // isolated cr
-
-    gui_settings settings;
-
-    QsciScintilla::EolMode eol_mode
-      = static_cast<QsciScintilla::EolMode> (settings.int_value (ed_default_eol_mode));
-
-    int count_max = 0;
-
-    if (count_crlf > count_max)
-      {
-        eol_mode = QsciScintilla::EolWindows;
-        count_max = count_crlf;
-      }
-    if (count_lf > count_max)
-      {
-        eol_mode = QsciScintilla::EolUnix;
-        count_max = count_lf;
-      }
-    if (count_cr > count_max)
-      {
-        eol_mode = QsciScintilla::EolMac;
-      }
-
-    return eol_mode;
-  }
-
-  void file_editor_tab::update_eol_indicator ()
-  {
-    switch (m_edit_area->eolMode ())
-      {
-      case QsciScintilla::EolWindows:
-        m_eol_indicator->setText ("CRLF");
-        break;
-      case QsciScintilla::EolMac:
-        m_eol_indicator->setText ("CR");
-        break;
-      case QsciScintilla::EolUnix:
-        m_eol_indicator->setText ("LF");
-        break;
-      }
-  }
-
-  void file_editor_tab::update_breakpoints ()
-  {
-    if (m_file_name.isEmpty ())
+    }
+  else
+    {
+      emit tab_ready_to_close ();
+    }
+
+  return decision;
+}
+
+void file_editor_tab::set_modified (bool modified)
+{
+  m_edit_area->setModified (modified);
+}
+
+void file_editor_tab::recover_from_exit ()
+{
+  // reset the possibly still existing read only state
+  m_edit_area->setReadOnly (false);
+
+  // if we are in this slot and the list of breakpoints is not empty,
+  // then this tab was saved during an exit of the applications (not
+  // restoring the breakpoints and not emptying the list) and the user
+  // canceled this closing late on.
+  check_restore_breakpoints ();
+}
+
+void file_editor_tab::check_restore_breakpoints ()
+{
+  if (! m_bp_lines.isEmpty ())
+    {
+      // At least one breakpoint is present.
+      // Get rid of breakpoints at old (now possibly invalid) linenumbers
+      remove_all_breakpoints (this);
+
+      // and set breakpoints at the new linenumbers
+      m_bp_restore_count = m_bp_lines.length ();
+      for (int i = 0; i < m_bp_lines.length (); i++)
+        handle_request_add_breakpoint (m_bp_lines.value (i) + 1,
+                                       m_bp_conditions.value (i));
+
+      // Keep the list of breakpoints empty, except after explicit requests.
+      m_bp_lines.clear ();
+      m_bp_conditions.clear ();
+    }
+}
+
+QString file_editor_tab::load_file (const QString& fileName)
+{
+  // get the absolute path
+  QFileInfo file_info = QFileInfo (fileName);
+  QString file_to_load;
+  if (file_info.exists ())
+    file_to_load = file_info.canonicalFilePath ();
+  else
+    file_to_load = fileName;
+  QFile file (file_to_load);
+  if (!file.open(QIODevice::ReadOnly))
+    return file.errorString ();
+
+  int col = 0, line = 0;
+  if (fileName == m_file_name)
+    {
+      // We have to reload the current file, thus get current cursor position
+      line = m_line;
+      col = m_col;
+    }
+
+  QApplication::setOverrideCursor (Qt::WaitCursor);
+
+  // read the file binary, decoding later
+  QByteArray text_data = file.readAll ();
+
+  // remove newline at end of file if we add one again when saving
+
+  gui_settings settings;
+
+  if (settings.bool_value (ed_force_newline))
+    {
+      const QByteArray eol_lf = QByteArray (1, 0x0a);
+      const QByteArray eol_cr = QByteArray (1, 0x0d);
+
+      if (text_data.endsWith (eol_lf))
+        text_data.chop (1);   // remove LF
+
+      if (text_data.endsWith (eol_cr)) // remove CR (altogether CRLF, too)
+        text_data.chop (1);
+    }
+
+  // decode
+  QTextCodec::ConverterState st;
+  QTextCodec *codec = QTextCodec::codecForName (m_encoding.toLatin1 ());
+  if (codec == nullptr)
+    codec = QTextCodec::codecForLocale ();
+
+  const QString text = codec->toUnicode(text_data.constData(),
+                                        text_data.size(), &st);
+
+  // Decoding with invalid characters?
+  if (st.invalidChars > 0)
+    {
+      // Set read only
+      m_edit_area->setReadOnly (true);
+
+      // Message box for user decision
+      QString msg = tr ("There were problems reading the file\n"
+                        "%1\n"
+                        "with the selected encoding %2.\n\n"
+                        "Modifying and saving the file might "
+                        "cause data loss!")
+                        .arg (file_to_load).arg (m_encoding);
+      QMessageBox *msg_box = new QMessageBox ();
+      msg_box->setIcon (QMessageBox::Warning);
+      msg_box->setText (msg);
+      msg_box->setWindowTitle (tr ("Octave Editor"));
+      msg_box->addButton (tr ("&Edit anyway"), QMessageBox::YesRole);
+      msg_box->addButton (tr ("Chan&ge encoding"), QMessageBox::AcceptRole);
+      msg_box->addButton (tr ("&Close"), QMessageBox::RejectRole);
+
+      connect (msg_box, &QMessageBox::buttonClicked,
+               this, &file_editor_tab::handle_decode_warning_answer);
+
+      msg_box->setWindowModality (Qt::WindowModal);
+      msg_box->setAttribute (Qt::WA_DeleteOnClose);
+      msg_box->show ();
+    }
+
+  m_edit_area->setText (text);
+  m_edit_area->setEolMode (detect_eol_mode ());
+
+  QApplication::restoreOverrideCursor ();
+
+  m_copy_available = false;     // no selection yet available
+  m_edit_area->setModified (false); // loaded file is not modified yet
+  set_file_name (file_to_load);
+
+  update_eol_indicator ();
+
+  m_edit_area->setCursorPosition (line, col);
+
+  return QString ();
+}
+
+void file_editor_tab::handle_decode_warning_answer (QAbstractButton *btn)
+{
+  QString txt = btn->text ();
+
+  if (txt == tr ("&Close"))
+    {
+      // Just close the file
+      close ();
       return;
-
-    // Create and queue the command object.
-
-    // The interpreter_event callback function below emits a signal.
-    // Because we don't control when that happens, use a guarded pointer
-    // so that the callback can abort if this object is no longer valid.
-
-    QPointer<file_editor_tab> this_fetab (this);
-
-    emit interpreter_event
-      ([=] (interpreter& interp)
-       {
-         // INTERPRETER THREAD
-
-         // We can skip the entire callback function because it does not
-         // make any changes to the interpreter state.
-
-         if (this_fetab.isNull ())
-           return;
-
-         octave_value_list argout = Fdbstatus (interp, ovl (), 1);
-
-         connect (this, &file_editor_tab::update_breakpoints_signal,
-                  this, &file_editor_tab::update_breakpoints_handler,
-                  Qt::QueuedConnection);
-
-         emit update_breakpoints_signal (argout);
-       });
-  }
-
-  void file_editor_tab::update_breakpoints_handler (const octave_value_list& argout)
-  {
-    octave_map dbg = argout(0).map_value ();
-    octave_idx_type n_dbg = dbg.numel ();
-
-    Cell file = dbg.contents ("file");
-    Cell line = dbg.contents ("line");
-    Cell cond = dbg.contents ("cond");
-
-    for (octave_idx_type i = 0; i < n_dbg; i++)
-      {
-        if (file (i).string_value () == m_file_name.toStdString ())
-          do_breakpoint_marker (true, this, line (i).int_value (),
-                                QString::fromStdString (cond (i).string_value ()));
-      }
-  }
-
-  void file_editor_tab::new_file (const QString& commands)
-  {
-    update_window_title (false); // window title (no modification)
-
-    gui_settings settings;
-
-    // set the eol mode from the settings or depending on the OS if the entry is
-    // missing in the settings
-    m_edit_area->setEolMode (static_cast<QsciScintilla::EolMode> (settings.int_value (ed_default_eol_mode)));
-
-    update_eol_indicator ();
-
-    update_lexer ();
-
-    m_edit_area->setText (commands);
-    m_edit_area->setModified (!commands.isEmpty ());
-  }
-
-  void file_editor_tab::confirm_dbquit_and_save (const QString& file_to_save,
-                                                 const QString& base_name,
-                                                 bool remove_on_success,
-                                                 bool restore_breakpoints)
-  {
-    int ans = QMessageBox::question (nullptr, tr ("Debug or Save"),
-                                     tr ("This file is currently being executed.\n"
-                                         "Quit debugging and save?"),
-                                     QMessageBox::Save | QMessageBox::Cancel);
-
-    if (ans == QMessageBox::Save)
-      {
-        // The interpreter_event callback function below emits a signal.
-        // Because we don't control when that happens, use a guarded
-        // pointer so that the callback can abort if this object is no
-        // longer valid.
-
-        QPointer<file_editor_tab> this_fetab (this);
-
-        emit interpreter_event
-          ([=] (interpreter& interp)
-           {
-             // INTERPRETER THREAD
-
-             // If THIS_FETAB is no longer valid, we still want to
-             // perform the actions in the interpreter but we can't emit
-             // the signal associated with THIS_FETAB.
-
-             tree_evaluator& tw = interp.get_evaluator ();
-
-             tw.dbquit (true);
-
-             command_editor::interrupt (true);
-
-             std::string std_base_name = base_name.toStdString ();
-
-             symbol_table& symtab = interp.get_symbol_table ();
-
-             symtab.clear_user_function (std_base_name);
-
-             if (this_fetab.isNull ())
-               return;
-
-             emit do_save_file_signal (file_to_save, remove_on_success,
-                                       restore_breakpoints);
-           });
-      }
-  }
-
-  void file_editor_tab::save_file (const QString& saveFileName,
-                                   bool remove_on_success,
-                                   bool restore_breakpoints)
-  {
-    // If it is a new file with no name, signal that saveFileAs
-    // should be performed.
-    if (! valid_file_name (saveFileName))
-      {
-        save_file_as (remove_on_success);
-        return;
-      }
-
-    m_encoding = m_new_encoding;    // consider a possible new encoding
-
-    // set the desired codec (if suitable for contents)
-    QTextCodec *codec = check_valid_codec ();
-    if (! codec)
-      return;   // No valid codec
-
-    // Get a list of breakpoint line numbers, before exiting debug mode
-    // and clearing function in interpreter_event action below.
-
-    emit report_marker_linenr (m_bp_lines, m_bp_conditions);
-
-    // get the absolute path (if existing)
-    QFileInfo file_info = QFileInfo (saveFileName);
-    QString file_to_save;
-    if (file_info.exists ())
-      {
-        file_to_save = file_info.canonicalFilePath ();
-        QString base_name = file_info.baseName ();
-
-        // The interpreter_event callback function below emits a signal.
-        // Because we don't control when that happens, use a guarded
-        // pointer so that the callback can abort if this object is no
-        // longer valid.
-
-        QPointer<file_editor_tab> this_fetab (this);
-
-        emit interpreter_event
-          ([=] (interpreter& interp)
-           {
-             // INTERPRETER THREAD
-
-             // We are intentionally skipping any side effects that may
-             // occur in the callback function if THIS_FETAB is no
-             // longer valid.  If the editor tab has disappeared, there
-             // is not much point in reloading the function to restore
-             // breakpoint info in the GUI.
-
-             if (this_fetab.isNull ())
-               return;
-
-             // Force reloading of a file after it is saved.
-             // This is needed to get the right line numbers for
-             // breakpoints (bug #46632).
-
-             tree_evaluator& tw = interp.get_evaluator ();
-
-             symbol_table& symtab = interp.get_symbol_table ();
-
-             std::string std_base_name = base_name.toStdString ();
-
-             if (tw.in_debug_repl ())
-               {
-                 octave_value sym;
-                 try
-                   {
-                     sym = symtab.find_user_function (std_base_name);
-                   }
-                 catch (const execution_exception&)
-                   {
-                     interp.recover_from_exception ();
-
-                     // Ignore syntax error.  It was in the old file on disk;
-                     // the user may have fixed it already.
-                   }
-
-                 // Return early if this file is not loaded in the symbol table
-                 if (! sym.is_defined () || ! sym.is_user_code ())
-                   {
-                     emit do_save_file_signal (file_to_save, remove_on_success,
-                                               restore_breakpoints);
-                     return;
-                   }
-
-                 octave_user_code *fcn = sym.user_code_value ();
-
-                 std::string full_name = file_to_save.toStdString ();
-
-                 if (sys::canonicalize_file_name (full_name)
-                     != sys::canonicalize_file_name (fcn->fcn_file_name ()))
-                   {
-                     emit do_save_file_signal (file_to_save, remove_on_success,
-                                               restore_breakpoints);
-                     return;
-                   }
-
-                 // If this file is loaded, check that we aren't currently
-                 // running it.
-                 // FIXME: is there a better way to get this info?
-
-                 octave_idx_type curr_frame = -1;
-
-                 octave_map stk = tw.backtrace (curr_frame, false);
-
-                 Cell names = stk.contents ("name");
-
-                 for (octave_idx_type i = names.numel () - 1; i >= 0; i--)
-                   {
-                     if (names(i).string_value () == std_base_name)
-                       {
-                         emit confirm_dbquit_and_save_signal
-                           (file_to_save, base_name, remove_on_success,
-                            restore_breakpoints);
-                         return;
-                       }
-                   }
-               }
-
-             symtab.clear_user_function (std_base_name);
-
-             emit do_save_file_signal (file_to_save, remove_on_success,
-                                       restore_breakpoints);
-           });
-      }
-    else
-      emit do_save_file_signal (saveFileName, remove_on_success,
-                                restore_breakpoints);
-  }
-
-  void file_editor_tab::do_save_file (const QString& file_to_save,
-                                      bool remove_on_success,
-                                      bool restore_breakpoints)
-  {
-    QSaveFile file (file_to_save);
-
-    // stop watching file
-    QStringList trackedFiles = m_file_system_watcher.files ();
-    if (trackedFiles.contains (file_to_save))
-      m_file_system_watcher.removePath (file_to_save);
-
-    // Remove trailing white spaces if desired
-
-    gui_settings settings;
-
-    if (settings.bool_value (ed_rm_trailing_spaces))
-      {
-        // Replace trailing spaces, make sure edit area is writable,
-        // which is not the case when saving at exit or when closing
-        // the modified file.
-        bool ro = m_edit_area->isReadOnly ();
-        m_edit_area->setReadOnly (false); // allow writing for replace_all
-        m_edit_area->replace_all ("[ \\t]+$", "", true, false, false);
-        m_edit_area->setReadOnly (ro);    // recover read only state
-      }
-
-    // open the file for writing (use QIODevice::ReadWrite for avoiding
-    // truncating the previous file contents)
-    if (! file.open (QIODevice::WriteOnly))
-      {
-        // Unsuccessful, begin watching file again if it was being
-        // watched previously.
-        if (trackedFiles.contains (file_to_save))
-          m_file_system_watcher.addPath (file_to_save);
-
-        // Create a NonModal message about error.
-        QMessageBox *msgBox
-          = new QMessageBox (QMessageBox::Critical,
+    }
+
+  if (txt == tr ("Chan&ge encoding"))
+    {
+      // Dialog for reloading the file with another encoding
+      QDialog dlg;
+      dlg.setWindowTitle (tr ("Select new default encoding"));
+
+      QLabel *text
+        = new QLabel (tr ("Please select a new encoding\n"
+                          "for reloading the current file.\n\n"
+                          "This does not change the default encoding.\n"));
+
+      QComboBox *enc_combo = new QComboBox ();
+      gui_settings settings;
+      settings.combo_encoding (enc_combo);
+      m_new_encoding = enc_combo->currentText ();
+      connect (enc_combo, &QComboBox::currentTextChanged,
+               this, &file_editor_tab::handle_current_enc_changed);
+
+      QDialogButtonBox *buttons
+        = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
+                                Qt::Horizontal);
+      connect (buttons, &QDialogButtonBox::accepted, &dlg, &QDialog::accept);
+      connect (buttons, &QDialogButtonBox::rejected, &dlg, &QDialog::reject);
+
+      QGridLayout *main_layout = new QGridLayout;
+      main_layout->setSizeConstraint (QLayout::SetFixedSize);
+      main_layout->addWidget (text, 0, 0);
+      main_layout->addWidget (enc_combo, 1, 0);
+      main_layout->addWidget (buttons, 2, 0);
+      dlg.setLayout (main_layout);
+
+      int answer = dlg.exec ();
+
+      if (answer == QDialog::Accepted)
+        {
+          // Reload the file with new encoding but using the same tab
+          QString reload_file_name = m_file_name;  // store file name
+          m_file_name = "";  // force reuse of this tab when opening a new file
+          emit request_open_file (reload_file_name, m_new_encoding);
+        }
+    }
+
+  // Continue editing, set writable again
+  m_edit_area->setReadOnly (false);
+}
+
+void file_editor_tab::handle_current_enc_changed (const QString& enc)
+{
+  m_new_encoding = enc;
+}
+
+QsciScintilla::EolMode file_editor_tab::detect_eol_mode ()
+{
+  QByteArray text = m_edit_area->text ().toLatin1 ();
+
+  QByteArray eol_lf = QByteArray (1, 0x0a);
+  QByteArray eol_cr = QByteArray (1, 0x0d);
+  QByteArray eol_crlf = eol_cr;
+  eol_crlf.append (eol_lf);
+
+  int count_crlf = text.count (eol_crlf);
+  int count_lf = text.count (eol_lf) - count_crlf;  // isolated lf
+  int count_cr = text.count (eol_cr) - count_crlf;  // isolated cr
+
+  gui_settings settings;
+
+  QsciScintilla::EolMode eol_mode
+    = static_cast<QsciScintilla::EolMode> (settings.int_value (ed_default_eol_mode));
+
+  int count_max = 0;
+
+  if (count_crlf > count_max)
+    {
+      eol_mode = QsciScintilla::EolWindows;
+      count_max = count_crlf;
+    }
+  if (count_lf > count_max)
+    {
+      eol_mode = QsciScintilla::EolUnix;
+      count_max = count_lf;
+    }
+  if (count_cr > count_max)
+    {
+      eol_mode = QsciScintilla::EolMac;
+    }
+
+  return eol_mode;
+}
+
+void file_editor_tab::update_eol_indicator ()
+{
+  switch (m_edit_area->eolMode ())
+    {
+    case QsciScintilla::EolWindows:
+      m_eol_indicator->setText ("CRLF");
+      break;
+    case QsciScintilla::EolMac:
+      m_eol_indicator->setText ("CR");
+      break;
+    case QsciScintilla::EolUnix:
+      m_eol_indicator->setText ("LF");
+      break;
+    }
+}
+
+void file_editor_tab::update_breakpoints ()
+{
+  if (m_file_name.isEmpty ())
+    return;
+
+  // Create and queue the command object.
+
+  // The interpreter_event callback function below emits a signal.
+  // Because we don't control when that happens, use a guarded pointer
+  // so that the callback can abort if this object is no longer valid.
+
+  QPointer<file_editor_tab> this_fetab (this);
+
+  emit interpreter_event
+    ([=] (interpreter& interp)
+     {
+       // INTERPRETER THREAD
+
+       // We can skip the entire callback function because it does not
+       // make any changes to the interpreter state.
+
+       if (this_fetab.isNull ())
+         return;
+
+       octave_value_list argout = Fdbstatus (interp, ovl (), 1);
+
+       connect (this, &file_editor_tab::update_breakpoints_signal,
+                this, &file_editor_tab::update_breakpoints_handler,
+                Qt::QueuedConnection);
+
+       emit update_breakpoints_signal (argout);
+     });
+}
+
+void file_editor_tab::update_breakpoints_handler (const octave_value_list& argout)
+{
+  octave_map dbg = argout(0).map_value ();
+  octave_idx_type n_dbg = dbg.numel ();
+
+  Cell file = dbg.contents ("file");
+  Cell line = dbg.contents ("line");
+  Cell cond = dbg.contents ("cond");
+
+  for (octave_idx_type i = 0; i < n_dbg; i++)
+    {
+      if (file (i).string_value () == m_file_name.toStdString ())
+        do_breakpoint_marker (true, this, line (i).int_value (),
+                              QString::fromStdString (cond (i).string_value ()));
+    }
+}
+
+void file_editor_tab::new_file (const QString& commands)
+{
+  update_window_title (false); // window title (no modification)
+
+  gui_settings settings;
+
+  // set the eol mode from the settings or depending on the OS if the entry is
+  // missing in the settings
+  m_edit_area->setEolMode (static_cast<QsciScintilla::EolMode> (settings.int_value (ed_default_eol_mode)));
+
+  update_eol_indicator ();
+
+  update_lexer ();
+
+  m_edit_area->setText (commands);
+  m_edit_area->setModified (!commands.isEmpty ());
+}
+
+void file_editor_tab::confirm_dbquit_and_save (const QString& file_to_save,
+                                               const QString& base_name,
+                                               bool remove_on_success,
+                                               bool restore_breakpoints)
+{
+  int ans = QMessageBox::question (nullptr, tr ("Debug or Save"),
+                                   tr ("This file is currently being executed.\n"
+                                       "Quit debugging and save?"),
+                                   QMessageBox::Save | QMessageBox::Cancel);
+
+  if (ans == QMessageBox::Save)
+    {
+      // The interpreter_event callback function below emits a signal.
+      // Because we don't control when that happens, use a guarded
+      // pointer so that the callback can abort if this object is no
+      // longer valid.
+
+      QPointer<file_editor_tab> this_fetab (this);
+
+      emit interpreter_event
+        ([=] (interpreter& interp)
+         {
+           // INTERPRETER THREAD
+
+           // If THIS_FETAB is no longer valid, we still want to
+           // perform the actions in the interpreter but we can't emit
+           // the signal associated with THIS_FETAB.
+
+           tree_evaluator& tw = interp.get_evaluator ();
+
+           tw.dbquit (true);
+
+           command_editor::interrupt (true);
+
+           std::string std_base_name = base_name.toStdString ();
+
+           symbol_table& symtab = interp.get_symbol_table ();
+
+           symtab.clear_user_function (std_base_name);
+
+           if (this_fetab.isNull ())
+             return;
+
+           emit do_save_file_signal (file_to_save, remove_on_success,
+                                     restore_breakpoints);
+         });
+    }
+}
+
+void file_editor_tab::save_file (const QString& saveFileName,
+                                 bool remove_on_success,
+                                 bool restore_breakpoints)
+{
+  // If it is a new file with no name, signal that saveFileAs
+  // should be performed.
+  if (! valid_file_name (saveFileName))
+    {
+      save_file_as (remove_on_success);
+      return;
+    }
+
+  m_encoding = m_new_encoding;    // consider a possible new encoding
+
+  // set the desired codec (if suitable for contents)
+  QTextCodec *codec = check_valid_codec ();
+  if (! codec)
+    return;   // No valid codec
+
+  // Get a list of breakpoint line numbers, before exiting debug mode
+  // and clearing function in interpreter_event action below.
+
+  emit report_marker_linenr (m_bp_lines, m_bp_conditions);
+
+  // get the absolute path (if existing)
+  QFileInfo file_info = QFileInfo (saveFileName);
+  QString file_to_save;
+  if (file_info.exists ())
+    {
+      file_to_save = file_info.canonicalFilePath ();
+      QString base_name = file_info.baseName ();
+
+      // The interpreter_event callback function below emits a signal.
+      // Because we don't control when that happens, use a guarded
+      // pointer so that the callback can abort if this object is no
+      // longer valid.
+
+      QPointer<file_editor_tab> this_fetab (this);
+
+      emit interpreter_event
+        ([=] (interpreter& interp)
+         {
+           // INTERPRETER THREAD
+
+           // We are intentionally skipping any side effects that may
+           // occur in the callback function if THIS_FETAB is no
+           // longer valid.  If the editor tab has disappeared, there
+           // is not much point in reloading the function to restore
+           // breakpoint info in the GUI.
+
+           if (this_fetab.isNull ())
+             return;
+
+           // Force reloading of a file after it is saved.
+           // This is needed to get the right line numbers for
+           // breakpoints (bug #46632).
+
+           tree_evaluator& tw = interp.get_evaluator ();
+
+           symbol_table& symtab = interp.get_symbol_table ();
+
+           std::string std_base_name = base_name.toStdString ();
+
+           if (tw.in_debug_repl ())
+             {
+               octave_value sym;
+               try
+                 {
+                   sym = symtab.find_user_function (std_base_name);
+                 }
+               catch (const execution_exception&)
+                 {
+                   interp.recover_from_exception ();
+
+                   // Ignore syntax error.  It was in the old file on disk;
+                   // the user may have fixed it already.
+                 }
+
+               // Return early if this file is not loaded in the symbol table
+               if (! sym.is_defined () || ! sym.is_user_code ())
+                 {
+                   emit do_save_file_signal (file_to_save, remove_on_success,
+                                             restore_breakpoints);
+                   return;
+                 }
+
+               octave_user_code *fcn = sym.user_code_value ();
+
+               std::string full_name = file_to_save.toStdString ();
+
+               if (sys::canonicalize_file_name (full_name)
+                   != sys::canonicalize_file_name (fcn->fcn_file_name ()))
+                 {
+                   emit do_save_file_signal (file_to_save, remove_on_success,
+                                             restore_breakpoints);
+                   return;
+                 }
+
+               // If this file is loaded, check that we aren't currently
+               // running it.
+               // FIXME: is there a better way to get this info?
+
+               octave_idx_type curr_frame = -1;
+
+               octave_map stk = tw.backtrace (curr_frame, false);
+
+               Cell names = stk.contents ("name");
+
+               for (octave_idx_type i = names.numel () - 1; i >= 0; i--)
+                 {
+                   if (names(i).string_value () == std_base_name)
+                     {
+                       emit confirm_dbquit_and_save_signal
+                         (file_to_save, base_name, remove_on_success,
+                          restore_breakpoints);
+                       return;
+                     }
+                 }
+             }
+
+           symtab.clear_user_function (std_base_name);
+
+           emit do_save_file_signal (file_to_save, remove_on_success,
+                                     restore_breakpoints);
+         });
+    }
+  else
+    emit do_save_file_signal (saveFileName, remove_on_success,
+                              restore_breakpoints);
+}
+
+void file_editor_tab::do_save_file (const QString& file_to_save,
+                                    bool remove_on_success,
+                                    bool restore_breakpoints)
+{
+  QSaveFile file (file_to_save);
+
+  // stop watching file
+  QStringList trackedFiles = m_file_system_watcher.files ();
+  if (trackedFiles.contains (file_to_save))
+    m_file_system_watcher.removePath (file_to_save);
+
+  // Remove trailing white spaces if desired
+
+  gui_settings settings;
+
+  if (settings.bool_value (ed_rm_trailing_spaces))
+    {
+      // Replace trailing spaces, make sure edit area is writable,
+      // which is not the case when saving at exit or when closing
+      // the modified file.
+      bool ro = m_edit_area->isReadOnly ();
+      m_edit_area->setReadOnly (false); // allow writing for replace_all
+      m_edit_area->replace_all ("[ \\t]+$", "", true, false, false);
+      m_edit_area->setReadOnly (ro);    // recover read only state
+    }
+
+  // open the file for writing (use QIODevice::ReadWrite for avoiding
+  // truncating the previous file contents)
+  if (! file.open (QIODevice::WriteOnly))
+    {
+      // Unsuccessful, begin watching file again if it was being
+      // watched previously.
+      if (trackedFiles.contains (file_to_save))
+        m_file_system_watcher.addPath (file_to_save);
+
+      // Create a NonModal message about error.
+      QMessageBox *msgBox
+        = new QMessageBox (QMessageBox::Critical,
+                           tr ("Octave Editor"),
+                           tr ("Could not open file %1 for write:\n%2.").
+                           arg (file_to_save).arg (file.errorString ()),
+                           QMessageBox::Ok, nullptr);
+      show_dialog (msgBox, false);
+
+      return;
+    }
+
+  // save the contents into the file
+
+  // write the file
+  QTextStream out (&file);
+
+  // set the desired codec (if suitable for contents)
+  QTextCodec *codec = check_valid_codec ();
+  if (! codec)
+    return;   // No valid codec
+
+  // Save the file
+  out.setCodec (codec);
+
+  QApplication::setOverrideCursor (Qt::WaitCursor);
+
+  out << m_edit_area->text ();
+  if (settings.bool_value (ed_force_newline)
+      && m_edit_area->text ().length ())
+    out << m_edit_area->eol_string ();   // Add newline if desired
+
+  out.flush ();
+  QApplication::restoreOverrideCursor ();
+
+  // Finish writing by committing the changes to disk,
+  // where nothing is done when an error occurred while writing above
+  bool writing_ok = file.commit ();
+
+  if (writing_ok)
+    {
+      // Writing was successful: file exists now
+      QFileInfo file_info = QFileInfo (file.fileName ());
+      QString full_file_to_save = file_info.canonicalFilePath ();
+
+      // file is save -> not modified, update encoding in statusbar
+      m_edit_area->setModified (false);
+      m_enc_indicator->setText (m_encoding);
+
+      // save filename after closing file as set_file_name starts watching again
+      set_file_name (full_file_to_save);   // make absolute
+
+      emit tab_ready_to_close ();
+
+      if (remove_on_success)
+        {
+          emit tab_remove_request ();
+          return;  // Don't touch member variables after removal
+        }
+
+      // Attempt to restore the breakpoints if that is desired.
+      // This is only allowed if the tab is not closing since changing
+      // breakpoints would reopen the tab in this case.
+      if (restore_breakpoints)
+        check_restore_breakpoints ();
+    }
+  else
+    {
+      QMessageBox::critical (nullptr,
                              tr ("Octave Editor"),
-                             tr ("Could not open file %1 for write:\n%2.").
-                             arg (file_to_save).arg (file.errorString ()),
-                             QMessageBox::Ok, nullptr);
-        show_dialog (msgBox, false);
-
-        return;
-      }
-
-    // save the contents into the file
-
-    // write the file
-    QTextStream out (&file);
-
-    // set the desired codec (if suitable for contents)
-    QTextCodec *codec = check_valid_codec ();
-    if (! codec)
-      return;   // No valid codec
-
-    // Save the file
-    out.setCodec (codec);
-
-    QApplication::setOverrideCursor (Qt::WaitCursor);
-
-    out << m_edit_area->text ();
-    if (settings.bool_value (ed_force_newline)
-        && m_edit_area->text ().length ())
-      out << m_edit_area->eol_string ();   // Add newline if desired
-
-    out.flush ();
-    QApplication::restoreOverrideCursor ();
-
-    // Finish writing by committing the changes to disk,
-    // where nothing is done when an error occurred while writing above
-    bool writing_ok = file.commit ();
-
-    if (writing_ok)
-      {
-        // Writing was successful: file exists now
-        QFileInfo file_info = QFileInfo (file.fileName ());
-        QString full_file_to_save = file_info.canonicalFilePath ();
-
-        // file is save -> not modified, update encoding in statusbar
-        m_edit_area->setModified (false);
-        m_enc_indicator->setText (m_encoding);
-
-        // save filename after closing file as set_file_name starts watching again
-        set_file_name (full_file_to_save);   // make absolute
-
-        emit tab_ready_to_close ();
-
-        if (remove_on_success)
-          {
-            emit tab_remove_request ();
-            return;  // Don't touch member variables after removal
-          }
-
-        // Attempt to restore the breakpoints if that is desired.
-        // This is only allowed if the tab is not closing since changing
-        // breakpoints would reopen the tab in this case.
-        if (restore_breakpoints)
-          check_restore_breakpoints ();
-      }
-    else
-      {
-        QMessageBox::critical (nullptr,
-                               tr ("Octave Editor"),
-                               tr ("The changes could not be saved to the file\n"
-                                   "%1")
-                                   .arg (file.fileName ())
-                              );
-      }
-  }
-
-  void file_editor_tab::save_file_as (bool remove_on_success)
-  {
-    // Simply put up the file chooser dialog box with a slot connection
-    // then return control to the system waiting for a file selection.
-
-    // reset m_new_encoding
-    m_new_encoding = m_encoding;
-
-    // If the tab is removed in response to a QFileDialog signal, the tab
-    // can't be a parent.
-    QFileDialog *fileDialog;
-    if (remove_on_success)
-      {
-        // If tab is closed, "this" cannot be parent in which case modality
-        // has no effect.  Disable editing instead.
-        m_edit_area->setReadOnly (true);
-        fileDialog = new QFileDialog ();
-      }
-    else
-      fileDialog = new QFileDialog (this);
-
-    // add the possible filters and the default suffix
-    QStringList filters;
-    filters << tr ("Octave Files (*.m)")
-            << tr ("All Files (*)");
-    fileDialog->setNameFilters (filters);
-    fileDialog->setDefaultSuffix ("m");
-
-    if (valid_file_name ())
-      {
-        fileDialog->selectFile (m_file_name);
-        QFileInfo file_info (m_file_name);
-        if (file_info.suffix () != "m")
-          {
-            // it is not an octave file
-            fileDialog->selectNameFilter (filters.at (1));  // "All Files"
-            fileDialog->setDefaultSuffix ("");              // no default suffix
-          }
-      }
-    else
-      {
-        fileDialog->selectFile ("");
-        fileDialog->setDirectory (m_ced);
-
-        // propose a name corresponding to the function name
-        // if the new file contains a function
-        QString fname = get_function_name ();
-        if (! fname.isEmpty ())
-          fileDialog->selectFile (fname + ".m");
-      }
-
-    fileDialog->setAcceptMode (QFileDialog::AcceptSave);
-    fileDialog->setViewMode (QFileDialog::Detail);
-    fileDialog->setOption (QFileDialog::HideNameFilterDetails, false);
-
-    // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
-
-    gui_settings settings;
-
-    if (! settings.bool_value (global_use_native_dialogs))
-      {
-        // Qt file dialogs
-        fileDialog->setOption(QFileDialog::DontUseNativeDialog);
-      }
-    else
-      {
-        // Native file dialogs: Test for already existing files is done manually
-        // since native file dialogs might not consider the automatically
-        // appended default extension when checking if the file already exists
-        fileDialog->setOption(QFileDialog::DontConfirmOverwrite);
-      }
-
-    connect (fileDialog, &QFileDialog::filterSelected,
-             this, &file_editor_tab::handle_save_as_filter_selected);
-
-    if (remove_on_success)
-      {
-        connect (fileDialog, &QFileDialog::fileSelected,
-                 this, &file_editor_tab::handle_save_file_as_answer_close);
-
-        connect (fileDialog, &QFileDialog::rejected,
-                 this, &file_editor_tab::handle_save_file_as_answer_cancel);
-      }
-    else
-      {
-        connect (fileDialog, &QFileDialog::fileSelected,
-                 this, &file_editor_tab::handle_save_file_as_answer);
-      }
-
-    show_dialog (fileDialog, ! valid_file_name ());
-  }
-
-  void file_editor_tab::handle_save_as_filter_selected (const QString& filter)
-  {
-    // On some systems, the filterSelected signal is emitted without user
-    // action and with  an empty filter string when the file dialog is shown.
-    // Just return in this case and do not remove the current default suffix.
-    if (filter.isEmpty ())
-      return;
-
-    QFileDialog *file_dialog = qobject_cast<QFileDialog *> (sender ());
-
-    QRegExp rx ("\\*\\.([^ ^\\)]*)[ \\)]");   // regexp for suffix in filter
-    int index = rx.indexIn (filter, 0);       // get first suffix in filter
-
-    if (index > -1)
-      file_dialog->setDefaultSuffix (rx.cap (1)); // found a suffix, set default
-    else
-      file_dialog->setDefaultSuffix ("");         // not found, clear default
-  }
-
-  bool file_editor_tab::check_valid_identifier (QString file_name)
-  {
-    QFileInfo file = QFileInfo (file_name);
-    QString base_name = file.baseName ();
-
-    if ((file.suffix () == "m")
-        && (! valid_identifier (base_name.toStdString ())))
-      {
-        int ans = QMessageBox::question (nullptr, tr ("Octave Editor"),
-                                         tr ("\"%1\"\n"
-                                             "is not a valid identifier.\n\n"
-                                             "If you keep this filename, you will not be able to\n"
-                                             "call your script using its name as an Octave command.\n\n"
-                                             "Do you want to choose another name?").arg (base_name),
-                                         QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
-
-        if (ans == QMessageBox::Yes)
-          return true;
-      }
-
-    return false;
-  }
-
-  QTextCodec* file_editor_tab::check_valid_codec ()
-  {
-    QTextCodec *codec = QTextCodec::codecForName (m_encoding.toLatin1 ());
-
-    // "SYSTEM" is used as alias for the locale encoding.
-    if ((! codec) && m_encoding.startsWith("SYSTEM"))
-      codec = QTextCodec::codecForLocale ();
-
-    if (! codec)
-      {
-        QMessageBox::critical (nullptr,
-                               tr ("Octave Editor"),
-                               tr ("The current encoding %1\n"
-                                   "can not be applied.\n\n"
-                                   "Please select another one!").arg (m_encoding));
-
+                             tr ("The changes could not be saved to the file\n"
+                                 "%1")
+                                 .arg (file.fileName ())
+                            );
+    }
+}
+
+void file_editor_tab::save_file_as (bool remove_on_success)
+{
+  // Simply put up the file chooser dialog box with a slot connection
+  // then return control to the system waiting for a file selection.
+
+  // reset m_new_encoding
+  m_new_encoding = m_encoding;
+
+  // If the tab is removed in response to a QFileDialog signal, the tab
+  // can't be a parent.
+  QFileDialog *fileDialog;
+  if (remove_on_success)
+    {
+      // If tab is closed, "this" cannot be parent in which case modality
+      // has no effect.  Disable editing instead.
+      m_edit_area->setReadOnly (true);
+      fileDialog = new QFileDialog ();
+    }
+  else
+    fileDialog = new QFileDialog (this);
+
+  // add the possible filters and the default suffix
+  QStringList filters;
+  filters << tr ("Octave Files (*.m)")
+          << tr ("All Files (*)");
+  fileDialog->setNameFilters (filters);
+  fileDialog->setDefaultSuffix ("m");
+
+  if (valid_file_name ())
+    {
+      fileDialog->selectFile (m_file_name);
+      QFileInfo file_info (m_file_name);
+      if (file_info.suffix () != "m")
+        {
+          // it is not an octave file
+          fileDialog->selectNameFilter (filters.at (1));  // "All Files"
+          fileDialog->setDefaultSuffix ("");              // no default suffix
+        }
+    }
+  else
+    {
+      fileDialog->selectFile ("");
+      fileDialog->setDirectory (m_ced);
+
+      // propose a name corresponding to the function name
+      // if the new file contains a function
+      QString fname = get_function_name ();
+      if (! fname.isEmpty ())
+        fileDialog->selectFile (fname + ".m");
+    }
+
+  fileDialog->setAcceptMode (QFileDialog::AcceptSave);
+  fileDialog->setViewMode (QFileDialog::Detail);
+  fileDialog->setOption (QFileDialog::HideNameFilterDetails, false);
+
+  // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
+
+  gui_settings settings;
+
+  if (! settings.bool_value (global_use_native_dialogs))
+    {
+      // Qt file dialogs
+      fileDialog->setOption(QFileDialog::DontUseNativeDialog);
+    }
+  else
+    {
+      // Native file dialogs: Test for already existing files is done manually
+      // since native file dialogs might not consider the automatically
+      // appended default extension when checking if the file already exists
+      fileDialog->setOption(QFileDialog::DontConfirmOverwrite);
+    }
+
+  connect (fileDialog, &QFileDialog::filterSelected,
+           this, &file_editor_tab::handle_save_as_filter_selected);
+
+  if (remove_on_success)
+    {
+      connect (fileDialog, &QFileDialog::fileSelected,
+               this, &file_editor_tab::handle_save_file_as_answer_close);
+
+      connect (fileDialog, &QFileDialog::rejected,
+               this, &file_editor_tab::handle_save_file_as_answer_cancel);
+    }
+  else
+    {
+      connect (fileDialog, &QFileDialog::fileSelected,
+               this, &file_editor_tab::handle_save_file_as_answer);
+    }
+
+  show_dialog (fileDialog, ! valid_file_name ());
+}
+
+void file_editor_tab::handle_save_as_filter_selected (const QString& filter)
+{
+  // On some systems, the filterSelected signal is emitted without user
+  // action and with  an empty filter string when the file dialog is shown.
+  // Just return in this case and do not remove the current default suffix.
+  if (filter.isEmpty ())
+    return;
+
+  QFileDialog *file_dialog = qobject_cast<QFileDialog *> (sender ());
+
+  QRegExp rx ("\\*\\.([^ ^\\)]*)[ \\)]");   // regexp for suffix in filter
+  int index = rx.indexIn (filter, 0);       // get first suffix in filter
+
+  if (index > -1)
+    file_dialog->setDefaultSuffix (rx.cap (1)); // found a suffix, set default
+  else
+    file_dialog->setDefaultSuffix ("");         // not found, clear default
+}
+
+bool file_editor_tab::check_valid_identifier (QString file_name)
+{
+  QFileInfo file = QFileInfo (file_name);
+  QString base_name = file.baseName ();
+
+  if ((file.suffix () == "m")
+      && (! valid_identifier (base_name.toStdString ())))
+    {
+      int ans = QMessageBox::question (nullptr, tr ("Octave Editor"),
+                                       tr ("\"%1\"\n"
+                                           "is not a valid identifier.\n\n"
+                                           "If you keep this filename, you will not be able to\n"
+                                           "call your script using its name as an Octave command.\n\n"
+                                           "Do you want to choose another name?").arg (base_name),
+                                       QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
+
+      if (ans == QMessageBox::Yes)
+        return true;
+    }
+
+  return false;
+}
+
+QTextCodec* file_editor_tab::check_valid_codec ()
+{
+  QTextCodec *codec = QTextCodec::codecForName (m_encoding.toLatin1 ());
+
+  // "SYSTEM" is used as alias for the locale encoding.
+  if ((! codec) && m_encoding.startsWith("SYSTEM"))
+    codec = QTextCodec::codecForLocale ();
+
+  if (! codec)
+    {
+      QMessageBox::critical (nullptr,
+                             tr ("Octave Editor"),
+                             tr ("The current encoding %1\n"
+                                 "can not be applied.\n\n"
+                                 "Please select another one!").arg (m_encoding));
+
+      return nullptr;
+    }
+
+  QString editor_text = m_edit_area->text ();
+  bool can_encode = codec->canEncode (editor_text);
+
+  // We cannot rely on QTextCodec::canEncode because it uses the
+  // ConverterState of convertFromUnicode which isn't updated by some
+  // implementations.
+  if (can_encode)
+    {
+      QVector<uint> u32_str = editor_text.toUcs4 ();
+      const uint32_t *src = reinterpret_cast<const uint32_t *>
+                            (u32_str.data ());
+
+      std::size_t length;
+      const std::string encoding = m_encoding.toStdString ();
+      char *res_str =
+        octave_u32_conv_to_encoding_strict (encoding.c_str (), src,
+                                            u32_str.size (), &length);
+      if (! res_str)
+        {
+          if (errno == EILSEQ)
+            can_encode = false;
+        }
+      else
+        ::free (static_cast<void *> (res_str));
+    }
+
+  if (! can_encode)
+    {
+      QMessageBox::StandardButton pressed_button
+        = QMessageBox::critical (nullptr,
+                                 tr ("Octave Editor"),
+                                 tr ("The current editor contents can not be encoded\n"
+                                     "with the selected encoding %1.\n"
+                                     "Using it would result in data loss!\n\n"
+                                     "Please select another one!").arg (m_encoding),
+                                 QMessageBox::Cancel | QMessageBox::Ignore,
+                                 QMessageBox::Cancel);
+
+      if (pressed_button == QMessageBox::Ignore)
+        return codec;
+      else
         return nullptr;
-      }
-
-    QString editor_text = m_edit_area->text ();
-    bool can_encode = codec->canEncode (editor_text);
-
-    // We cannot rely on QTextCodec::canEncode because it uses the
-    // ConverterState of convertFromUnicode which isn't updated by some
-    // implementations.
-    if (can_encode)
-      {
-        QVector<uint> u32_str = editor_text.toUcs4 ();
-        const uint32_t *src = reinterpret_cast<const uint32_t *>
-                              (u32_str.data ());
-
-        std::size_t length;
-        const std::string encoding = m_encoding.toStdString ();
-        char *res_str =
-          octave_u32_conv_to_encoding_strict (encoding.c_str (), src,
-                                              u32_str.size (), &length);
-        if (! res_str)
-          {
-            if (errno == EILSEQ)
-              can_encode = false;
-          }
-        else
-          ::free (static_cast<void *> (res_str));
-      }
-
-    if (! can_encode)
-      {
-        QMessageBox::StandardButton pressed_button
-          = QMessageBox::critical (nullptr,
-                                   tr ("Octave Editor"),
-                                   tr ("The current editor contents can not be encoded\n"
-                                       "with the selected encoding %1.\n"
-                                       "Using it would result in data loss!\n\n"
-                                       "Please select another one!").arg (m_encoding),
-                                   QMessageBox::Cancel | QMessageBox::Ignore,
-                                   QMessageBox::Cancel);
-
-        if (pressed_button == QMessageBox::Ignore)
-          return codec;
-        else
-          return nullptr;
-      }
-
-    return codec;
-  }
-
-  void file_editor_tab::handle_save_file_as_answer (const QString& save_file_name)
-  {
-    QString saveFileName = save_file_name;
-    QFileInfo file (saveFileName);
-    QFileDialog *file_dialog = qobject_cast<QFileDialog *> (sender ());
-
-    // Test if the file dialog should have added a default file
-    // suffix, but the selected file still has no suffix (see Qt bug
-    // https://bugreports.qt.io/browse/QTBUG-59401)
-    if ((! file_dialog->defaultSuffix ().isEmpty ()) && file.suffix ().isEmpty ())
-      {
-        saveFileName = saveFileName + "." + file_dialog->defaultSuffix ();
-      }
-
-    file.setFile (saveFileName);
-
-    // If overwrite confirmation was not done by the file dialog (in case
-    // of native file dialogs, see above), do it here
-    if (file_dialog->testOption (QFileDialog::DontConfirmOverwrite) && file.exists ())
-      {
-        int ans = QMessageBox::question (file_dialog,
-                              tr ("Octave Editor"),
-                              tr ("%1\n already exists\n"
-                                  "Do you want to overwrite it?").arg (saveFileName),
-                              QMessageBox::Yes | QMessageBox::No);
-        if (ans != QMessageBox::Yes)
-          {
-            // Try again, if edit area is read only, remove on success
-            save_file_as (m_edit_area->isReadOnly ());
-            return;
-          }
-      }
-
-    if (saveFileName == m_file_name)
-      {
-        save_file (saveFileName);
-      }
-    else
-      {
-        // Have editor check for conflict, do not delete tab after save.
-        if (check_valid_identifier (saveFileName))
-          save_file_as (false);
-        else
-          emit editor_check_conflict_save (saveFileName, false);
-      }
-  }
-
-  void file_editor_tab::handle_save_file_as_answer_close (const QString& saveFileName)
-  {
-    // saveFileName == m_file_name can not happen, because we only can get here
-    // when we close a tab and m_file_name is not a valid filename yet
-
-    // Have editor check for conflict, delete tab after save.
-    if (check_valid_identifier (saveFileName))
-      save_file_as (true);
-    else
-      emit editor_check_conflict_save (saveFileName, true);
-  }
-
-  void file_editor_tab::handle_save_file_as_answer_cancel ()
-  {
-    // User canceled, allow editing again.
-    m_edit_area->setReadOnly (false);
-  }
-
-  void file_editor_tab::file_has_changed (const QString&, bool do_close)
-  {
-    bool file_exists = QFile::exists (m_file_name);
-
-    if (file_exists && ! do_close)
-      {
-        // Test if file is really modified or if just the timezone has
-        // changed.  In the latter, just return without doing anything.
-        QDateTime modified = QFileInfo (m_file_name).lastModified ().toUTC ();
-
-        if (modified <= m_last_modified)
+    }
+
+  return codec;
+}
+
+void file_editor_tab::handle_save_file_as_answer (const QString& save_file_name)
+{
+  QString saveFileName = save_file_name;
+  QFileInfo file (saveFileName);
+  QFileDialog *file_dialog = qobject_cast<QFileDialog *> (sender ());
+
+  // Test if the file dialog should have added a default file
+  // suffix, but the selected file still has no suffix (see Qt bug
+  // https://bugreports.qt.io/browse/QTBUG-59401)
+  if ((! file_dialog->defaultSuffix ().isEmpty ()) && file.suffix ().isEmpty ())
+    {
+      saveFileName = saveFileName + "." + file_dialog->defaultSuffix ();
+    }
+
+  file.setFile (saveFileName);
+
+  // If overwrite confirmation was not done by the file dialog (in case
+  // of native file dialogs, see above), do it here
+  if (file_dialog->testOption (QFileDialog::DontConfirmOverwrite) && file.exists ())
+    {
+      int ans = QMessageBox::question (file_dialog,
+                            tr ("Octave Editor"),
+                            tr ("%1\n already exists\n"
+                                "Do you want to overwrite it?").arg (saveFileName),
+                            QMessageBox::Yes | QMessageBox::No);
+      if (ans != QMessageBox::Yes)
+        {
+          // Try again, if edit area is read only, remove on success
+          save_file_as (m_edit_area->isReadOnly ());
           return;
-
-        m_last_modified = modified;
-      }
-
-    // Prevent popping up multiple message boxes when the file has
-    // been changed multiple times by temporarily removing from the
-    // file watcher.
-    QStringList trackedFiles = m_file_system_watcher.files ();
-    if (! trackedFiles.isEmpty ())
-      m_file_system_watcher.removePath (m_file_name);
-
-    if (file_exists && ! do_close)
-      {
-
-        // The file is modified
-        if (m_always_reload_changed_files)
-          load_file (m_file_name);
-
-        else
-          {
-            // give editor and this tab the focus,
-            // possibly making the editor visible if it is hidden
-            emit set_focus_editor_signal (this);
-            m_edit_area->setFocus ();
-
-            // Create a WindowModal message that blocks the edit area
-            // by making m_edit_area parent.
-            QMessageBox *msgBox
-              = new QMessageBox (QMessageBox::Warning,
-                                 tr ("Octave Editor"),
-                                 tr ("It seems that \'%1\' has been modified by another application. Do you want to reload it?").
-                                 arg (m_file_name),
-                                 QMessageBox::Yes | QMessageBox::No, this);
-
-            connect (msgBox, &QMessageBox::finished,
-                     this, &file_editor_tab::handle_file_reload_answer);
-
-            msgBox->setWindowModality (Qt::WindowModal);
-            msgBox->setAttribute (Qt::WA_DeleteOnClose);
-            msgBox->show ();
-          }
-      }
-    else
-      {
-        // If desired and if file is not modified,
-        // close the file without any user interaction
-        if (do_close && ! m_edit_area->isModified ())
-          {
-            handle_file_resave_answer (QMessageBox::Cancel);
-            return;
-          }
-
-        // give editor and this tab the focus,
-        // possibly making the editor visible if it is hidden
-        emit set_focus_editor_signal (this);
-        m_edit_area->setFocus ();
-
-        QString modified = "";
-        if (m_edit_area->isModified ())
-          modified = tr ("\n\nWarning: The contents in the editor is modified!");
-
-        // Create a WindowModal message.  The file editor tab can't be made
-        // parent because it may be deleted depending upon the response.
-        // Instead, change the m_edit_area to read only.
-        QMessageBox *msgBox
-          = new QMessageBox (QMessageBox::Warning, tr ("Octave Editor"),
-                             tr ("It seems that the file\n"
-                                 "%1\n"
-                                 "has been deleted or renamed. Do you want to save it now?%2").
-                             arg (m_file_name).arg (modified),
-                             QMessageBox::Save | QMessageBox::Close, nullptr);
-
-        m_edit_area->setReadOnly (true);
-
-        connect (msgBox, &QMessageBox::finished,
-                 this, &file_editor_tab::handle_file_resave_answer);
-
-        msgBox->setWindowModality (Qt::WindowModal);
-        msgBox->setAttribute (Qt::WA_DeleteOnClose);
-        msgBox->show ();
-      }
-  }
-
-  void file_editor_tab::notice_settings (bool init)
-  {
-    gui_settings settings;
-
-    if (! init)
-      update_lexer_settings ();
-
-    // code folding
-    if (settings.bool_value (ed_code_folding))
-      {
-        m_edit_area->setMarginType (3, QsciScintilla::SymbolMargin);
-        m_edit_area->setFolding (QsciScintilla::BoxedTreeFoldStyle, 3);
-      }
-    else
-      {
-        m_edit_area->setFolding (QsciScintilla::NoFoldStyle, 3);
-      }
-
-    // status bar
-    if (settings.bool_value (ed_show_edit_status_bar))
-      m_status_bar->show ();
-    else
-      m_status_bar->hide ();
-
-    //highlight current line color
-    m_edit_area->setCaretLineVisible
-      (settings.bool_value (ed_highlight_current_line));
-
-    // auto completion
-    bool match_keywords = settings.bool_value (ed_code_completion_keywords);
-    bool match_document = settings.bool_value (ed_code_completion_document);
-
-    QsciScintilla::AutoCompletionSource source = QsciScintilla::AcsNone;
-    if (match_keywords)
-      if (match_document)
-        source = QsciScintilla::AcsAll;
+        }
+    }
+
+  if (saveFileName == m_file_name)
+    {
+      save_file (saveFileName);
+    }
+  else
+    {
+      // Have editor check for conflict, do not delete tab after save.
+      if (check_valid_identifier (saveFileName))
+        save_file_as (false);
+      else
+        emit editor_check_conflict_save (saveFileName, false);
+    }
+}
+
+void file_editor_tab::handle_save_file_as_answer_close (const QString& saveFileName)
+{
+  // saveFileName == m_file_name can not happen, because we only can get here
+  // when we close a tab and m_file_name is not a valid filename yet
+
+  // Have editor check for conflict, delete tab after save.
+  if (check_valid_identifier (saveFileName))
+    save_file_as (true);
+  else
+    emit editor_check_conflict_save (saveFileName, true);
+}
+
+void file_editor_tab::handle_save_file_as_answer_cancel ()
+{
+  // User canceled, allow editing again.
+  m_edit_area->setReadOnly (false);
+}
+
+void file_editor_tab::file_has_changed (const QString&, bool do_close)
+{
+  bool file_exists = QFile::exists (m_file_name);
+
+  if (file_exists && ! do_close)
+    {
+      // Test if file is really modified or if just the timezone has
+      // changed.  In the latter, just return without doing anything.
+      QDateTime modified = QFileInfo (m_file_name).lastModified ().toUTC ();
+
+      if (modified <= m_last_modified)
+        return;
+
+      m_last_modified = modified;
+    }
+
+  // Prevent popping up multiple message boxes when the file has
+  // been changed multiple times by temporarily removing from the
+  // file watcher.
+  QStringList trackedFiles = m_file_system_watcher.files ();
+  if (! trackedFiles.isEmpty ())
+    m_file_system_watcher.removePath (m_file_name);
+
+  if (file_exists && ! do_close)
+    {
+
+      // The file is modified
+      if (m_always_reload_changed_files)
+        load_file (m_file_name);
+
       else
-        source = QsciScintilla::AcsAPIs;
-    else if (match_document)
-      source = QsciScintilla::AcsDocument;
-    m_edit_area->setAutoCompletionSource (source);
-
-    m_edit_area->setAutoCompletionReplaceWord
-      (settings.bool_value (ed_code_completion_replace));
-    m_edit_area->setAutoCompletionCaseSensitivity
-      (settings.bool_value (ed_code_completion_case));
-
-    if (settings.bool_value (ed_code_completion))
-      m_edit_area->setAutoCompletionThreshold
-        (settings.int_value (ed_code_completion_threshold));
-    else
-      m_edit_area->setAutoCompletionThreshold (-1);
-
-    if (settings.bool_value (ed_show_white_space))
-      if (settings.bool_value (ed_show_white_space_indent))
-        m_edit_area->setWhitespaceVisibility (QsciScintilla::WsVisibleAfterIndent);
-      else
-        m_edit_area->setWhitespaceVisibility (QsciScintilla::WsVisible);
+        {
+          // give editor and this tab the focus,
+          // possibly making the editor visible if it is hidden
+          emit set_focus_editor_signal (this);
+          m_edit_area->setFocus ();
+
+          // Create a WindowModal message that blocks the edit area
+          // by making m_edit_area parent.
+          QMessageBox *msgBox
+            = new QMessageBox (QMessageBox::Warning,
+                               tr ("Octave Editor"),
+                               tr ("It seems that \'%1\' has been modified by another application. Do you want to reload it?").
+                               arg (m_file_name),
+                               QMessageBox::Yes | QMessageBox::No, this);
+
+          connect (msgBox, &QMessageBox::finished,
+                   this, &file_editor_tab::handle_file_reload_answer);
+
+          msgBox->setWindowModality (Qt::WindowModal);
+          msgBox->setAttribute (Qt::WA_DeleteOnClose);
+          msgBox->show ();
+        }
+    }
+  else
+    {
+      // If desired and if file is not modified,
+      // close the file without any user interaction
+      if (do_close && ! m_edit_area->isModified ())
+        {
+          handle_file_resave_answer (QMessageBox::Cancel);
+          return;
+        }
+
+      // give editor and this tab the focus,
+      // possibly making the editor visible if it is hidden
+      emit set_focus_editor_signal (this);
+      m_edit_area->setFocus ();
+
+      QString modified = "";
+      if (m_edit_area->isModified ())
+        modified = tr ("\n\nWarning: The contents in the editor is modified!");
+
+      // Create a WindowModal message.  The file editor tab can't be made
+      // parent because it may be deleted depending upon the response.
+      // Instead, change the m_edit_area to read only.
+      QMessageBox *msgBox
+        = new QMessageBox (QMessageBox::Warning, tr ("Octave Editor"),
+                           tr ("It seems that the file\n"
+                               "%1\n"
+                               "has been deleted or renamed. Do you want to save it now?%2").
+                           arg (m_file_name).arg (modified),
+                           QMessageBox::Save | QMessageBox::Close, nullptr);
+
+      m_edit_area->setReadOnly (true);
+
+      connect (msgBox, &QMessageBox::finished,
+               this, &file_editor_tab::handle_file_resave_answer);
+
+      msgBox->setWindowModality (Qt::WindowModal);
+      msgBox->setAttribute (Qt::WA_DeleteOnClose);
+      msgBox->show ();
+    }
+}
+
+void file_editor_tab::notice_settings (bool init)
+{
+  gui_settings settings;
+
+  if (! init)
+    update_lexer_settings ();
+
+  // code folding
+  if (settings.bool_value (ed_code_folding))
+    {
+      m_edit_area->setMarginType (3, QsciScintilla::SymbolMargin);
+      m_edit_area->setFolding (QsciScintilla::BoxedTreeFoldStyle, 3);
+    }
+  else
+    {
+      m_edit_area->setFolding (QsciScintilla::NoFoldStyle, 3);
+    }
+
+  // status bar
+  if (settings.bool_value (ed_show_edit_status_bar))
+    m_status_bar->show ();
+  else
+    m_status_bar->hide ();
+
+  //highlight current line color
+  m_edit_area->setCaretLineVisible
+    (settings.bool_value (ed_highlight_current_line));
+
+  // auto completion
+  bool match_keywords = settings.bool_value (ed_code_completion_keywords);
+  bool match_document = settings.bool_value (ed_code_completion_document);
+
+  QsciScintilla::AutoCompletionSource source = QsciScintilla::AcsNone;
+  if (match_keywords)
+    if (match_document)
+      source = QsciScintilla::AcsAll;
     else
-      m_edit_area->setWhitespaceVisibility (QsciScintilla::WsInvisible);
-
-    m_edit_area->setEolVisibility (settings.bool_value (ed_show_eol_chars));
-
-    m_save_as_desired_eol = static_cast<QsciScintilla::EolMode>
-                              (settings.int_value (ed_default_eol_mode));
-
-    if (settings.bool_value (ed_show_line_numbers))
-      {
-        m_edit_area->setMarginLineNumbers (2, true);
-        auto_margin_width ();
-        connect (m_edit_area, SIGNAL (linesChanged ()),
-                 this, SLOT (auto_margin_width ()));
-      }
-    else
-      {
-        m_edit_area->setMarginLineNumbers (2, false);
-        disconnect (m_edit_area, SIGNAL (linesChanged ()), nullptr, nullptr);
-      }
-
-    m_smart_indent = settings.bool_value (ed_auto_indent);
-    m_edit_area->setAutoIndent (m_smart_indent);
-    m_edit_area->setTabIndents
-      (settings.bool_value (ed_tab_indents_line));
-    m_edit_area->setBackspaceUnindents
-      (settings.bool_value (ed_backspace_unindents_line));
-    m_edit_area->setIndentationGuides
-      (settings.bool_value (ed_show_indent_guides));
-    m_edit_area->setIndentationsUseTabs
-      (settings.bool_value (ed_indent_uses_tabs));
-    m_edit_area->setIndentationWidth
-      (settings.int_value (ed_indent_width));
-
-    m_edit_area->setTabWidth
-      (settings.int_value (ed_tab_width));
-
-    m_ind_char_width = 1;
-    if (m_edit_area->indentationsUseTabs ())
-      m_ind_char_width = m_edit_area->tabWidth ();
-
-    m_edit_area->SendScintilla (QsciScintillaBase::SCI_SETHSCROLLBAR,
-                                settings.bool_value (ed_show_hscroll_bar));
-    m_edit_area->SendScintilla (QsciScintillaBase::SCI_SETSCROLLWIDTH,-1);
-    m_edit_area->SendScintilla (QsciScintillaBase::SCI_SETSCROLLWIDTHTRACKING,true);
-
-    update_window_title (m_edit_area->isModified ());
-
-    m_auto_endif = settings.int_value (ed_auto_endif);
-
-    // long line marker
-    int line_length = settings.int_value (ed_long_line_column);
-    m_edit_area->setEdgeColumn (line_length);
-
-    if (settings.bool_value (ed_long_line_marker))
-      {
-        if (settings.bool_value (ed_long_line_marker_line))
-          m_edit_area->setEdgeMode (QsciScintilla::EdgeLine);
-        else
-          {
-            if (settings.bool_value (ed_long_line_marker_background))
-              m_edit_area->setEdgeMode (QsciScintilla::EdgeBackground);
-            else
-              m_edit_area->setEdgeMode (QsciScintilla::EdgeLine);
-          }
-      }
-    else
-      m_edit_area->setEdgeMode (QsciScintilla::EdgeNone);
-
-    // line wrapping and breaking
-    m_edit_area->setWrapVisualFlags (QsciScintilla::WrapFlagByBorder);
-    m_edit_area->setWrapIndentMode (QsciScintilla::WrapIndentSame);
-
-    if (settings.bool_value (ed_wrap_lines))
-      m_edit_area->setWrapMode (QsciScintilla::WrapWord);
-    else
-      m_edit_area->setWrapMode (QsciScintilla::WrapNone);
-
-    if (settings.bool_value (ed_break_lines))
-      m_line_break = line_length;
-    else
-      m_line_break = 0;
-
-    m_line_break_comments =
-      settings.bool_value (ed_break_lines_comments);
-
-    // highlight all occurrences of a word selected by a double click
-    m_highlight_all_occurrences =
-      settings.bool_value (ed_highlight_all_occurrences);
-
-    // reload changed files
-    m_always_reload_changed_files =
-      settings.bool_value (ed_always_reload_changed_files);
-
-    // Set cursor blinking depending on the settings.
-    // QScintilla ignores the application global settings, so some special
-    // handling is required
-    bool cursor_blinking;
-
-    if (settings.contains (global_cursor_blinking.settings_key ()))
-      cursor_blinking = settings.bool_value (global_cursor_blinking);
-    else
-      cursor_blinking = settings.bool_value (cs_cursor_blinking);
-
-    if (cursor_blinking)
-      m_edit_area->SendScintilla (QsciScintillaBase::SCI_SETCARETPERIOD, 500);
-    else
-      m_edit_area->SendScintilla (QsciScintillaBase::SCI_SETCARETPERIOD, 0);
-
-  }
-
-  void file_editor_tab::auto_margin_width ()
-  {
-    m_edit_area->setMarginWidth (2, "1" + QString::number (m_edit_area->lines ()));
-  }
-
-  // the following close request was changed from a signal slot into a
-  // normal function because we need the return value from close whether
-  // the tab really was closed (for canceling exiting octave).
-  // When emitting a signal, only the return value from the last slot
-  // goes back to the sender
-  bool file_editor_tab::conditional_close ()
-  {
-    return close ();
-  }
-
-  void file_editor_tab::change_editor_state (const QWidget *ID)
-  {
-    if (ID != this)
-      return;
-
-    emit editor_state_changed (m_copy_available, m_is_octave_file,
-                               m_edit_area->isModified ());
-  }
-
-  void file_editor_tab::handle_file_reload_answer (int decision)
-  {
-    if (decision == QMessageBox::Yes)
-      {
-        // reload: file is readded to the file watcher in set_file_name ()
-        load_file (m_file_name);
-      }
-    else
-      {
-        // do not reload: readd to the file watcher
-        m_file_system_watcher.addPath (m_file_name);
-      }
-  }
-
-  void file_editor_tab::handle_file_resave_answer (int decision)
-  {
-    // check decision of user in dialog
-    if (decision == QMessageBox::Save)
-      {
-        save_file (m_file_name);  // readds file to watcher in set_file_name ()
-        m_edit_area->setReadOnly (false);  // delete read only flag
-      }
+      source = QsciScintilla::AcsAPIs;
+  else if (match_document)
+    source = QsciScintilla::AcsDocument;
+  m_edit_area->setAutoCompletionSource (source);
+
+  m_edit_area->setAutoCompletionReplaceWord
+    (settings.bool_value (ed_code_completion_replace));
+  m_edit_area->setAutoCompletionCaseSensitivity
+    (settings.bool_value (ed_code_completion_case));
+
+  if (settings.bool_value (ed_code_completion))
+    m_edit_area->setAutoCompletionThreshold
+      (settings.int_value (ed_code_completion_threshold));
+  else
+    m_edit_area->setAutoCompletionThreshold (-1);
+
+  if (settings.bool_value (ed_show_white_space))
+    if (settings.bool_value (ed_show_white_space_indent))
+      m_edit_area->setWhitespaceVisibility (QsciScintilla::WsVisibleAfterIndent);
     else
-      {
-        // Definitely close the file.
-        // Set modified to false to prevent the dialog box when the close event
-        // is posted.  If the user cancels the close in this dialog the tab is
-        // left open with a non-existing file.
-        m_edit_area->setModified (false);
-        close ();
-      }
-  }
-
-  void file_editor_tab::insert_debugger_pointer (const QWidget *ID, int line)
-  {
-    if (ID != this || ID == nullptr)
-      return;
-
-    emit remove_all_positions ();  // debugger_position, unsure_debugger_position
-
-    if (line > 0)
-      {
-        marker *dp;
-
-        if (m_edit_area->isModified ())
-          {
-            // The best that can be done if the editor contents have been
-            // modified is to see if there is a match with the original
-            // line number of any existing breakpoints.  We can put a normal
-            // debugger pointer at that breakpoint position.  Otherwise, it
-            // isn't certain whether the original line number and current line
-            // number match.
-            int editor_linenr = -1;
-            marker *dummy;
-            emit find_translated_line_number (line, editor_linenr, dummy);
-            if (editor_linenr != -1)
-              {
-                // Match with an existing breakpoint.
-                dp = new marker (m_edit_area, line,
-                                 marker::debugger_position, editor_linenr);
-              }
-            else
-              {
-                int original_linenr = -1;
-                editor_linenr = -1;
-                emit find_linenr_just_before (line, original_linenr, editor_linenr);
-                if (original_linenr >= 0)
-                  {
-                    // Make a guess by using an offset from the breakpoint.
-                    int linenr_guess = editor_linenr + line - original_linenr;
-                    dp = new marker (m_edit_area, line,
-                                     marker::unsure_debugger_position,
-                                     linenr_guess);
-                  }
-                else
-                  {
-                    // Can't make a very good guess, so just use the debugger
-                    // line number.
-                    dp = new marker (m_edit_area, line,
-                                     marker::unsure_debugger_position);
-                  }
-              }
-          }
-        else
-          {
-            dp = new marker (m_edit_area, line, marker::debugger_position);
-
-            // In case of a not modified file we might have to remove
-            // a breakpoint here if we have stepped into the file
-            if (line == m_breakpoint_info.remove_line)
-              {
-                m_breakpoint_info.remove_line = -1;
-                if (line != m_breakpoint_info.do_not_remove_line)
-                  handle_request_remove_breakpoint (line);
-              }
-          }
-
-        connect (this, &file_editor_tab::remove_position_via_debugger_linenr,
-                 dp, &marker::handle_remove_via_original_linenr);
-
-        connect (this, &file_editor_tab::remove_all_positions,
-                 dp, &marker::handle_remove);
-
-        center_current_line (false);
-      }
-  }
-
-  void file_editor_tab::delete_debugger_pointer (const QWidget *ID, int line)
-  {
-    if (ID != this || ID == nullptr)
-      return;
-
-    if (line > 0)
-      emit remove_position_via_debugger_linenr (line);
-  }
-
-  void file_editor_tab::do_breakpoint_marker (bool insert,
-                                              const QWidget *ID, int line,
-                                              const QString& cond)
-  {
-    if (ID != this || ID == nullptr)
-      return;
-
-    if (line > 0)
-      {
-        if (insert)
-          {
-            int editor_linenr = -1;
-            marker *bp = nullptr;
-
-            // If comes back indicating a non-zero breakpoint marker,
-            // reuse it if possible
-            emit find_translated_line_number (line, editor_linenr, bp);
-            if (bp != nullptr)
-              {
-                if ((cond == "") != (bp->get_cond () == ""))
-                  {
-                    // can only reuse conditional bp as conditional
-                    emit remove_breakpoint_via_debugger_linenr (line);
-                    bp = nullptr;
-                  }
-                else
-                  bp->set_cond (cond);
-              }
-
-            if (bp == nullptr)
-              {
-                bp = new marker (m_edit_area, line,
-                                 cond == "" ? marker::breakpoint
-                                 : marker::cond_break, cond);
-
-                connect (this, &file_editor_tab::remove_breakpoint_via_debugger_linenr,
-                         bp, &marker::handle_remove_via_original_linenr);
-                connect (this, &file_editor_tab::request_remove_breakpoint_via_editor_linenr,
-                         bp, &marker::handle_request_remove_via_editor_linenr);
-                connect (this, &file_editor_tab::remove_all_breakpoints_signal,
-                         bp, &marker::handle_remove);
-                connect (this, &file_editor_tab::find_translated_line_number,
-                         bp, &marker::handle_find_translation);
-                connect (this, &file_editor_tab::find_linenr_just_before,
-                         bp, &marker::handle_find_just_before);
-                connect (this, &file_editor_tab::report_marker_linenr,
-                         bp, &marker::handle_report_editor_linenr);
-                connect (bp, &marker::request_remove,
-                         this, &file_editor_tab::handle_request_remove_breakpoint);
-              }
-          }
-        else
-          emit remove_breakpoint_via_debugger_linenr (line);
-      }
-  }
-
-  void file_editor_tab::center_current_line (bool always)
-  {
-    long int visible_lines
-      = m_edit_area->SendScintilla (QsciScintillaBase::SCI_LINESONSCREEN);
-
-    if (visible_lines > 2)
-      {
-        int line, index;
-        m_edit_area->getCursorPosition (&line, &index);
-        // compensate for "folding":
-        // step 1: expand the current line, if it was folded
-        m_edit_area->SendScintilla (2232, line);   // SCI_ENSUREVISIBLE
-
-        // step 2: map file line num to "visible" one // SCI_VISIBLEFROMDOCLINE
-        int vis_line = m_edit_area->SendScintilla (2220, line);
-
-        int first_line = m_edit_area->firstVisibleLine ();
-
-        if (always || vis_line == first_line
-            || vis_line > first_line + visible_lines - 2)
-          {
-            first_line += (vis_line - first_line - (visible_lines - 1) / 2);
-            m_edit_area->SendScintilla (2613, first_line); // SCI_SETFIRSTVISIBLELINE
-          }
-      }
-  }
-
-  void file_editor_tab::handle_lines_changed ()
-  {
-    // the related signal is emitted before cursor-move-signal!
-    m_lines_changed = true;
-  }
-
-  void file_editor_tab::handle_cursor_moved (int line, int col)
-  {
-    // Cursor has moved, first check wether an autocompletion list
-    // is active or if it was closed. Scintilla provides signals for
-    // completed or cancelled lists, but not for list that where hidden
-    // due to a new character not matching anymore with the list entries
-    if (m_edit_area->SendScintilla (QsciScintillaBase::SCI_AUTOCACTIVE))
-      m_autoc_active = true;
-    else if (m_autoc_active)
-      {
-        m_autoc_active = false;
-        emit autoc_closed (); // Tell editor about closed list
-      }
-
-    // Lines changed? Take care of indentation!
-    bool do_smart_indent = m_lines_changed && m_is_octave_file
-                           && (line == m_line+1) && (col < m_col)
-                           && (m_smart_indent || m_auto_endif);
-    m_lines_changed = false;
-
-    // Update line and column indicator in the status bar
-    int o_line = m_line;
-    update_rowcol_indicator (line, col);
-
-    // Do smart indent after update of line indicator for having
-    // consistent indicator data
-    if (do_smart_indent)
-      m_edit_area->smart_indent (m_smart_indent, m_auto_endif,
-                                 o_line, m_ind_char_width);
-  }
-
-  void file_editor_tab::update_rowcol_indicator (int line, int col)
-  {
-    m_line = line;
-    m_col  = col;
-    m_row_indicator->setNum (line+1);
-    m_col_indicator->setNum (col+1);
-  }
-
-  // Slot that is entered each time a new character was typed.
-  // It is used for handling line breaking if this is desired.
-  // The related signal is emitted after the signal for a moved cursor
-  // such that m_col and m_line can not be used for current position.
-  void file_editor_tab::handle_char_added (int)
-  {
-    if (m_line_break)
-      {
-        // If line breaking is desired, get the current line and column.
-        // For taking the tab width into consideration, use own function
-        int line, col, pos;
-        m_edit_area->get_current_position (&pos, &line, &col);
-
-        // immediately return if line has not reached the max. line length
-        if (col <= m_line_break)
-          return;
-
-        // If line breaking is only desired in comments,
-        // return if not in a comment
-        int style_comment = octave_qscintilla::ST_NONE;
-        if (m_line_break_comments)
-          {
-            // line breaking only in comments, check for comment style
-            style_comment = m_edit_area->is_style_comment ();
-            if (! style_comment)
-              return;       // no comment, return
-          }
-
-        // Here we go for breaking the current line by inserting a newline.
-        // For determining the position of a specific column, we have to get
-        // the column from the QScintilla function without taking tab lengths
-        // into account, since the calculation from line/col to position
-        // ignores this, too.
-        m_edit_area->getCursorPosition (&line, &col);
-        int c = 0;
-        int col_space = col;
-        int indentation = m_edit_area->indentation (line);
-
-        // Search the first occurrence of space or tab backwards starting from
-        // the current column (col_space).
-        while (c != ' ' && c != '\t' && col_space > indentation)
-          {
-            pos = m_edit_area->positionFromLineIndex (line, col_space--);
-            c = m_edit_area->SendScintilla (QsciScintillaBase::SCI_GETCHARAT, pos);
-          }
-
-        // If a space or tab was found, break at this char,
-        // otherwise break at cursor position
-        int col_newline = col - 1;
-        if (c == ' ' || c == '\t')
-          col_newline = col_space + 1;
-
-        // Insert a newline char for breaking the line possibly followed
-        // by a line comment string
-        QString newline = QString ("\n");
-        style_comment = m_edit_area->is_style_comment ();
-        if (style_comment == octave_qscintilla::ST_LINE_COMMENT)
-          newline = newline + m_edit_area->comment_string ().at (0);
-        m_edit_area->insertAt (newline, line, col_newline);
-
-        // Automatically indent the new line to the indentation of previous line
-        // and set the cursor position to the end of the indentation.
-        m_edit_area->setIndentation (line + 1, indentation);
-        m_edit_area->SendScintilla (QsciScintillaBase::SCI_LINEEND);
-      }
-  }
-
-  // Slot handling a double click into the text area
-  void file_editor_tab::handle_double_click (int, int, int modifier)
-  {
-    if (! modifier)
-      {
-        // double clicks without modifier
-        // clear any existing indicators of this type
-        m_edit_area->clear_selection_markers ();
-
-        if (m_highlight_all_occurrences)
-          {
-            // Clear any previous selection.
-            m_edit_area->set_word_selection ();
-
-            // highlighting of all occurrences of the clicked word is enabled
-
-            // get the resulting cursor position
-            // (required if click was beyond a line ending)
-            int line, col;
-            m_edit_area->getCursorPosition (&line, &col);
-
-            // get the word at the cursor (if any)
-            QString word = m_edit_area->wordAtLineIndex (line, col);
-            word = word.trimmed ();
-
-            if (! word.isEmpty ())
-              {
-                // word is not empty, so find all occurrences of the word
-
-                // remember first visible line and x-offset for restoring the view afterwards
-                int first_line = m_edit_area->firstVisibleLine ();
-                int x_offset = m_edit_area->SendScintilla (QsciScintillaBase::SCI_GETXOFFSET);
-
-                // search for first occurrence of the detected word
-                bool find_result_available
-                  = m_edit_area->findFirst (word,
-                                            false,   // no regexp
-                                            true,    // case sensitive
-                                            true,    // whole words only
-                                            false,   // do not wrap
-                                            true,    // forward
-                                            0, 0,    // from the beginning
-                                            false
+      m_edit_area->setWhitespaceVisibility (QsciScintilla::WsVisible);
+  else
+    m_edit_area->setWhitespaceVisibility (QsciScintilla::WsInvisible);
+
+  m_edit_area->setEolVisibility (settings.bool_value (ed_show_eol_chars));
+
+  m_save_as_desired_eol = static_cast<QsciScintilla::EolMode>
+                            (settings.int_value (ed_default_eol_mode));
+
+  if (settings.bool_value (ed_show_line_numbers))
+    {
+      m_edit_area->setMarginLineNumbers (2, true);
+      auto_margin_width ();
+      connect (m_edit_area, SIGNAL (linesChanged ()),
+               this, SLOT (auto_margin_width ()));
+    }
+  else
+    {
+      m_edit_area->setMarginLineNumbers (2, false);
+      disconnect (m_edit_area, SIGNAL (linesChanged ()), nullptr, nullptr);
+    }
+
+  m_smart_indent = settings.bool_value (ed_auto_indent);
+  m_edit_area->setAutoIndent (m_smart_indent);
+  m_edit_area->setTabIndents
+    (settings.bool_value (ed_tab_indents_line));
+  m_edit_area->setBackspaceUnindents
+    (settings.bool_value (ed_backspace_unindents_line));
+  m_edit_area->setIndentationGuides
+    (settings.bool_value (ed_show_indent_guides));
+  m_edit_area->setIndentationsUseTabs
+    (settings.bool_value (ed_indent_uses_tabs));
+  m_edit_area->setIndentationWidth
+    (settings.int_value (ed_indent_width));
+
+  m_edit_area->setTabWidth
+    (settings.int_value (ed_tab_width));
+
+  m_ind_char_width = 1;
+  if (m_edit_area->indentationsUseTabs ())
+    m_ind_char_width = m_edit_area->tabWidth ();
+
+  m_edit_area->SendScintilla (QsciScintillaBase::SCI_SETHSCROLLBAR,
+                              settings.bool_value (ed_show_hscroll_bar));
+  m_edit_area->SendScintilla (QsciScintillaBase::SCI_SETSCROLLWIDTH,-1);
+  m_edit_area->SendScintilla (QsciScintillaBase::SCI_SETSCROLLWIDTHTRACKING,true);
+
+  update_window_title (m_edit_area->isModified ());
+
+  m_auto_endif = settings.int_value (ed_auto_endif);
+
+  // long line marker
+  int line_length = settings.int_value (ed_long_line_column);
+  m_edit_area->setEdgeColumn (line_length);
+
+  if (settings.bool_value (ed_long_line_marker))
+    {
+      if (settings.bool_value (ed_long_line_marker_line))
+        m_edit_area->setEdgeMode (QsciScintilla::EdgeLine);
+      else
+        {
+          if (settings.bool_value (ed_long_line_marker_background))
+            m_edit_area->setEdgeMode (QsciScintilla::EdgeBackground);
+          else
+            m_edit_area->setEdgeMode (QsciScintilla::EdgeLine);
+        }
+    }
+  else
+    m_edit_area->setEdgeMode (QsciScintilla::EdgeNone);
+
+  // line wrapping and breaking
+  m_edit_area->setWrapVisualFlags (QsciScintilla::WrapFlagByBorder);
+  m_edit_area->setWrapIndentMode (QsciScintilla::WrapIndentSame);
+
+  if (settings.bool_value (ed_wrap_lines))
+    m_edit_area->setWrapMode (QsciScintilla::WrapWord);
+  else
+    m_edit_area->setWrapMode (QsciScintilla::WrapNone);
+
+  if (settings.bool_value (ed_break_lines))
+    m_line_break = line_length;
+  else
+    m_line_break = 0;
+
+  m_line_break_comments =
+    settings.bool_value (ed_break_lines_comments);
+
+  // highlight all occurrences of a word selected by a double click
+  m_highlight_all_occurrences =
+    settings.bool_value (ed_highlight_all_occurrences);
+
+  // reload changed files
+  m_always_reload_changed_files =
+    settings.bool_value (ed_always_reload_changed_files);
+
+  // Set cursor blinking depending on the settings.
+  // QScintilla ignores the application global settings, so some special
+  // handling is required
+  bool cursor_blinking;
+
+  if (settings.contains (global_cursor_blinking.settings_key ()))
+    cursor_blinking = settings.bool_value (global_cursor_blinking);
+  else
+    cursor_blinking = settings.bool_value (cs_cursor_blinking);
+
+  if (cursor_blinking)
+    m_edit_area->SendScintilla (QsciScintillaBase::SCI_SETCARETPERIOD, 500);
+  else
+    m_edit_area->SendScintilla (QsciScintillaBase::SCI_SETCARETPERIOD, 0);
+
+}
+
+void file_editor_tab::auto_margin_width ()
+{
+  m_edit_area->setMarginWidth (2, "1" + QString::number (m_edit_area->lines ()));
+}
+
+// the following close request was changed from a signal slot into a
+// normal function because we need the return value from close whether
+// the tab really was closed (for canceling exiting octave).
+// When emitting a signal, only the return value from the last slot
+// goes back to the sender
+bool file_editor_tab::conditional_close ()
+{
+  return close ();
+}
+
+void file_editor_tab::change_editor_state (const QWidget *ID)
+{
+  if (ID != this)
+    return;
+
+  emit editor_state_changed (m_copy_available, m_is_octave_file,
+                             m_edit_area->isModified ());
+}
+
+void file_editor_tab::handle_file_reload_answer (int decision)
+{
+  if (decision == QMessageBox::Yes)
+    {
+      // reload: file is readded to the file watcher in set_file_name ()
+      load_file (m_file_name);
+    }
+  else
+    {
+      // do not reload: readd to the file watcher
+      m_file_system_watcher.addPath (m_file_name);
+    }
+}
+
+void file_editor_tab::handle_file_resave_answer (int decision)
+{
+  // check decision of user in dialog
+  if (decision == QMessageBox::Save)
+    {
+      save_file (m_file_name);  // readds file to watcher in set_file_name ()
+      m_edit_area->setReadOnly (false);  // delete read only flag
+    }
+  else
+    {
+      // Definitely close the file.
+      // Set modified to false to prevent the dialog box when the close event
+      // is posted.  If the user cancels the close in this dialog the tab is
+      // left open with a non-existing file.
+      m_edit_area->setModified (false);
+      close ();
+    }
+}
+
+void file_editor_tab::insert_debugger_pointer (const QWidget *ID, int line)
+{
+  if (ID != this || ID == nullptr)
+    return;
+
+  emit remove_all_positions ();  // debugger_position, unsure_debugger_position
+
+  if (line > 0)
+    {
+      marker *dp;
+
+      if (m_edit_area->isModified ())
+        {
+          // The best that can be done if the editor contents have been
+          // modified is to see if there is a match with the original
+          // line number of any existing breakpoints.  We can put a normal
+          // debugger pointer at that breakpoint position.  Otherwise, it
+          // isn't certain whether the original line number and current line
+          // number match.
+          int editor_linenr = -1;
+          marker *dummy;
+          emit find_translated_line_number (line, editor_linenr, dummy);
+          if (editor_linenr != -1)
+            {
+              // Match with an existing breakpoint.
+              dp = new marker (m_edit_area, line,
+                               marker::debugger_position, editor_linenr);
+            }
+          else
+            {
+              int original_linenr = -1;
+              editor_linenr = -1;
+              emit find_linenr_just_before (line, original_linenr, editor_linenr);
+              if (original_linenr >= 0)
+                {
+                  // Make a guess by using an offset from the breakpoint.
+                  int linenr_guess = editor_linenr + line - original_linenr;
+                  dp = new marker (m_edit_area, line,
+                                   marker::unsure_debugger_position,
+                                   linenr_guess);
+                }
+              else
+                {
+                  // Can't make a very good guess, so just use the debugger
+                  // line number.
+                  dp = new marker (m_edit_area, line,
+                                   marker::unsure_debugger_position);
+                }
+            }
+        }
+      else
+        {
+          dp = new marker (m_edit_area, line, marker::debugger_position);
+
+          // In case of a not modified file we might have to remove
+          // a breakpoint here if we have stepped into the file
+          if (line == m_breakpoint_info.remove_line)
+            {
+              m_breakpoint_info.remove_line = -1;
+              if (line != m_breakpoint_info.do_not_remove_line)
+                handle_request_remove_breakpoint (line);
+            }
+        }
+
+      connect (this, &file_editor_tab::remove_position_via_debugger_linenr,
+               dp, &marker::handle_remove_via_original_linenr);
+
+      connect (this, &file_editor_tab::remove_all_positions,
+               dp, &marker::handle_remove);
+
+      center_current_line (false);
+    }
+}
+
+void file_editor_tab::delete_debugger_pointer (const QWidget *ID, int line)
+{
+  if (ID != this || ID == nullptr)
+    return;
+
+  if (line > 0)
+    emit remove_position_via_debugger_linenr (line);
+}
+
+void file_editor_tab::do_breakpoint_marker (bool insert,
+                                            const QWidget *ID, int line,
+                                            const QString& cond)
+{
+  if (ID != this || ID == nullptr)
+    return;
+
+  if (line > 0)
+    {
+      if (insert)
+        {
+          int editor_linenr = -1;
+          marker *bp = nullptr;
+
+          // If comes back indicating a non-zero breakpoint marker,
+          // reuse it if possible
+          emit find_translated_line_number (line, editor_linenr, bp);
+          if (bp != nullptr)
+            {
+              if ((cond == "") != (bp->get_cond () == ""))
+                {
+                  // can only reuse conditional bp as conditional
+                  emit remove_breakpoint_via_debugger_linenr (line);
+                  bp = nullptr;
+                }
+              else
+                bp->set_cond (cond);
+            }
+
+          if (bp == nullptr)
+            {
+              bp = new marker (m_edit_area, line,
+                               cond == "" ? marker::breakpoint
+                               : marker::cond_break, cond);
+
+              connect (this, &file_editor_tab::remove_breakpoint_via_debugger_linenr,
+                       bp, &marker::handle_remove_via_original_linenr);
+              connect (this, &file_editor_tab::request_remove_breakpoint_via_editor_linenr,
+                       bp, &marker::handle_request_remove_via_editor_linenr);
+              connect (this, &file_editor_tab::remove_all_breakpoints_signal,
+                       bp, &marker::handle_remove);
+              connect (this, &file_editor_tab::find_translated_line_number,
+                       bp, &marker::handle_find_translation);
+              connect (this, &file_editor_tab::find_linenr_just_before,
+                       bp, &marker::handle_find_just_before);
+              connect (this, &file_editor_tab::report_marker_linenr,
+                       bp, &marker::handle_report_editor_linenr);
+              connect (bp, &marker::request_remove,
+                       this, &file_editor_tab::handle_request_remove_breakpoint);
+            }
+        }
+      else
+        emit remove_breakpoint_via_debugger_linenr (line);
+    }
+}
+
+void file_editor_tab::center_current_line (bool always)
+{
+  long int visible_lines
+    = m_edit_area->SendScintilla (QsciScintillaBase::SCI_LINESONSCREEN);
+
+  if (visible_lines > 2)
+    {
+      int line, index;
+      m_edit_area->getCursorPosition (&line, &index);
+      // compensate for "folding":
+      // step 1: expand the current line, if it was folded
+      m_edit_area->SendScintilla (2232, line);   // SCI_ENSUREVISIBLE
+
+      // step 2: map file line num to "visible" one // SCI_VISIBLEFROMDOCLINE
+      int vis_line = m_edit_area->SendScintilla (2220, line);
+
+      int first_line = m_edit_area->firstVisibleLine ();
+
+      if (always || vis_line == first_line
+          || vis_line > first_line + visible_lines - 2)
+        {
+          first_line += (vis_line - first_line - (visible_lines - 1) / 2);
+          m_edit_area->SendScintilla (2613, first_line); // SCI_SETFIRSTVISIBLELINE
+        }
+    }
+}
+
+void file_editor_tab::handle_lines_changed ()
+{
+  // the related signal is emitted before cursor-move-signal!
+  m_lines_changed = true;
+}
+
+void file_editor_tab::handle_cursor_moved (int line, int col)
+{
+  // Cursor has moved, first check wether an autocompletion list
+  // is active or if it was closed. Scintilla provides signals for
+  // completed or cancelled lists, but not for list that where hidden
+  // due to a new character not matching anymore with the list entries
+  if (m_edit_area->SendScintilla (QsciScintillaBase::SCI_AUTOCACTIVE))
+    m_autoc_active = true;
+  else if (m_autoc_active)
+    {
+      m_autoc_active = false;
+      emit autoc_closed (); // Tell editor about closed list
+    }
+
+  // Lines changed? Take care of indentation!
+  bool do_smart_indent = m_lines_changed && m_is_octave_file
+                         && (line == m_line+1) && (col < m_col)
+                         && (m_smart_indent || m_auto_endif);
+  m_lines_changed = false;
+
+  // Update line and column indicator in the status bar
+  int o_line = m_line;
+  update_rowcol_indicator (line, col);
+
+  // Do smart indent after update of line indicator for having
+  // consistent indicator data
+  if (do_smart_indent)
+    m_edit_area->smart_indent (m_smart_indent, m_auto_endif,
+                               o_line, m_ind_char_width);
+}
+
+void file_editor_tab::update_rowcol_indicator (int line, int col)
+{
+  m_line = line;
+  m_col  = col;
+  m_row_indicator->setNum (line+1);
+  m_col_indicator->setNum (col+1);
+}
+
+// Slot that is entered each time a new character was typed.
+// It is used for handling line breaking if this is desired.
+// The related signal is emitted after the signal for a moved cursor
+// such that m_col and m_line can not be used for current position.
+void file_editor_tab::handle_char_added (int)
+{
+  if (m_line_break)
+    {
+      // If line breaking is desired, get the current line and column.
+      // For taking the tab width into consideration, use own function
+      int line, col, pos;
+      m_edit_area->get_current_position (&pos, &line, &col);
+
+      // immediately return if line has not reached the max. line length
+      if (col <= m_line_break)
+        return;
+
+      // If line breaking is only desired in comments,
+      // return if not in a comment
+      int style_comment = octave_qscintilla::ST_NONE;
+      if (m_line_break_comments)
+        {
+          // line breaking only in comments, check for comment style
+          style_comment = m_edit_area->is_style_comment ();
+          if (! style_comment)
+            return;       // no comment, return
+        }
+
+      // Here we go for breaking the current line by inserting a newline.
+      // For determining the position of a specific column, we have to get
+      // the column from the QScintilla function without taking tab lengths
+      // into account, since the calculation from line/col to position
+      // ignores this, too.
+      m_edit_area->getCursorPosition (&line, &col);
+      int c = 0;
+      int col_space = col;
+      int indentation = m_edit_area->indentation (line);
+
+      // Search the first occurrence of space or tab backwards starting from
+      // the current column (col_space).
+      while (c != ' ' && c != '\t' && col_space > indentation)
+        {
+          pos = m_edit_area->positionFromLineIndex (line, col_space--);
+          c = m_edit_area->SendScintilla (QsciScintillaBase::SCI_GETCHARAT, pos);
+        }
+
+      // If a space or tab was found, break at this char,
+      // otherwise break at cursor position
+      int col_newline = col - 1;
+      if (c == ' ' || c == '\t')
+        col_newline = col_space + 1;
+
+      // Insert a newline char for breaking the line possibly followed
+      // by a line comment string
+      QString newline = QString ("\n");
+      style_comment = m_edit_area->is_style_comment ();
+      if (style_comment == octave_qscintilla::ST_LINE_COMMENT)
+        newline = newline + m_edit_area->comment_string ().at (0);
+      m_edit_area->insertAt (newline, line, col_newline);
+
+      // Automatically indent the new line to the indentation of previous line
+      // and set the cursor position to the end of the indentation.
+      m_edit_area->setIndentation (line + 1, indentation);
+      m_edit_area->SendScintilla (QsciScintillaBase::SCI_LINEEND);
+    }
+}
+
+// Slot handling a double click into the text area
+void file_editor_tab::handle_double_click (int, int, int modifier)
+{
+  if (! modifier)
+    {
+      // double clicks without modifier
+      // clear any existing indicators of this type
+      m_edit_area->clear_selection_markers ();
+
+      if (m_highlight_all_occurrences)
+        {
+          // Clear any previous selection.
+          m_edit_area->set_word_selection ();
+
+          // highlighting of all occurrences of the clicked word is enabled
+
+          // get the resulting cursor position
+          // (required if click was beyond a line ending)
+          int line, col;
+          m_edit_area->getCursorPosition (&line, &col);
+
+          // get the word at the cursor (if any)
+          QString word = m_edit_area->wordAtLineIndex (line, col);
+          word = word.trimmed ();
+
+          if (! word.isEmpty ())
+            {
+              // word is not empty, so find all occurrences of the word
+
+              // remember first visible line and x-offset for restoring the view afterwards
+              int first_line = m_edit_area->firstVisibleLine ();
+              int x_offset = m_edit_area->SendScintilla (QsciScintillaBase::SCI_GETXOFFSET);
+
+              // search for first occurrence of the detected word
+              bool find_result_available
+                = m_edit_area->findFirst (word,
+                                          false,   // no regexp
+                                          true,    // case sensitive
+                                          true,    // whole words only
+                                          false,   // do not wrap
+                                          true,    // forward
+                                          0, 0,    // from the beginning
+                                          false
 #if defined (HAVE_QSCI_VERSION_2_6_0)
-                                            , true
+                                          , true
 #endif
-                                           );
-
-                // loop over all occurrences and set the related indicator
-                int oline, ocol;
-                int wlen = word.length ();
-
-                while (find_result_available)
-                  {
-                    // get cursor position after having found an occurrence
-                    m_edit_area->getCursorPosition (&oline, &ocol);
-                    // mark the selection
-                    m_edit_area->show_selection_markers (oline, ocol-wlen, oline, ocol);
-
-                    // find next occurrence
-                    find_result_available = m_edit_area->findNext ();
-                  }
-
-                // restore the visible area of the file, the cursor position,
-                // and the selection
-                m_edit_area->setFirstVisibleLine (first_line);
-                m_edit_area->SendScintilla (QsciScintillaBase::SCI_SETXOFFSET, x_offset);
-                m_edit_area->setCursorPosition (line, col);
-                m_edit_area->setSelection (line, col - wlen, line, col);
-                m_edit_area->set_word_selection (word);
-              }
-          }
-      }
-  }
-
-  QString file_editor_tab::get_function_name ()
-  {
-    QRegExp rxfun1 ("^[\t ]*function[^=]+=([^\\(]+)\\([^\\)]*\\)[\t ]*$");
-    QRegExp rxfun2 ("^[\t ]*function[\t ]+([^\\(]+)\\([^\\)]*\\)[\t ]*$");
-    QRegExp rxfun3 ("^[\t ]*function[^=]+=[\t ]*([^\\s]+)[\t ]*$");
-    QRegExp rxfun4 ("^[\t ]*function[\t ]+([^\\s]+)[\t ]*$");
-    QRegExp rxfun5 ("^[\t ]*classdef[\t ]+([^\\s]+)[\t ]*$");
-
-    QStringList lines = m_edit_area->text ().split ("\n");
-
-    for (int i = 0; i < lines.count (); i++)
-      {
-        if (rxfun1.indexIn (lines.at (i)) != -1)
-          return rxfun1.cap (1).remove (QRegExp ("[ \t]*"));
-        else if (rxfun2.indexIn (lines.at (i)) != -1)
-          return rxfun2.cap (1).remove (QRegExp ("[ \t]*"));
-        else if (rxfun3.indexIn (lines.at (i)) != -1)
-          return rxfun3.cap (1).remove (QRegExp ("[ \t]*"));
-        else if (rxfun4.indexIn (lines.at (i)) != -1)
-          return rxfun4.cap (1).remove (QRegExp ("[ \t]*"));
-        else if (rxfun5.indexIn (lines.at (i)) != -1)
-          return rxfun5.cap (1).remove (QRegExp ("[ \t]*"));
-      }
-
-    return QString ();
-  }
+                                         );
+
+              // loop over all occurrences and set the related indicator
+              int oline, ocol;
+              int wlen = word.length ();
+
+              while (find_result_available)
+                {
+                  // get cursor position after having found an occurrence
+                  m_edit_area->getCursorPosition (&oline, &ocol);
+                  // mark the selection
+                  m_edit_area->show_selection_markers (oline, ocol-wlen, oline, ocol);
+
+                  // find next occurrence
+                  find_result_available = m_edit_area->findNext ();
+                }
+
+              // restore the visible area of the file, the cursor position,
+              // and the selection
+              m_edit_area->setFirstVisibleLine (first_line);
+              m_edit_area->SendScintilla (QsciScintillaBase::SCI_SETXOFFSET, x_offset);
+              m_edit_area->setCursorPosition (line, col);
+              m_edit_area->setSelection (line, col - wlen, line, col);
+              m_edit_area->set_word_selection (word);
+            }
+        }
+    }
+}
+
+QString file_editor_tab::get_function_name ()
+{
+  QRegExp rxfun1 ("^[\t ]*function[^=]+=([^\\(]+)\\([^\\)]*\\)[\t ]*$");
+  QRegExp rxfun2 ("^[\t ]*function[\t ]+([^\\(]+)\\([^\\)]*\\)[\t ]*$");
+  QRegExp rxfun3 ("^[\t ]*function[^=]+=[\t ]*([^\\s]+)[\t ]*$");
+  QRegExp rxfun4 ("^[\t ]*function[\t ]+([^\\s]+)[\t ]*$");
+  QRegExp rxfun5 ("^[\t ]*classdef[\t ]+([^\\s]+)[\t ]*$");
+
+  QStringList lines = m_edit_area->text ().split ("\n");
+
+  for (int i = 0; i < lines.count (); i++)
+    {
+      if (rxfun1.indexIn (lines.at (i)) != -1)
+        return rxfun1.cap (1).remove (QRegExp ("[ \t]*"));
+      else if (rxfun2.indexIn (lines.at (i)) != -1)
+        return rxfun2.cap (1).remove (QRegExp ("[ \t]*"));
+      else if (rxfun3.indexIn (lines.at (i)) != -1)
+        return rxfun3.cap (1).remove (QRegExp ("[ \t]*"));
+      else if (rxfun4.indexIn (lines.at (i)) != -1)
+        return rxfun4.cap (1).remove (QRegExp ("[ \t]*"));
+      else if (rxfun5.indexIn (lines.at (i)) != -1)
+        return rxfun5.cap (1).remove (QRegExp ("[ \t]*"));
+    }
+
+  return QString ();
+}
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/src/m-editor/file-editor-tab.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/m-editor/file-editor-tab.h	Thu Feb 02 12:25:51 2023 -0800
@@ -44,304 +44,304 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class file_editor;
+class file_editor;
 
-  class file_editor_tab : public QWidget
-  {
-    Q_OBJECT
+class file_editor_tab : public QWidget
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    file_editor_tab (const QString& directory = "");
+  file_editor_tab (const QString& directory = "");
 
-    ~file_editor_tab ();
+  ~file_editor_tab ();
 
-    octave_qscintilla * qsci_edit_area () { return m_edit_area; }
+  octave_qscintilla * qsci_edit_area () { return m_edit_area; }
 
-    // Will initiate close if associated with the identifier tag.
-    bool conditional_close ();
+  // Will initiate close if associated with the identifier tag.
+  bool conditional_close ();
 
-    void update_breakpoints ();
-    void set_file_name (const QString& fileName);
-    void enable_file_watcher (bool do_enable);
+  void update_breakpoints ();
+  void set_file_name (const QString& fileName);
+  void enable_file_watcher (bool do_enable);
 
-    QString file_name () const { return m_file_name; }
-    QString encoding () const { return m_encoding; }
+  QString file_name () const { return m_file_name; }
+  QString encoding () const { return m_encoding; }
 
-  signals:
+signals:
 
-    void tab_ready_to_close ();
-    void file_name_changed (const QString& fileName,
-                            const QString& toolTip,
-                            bool modified);
-    void editor_state_changed (bool copy_available, bool is_octave_file,
-                               bool is_modified);
-    void set_focus_editor_signal (QWidget *);
-    void edit_area_changed (octave_qscintilla *edit_area);
-    void tab_remove_request ();
-    void mru_add_file (const QString& file_name, const QString& encoding);
-    void editor_check_conflict_save (const QString& saveFileName,
-                                     bool remove_on_success);
-    void run_file_signal (const QFileInfo& info);
-    void request_open_file (const QString&, const QString& = QString ());
-    void edit_mfile_request (const QString&, const QString&,
-                             const QString&, int);
+  void tab_ready_to_close ();
+  void file_name_changed (const QString& fileName,
+                          const QString& toolTip,
+                          bool modified);
+  void editor_state_changed (bool copy_available, bool is_octave_file,
+                             bool is_modified);
+  void set_focus_editor_signal (QWidget *);
+  void edit_area_changed (octave_qscintilla *edit_area);
+  void tab_remove_request ();
+  void mru_add_file (const QString& file_name, const QString& encoding);
+  void editor_check_conflict_save (const QString& saveFileName,
+                                   bool remove_on_success);
+  void run_file_signal (const QFileInfo& info);
+  void request_open_file (const QString&, const QString& = QString ());
+  void edit_mfile_request (const QString&, const QString&,
+                           const QString&, int);
 
-    void autoc_closed ();
+  void autoc_closed ();
 
-    void update_breakpoints_signal (const octave_value_list& args);
+  void update_breakpoints_signal (const octave_value_list& args);
 
-    void remove_breakpoint_via_debugger_linenr (int debugger_linenr);
-    void request_remove_breakpoint_via_editor_linenr (int editor_linenr);
-    void remove_all_breakpoints_signal ();
-    void find_translated_line_number (int original_linenr,
-                                      int& translated_linenr, marker*&);
-    void find_linenr_just_before (int linenr, int& original_linenr,
-                                  int& editor_linenr);
-    void report_marker_linenr (QIntList& lines, QStringList& conditions);
-    void remove_position_via_debugger_linenr (int debugger_linenr);
-    void remove_all_positions ();
+  void remove_breakpoint_via_debugger_linenr (int debugger_linenr);
+  void request_remove_breakpoint_via_editor_linenr (int editor_linenr);
+  void remove_all_breakpoints_signal ();
+  void find_translated_line_number (int original_linenr,
+                                    int& translated_linenr, marker*&);
+  void find_linenr_just_before (int linenr, int& original_linenr,
+                                int& editor_linenr);
+  void report_marker_linenr (QIntList& lines, QStringList& conditions);
+  void remove_position_via_debugger_linenr (int debugger_linenr);
+  void remove_all_positions ();
 
-    void debug_quit_signal ();
+  void debug_quit_signal ();
 
-    void interpreter_event (const fcn_callback& fcn);
-    void interpreter_event (const meth_callback& meth);
+  void interpreter_event (const fcn_callback& fcn);
+  void interpreter_event (const meth_callback& meth);
 
-    void maybe_remove_next (int remove_line);
+  void maybe_remove_next (int remove_line);
 
-    void dbstop_if (const QString& prompt, int line, const QString& cond);
-    void request_add_breakpoint (int line, const QString& cond);
-    void request_add_octave_apis (const QStringList&);
-    void api_entries_added ();
+  void dbstop_if (const QString& prompt, int line, const QString& cond);
+  void request_add_breakpoint (int line, const QString& cond);
+  void request_add_octave_apis (const QStringList&);
+  void api_entries_added ();
 
-    void do_save_file_signal (const QString& file_to_save,
-                              bool remove_on_success, bool restore_breakpoints);
+  void do_save_file_signal (const QString& file_to_save,
+                            bool remove_on_success, bool restore_breakpoints);
 
-    void confirm_dbquit_and_save_signal (const QString& file_to_save,
-                                         const QString& base_name,
-                                         bool remove_on_success,
-                                         bool restore_breakpoints);
+  void confirm_dbquit_and_save_signal (const QString& file_to_save,
+                                       const QString& base_name,
+                                       bool remove_on_success,
+                                       bool restore_breakpoints);
 
-    // FIXME: The following is similar to "process_octave_code" signal.
-    // However, currently that signal is connected to something that simply
-    // focuses a window and does not actually communicate with Octave.
-    //
-    // void evaluate_octave_command (const QString& command);
+  // FIXME: The following is similar to "process_octave_code" signal.
+  // However, currently that signal is connected to something that simply
+  // focuses a window and does not actually communicate with Octave.
+  //
+  // void evaluate_octave_command (const QString& command);
 
-  public slots:
+public slots:
 
-    void update_window_title (bool modified);
-    void handle_copy_available (bool enableCopy);
-    void handle_margin_clicked (int line, int margin,
-                                Qt::KeyboardModifiers state);
+  void update_window_title (bool modified);
+  void handle_copy_available (bool enableCopy);
+  void handle_margin_clicked (int line, int margin,
+                              Qt::KeyboardModifiers state);
 
-    // Tells the editor tab to react on changed settings.
-    void notice_settings (bool init = false);
+  // Tells the editor tab to react on changed settings.
+  void notice_settings (bool init = false);
 
-    // Change to a different editor tab by identifier tag.
-    void change_editor_state (const QWidget *ID);
+  // Change to a different editor tab by identifier tag.
+  void change_editor_state (const QWidget *ID);
 
-    void set_focus (const QWidget *ID);
-    void set_current_directory (const QString& dir);
-    void context_help (const QWidget *ID, bool);
-    void context_edit (const QWidget *ID);
-    void save_file (const QWidget *ID);
-    void save_file (const QWidget *ID, const QString& fileName,
-                    bool remove_on_success);
-    void save_file_as (const QWidget *ID);
-    void print_file (const QWidget *ID);
-    void run_file (const QWidget *ID, bool step_into = false);
-    void context_run (const QWidget *ID);
-    void toggle_bookmark (const QWidget *ID);
-    void next_bookmark (const QWidget *ID);
-    void previous_bookmark (const QWidget *ID);
-    void remove_bookmark (const QWidget *ID);
+  void set_focus (const QWidget *ID);
+  void set_current_directory (const QString& dir);
+  void context_help (const QWidget *ID, bool);
+  void context_edit (const QWidget *ID);
+  void save_file (const QWidget *ID);
+  void save_file (const QWidget *ID, const QString& fileName,
+                  bool remove_on_success);
+  void save_file_as (const QWidget *ID);
+  void print_file (const QWidget *ID);
+  void run_file (const QWidget *ID, bool step_into = false);
+  void context_run (const QWidget *ID);
+  void toggle_bookmark (const QWidget *ID);
+  void next_bookmark (const QWidget *ID);
+  void previous_bookmark (const QWidget *ID);
+  void remove_bookmark (const QWidget *ID);
 
-    void toggle_breakpoint (const QWidget *ID);
-    void next_breakpoint (const QWidget *ID);
-    void previous_breakpoint (const QWidget *ID);
-    void remove_all_breakpoints (const QWidget *ID);
+  void toggle_breakpoint (const QWidget *ID);
+  void next_breakpoint (const QWidget *ID);
+  void previous_breakpoint (const QWidget *ID);
+  void remove_all_breakpoints (const QWidget *ID);
 
-    void scintilla_command (const QWidget *, unsigned int);
+  void scintilla_command (const QWidget *, unsigned int);
 
-    void comment_selected_text (const QWidget *ID, bool input_str);
-    void uncomment_selected_text (const QWidget *ID);
+  void comment_selected_text (const QWidget *ID, bool input_str);
+  void uncomment_selected_text (const QWidget *ID);
 
-    void indent_selected_text (const QWidget *ID);
-    void unindent_selected_text (const QWidget *ID);
-    void smart_indent_line_or_selected_text (const QWidget *ID);
-    void convert_eol (const QWidget *ID, QsciScintilla::EolMode);
+  void indent_selected_text (const QWidget *ID);
+  void unindent_selected_text (const QWidget *ID);
+  void smart_indent_line_or_selected_text (const QWidget *ID);
+  void convert_eol (const QWidget *ID, QsciScintilla::EolMode);
 
-    void zoom_in (const QWidget *ID);
-    void zoom_out (const QWidget *ID);
-    void zoom_normal (const QWidget *ID);
+  void zoom_in (const QWidget *ID);
+  void zoom_out (const QWidget *ID);
+  void zoom_normal (const QWidget *ID);
 
-    void goto_line (const QWidget *ID, int line = -1);
-    void move_match_brace (const QWidget *ID, bool select);
-    void show_auto_completion (const QWidget *ID);
+  void goto_line (const QWidget *ID, int line = -1);
+  void move_match_brace (const QWidget *ID, bool select);
+  void show_auto_completion (const QWidget *ID);
 
-    void insert_debugger_pointer (const QWidget *ID, int line = -1);
-    void delete_debugger_pointer (const QWidget *ID, int line = -1);
+  void insert_debugger_pointer (const QWidget *ID, int line = -1);
+  void delete_debugger_pointer (const QWidget *ID, int line = -1);
 
-    void do_breakpoint_marker (bool insert, const QWidget *ID, int line = -1,
-                               const QString& cond = "");
+  void do_breakpoint_marker (bool insert, const QWidget *ID, int line = -1,
+                             const QString& cond = "");
 
-    void recover_from_exit ();
-    void set_modified (bool modified = true);
+  void recover_from_exit ();
+  void set_modified (bool modified = true);
 
-    void set_encoding (const QString& new_encoding);
+  void set_encoding (const QString& new_encoding);
 
-    QString load_file (const QString& fileName);
+  QString load_file (const QString& fileName);
 
-    void new_file (const QString& commands = QString ());
+  void new_file (const QString& commands = QString ());
 
-    void file_has_changed (const QString& path, bool do_close = false);
+  void file_has_changed (const QString& path, bool do_close = false);
 
-    void handle_context_menu_edit (const QString&);
-    void handle_context_menu_break_condition (int linenr);
+  void handle_context_menu_edit (const QString&);
+  void handle_context_menu_break_condition (int linenr);
 
-    void handle_request_add_breakpoint (int line, const QString& cond);
-    void handle_request_remove_breakpoint (int line);
+  void handle_request_add_breakpoint (int line, const QString& cond);
+  void handle_request_remove_breakpoint (int line);
 
-    void update_breakpoints_handler (const octave_value_list& argout);
-    void update_rowcol_indicator (int line, int col);
-    void update_lexer_settings (bool update_apis_only = false);
+  void update_breakpoints_handler (const octave_value_list& argout);
+  void update_rowcol_indicator (int line, int col);
+  void update_lexer_settings (bool update_apis_only = false);
 
-  private slots:
+private slots:
 
-    // When user closes message box for decoding problems
-    void handle_decode_warning_answer (QAbstractButton *btn);
+  // When user closes message box for decoding problems
+  void handle_decode_warning_answer (QAbstractButton *btn);
 
-    // When user closes message box for reload question.
-    void handle_file_reload_answer (int decision);
+  // When user closes message box for reload question.
+  void handle_file_reload_answer (int decision);
 
-    // When user closes message box for resave question.
-    void handle_file_resave_answer (int decision);
+  // When user closes message box for resave question.
+  void handle_file_resave_answer (int decision);
 
-    // When user closes QFileDialog box.
-    void handle_save_file_as_answer (const QString& fileName);
-    void handle_save_file_as_answer_close (const QString& fileName);
-    void handle_save_file_as_answer_cancel ();
-    void handle_save_as_filter_selected (const QString& filter);
+  // When user closes QFileDialog box.
+  void handle_save_file_as_answer (const QString& fileName);
+  void handle_save_file_as_answer_close (const QString& fileName);
+  void handle_save_file_as_answer_cancel ();
+  void handle_save_as_filter_selected (const QString& filter);
 
-    // When user changes encoding after decoding errors were found
-    void handle_current_enc_changed (const QString& enc);
+  // When user changes encoding after decoding errors were found
+  void handle_current_enc_changed (const QString& enc);
 
-    // When apis preparation has finished and is ready to save
-    void save_apis_info ();
+  // When apis preparation has finished and is ready to save
+  void save_apis_info ();
 
-    // When the numer of lines changes -> adapt width of margin
-    void auto_margin_width ();
+  // When the numer of lines changes -> adapt width of margin
+  void auto_margin_width ();
 
-    void handle_cursor_moved (int line, int col);
-    void handle_char_added (int character);
-    void handle_double_click (int p, int l, int modifier);
-    void handle_lines_changed ();
+  void handle_cursor_moved (int line, int col);
+  void handle_char_added (int character);
+  void handle_double_click (int p, int l, int modifier);
+  void handle_lines_changed ();
 
-    void handle_remove_next (int remove_line);
-    void handle_dbstop_if (const QString& prompt, int line,
-                           const QString& cond);
-    void handle_add_octave_apis (const QStringList& api_entries);
-    void handle_api_entries_added ();
+  void handle_remove_next (int remove_line);
+  void handle_dbstop_if (const QString& prompt, int line,
+                         const QString& cond);
+  void handle_add_octave_apis (const QStringList& api_entries);
+  void handle_api_entries_added ();
 
-    void do_save_file (const QString& file_to_save, bool remove_on_success,
-                       bool restore_breakpoints);
+  void do_save_file (const QString& file_to_save, bool remove_on_success,
+                     bool restore_breakpoints);
 
-    void confirm_dbquit_and_save (const QString& file_to_save,
-                                  const QString& base_name,
-                                  bool remove_on_success,
-                                  bool restore_breakpoints);
+  void confirm_dbquit_and_save (const QString& file_to_save,
+                                const QString& base_name,
+                                bool remove_on_success,
+                                bool restore_breakpoints);
 
-  protected:
+protected:
 
-    void closeEvent (QCloseEvent *event);
+  void closeEvent (QCloseEvent *event);
 
-  private:
+private:
 
-    void add_breakpoint_event (int line, const QString& cond);
+  void add_breakpoint_event (int line, const QString& cond);
 
-    bool valid_file_name (const QString& file = QString ());
-    void save_file (const QString& saveFileName, bool remove_on_success = false,
-                    bool restore_breakpoints = true);
-    void save_file_as (bool remove_on_success = false);
-    bool check_valid_identifier (QString file_name);
-    QTextCodec * check_valid_codec ();
+  bool valid_file_name (const QString& file = QString ());
+  void save_file (const QString& saveFileName, bool remove_on_success = false,
+                  bool restore_breakpoints = true);
+  void save_file_as (bool remove_on_success = false);
+  bool check_valid_identifier (QString file_name);
+  QTextCodec * check_valid_codec ();
 
-    bool unchanged_or_saved ();
+  bool unchanged_or_saved ();
 
-    void update_lexer ();
+  void update_lexer ();
 
-    void show_dialog (QDialog *dlg, bool modal);
+  void show_dialog (QDialog *dlg, bool modal);
 
-  public:
+public:
 
-    int check_file_modified (bool remove = false);
-    QString get_all_bookmarks ();
+  int check_file_modified (bool remove = false);
+  QString get_all_bookmarks ();
 
-  private:
-    void do_comment_selected_text (bool comment, bool input_str = false);
-    void do_indent_selected_text (bool indent);
-    void do_smart_indent_line_or_selected_text ();
+private:
+  void do_comment_selected_text (bool comment, bool input_str = false);
+  void do_indent_selected_text (bool indent);
+  void do_smart_indent_line_or_selected_text ();
 
-    void check_restore_breakpoints ();
-    void center_current_line (bool always=true);
+  void check_restore_breakpoints ();
+  void center_current_line (bool always=true);
 
-    QString get_function_name ();
+  QString get_function_name ();
 
-    QsciScintilla::EolMode detect_eol_mode ();
-    void update_eol_indicator ();
+  QsciScintilla::EolMode detect_eol_mode ();
+  void update_eol_indicator ();
 
-    octave_qscintilla *m_edit_area;
+  octave_qscintilla *m_edit_area;
 
-    QStatusBar *m_status_bar;
-    QLabel *m_row_indicator;
-    QLabel *m_col_indicator;
-    QLabel *m_eol_indicator;
-    QLabel *m_enc_indicator;
+  QStatusBar *m_status_bar;
+  QLabel *m_row_indicator;
+  QLabel *m_col_indicator;
+  QLabel *m_eol_indicator;
+  QLabel *m_enc_indicator;
 
-    QsciScintilla::EolMode m_save_as_desired_eol;
+  QsciScintilla::EolMode m_save_as_desired_eol;
 
-    QString m_file_name;
-    QString m_file_name_short;
-    QString m_ced;
-    QString m_encoding;
-    QString m_new_encoding;
-    QDateTime m_last_modified;
+  QString m_file_name;
+  QString m_file_name_short;
+  QString m_ced;
+  QString m_encoding;
+  QString m_new_encoding;
+  QDateTime m_last_modified;
 
-    bool m_autoc_active;
-    bool m_copy_available;
-    bool m_is_octave_file;
-    bool m_always_reload_changed_files;
-    bool m_smart_indent;
-    int m_auto_endif;
-    int m_ind_char_width;
+  bool m_autoc_active;
+  bool m_copy_available;
+  bool m_is_octave_file;
+  bool m_always_reload_changed_files;
+  bool m_smart_indent;
+  int m_auto_endif;
+  int m_ind_char_width;
 
-    QFileSystemWatcher m_file_system_watcher;
+  QFileSystemWatcher m_file_system_watcher;
 
-    QIntList m_bp_lines;
-    QStringList m_bp_conditions;
+  QIntList m_bp_lines;
+  QStringList m_bp_conditions;
 
-    QsciAPIs *m_lexer_apis;
-    QString m_prep_apis_path;
-    QString m_prep_apis_file;
+  QsciAPIs *m_lexer_apis;
+  QString m_prep_apis_path;
+  QString m_prep_apis_file;
 
-    int m_line_break;
-    bool m_line_break_comments;
-    int m_line;
-    int m_col;
-    bool m_lines_changed;
-    bool m_highlight_all_occurrences;
-    int m_bp_restore_count;
+  int m_line_break;
+  bool m_line_break_comments;
+  int m_line;
+  int m_col;
+  bool m_lines_changed;
+  bool m_highlight_all_occurrences;
+  int m_bp_restore_count;
 
-    struct breakpoint_info
-    {
-      bool remove_next;
-      int remove_line;
-      int do_not_remove_line;
-    };
+  struct breakpoint_info
+  {
+    bool remove_next;
+    int remove_line;
+    int do_not_remove_line;
+  };
 
-    breakpoint_info m_breakpoint_info;
-  };
+  breakpoint_info m_breakpoint_info;
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/src/m-editor/file-editor.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/m-editor/file-editor.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -63,2824 +63,2824 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  // Functions of the the reimplemented tab widget
-
-  file_editor_tab_widget::file_editor_tab_widget (QWidget *p, file_editor *fe)
-    : QTabWidget (p)
-  {
-    tab_bar *bar = new tab_bar (this);
-
-    connect (bar, &tab_bar::close_current_tab_signal,
-             fe, &file_editor::request_close_file);
-
-    this->setTabBar (bar);
-
-    setTabsClosable (true);
-    setUsesScrollButtons (true);
-    setMovable (true);
-  }
-
-  tab_bar *file_editor_tab_widget::get_tab_bar () const
-  {
-    return qobject_cast<tab_bar *> (tabBar ());
-  }
-
-  std::list<file_editor_tab *>
-  file_editor_tab_widget::tab_list () const
-  {
-    std::list<file_editor_tab *> retval;
-    for (int i = 0; i < count (); i++)
-      retval.push_back (static_cast<file_editor_tab *> (widget (i)));
-    return retval;
-  }
-
-  // File editor
-
-  file_editor::file_editor (QWidget *p)
-    : file_editor_interface (p)
-  {
-    // Set current editing directory before construction because loaded
-    // files will change ced accordingly.
-    m_ced = QDir::currentPath ();
-
-    // Set actions that are later added by the main window to null,
-    // preventing access to them when they are still undefined.
-    m_undo_action = nullptr;
-    m_copy_action = nullptr;
-    m_paste_action = nullptr;
-    m_selectall_action = nullptr;
-
-    m_find_dialog = nullptr;
-
-    m_closed = false;
-    m_no_focus = false;
-    m_editor_ready = false;
-
-    m_copy_action_enabled = false;
-    m_undo_action_enabled = false;
-    m_current_tab_modified = false;
-
-    construct ();
-
-    setVisible (false);
-    setAcceptDrops (true);
-    setFocusPolicy (Qt::StrongFocus);
-  }
-
-  void file_editor::focusInEvent (QFocusEvent *e)
-  {
-    // The focus is transferred to the active tab and its edit
-    // area in this focus in event handler. This is to avoid
-    // using focus proxies with conflicts in the proxy change
-    // presumably introduced by bug
-    // https://bugreports.qt.io/browse/QTBUG-61092
-    reset_focus (); // Make sure editor tab with edit area get focus
-
-    QDockWidget::focusInEvent (e);
-  }
-
-  // insert global actions, that should also be displayed in the editor window,
-  // into the editor's menu and/or toolbar
-  void file_editor::insert_global_actions (QList<QAction *> shared_actions)
-  {
-    // actions/menus that have to be added to the toolbar or the menu
-    QAction *open_action = shared_actions.at (OPEN_ACTION);
-    QAction *new_action = shared_actions.at (NEW_SCRIPT_ACTION);
-    QAction *new_fcn_action = shared_actions.at (NEW_FUNCTION_ACTION);
-    m_fileMenu->insertAction (m_mru_file_menu->menuAction (), open_action);
-    m_fileMenu->insertAction (open_action, new_fcn_action);
-    m_fileMenu->insertAction (new_fcn_action, new_action);
-    m_tool_bar->insertAction (m_popdown_mru_action, open_action);
-    m_tool_bar->insertAction (open_action, new_action);
-
-    // actions that are additionally enabled/disabled later by the editor
-    // undo
-    m_undo_action = shared_actions.at (UNDO_ACTION);
-    m_tool_bar->insertAction (m_redo_action, m_undo_action);
-    m_edit_menu->insertAction (m_redo_action, m_undo_action);
-    // select all
-    m_selectall_action = shared_actions.at (SELECTALL_ACTION);
-    m_edit_menu->insertAction (m_find_action, m_selectall_action);
-    m_edit_menu->insertSeparator (m_find_action);
-    // paste
-    m_paste_action = shared_actions.at (PASTE_ACTION);
-    m_tool_bar->insertAction (m_find_action, m_paste_action);
-    m_edit_menu->insertAction (m_selectall_action, m_paste_action);
-    m_edit_menu->insertSeparator (m_selectall_action);
-    // copy
-    m_copy_action = shared_actions.at (COPY_ACTION);
-    m_tool_bar->insertAction (m_paste_action, m_copy_action);
-    m_edit_menu->insertAction (m_paste_action, m_copy_action);
-    // find files
-    m_find_files_action = shared_actions.at (FIND_FILES_ACTION);
-    m_edit_menu->insertAction (m_find_action, m_find_files_action);
-  }
-
-  void file_editor::handle_enter_debug_mode ()
-  {
-    gui_settings settings;
-
-    QString sc_run = settings.sc_value (sc_edit_run_run_file);
-    QString sc_cont = settings.sc_value (sc_main_debug_continue);
-
-    if (sc_run == sc_cont)
-      m_run_action->setShortcut (QKeySequence ());  // prevent ambiguous shortcuts
-
-    m_run_action->setToolTip (tr ("Continue"));   // update tool tip
-
-    emit enter_debug_mode_signal ();
-  }
-
-  void file_editor::handle_exit_debug_mode ()
-  {
-    gui_settings settings;
-    settings.set_shortcut (m_run_action, sc_edit_run_run_file);
-    m_run_action->setToolTip (tr ("Save File and Run"));  // update tool tip
-
-    emit exit_debug_mode_signal ();
-  }
-
-  void file_editor::check_actions ()
-  {
-    // Do not include shared actions not only related to the editor
-    bool have_tabs = m_tab_widget->count () > 0;
-
-    m_edit_cmd_menu->setEnabled (have_tabs);
-    m_edit_fmt_menu->setEnabled (have_tabs);
-    m_edit_nav_menu->setEnabled (have_tabs);
-
-    m_comment_selection_action->setEnabled (have_tabs);
-    m_uncomment_selection_action->setEnabled (have_tabs);
-    m_comment_var_selection_action->setEnabled (have_tabs);
-    m_indent_selection_action->setEnabled (have_tabs);
-    m_unindent_selection_action->setEnabled (have_tabs);
-    m_smart_indent_line_or_selection_action->setEnabled (have_tabs);
-
-    m_context_help_action->setEnabled (have_tabs);
-    m_context_doc_action->setEnabled (have_tabs);
-
-    m_view_editor_menu->setEnabled (have_tabs);
-    m_zoom_in_action->setEnabled (have_tabs);
-    m_zoom_out_action->setEnabled (have_tabs);
-    m_zoom_normal_action->setEnabled (have_tabs);
-
-    m_find_action->setEnabled (have_tabs);
-    m_find_next_action->setEnabled (have_tabs);
-    m_find_previous_action->setEnabled (have_tabs);
-    m_print_action->setEnabled (have_tabs);
-
-    m_run_action->setEnabled (have_tabs && m_is_octave_file);
-
-    m_toggle_breakpoint_action->setEnabled (have_tabs && m_is_octave_file);
-    m_next_breakpoint_action->setEnabled (have_tabs && m_is_octave_file);
-    m_previous_breakpoint_action->setEnabled (have_tabs && m_is_octave_file);
-    m_remove_all_breakpoints_action->setEnabled (have_tabs && m_is_octave_file);
-
-    m_edit_function_action->setEnabled (have_tabs);
-    m_save_action->setEnabled (have_tabs && m_current_tab_modified);
-    m_save_as_action->setEnabled (have_tabs);
-    m_close_action->setEnabled (have_tabs);
-    m_close_all_action->setEnabled (have_tabs);
-    m_close_others_action->setEnabled (have_tabs && m_tab_widget->count () > 1);
-    m_sort_tabs_action->setEnabled (have_tabs && m_tab_widget->count () > 1);
-
-    emit editor_tabs_changed_signal (have_tabs, m_is_octave_file);
-  }
-
-  // empty_script determines whether we have to create an empty script
-  // 1. At startup, when the editor has to be (really) visible
-  //    (Here we can not use the visibility changed signal)
-  // 2. When the editor becomes visible when octave is running
-  void file_editor::empty_script (bool startup, bool visible)
-  {
-
-    if (startup)
-      m_editor_ready = true;
-    else
-      {
-        if (! m_editor_ready)
-          return;  // not yet ready but got visibility changed signals
-      }
-
-    gui_settings settings;
-
-    if (settings.value (global_use_custom_editor.settings_key (),
-                        global_use_custom_editor.def ()).toBool ())
-      return;  // do not open an empty script in the external editor
-
-    bool real_visible;
-
-    if (startup)
-      real_visible = isVisible ();
-    else
-      real_visible = visible;
-
-    if (! real_visible || m_tab_widget->count () > 0)
-      return;
-
-    if (startup && ! isFloating ())
-      {
-        // check if editor is really visible or hidden between tabbed widgets
-        QWidget *parent = parentWidget ();
-
-        if (parent)
-          {
-            QList<QTabBar *> tab_list = parent->findChildren<QTabBar *>();
-
-            bool in_tab = false;
-            int i = 0;
-            while ((i < tab_list.count ()) && (! in_tab))
-              {
-                QTabBar *tab = tab_list.at (i);
-                i++;
-
-                int j = 0;
-                while ((j < tab->count ()) && (! in_tab))
-                  {
-                    // check all tabs for the editor
-                    if (tab->tabText (j) == windowTitle ())
-                      {
-                        // editor is in this tab widget
-                        in_tab = true;
-                        int top = tab->currentIndex ();
-                        if (! (top > -1 && tab->tabText (top) == windowTitle ()))
-                          return; // not current tab -> not visible
-                      }
-                    j++;
-                  }
-              }
-          }
-      }
-
-    request_new_file ("");
-  }
-
-  void file_editor::restore_session ()
-  {
-    gui_settings settings;
-
-    //restore previous session
-    if (! settings.bool_value (ed_restore_session))
-      return;
-
-    // get the data from the settings file
-    QStringList sessionFileNames
-      = settings.string_list_value (ed_session_names);
-
-    QStringList session_encodings
-      = settings.string_list_value (ed_session_enc);
-
-    QStringList session_index
-      = settings.string_list_value (ed_session_ind);
-
-    QStringList session_lines
-      = settings.string_list_value (ed_session_lines);
-
-    QStringList session_bookmarks
-      = settings.string_list_value (ed_session_bookmarks);
-
-    // fill a list of the struct and sort it (depending on index)
-    QList<session_data> s_data;
-
-    bool do_encoding = (session_encodings.count () == sessionFileNames.count ());
-    bool do_index = (session_index.count () == sessionFileNames.count ());
-    bool do_lines = (session_lines.count () == sessionFileNames.count ());
-    bool do_bookmarks = (session_bookmarks.count () == sessionFileNames.count ());
-
-    for (int n = 0; n < sessionFileNames.count (); ++n)
-      {
-        QFileInfo file = QFileInfo (sessionFileNames.at (n));
-        if (! file.exists ())
-          continue;
-
-        session_data item = { 0, -1, sessionFileNames.at (n),
-                              QString (), QString (), QString ()};
-        if (do_lines)
-          item.line = session_lines.at (n).toInt ();
-        if (do_index)
-          item.index = session_index.at (n).toInt ();
-        if (do_encoding)
-          item.encoding = session_encodings.at (n);
-        if (do_bookmarks)
-          item.bookmarks = session_bookmarks.at (n);
-
-        s_data << item;
-      }
-
-    std::sort (s_data.begin (), s_data.end ());
-
-    // finally open the files with the desired encoding in the desired order
-    for (int n = 0; n < s_data.count (); ++n)
-      request_open_file (s_data.at (n).file_name, s_data.at (n).encoding,
-                         s_data.at (n).line, false, false, true, "", -1,
-                         s_data.at (n).bookmarks);
-  }
-
-  void file_editor::activate ()
-  {
-    if (m_no_focus)
-      return;  // No focus for the editor if external open/close request
-
-    octave_dock_widget::activate ();
-
-    // set focus to current tab
-    reset_focus ();
-  }
-
-  void file_editor::set_focus (QWidget *fet)
-  {
-    setFocus ();
-
-    // set focus to desired tab
-    if (fet)
-      m_tab_widget->setCurrentWidget (fet);
-  }
-
-  // function enabling/disabling the menu accelerators depending on the
-  // focus of the editor
-  void file_editor::enable_menu_shortcuts (bool enable)
-  {
-    // Hide or show the find dialog together with the focus of the
-    // editor widget depending on the overall visibility of the find dialog.
-    // Do not change internal visibility state.
-    if (m_find_dialog)
-      m_find_dialog->set_visible (enable);
-
-    // Take care of the shortcuts
-    QHash<QMenu *, QStringList>::const_iterator i = m_hash_menu_text.constBegin ();
-
-    while (i != m_hash_menu_text.constEnd ())
-      {
-        i.key ()->setTitle (i.value ().at (! enable));
-        ++i;
-      }
-
-    // when editor loses focus, enable the actions, which are always active
-    // in the main window due to missing info on selected text and undo actions
-    if (m_copy_action && m_undo_action)
-      {
-        if (enable)
-          {
-            m_copy_action->setEnabled (m_copy_action_enabled);
-            m_undo_action->setEnabled (m_undo_action_enabled);
-          }
-        else
-          {
-            m_copy_action_enabled = m_copy_action->isEnabled ();
-            m_undo_action_enabled = m_undo_action->isEnabled ();
-            m_copy_action->setEnabled (true);
-            m_undo_action->setEnabled (true);
-          }
-      }
-  }
-
-  // Save open files for restoring in next session
-  // (even if last session will not be restored next time)
-  // together with encoding and the tab index
-  void file_editor::save_session ()
-  {
-    gui_settings settings;
-
-    QStringList fetFileNames;
-    QStringList fet_encodings;
-    QStringList fet_index;
-    QStringList fet_lines;
-    QStringList fet_bookmarks;
-
-    std::list<file_editor_tab *> editor_tab_lst = m_tab_widget->tab_list ();
-
-    for (auto editor_tab : editor_tab_lst)
-      {
-        QString file_name = editor_tab->file_name ();
-
-        // Don't append unnamed files.
-
-        if (! file_name.isEmpty ())
-          {
-            fetFileNames.append (file_name);
-            fet_encodings.append (editor_tab->encoding ());
-
-            QString index;
-            fet_index.append (index.setNum (m_tab_widget->indexOf (editor_tab)));
-
-            int l, c;
-            editor_tab->qsci_edit_area ()->getCursorPosition (&l, &c);
-            fet_lines.append (index.setNum (l + 1));
-
-            fet_bookmarks.append (editor_tab->get_all_bookmarks ());
-          }
-      }
-
-    settings.setValue (ed_session_names.settings_key (), fetFileNames);
-    settings.setValue (ed_session_enc.settings_key (), fet_encodings);
-    settings.setValue (ed_session_ind.settings_key (), fet_index);
-    settings.setValue (ed_session_lines.settings_key (), fet_lines);
-    settings.setValue (ed_session_bookmarks.settings_key (), fet_bookmarks);
-
-    settings.sync ();
-  }
-
-  bool file_editor::check_closing ()
-  {
-    // When the application or the editor is closing and the user wants to
-    // close all files, in the latter case all editor tabs are checked whether
-    // they need to be saved.  During these checks tabs are not closed since
-    // the user might cancel closing Octave during one of these saving dialogs.
-    // Therefore, saving the session for restoring at next start is not done
-    // before the application is definitely closing.
-
-    // Save the session. Even is closing is cancelled, this would be
-    // overwritten by the next attempt to close the editor
-    save_session ();
-
-    std::list<file_editor_tab *> fe_tab_lst = m_tab_widget->tab_list ();
-    m_number_of_tabs = fe_tab_lst.size ();
-
-    for (auto fe_tab : fe_tab_lst)
-      {
-        // Wait for all editor tabs to have saved their files if required
-
-        connect (fe_tab, &file_editor_tab::tab_ready_to_close,
-                 this, &file_editor::handle_tab_ready_to_close,
-                 Qt::UniqueConnection);
-      }
-
-    m_closing_canceled = false;
-
-    for (auto fe_tab : fe_tab_lst)
-      {
-        // If there was a cancellation, make the already saved/discarded tabs
-        // recover from the exit by removing the read-only state and by
-        // recovering the debugger breakpoints.  Finally return false in order
-        // to cancel closing the application or the editor.
-
-        if (fe_tab->check_file_modified (false) == QMessageBox::Cancel)
-          {
-            emit fetab_recover_from_exit ();
-
-            m_closing_canceled = true;
-
-            for (auto fet : fe_tab_lst)
-              disconnect (fet, &file_editor_tab::tab_ready_to_close, 0, 0);
-
-            return false;
-          }
-      }
-
-    return true;
-  }
-
-  void file_editor::handle_tab_ready_to_close ()
-  {
-    if (m_closing_canceled)
-      return;
-
-    // FIXME: Why count down to zero here before doing anything?  Why
-    // not remove and delete each tab that is ready to be closed, one
-    // per invocation?
-
-    m_number_of_tabs--;
-
-    if (m_number_of_tabs > 0)
-      return;
-
-    // Here, the application or the editor will be closed -> store the session
-
-    // Take care of the find dialog
-    if (m_find_dialog)
-      m_find_dialog->close ();
-
-    // Finally close all the tabs and return indication that we can exit
-    // the application or close the editor.
-    // Closing and deleting the tabs makes the editor visible.  In case it was
-    // hidden before, this state has to be restored afterwards.
-    bool vis = isVisible ();
-
-    std::list<file_editor_tab *> editor_tab_lst = m_tab_widget->tab_list ();
-    for (auto editor_tab : editor_tab_lst)
-      editor_tab->deleteLater ();
-
-    m_tab_widget->clear ();
-
-    setVisible (vis);
-  }
-
-  void file_editor::request_new_file (const QString& commands)
-  {
-    // Custom editor? If yes, we can only call the editor without passing
-    // some initial contents and even without being sure a new file is opened
-    if (call_custom_editor ())
+// Functions of the the reimplemented tab widget
+
+file_editor_tab_widget::file_editor_tab_widget (QWidget *p, file_editor *fe)
+  : QTabWidget (p)
+{
+  tab_bar *bar = new tab_bar (this);
+
+  connect (bar, &tab_bar::close_current_tab_signal,
+           fe, &file_editor::request_close_file);
+
+  this->setTabBar (bar);
+
+  setTabsClosable (true);
+  setUsesScrollButtons (true);
+  setMovable (true);
+}
+
+tab_bar *file_editor_tab_widget::get_tab_bar () const
+{
+  return qobject_cast<tab_bar *> (tabBar ());
+}
+
+std::list<file_editor_tab *>
+file_editor_tab_widget::tab_list () const
+{
+  std::list<file_editor_tab *> retval;
+  for (int i = 0; i < count (); i++)
+    retval.push_back (static_cast<file_editor_tab *> (widget (i)));
+  return retval;
+}
+
+// File editor
+
+file_editor::file_editor (QWidget *p)
+  : file_editor_interface (p)
+{
+  // Set current editing directory before construction because loaded
+  // files will change ced accordingly.
+  m_ced = QDir::currentPath ();
+
+  // Set actions that are later added by the main window to null,
+  // preventing access to them when they are still undefined.
+  m_undo_action = nullptr;
+  m_copy_action = nullptr;
+  m_paste_action = nullptr;
+  m_selectall_action = nullptr;
+
+  m_find_dialog = nullptr;
+
+  m_closed = false;
+  m_no_focus = false;
+  m_editor_ready = false;
+
+  m_copy_action_enabled = false;
+  m_undo_action_enabled = false;
+  m_current_tab_modified = false;
+
+  construct ();
+
+  setVisible (false);
+  setAcceptDrops (true);
+  setFocusPolicy (Qt::StrongFocus);
+}
+
+void file_editor::focusInEvent (QFocusEvent *e)
+{
+  // The focus is transferred to the active tab and its edit
+  // area in this focus in event handler. This is to avoid
+  // using focus proxies with conflicts in the proxy change
+  // presumably introduced by bug
+  // https://bugreports.qt.io/browse/QTBUG-61092
+  reset_focus (); // Make sure editor tab with edit area get focus
+
+  QDockWidget::focusInEvent (e);
+}
+
+// insert global actions, that should also be displayed in the editor window,
+// into the editor's menu and/or toolbar
+void file_editor::insert_global_actions (QList<QAction *> shared_actions)
+{
+  // actions/menus that have to be added to the toolbar or the menu
+  QAction *open_action = shared_actions.at (OPEN_ACTION);
+  QAction *new_action = shared_actions.at (NEW_SCRIPT_ACTION);
+  QAction *new_fcn_action = shared_actions.at (NEW_FUNCTION_ACTION);
+  m_fileMenu->insertAction (m_mru_file_menu->menuAction (), open_action);
+  m_fileMenu->insertAction (open_action, new_fcn_action);
+  m_fileMenu->insertAction (new_fcn_action, new_action);
+  m_tool_bar->insertAction (m_popdown_mru_action, open_action);
+  m_tool_bar->insertAction (open_action, new_action);
+
+  // actions that are additionally enabled/disabled later by the editor
+  // undo
+  m_undo_action = shared_actions.at (UNDO_ACTION);
+  m_tool_bar->insertAction (m_redo_action, m_undo_action);
+  m_edit_menu->insertAction (m_redo_action, m_undo_action);
+  // select all
+  m_selectall_action = shared_actions.at (SELECTALL_ACTION);
+  m_edit_menu->insertAction (m_find_action, m_selectall_action);
+  m_edit_menu->insertSeparator (m_find_action);
+  // paste
+  m_paste_action = shared_actions.at (PASTE_ACTION);
+  m_tool_bar->insertAction (m_find_action, m_paste_action);
+  m_edit_menu->insertAction (m_selectall_action, m_paste_action);
+  m_edit_menu->insertSeparator (m_selectall_action);
+  // copy
+  m_copy_action = shared_actions.at (COPY_ACTION);
+  m_tool_bar->insertAction (m_paste_action, m_copy_action);
+  m_edit_menu->insertAction (m_paste_action, m_copy_action);
+  // find files
+  m_find_files_action = shared_actions.at (FIND_FILES_ACTION);
+  m_edit_menu->insertAction (m_find_action, m_find_files_action);
+}
+
+void file_editor::handle_enter_debug_mode ()
+{
+  gui_settings settings;
+
+  QString sc_run = settings.sc_value (sc_edit_run_run_file);
+  QString sc_cont = settings.sc_value (sc_main_debug_continue);
+
+  if (sc_run == sc_cont)
+    m_run_action->setShortcut (QKeySequence ());  // prevent ambiguous shortcuts
+
+  m_run_action->setToolTip (tr ("Continue"));   // update tool tip
+
+  emit enter_debug_mode_signal ();
+}
+
+void file_editor::handle_exit_debug_mode ()
+{
+  gui_settings settings;
+  settings.set_shortcut (m_run_action, sc_edit_run_run_file);
+  m_run_action->setToolTip (tr ("Save File and Run"));  // update tool tip
+
+  emit exit_debug_mode_signal ();
+}
+
+void file_editor::check_actions ()
+{
+  // Do not include shared actions not only related to the editor
+  bool have_tabs = m_tab_widget->count () > 0;
+
+  m_edit_cmd_menu->setEnabled (have_tabs);
+  m_edit_fmt_menu->setEnabled (have_tabs);
+  m_edit_nav_menu->setEnabled (have_tabs);
+
+  m_comment_selection_action->setEnabled (have_tabs);
+  m_uncomment_selection_action->setEnabled (have_tabs);
+  m_comment_var_selection_action->setEnabled (have_tabs);
+  m_indent_selection_action->setEnabled (have_tabs);
+  m_unindent_selection_action->setEnabled (have_tabs);
+  m_smart_indent_line_or_selection_action->setEnabled (have_tabs);
+
+  m_context_help_action->setEnabled (have_tabs);
+  m_context_doc_action->setEnabled (have_tabs);
+
+  m_view_editor_menu->setEnabled (have_tabs);
+  m_zoom_in_action->setEnabled (have_tabs);
+  m_zoom_out_action->setEnabled (have_tabs);
+  m_zoom_normal_action->setEnabled (have_tabs);
+
+  m_find_action->setEnabled (have_tabs);
+  m_find_next_action->setEnabled (have_tabs);
+  m_find_previous_action->setEnabled (have_tabs);
+  m_print_action->setEnabled (have_tabs);
+
+  m_run_action->setEnabled (have_tabs && m_is_octave_file);
+
+  m_toggle_breakpoint_action->setEnabled (have_tabs && m_is_octave_file);
+  m_next_breakpoint_action->setEnabled (have_tabs && m_is_octave_file);
+  m_previous_breakpoint_action->setEnabled (have_tabs && m_is_octave_file);
+  m_remove_all_breakpoints_action->setEnabled (have_tabs && m_is_octave_file);
+
+  m_edit_function_action->setEnabled (have_tabs);
+  m_save_action->setEnabled (have_tabs && m_current_tab_modified);
+  m_save_as_action->setEnabled (have_tabs);
+  m_close_action->setEnabled (have_tabs);
+  m_close_all_action->setEnabled (have_tabs);
+  m_close_others_action->setEnabled (have_tabs && m_tab_widget->count () > 1);
+  m_sort_tabs_action->setEnabled (have_tabs && m_tab_widget->count () > 1);
+
+  emit editor_tabs_changed_signal (have_tabs, m_is_octave_file);
+}
+
+// empty_script determines whether we have to create an empty script
+// 1. At startup, when the editor has to be (really) visible
+//    (Here we can not use the visibility changed signal)
+// 2. When the editor becomes visible when octave is running
+void file_editor::empty_script (bool startup, bool visible)
+{
+
+  if (startup)
+    m_editor_ready = true;
+  else
+    {
+      if (! m_editor_ready)
+        return;  // not yet ready but got visibility changed signals
+    }
+
+  gui_settings settings;
+
+  if (settings.value (global_use_custom_editor.settings_key (),
+                      global_use_custom_editor.def ()).toBool ())
+    return;  // do not open an empty script in the external editor
+
+  bool real_visible;
+
+  if (startup)
+    real_visible = isVisible ();
+  else
+    real_visible = visible;
+
+  if (! real_visible || m_tab_widget->count () > 0)
+    return;
+
+  if (startup && ! isFloating ())
+    {
+      // check if editor is really visible or hidden between tabbed widgets
+      QWidget *parent = parentWidget ();
+
+      if (parent)
+        {
+          QList<QTabBar *> tab_list = parent->findChildren<QTabBar *>();
+
+          bool in_tab = false;
+          int i = 0;
+          while ((i < tab_list.count ()) && (! in_tab))
+            {
+              QTabBar *tab = tab_list.at (i);
+              i++;
+
+              int j = 0;
+              while ((j < tab->count ()) && (! in_tab))
+                {
+                  // check all tabs for the editor
+                  if (tab->tabText (j) == windowTitle ())
+                    {
+                      // editor is in this tab widget
+                      in_tab = true;
+                      int top = tab->currentIndex ();
+                      if (! (top > -1 && tab->tabText (top) == windowTitle ()))
+                        return; // not current tab -> not visible
+                    }
+                  j++;
+                }
+            }
+        }
+    }
+
+  request_new_file ("");
+}
+
+void file_editor::restore_session ()
+{
+  gui_settings settings;
+
+  //restore previous session
+  if (! settings.bool_value (ed_restore_session))
+    return;
+
+  // get the data from the settings file
+  QStringList sessionFileNames
+    = settings.string_list_value (ed_session_names);
+
+  QStringList session_encodings
+    = settings.string_list_value (ed_session_enc);
+
+  QStringList session_index
+    = settings.string_list_value (ed_session_ind);
+
+  QStringList session_lines
+    = settings.string_list_value (ed_session_lines);
+
+  QStringList session_bookmarks
+    = settings.string_list_value (ed_session_bookmarks);
+
+  // fill a list of the struct and sort it (depending on index)
+  QList<session_data> s_data;
+
+  bool do_encoding = (session_encodings.count () == sessionFileNames.count ());
+  bool do_index = (session_index.count () == sessionFileNames.count ());
+  bool do_lines = (session_lines.count () == sessionFileNames.count ());
+  bool do_bookmarks = (session_bookmarks.count () == sessionFileNames.count ());
+
+  for (int n = 0; n < sessionFileNames.count (); ++n)
+    {
+      QFileInfo file = QFileInfo (sessionFileNames.at (n));
+      if (! file.exists ())
+        continue;
+
+      session_data item = { 0, -1, sessionFileNames.at (n),
+                            QString (), QString (), QString ()};
+      if (do_lines)
+        item.line = session_lines.at (n).toInt ();
+      if (do_index)
+        item.index = session_index.at (n).toInt ();
+      if (do_encoding)
+        item.encoding = session_encodings.at (n);
+      if (do_bookmarks)
+        item.bookmarks = session_bookmarks.at (n);
+
+      s_data << item;
+    }
+
+  std::sort (s_data.begin (), s_data.end ());
+
+  // finally open the files with the desired encoding in the desired order
+  for (int n = 0; n < s_data.count (); ++n)
+    request_open_file (s_data.at (n).file_name, s_data.at (n).encoding,
+                       s_data.at (n).line, false, false, true, "", -1,
+                       s_data.at (n).bookmarks);
+}
+
+void file_editor::activate ()
+{
+  if (m_no_focus)
+    return;  // No focus for the editor if external open/close request
+
+  octave_dock_widget::activate ();
+
+  // set focus to current tab
+  reset_focus ();
+}
+
+void file_editor::set_focus (QWidget *fet)
+{
+  setFocus ();
+
+  // set focus to desired tab
+  if (fet)
+    m_tab_widget->setCurrentWidget (fet);
+}
+
+// function enabling/disabling the menu accelerators depending on the
+// focus of the editor
+void file_editor::enable_menu_shortcuts (bool enable)
+{
+  // Hide or show the find dialog together with the focus of the
+  // editor widget depending on the overall visibility of the find dialog.
+  // Do not change internal visibility state.
+  if (m_find_dialog)
+    m_find_dialog->set_visible (enable);
+
+  // Take care of the shortcuts
+  QHash<QMenu *, QStringList>::const_iterator i = m_hash_menu_text.constBegin ();
+
+  while (i != m_hash_menu_text.constEnd ())
+    {
+      i.key ()->setTitle (i.value ().at (! enable));
+      ++i;
+    }
+
+  // when editor loses focus, enable the actions, which are always active
+  // in the main window due to missing info on selected text and undo actions
+  if (m_copy_action && m_undo_action)
+    {
+      if (enable)
+        {
+          m_copy_action->setEnabled (m_copy_action_enabled);
+          m_undo_action->setEnabled (m_undo_action_enabled);
+        }
+      else
+        {
+          m_copy_action_enabled = m_copy_action->isEnabled ();
+          m_undo_action_enabled = m_undo_action->isEnabled ();
+          m_copy_action->setEnabled (true);
+          m_undo_action->setEnabled (true);
+        }
+    }
+}
+
+// Save open files for restoring in next session
+// (even if last session will not be restored next time)
+// together with encoding and the tab index
+void file_editor::save_session ()
+{
+  gui_settings settings;
+
+  QStringList fetFileNames;
+  QStringList fet_encodings;
+  QStringList fet_index;
+  QStringList fet_lines;
+  QStringList fet_bookmarks;
+
+  std::list<file_editor_tab *> editor_tab_lst = m_tab_widget->tab_list ();
+
+  for (auto editor_tab : editor_tab_lst)
+    {
+      QString file_name = editor_tab->file_name ();
+
+      // Don't append unnamed files.
+
+      if (! file_name.isEmpty ())
+        {
+          fetFileNames.append (file_name);
+          fet_encodings.append (editor_tab->encoding ());
+
+          QString index;
+          fet_index.append (index.setNum (m_tab_widget->indexOf (editor_tab)));
+
+          int l, c;
+          editor_tab->qsci_edit_area ()->getCursorPosition (&l, &c);
+          fet_lines.append (index.setNum (l + 1));
+
+          fet_bookmarks.append (editor_tab->get_all_bookmarks ());
+        }
+    }
+
+  settings.setValue (ed_session_names.settings_key (), fetFileNames);
+  settings.setValue (ed_session_enc.settings_key (), fet_encodings);
+  settings.setValue (ed_session_ind.settings_key (), fet_index);
+  settings.setValue (ed_session_lines.settings_key (), fet_lines);
+  settings.setValue (ed_session_bookmarks.settings_key (), fet_bookmarks);
+
+  settings.sync ();
+}
+
+bool file_editor::check_closing ()
+{
+  // When the application or the editor is closing and the user wants to
+  // close all files, in the latter case all editor tabs are checked whether
+  // they need to be saved.  During these checks tabs are not closed since
+  // the user might cancel closing Octave during one of these saving dialogs.
+  // Therefore, saving the session for restoring at next start is not done
+  // before the application is definitely closing.
+
+  // Save the session. Even is closing is cancelled, this would be
+  // overwritten by the next attempt to close the editor
+  save_session ();
+
+  std::list<file_editor_tab *> fe_tab_lst = m_tab_widget->tab_list ();
+  m_number_of_tabs = fe_tab_lst.size ();
+
+  for (auto fe_tab : fe_tab_lst)
+    {
+      // Wait for all editor tabs to have saved their files if required
+
+      connect (fe_tab, &file_editor_tab::tab_ready_to_close,
+               this, &file_editor::handle_tab_ready_to_close,
+               Qt::UniqueConnection);
+    }
+
+  m_closing_canceled = false;
+
+  for (auto fe_tab : fe_tab_lst)
+    {
+      // If there was a cancellation, make the already saved/discarded tabs
+      // recover from the exit by removing the read-only state and by
+      // recovering the debugger breakpoints.  Finally return false in order
+      // to cancel closing the application or the editor.
+
+      if (fe_tab->check_file_modified (false) == QMessageBox::Cancel)
+        {
+          emit fetab_recover_from_exit ();
+
+          m_closing_canceled = true;
+
+          for (auto fet : fe_tab_lst)
+            disconnect (fet, &file_editor_tab::tab_ready_to_close, 0, 0);
+
+          return false;
+        }
+    }
+
+  return true;
+}
+
+void file_editor::handle_tab_ready_to_close ()
+{
+  if (m_closing_canceled)
+    return;
+
+  // FIXME: Why count down to zero here before doing anything?  Why
+  // not remove and delete each tab that is ready to be closed, one
+  // per invocation?
+
+  m_number_of_tabs--;
+
+  if (m_number_of_tabs > 0)
+    return;
+
+  // Here, the application or the editor will be closed -> store the session
+
+  // Take care of the find dialog
+  if (m_find_dialog)
+    m_find_dialog->close ();
+
+  // Finally close all the tabs and return indication that we can exit
+  // the application or close the editor.
+  // Closing and deleting the tabs makes the editor visible.  In case it was
+  // hidden before, this state has to be restored afterwards.
+  bool vis = isVisible ();
+
+  std::list<file_editor_tab *> editor_tab_lst = m_tab_widget->tab_list ();
+  for (auto editor_tab : editor_tab_lst)
+    editor_tab->deleteLater ();
+
+  m_tab_widget->clear ();
+
+  setVisible (vis);
+}
+
+void file_editor::request_new_file (const QString& commands)
+{
+  // Custom editor? If yes, we can only call the editor without passing
+  // some initial contents and even without being sure a new file is opened
+  if (call_custom_editor ())
+    return;
+
+  // New file isn't a file_editor_tab function since the file
+  // editor tab has yet to be created and there is no object to
+  // pass a signal to.  Hence, functionality is here.
+
+  file_editor_tab *fileEditorTab = make_file_editor_tab (m_ced);
+  add_file_editor_tab (fileEditorTab, "");  // new tab with empty title
+  fileEditorTab->new_file (commands);       // title is updated here
+  activate ();                              // focus editor and new tab
+}
+
+void file_editor::request_close_file (bool)
+{
+  file_editor_tab *editor_tab
+    = static_cast<file_editor_tab *> (m_tab_widget->currentWidget ());
+  editor_tab->conditional_close ();
+}
+
+void file_editor::request_close_all_files (bool)
+{
+  file_editor_tab *editor_tab;
+
+  // loop over all tabs starting from last one otherwise deletion changes index
+  for (int index = m_tab_widget->count ()-1; index >= 0; index--)
+    {
+      editor_tab = static_cast<file_editor_tab *> (m_tab_widget->widget (index));
+      editor_tab->conditional_close ();
+    }
+}
+
+void file_editor::request_close_other_files (bool)
+{
+  file_editor_tab *editor_tab;
+  QWidget *tabID = m_tab_widget->currentWidget ();
+
+  // loop over all tabs starting from last one otherwise deletion changes index
+  for (int index = m_tab_widget->count ()-1; index >= 0; index--)
+    {
+      if (tabID != m_tab_widget->widget (index))
+        {
+          editor_tab
+            = static_cast<file_editor_tab *> (m_tab_widget->widget (index));
+          editor_tab->conditional_close ();
+        }
+    }
+}
+
+void file_editor::copy_full_file_path (bool)
+{
+  file_editor_tab *editor_tab
+    = static_cast<file_editor_tab *> (m_tab_widget->currentWidget ());
+
+  if (editor_tab)
+    QGuiApplication::clipboard ()->setText (editor_tab->file_name ());
+}
+
+// open a file from the mru list
+void file_editor::request_mru_open_file (QAction *action)
+{
+  if (action)
+    {
+      request_open_file (action->data ().toStringList ().at (0),
+                         action->data ().toStringList ().at (1));
+    }
+}
+
+void file_editor::request_print_file (bool)
+{
+  emit fetab_print_file (m_tab_widget->currentWidget ());
+}
+
+void file_editor::request_redo (bool)
+{
+  emit fetab_scintilla_command (m_tab_widget->currentWidget (),
+                                QsciScintillaBase::SCI_REDO);
+}
+
+void file_editor::request_cut (bool)
+{
+  emit fetab_scintilla_command (m_tab_widget->currentWidget (),
+                                QsciScintillaBase::SCI_CUT);
+}
+
+void file_editor::request_context_help (bool)
+{
+  emit fetab_context_help (m_tab_widget->currentWidget (), false);
+}
+
+void file_editor::request_context_doc (bool)
+{
+  emit fetab_context_help (m_tab_widget->currentWidget (), true);
+}
+
+void file_editor::request_context_edit (bool)
+{
+  emit fetab_context_edit (m_tab_widget->currentWidget ());
+}
+
+void file_editor::request_save_file (bool)
+{
+  emit fetab_save_file (m_tab_widget->currentWidget ());
+}
+
+void file_editor::request_save_file_as (bool)
+{
+  emit fetab_save_file_as (m_tab_widget->currentWidget ());
+}
+
+void file_editor::request_run_file (bool)
+{
+  // The interpreter_event callback function below emits a signal.
+  // Because we don't control when that happens, use a guarded pointer
+  // so that the callback can abort if this object is no longer valid.
+
+  QPointer<file_editor> this_fe (this);
+
+  emit interpreter_event
+    ([=] (interpreter& interp)
+     {
+       // INTERPRETER THREAD
+
+       // If THIS_FE is no longer valid, skip the entire callback
+       // function.  With the way things are implemented now, we can't
+       // run the contents of a file unless the file editor and the
+       // corresponding file editor tab are still valid.
+
+       if (this_fe.isNull ())
+         return;
+
+       // Act as though this action was entered at the command propmt
+       // so that the interpreter will check for updated file time
+       // stamps.
+       Vlast_prompt_time.stamp ();
+
+       tree_evaluator& tw = interp.get_evaluator ();
+
+       if (tw.in_debug_repl ())
+         emit request_dbcont_signal ();
+       else
+         emit fetab_run_file (m_tab_widget->currentWidget ());
+     });
+}
+
+void file_editor::request_step_into_file ()
+{
+  emit fetab_run_file (m_tab_widget->currentWidget (), true);
+}
+
+void file_editor::request_context_run (bool)
+{
+  emit fetab_context_run (m_tab_widget->currentWidget ());
+}
+
+void file_editor::request_toggle_bookmark (bool)
+{
+  emit fetab_toggle_bookmark (m_tab_widget->currentWidget ());
+}
+
+void file_editor::request_next_bookmark (bool)
+{
+  emit fetab_next_bookmark (m_tab_widget->currentWidget ());
+}
+
+void file_editor::request_previous_bookmark (bool)
+{
+  emit fetab_previous_bookmark (m_tab_widget->currentWidget ());
+}
+
+void file_editor::request_remove_bookmark (bool)
+{
+  emit fetab_remove_bookmark (m_tab_widget->currentWidget ());
+}
+
+void file_editor::request_move_match_brace (bool)
+{
+  emit fetab_move_match_brace (m_tab_widget->currentWidget (), false);
+}
+
+void file_editor::request_sel_match_brace (bool)
+{
+  emit fetab_move_match_brace (m_tab_widget->currentWidget (), true);
+}
+
+// FIXME: What should this do with conditional breakpoints?
+void file_editor::request_toggle_breakpoint (bool)
+{
+  emit fetab_toggle_breakpoint (m_tab_widget->currentWidget ());
+}
+
+void file_editor::request_next_breakpoint (bool)
+{
+  emit fetab_next_breakpoint (m_tab_widget->currentWidget ());
+}
+
+void file_editor::request_previous_breakpoint (bool)
+{
+  emit fetab_previous_breakpoint (m_tab_widget->currentWidget ());
+}
+
+void file_editor::request_remove_breakpoint (bool)
+{
+  emit fetab_remove_all_breakpoints (m_tab_widget->currentWidget ());
+}
+
+// slots for Edit->Commands actions
+void file_editor::request_delete_start_word (bool)
+{
+  emit fetab_scintilla_command (m_tab_widget->currentWidget (),
+                                QsciScintillaBase::SCI_DELWORDLEFT);
+}
+
+void file_editor::request_delete_end_word (bool)
+{
+  emit fetab_scintilla_command (m_tab_widget->currentWidget (),
+                                QsciScintillaBase::SCI_DELWORDRIGHT);
+}
+
+void file_editor::request_delete_start_line (bool)
+{
+  emit fetab_scintilla_command (m_tab_widget->currentWidget (),
+                                QsciScintillaBase::SCI_DELLINELEFT);
+}
+
+void file_editor::request_delete_end_line (bool)
+{
+  emit fetab_scintilla_command (m_tab_widget->currentWidget (),
+                                QsciScintillaBase::SCI_DELLINERIGHT);
+}
+
+void file_editor::request_delete_line (bool)
+{
+  emit fetab_scintilla_command (m_tab_widget->currentWidget (),
+                                QsciScintillaBase::SCI_LINEDELETE);
+}
+
+void file_editor::request_copy_line (bool)
+{
+  emit fetab_scintilla_command (m_tab_widget->currentWidget (),
+                                QsciScintillaBase::SCI_LINECOPY);
+}
+
+void file_editor::request_cut_line (bool)
+{
+  emit fetab_scintilla_command (m_tab_widget->currentWidget (),
+                                QsciScintillaBase::SCI_LINECUT);
+}
+
+void file_editor::request_duplicate_selection (bool)
+{
+  emit fetab_scintilla_command (m_tab_widget->currentWidget (),
+                                QsciScintillaBase::SCI_SELECTIONDUPLICATE);
+}
+
+void file_editor::request_transpose_line (bool)
+{
+  emit fetab_scintilla_command (m_tab_widget->currentWidget (),
+                                QsciScintillaBase::SCI_LINETRANSPOSE);
+}
+
+void file_editor::request_comment_selected_text (bool)
+{
+  emit fetab_comment_selected_text (m_tab_widget->currentWidget (), false);
+}
+
+void file_editor::request_uncomment_selected_text (bool)
+{
+  emit fetab_uncomment_selected_text (m_tab_widget->currentWidget ());
+}
+
+void file_editor::request_comment_var_selected_text (bool)
+{
+  emit fetab_comment_selected_text (m_tab_widget->currentWidget (), true);
+}
+
+// slots for Edit->Format actions
+void file_editor::request_upper_case (bool)
+{
+  emit fetab_scintilla_command (m_tab_widget->currentWidget (),
+                                QsciScintillaBase::SCI_UPPERCASE);
+}
+
+void file_editor::request_lower_case (bool)
+{
+  emit fetab_scintilla_command (m_tab_widget->currentWidget (),
+                                QsciScintillaBase::SCI_LOWERCASE);
+}
+
+void file_editor::request_indent_selected_text (bool)
+{
+  emit fetab_indent_selected_text (m_tab_widget->currentWidget ());
+}
+
+void file_editor::request_unindent_selected_text (bool)
+{
+  emit fetab_unindent_selected_text (m_tab_widget->currentWidget ());
+}
+
+void file_editor::request_smart_indent_line_or_selected_text ()
+{
+  emit fetab_smart_indent_line_or_selected_text (m_tab_widget->currentWidget ());
+}
+
+void file_editor::request_conv_eol_windows (bool)
+{
+  emit fetab_convert_eol (m_tab_widget->currentWidget (),
+                          QsciScintilla::EolWindows);
+}
+void
+file_editor::request_conv_eol_unix (bool)
+{
+  emit fetab_convert_eol (m_tab_widget->currentWidget (),
+                          QsciScintilla::EolUnix);
+}
+
+void file_editor::request_conv_eol_mac (bool)
+{
+  emit fetab_convert_eol (m_tab_widget->currentWidget (),
+                          QsciScintilla::EolMac);
+}
+
+// Slot for initially creating and showing the find dialog
+void file_editor::request_find (bool)
+{
+  // Create the dialog
+  find_create ();
+
+  // Since find_create shows the dialog without activating the widget
+  // (which is reuqired in other cases) do this manually here
+  m_find_dialog->activateWindow ();
+
+  // Initiate search text from possible selection and save the initial
+  // data from the dialog on the defined structure
+  m_find_dialog->init_search_text ();
+}
+
+// This method creates the find dialog.
+
+void file_editor::find_create ()
+{
+  if (m_find_dialog)
+    m_find_dialog->close ();
+
+  if (isFloating ())
+    m_find_dialog = new find_dialog (this, this);
+  else
+    m_find_dialog = new find_dialog (this, parentWidget ());
+
+  // Add required actions
+  m_find_dialog->addAction (m_find_next_action);
+  m_find_dialog->addAction (m_find_previous_action);
+
+  // Update edit area
+  file_editor_tab *fet
+    = static_cast<file_editor_tab *> (m_tab_widget->currentWidget ());
+  m_find_dialog->update_edit_area (fet->qsci_edit_area ());
+
+  // Icon is the same as the editor
+  m_find_dialog->setWindowIcon (windowIcon ());
+
+  // Position:  lower right of editor's position
+  int xp = x () + frameGeometry ().width ();
+  int yp = y () + frameGeometry ().height ();
+
+  if (! isFloating ())
+    {
+      // Fix position if editor is docked
+
+      QWidget *parent = parentWidget ();
+
+      if  (parent)
+        {
+          xp = xp + parent->x ();
+          yp = yp + parent->y ();
+        }
+    }
+
+  if (yp < 0)
+    yp = 0;
+
+  // The size of the find dialog is considered in restore_settings
+  // since its size might change depending on the options
+  m_find_dialog->restore_settings (QPoint (xp, yp));
+
+  // Set visible
+  m_find_dialog->set_visible (true);
+}
+
+void file_editor::request_find_next (bool)
+{
+  if (m_find_dialog)
+    m_find_dialog->find_next ();
+}
+
+void file_editor::request_find_previous (bool)
+{
+  if (m_find_dialog)
+    m_find_dialog->find_prev ();
+}
+
+void file_editor::request_goto_line (bool)
+{
+  emit fetab_goto_line (m_tab_widget->currentWidget ());
+}
+
+void file_editor::request_completion (bool)
+{
+  emit fetab_completion (m_tab_widget->currentWidget ());
+}
+
+void file_editor::handle_file_name_changed (const QString& fname,
+                                            const QString& tip,
+                                            bool modified)
+{
+  QObject *fileEditorTab = sender ();
+  if (fileEditorTab)
+    {
+      gui_settings settings;
+
+      for (int i = 0; i < m_tab_widget->count (); i++)
+        {
+          if (m_tab_widget->widget (i) == fileEditorTab)
+            {
+              m_tab_widget->setTabText (i, fname);
+              m_tab_widget->setTabToolTip (i, tip);
+
+              m_save_action->setEnabled (modified);
+              m_current_tab_modified = modified;
+
+              if (modified)
+                m_tab_widget->setTabIcon (i, settings.icon ("document-save"));
+              else
+                m_tab_widget->setTabIcon (i, QIcon ());
+            }
+        }
+    }
+}
+
+void file_editor::handle_tab_close_request (int index)
+{
+  file_editor_tab *editor_tab
+    = static_cast<file_editor_tab *> (m_tab_widget->widget (index));
+  editor_tab->conditional_close ();
+}
+
+void
+file_editor::handle_tab_remove_request ()
+{
+  QObject *fileEditorTab = sender ();
+  if (fileEditorTab)
+    {
+      for (int i = 0; i < m_tab_widget->count (); i++)
+        {
+          if (m_tab_widget->widget (i) == fileEditorTab)
+            {
+              m_tab_widget->removeTab (i);
+
+              // Deleting the sender (even with deleteLater) seems a
+              // bit strange.  Is there a better way?
+              fileEditorTab->deleteLater ();
+              break;
+            }
+        }
+    }
+  check_actions ();
+
+  activate ();     // focus stays in editor when tab is closed
+
+}
+
+// context menu of edit area
+void file_editor::active_tab_changed (int index)
+{
+  emit fetab_change_request (m_tab_widget->widget (index));
+  activate ();
+}
+
+void file_editor::handle_editor_state_changed (bool copy_available,
+                                               bool is_octave_file,
+                                               bool is_modified)
+{
+  // In case there is some scenario where traffic could be coming from
+  // all the file editor tabs, just process info from the current active tab.
+  if (sender () == m_tab_widget->currentWidget ())
+    {
+      m_save_action->setEnabled (is_modified);
+      m_current_tab_modified = is_modified;
+
+      if (m_copy_action)
+        m_copy_action->setEnabled (copy_available);
+
+      m_cut_action->setEnabled (copy_available);
+
+      m_run_selection_action->setEnabled (copy_available);
+      m_run_action->setEnabled (is_octave_file);
+      m_is_octave_file = is_octave_file;
+
+      emit editor_tabs_changed_signal (true, m_is_octave_file);
+    }
+
+  m_copy_action_enabled = m_copy_action->isEnabled ();
+  m_undo_action_enabled = m_undo_action->isEnabled ();
+}
+
+void file_editor::handle_mru_add_file (const QString& file_name,
+                                       const QString& encoding)
+{
+  int index;
+  while ((index = m_mru_files.indexOf (file_name)) >= 0)
+    {
+      m_mru_files.removeAt (index);
+      m_mru_files_encodings.removeAt (index);
+    }
+
+  m_mru_files.prepend (file_name);
+  m_mru_files_encodings.prepend (encoding);
+
+  mru_menu_update ();
+}
+
+void file_editor::check_conflict_save (const QString& saveFileName,
+                                       bool remove_on_success)
+{
+  // Check whether this file is already open in the editor.
+  file_editor_tab *tab = find_tab_widget (saveFileName);
+
+  if (tab)
+    {
+      // Note: to overwrite the contents of some other file editor tab
+      // with the same name requires identifying which file editor tab
+      // that is (not too difficult) then closing that tab.  Of course,
+      // that could trigger another dialog box if the file editor tab
+      // with the same name has modifications in it.  This could become
+      // somewhat confusing to the user.  For now, opt to do nothing.
+
+      // Create a NonModal message about error.
+      QMessageBox *msgBox
+        = new QMessageBox (QMessageBox::Critical, tr ("Octave Editor"),
+                           tr ("File not saved! A file with the selected name\n%1\n"
+                               "is already open in the editor").
+                           arg (saveFileName),
+                           QMessageBox::Ok, nullptr);
+
+      msgBox->setWindowModality (Qt::NonModal);
+      msgBox->setAttribute (Qt::WA_DeleteOnClose);
+      msgBox->show ();
+
       return;
-
-    // New file isn't a file_editor_tab function since the file
-    // editor tab has yet to be created and there is no object to
-    // pass a signal to.  Hence, functionality is here.
-
-    file_editor_tab *fileEditorTab = make_file_editor_tab (m_ced);
-    add_file_editor_tab (fileEditorTab, "");  // new tab with empty title
-    fileEditorTab->new_file (commands);       // title is updated here
-    activate ();                              // focus editor and new tab
-  }
-
-  void file_editor::request_close_file (bool)
-  {
-    file_editor_tab *editor_tab
-      = static_cast<file_editor_tab *> (m_tab_widget->currentWidget ());
-    editor_tab->conditional_close ();
-  }
-
-  void file_editor::request_close_all_files (bool)
-  {
-    file_editor_tab *editor_tab;
-
-    // loop over all tabs starting from last one otherwise deletion changes index
-    for (int index = m_tab_widget->count ()-1; index >= 0; index--)
-      {
-        editor_tab = static_cast<file_editor_tab *> (m_tab_widget->widget (index));
-        editor_tab->conditional_close ();
-      }
-  }
-
-  void file_editor::request_close_other_files (bool)
-  {
-    file_editor_tab *editor_tab;
-    QWidget *tabID = m_tab_widget->currentWidget ();
-
-    // loop over all tabs starting from last one otherwise deletion changes index
-    for (int index = m_tab_widget->count ()-1; index >= 0; index--)
-      {
-        if (tabID != m_tab_widget->widget (index))
-          {
-            editor_tab
-              = static_cast<file_editor_tab *> (m_tab_widget->widget (index));
-            editor_tab->conditional_close ();
-          }
-      }
-  }
-
-  void file_editor::copy_full_file_path (bool)
-  {
-    file_editor_tab *editor_tab
-      = static_cast<file_editor_tab *> (m_tab_widget->currentWidget ());
-
-    if (editor_tab)
-      QGuiApplication::clipboard ()->setText (editor_tab->file_name ());
-  }
-
-  // open a file from the mru list
-  void file_editor::request_mru_open_file (QAction *action)
-  {
-    if (action)
-      {
-        request_open_file (action->data ().toStringList ().at (0),
-                           action->data ().toStringList ().at (1));
-      }
-  }
-
-  void file_editor::request_print_file (bool)
-  {
-    emit fetab_print_file (m_tab_widget->currentWidget ());
-  }
-
-  void file_editor::request_redo (bool)
-  {
-    emit fetab_scintilla_command (m_tab_widget->currentWidget (),
-                                  QsciScintillaBase::SCI_REDO);
-  }
-
-  void file_editor::request_cut (bool)
-  {
-    emit fetab_scintilla_command (m_tab_widget->currentWidget (),
-                                  QsciScintillaBase::SCI_CUT);
-  }
-
-  void file_editor::request_context_help (bool)
-  {
-    emit fetab_context_help (m_tab_widget->currentWidget (), false);
-  }
-
-  void file_editor::request_context_doc (bool)
-  {
-    emit fetab_context_help (m_tab_widget->currentWidget (), true);
-  }
-
-  void file_editor::request_context_edit (bool)
-  {
-    emit fetab_context_edit (m_tab_widget->currentWidget ());
-  }
-
-  void file_editor::request_save_file (bool)
-  {
-    emit fetab_save_file (m_tab_widget->currentWidget ());
-  }
-
-  void file_editor::request_save_file_as (bool)
-  {
-    emit fetab_save_file_as (m_tab_widget->currentWidget ());
-  }
-
-  void file_editor::request_run_file (bool)
-  {
-    // The interpreter_event callback function below emits a signal.
-    // Because we don't control when that happens, use a guarded pointer
-    // so that the callback can abort if this object is no longer valid.
-
-    QPointer<file_editor> this_fe (this);
-
-    emit interpreter_event
-      ([=] (interpreter& interp)
-       {
-         // INTERPRETER THREAD
-
-         // If THIS_FE is no longer valid, skip the entire callback
-         // function.  With the way things are implemented now, we can't
-         // run the contents of a file unless the file editor and the
-         // corresponding file editor tab are still valid.
-
-         if (this_fe.isNull ())
-           return;
-
-         // Act as though this action was entered at the command propmt
-         // so that the interpreter will check for updated file time
-         // stamps.
-         Vlast_prompt_time.stamp ();
-
-         tree_evaluator& tw = interp.get_evaluator ();
-
-         if (tw.in_debug_repl ())
-           emit request_dbcont_signal ();
-         else
-           emit fetab_run_file (m_tab_widget->currentWidget ());
-       });
-  }
-
-  void file_editor::request_step_into_file ()
-  {
-    emit fetab_run_file (m_tab_widget->currentWidget (), true);
-  }
-
-  void file_editor::request_context_run (bool)
-  {
-    emit fetab_context_run (m_tab_widget->currentWidget ());
-  }
-
-  void file_editor::request_toggle_bookmark (bool)
-  {
-    emit fetab_toggle_bookmark (m_tab_widget->currentWidget ());
-  }
-
-  void file_editor::request_next_bookmark (bool)
-  {
-    emit fetab_next_bookmark (m_tab_widget->currentWidget ());
-  }
-
-  void file_editor::request_previous_bookmark (bool)
-  {
-    emit fetab_previous_bookmark (m_tab_widget->currentWidget ());
-  }
-
-  void file_editor::request_remove_bookmark (bool)
-  {
-    emit fetab_remove_bookmark (m_tab_widget->currentWidget ());
-  }
-
-  void file_editor::request_move_match_brace (bool)
-  {
-    emit fetab_move_match_brace (m_tab_widget->currentWidget (), false);
-  }
-
-  void file_editor::request_sel_match_brace (bool)
-  {
-    emit fetab_move_match_brace (m_tab_widget->currentWidget (), true);
-  }
-
-  // FIXME: What should this do with conditional breakpoints?
-  void file_editor::request_toggle_breakpoint (bool)
-  {
-    emit fetab_toggle_breakpoint (m_tab_widget->currentWidget ());
-  }
-
-  void file_editor::request_next_breakpoint (bool)
-  {
-    emit fetab_next_breakpoint (m_tab_widget->currentWidget ());
-  }
-
-  void file_editor::request_previous_breakpoint (bool)
-  {
-    emit fetab_previous_breakpoint (m_tab_widget->currentWidget ());
-  }
-
-  void file_editor::request_remove_breakpoint (bool)
-  {
-    emit fetab_remove_all_breakpoints (m_tab_widget->currentWidget ());
-  }
-
-  // slots for Edit->Commands actions
-  void file_editor::request_delete_start_word (bool)
-  {
-    emit fetab_scintilla_command (m_tab_widget->currentWidget (),
-                                  QsciScintillaBase::SCI_DELWORDLEFT);
-  }
-
-  void file_editor::request_delete_end_word (bool)
-  {
-    emit fetab_scintilla_command (m_tab_widget->currentWidget (),
-                                  QsciScintillaBase::SCI_DELWORDRIGHT);
-  }
-
-  void file_editor::request_delete_start_line (bool)
-  {
-    emit fetab_scintilla_command (m_tab_widget->currentWidget (),
-                                  QsciScintillaBase::SCI_DELLINELEFT);
-  }
-
-  void file_editor::request_delete_end_line (bool)
-  {
-    emit fetab_scintilla_command (m_tab_widget->currentWidget (),
-                                  QsciScintillaBase::SCI_DELLINERIGHT);
-  }
-
-  void file_editor::request_delete_line (bool)
-  {
-    emit fetab_scintilla_command (m_tab_widget->currentWidget (),
-                                  QsciScintillaBase::SCI_LINEDELETE);
-  }
-
-  void file_editor::request_copy_line (bool)
-  {
-    emit fetab_scintilla_command (m_tab_widget->currentWidget (),
-                                  QsciScintillaBase::SCI_LINECOPY);
-  }
-
-  void file_editor::request_cut_line (bool)
-  {
-    emit fetab_scintilla_command (m_tab_widget->currentWidget (),
-                                  QsciScintillaBase::SCI_LINECUT);
-  }
-
-  void file_editor::request_duplicate_selection (bool)
-  {
-    emit fetab_scintilla_command (m_tab_widget->currentWidget (),
-                                  QsciScintillaBase::SCI_SELECTIONDUPLICATE);
-  }
-
-  void file_editor::request_transpose_line (bool)
-  {
-    emit fetab_scintilla_command (m_tab_widget->currentWidget (),
-                                  QsciScintillaBase::SCI_LINETRANSPOSE);
-  }
-
-  void file_editor::request_comment_selected_text (bool)
-  {
-    emit fetab_comment_selected_text (m_tab_widget->currentWidget (), false);
-  }
-
-  void file_editor::request_uncomment_selected_text (bool)
-  {
-    emit fetab_uncomment_selected_text (m_tab_widget->currentWidget ());
-  }
-
-  void file_editor::request_comment_var_selected_text (bool)
-  {
-    emit fetab_comment_selected_text (m_tab_widget->currentWidget (), true);
-  }
-
-  // slots for Edit->Format actions
-  void file_editor::request_upper_case (bool)
-  {
-    emit fetab_scintilla_command (m_tab_widget->currentWidget (),
-                                  QsciScintillaBase::SCI_UPPERCASE);
-  }
-
-  void file_editor::request_lower_case (bool)
-  {
-    emit fetab_scintilla_command (m_tab_widget->currentWidget (),
-                                  QsciScintillaBase::SCI_LOWERCASE);
-  }
-
-  void file_editor::request_indent_selected_text (bool)
-  {
-    emit fetab_indent_selected_text (m_tab_widget->currentWidget ());
-  }
-
-  void file_editor::request_unindent_selected_text (bool)
-  {
-    emit fetab_unindent_selected_text (m_tab_widget->currentWidget ());
-  }
-
-  void file_editor::request_smart_indent_line_or_selected_text ()
-  {
-    emit fetab_smart_indent_line_or_selected_text (m_tab_widget->currentWidget ());
-  }
-
-  void file_editor::request_conv_eol_windows (bool)
-  {
-    emit fetab_convert_eol (m_tab_widget->currentWidget (),
-                            QsciScintilla::EolWindows);
-  }
-  void
-  file_editor::request_conv_eol_unix (bool)
-  {
-    emit fetab_convert_eol (m_tab_widget->currentWidget (),
-                            QsciScintilla::EolUnix);
-  }
-
-  void file_editor::request_conv_eol_mac (bool)
-  {
-    emit fetab_convert_eol (m_tab_widget->currentWidget (),
-                            QsciScintilla::EolMac);
-  }
-
-  // Slot for initially creating and showing the find dialog
-  void file_editor::request_find (bool)
-  {
-    // Create the dialog
-    find_create ();
-
-    // Since find_create shows the dialog without activating the widget
-    // (which is reuqired in other cases) do this manually here
-    m_find_dialog->activateWindow ();
-
-    // Initiate search text from possible selection and save the initial
-    // data from the dialog on the defined structure
-    m_find_dialog->init_search_text ();
-  }
-
-  // This method creates the find dialog.
-
-  void file_editor::find_create ()
-  {
-    if (m_find_dialog)
-      m_find_dialog->close ();
-
-    if (isFloating ())
-      m_find_dialog = new find_dialog (this, this);
-    else
-      m_find_dialog = new find_dialog (this, parentWidget ());
-
-    // Add required actions
-    m_find_dialog->addAction (m_find_next_action);
-    m_find_dialog->addAction (m_find_previous_action);
-
-    // Update edit area
-    file_editor_tab *fet
-      = static_cast<file_editor_tab *> (m_tab_widget->currentWidget ());
-    m_find_dialog->update_edit_area (fet->qsci_edit_area ());
-
-    // Icon is the same as the editor
-    m_find_dialog->setWindowIcon (windowIcon ());
-
-    // Position:  lower right of editor's position
-    int xp = x () + frameGeometry ().width ();
-    int yp = y () + frameGeometry ().height ();
-
-    if (! isFloating ())
-      {
-        // Fix position if editor is docked
-
-        QWidget *parent = parentWidget ();
-
-        if  (parent)
-          {
-            xp = xp + parent->x ();
-            yp = yp + parent->y ();
-          }
-      }
-
-    if (yp < 0)
-      yp = 0;
-
-    // The size of the find dialog is considered in restore_settings
-    // since its size might change depending on the options
-    m_find_dialog->restore_settings (QPoint (xp, yp));
-
-    // Set visible
-    m_find_dialog->set_visible (true);
-  }
-
-  void file_editor::request_find_next (bool)
-  {
-    if (m_find_dialog)
-      m_find_dialog->find_next ();
-  }
-
-  void file_editor::request_find_previous (bool)
-  {
-    if (m_find_dialog)
-      m_find_dialog->find_prev ();
-  }
-
-  void file_editor::request_goto_line (bool)
-  {
-    emit fetab_goto_line (m_tab_widget->currentWidget ());
-  }
-
-  void file_editor::request_completion (bool)
-  {
-    emit fetab_completion (m_tab_widget->currentWidget ());
-  }
-
-  void file_editor::handle_file_name_changed (const QString& fname,
-                                              const QString& tip,
-                                              bool modified)
-  {
-    QObject *fileEditorTab = sender ();
-    if (fileEditorTab)
-      {
-        gui_settings settings;
-
-        for (int i = 0; i < m_tab_widget->count (); i++)
-          {
-            if (m_tab_widget->widget (i) == fileEditorTab)
-              {
-                m_tab_widget->setTabText (i, fname);
-                m_tab_widget->setTabToolTip (i, tip);
-
-                m_save_action->setEnabled (modified);
-                m_current_tab_modified = modified;
-
-                if (modified)
-                  m_tab_widget->setTabIcon (i, settings.icon ("document-save"));
-                else
-                  m_tab_widget->setTabIcon (i, QIcon ());
-              }
-          }
-      }
-  }
-
-  void file_editor::handle_tab_close_request (int index)
-  {
-    file_editor_tab *editor_tab
-      = static_cast<file_editor_tab *> (m_tab_widget->widget (index));
-    editor_tab->conditional_close ();
-  }
-
-  void
-  file_editor::handle_tab_remove_request ()
-  {
-    QObject *fileEditorTab = sender ();
-    if (fileEditorTab)
-      {
-        for (int i = 0; i < m_tab_widget->count (); i++)
-          {
-            if (m_tab_widget->widget (i) == fileEditorTab)
-              {
-                m_tab_widget->removeTab (i);
-
-                // Deleting the sender (even with deleteLater) seems a
-                // bit strange.  Is there a better way?
-                fileEditorTab->deleteLater ();
-                break;
-              }
-          }
-      }
-    check_actions ();
-
-    activate ();     // focus stays in editor when tab is closed
-
-  }
-
-  // context menu of edit area
-  void file_editor::active_tab_changed (int index)
-  {
-    emit fetab_change_request (m_tab_widget->widget (index));
-    activate ();
-  }
-
-  void file_editor::handle_editor_state_changed (bool copy_available,
-                                                 bool is_octave_file,
-                                                 bool is_modified)
-  {
-    // In case there is some scenario where traffic could be coming from
-    // all the file editor tabs, just process info from the current active tab.
-    if (sender () == m_tab_widget->currentWidget ())
-      {
-        m_save_action->setEnabled (is_modified);
-        m_current_tab_modified = is_modified;
-
-        if (m_copy_action)
-          m_copy_action->setEnabled (copy_available);
-
-        m_cut_action->setEnabled (copy_available);
-
-        m_run_selection_action->setEnabled (copy_available);
-        m_run_action->setEnabled (is_octave_file);
-        m_is_octave_file = is_octave_file;
-
-        emit editor_tabs_changed_signal (true, m_is_octave_file);
-      }
-
-    m_copy_action_enabled = m_copy_action->isEnabled ();
-    m_undo_action_enabled = m_undo_action->isEnabled ();
-  }
-
-  void file_editor::handle_mru_add_file (const QString& file_name,
-                                         const QString& encoding)
-  {
-    int index;
-    while ((index = m_mru_files.indexOf (file_name)) >= 0)
-      {
-        m_mru_files.removeAt (index);
-        m_mru_files_encodings.removeAt (index);
-      }
-
-    m_mru_files.prepend (file_name);
-    m_mru_files_encodings.prepend (encoding);
-
-    mru_menu_update ();
-  }
-
-  void file_editor::check_conflict_save (const QString& saveFileName,
-                                         bool remove_on_success)
-  {
-    // Check whether this file is already open in the editor.
-    file_editor_tab *tab = find_tab_widget (saveFileName);
-
-    if (tab)
-      {
-        // Note: to overwrite the contents of some other file editor tab
-        // with the same name requires identifying which file editor tab
-        // that is (not too difficult) then closing that tab.  Of course,
-        // that could trigger another dialog box if the file editor tab
-        // with the same name has modifications in it.  This could become
-        // somewhat confusing to the user.  For now, opt to do nothing.
-
-        // Create a NonModal message about error.
-        QMessageBox *msgBox
-          = new QMessageBox (QMessageBox::Critical, tr ("Octave Editor"),
-                             tr ("File not saved! A file with the selected name\n%1\n"
-                                 "is already open in the editor").
-                             arg (saveFileName),
-                             QMessageBox::Ok, nullptr);
-
-        msgBox->setWindowModality (Qt::NonModal);
-        msgBox->setAttribute (Qt::WA_DeleteOnClose);
-        msgBox->show ();
-
-        return;
-      }
-
-    QObject *saveFileObject = sender ();
-    QWidget *saveFileWidget = nullptr;
-
-    for (int i = 0; i < m_tab_widget->count (); i++)
-      {
-        if (m_tab_widget->widget (i) == saveFileObject)
-          {
-            saveFileWidget = m_tab_widget->widget (i);
-            break;
-          }
-      }
-    if (! saveFileWidget)
-      {
-        // Create a NonModal message about error.
-        QMessageBox *msgBox
-          = new QMessageBox (QMessageBox::Critical, tr ("Octave Editor"),
-                             tr ("The associated file editor tab has disappeared."),
-                             QMessageBox::Ok, nullptr);
-
-        msgBox->setWindowModality (Qt::NonModal);
-        msgBox->setAttribute (Qt::WA_DeleteOnClose);
-        msgBox->show ();
-
-        return;
-      }
-
-    // Can save without conflict, have the file editor tab do so.
-    emit fetab_save_file (saveFileWidget, saveFileName, remove_on_success);
-  }
-
-  void file_editor::handle_insert_debugger_pointer_request (const QString& file,
-                                                            int line)
-  {
-    request_open_file (file, QString (), line, true); // default encoding
-  }
-
-  void file_editor::handle_delete_debugger_pointer_request (const QString& file,
-                                                            int line)
-  {
-    if (! file.isEmpty ())
-      {
-        // Check whether this file is already open in the editor.
-        file_editor_tab *tab = find_tab_widget (file);
-
-        if (tab)
-          {
-            m_tab_widget->setCurrentWidget (tab);
-
-            if (line > 0)
-              emit fetab_delete_debugger_pointer (tab, line);
-
-            emit fetab_set_focus (tab);
-          }
-      }
-  }
-
-  void file_editor::handle_update_breakpoint_marker_request (bool insert,
-                                                             const QString& file,
-                                                             int line,
-                                                             const QString& cond)
-  {
-    request_open_file (file, QString (), line, false, true, insert, cond);
-  }
-
-  void file_editor::handle_edit_file_request (const QString& file)
-  {
-    request_open_file (file);
-  }
-
-  // Slot used for signals indicating that a file was changed/renamed or
-  // is going to be deleted/renamed
-  void file_editor::handle_file_remove (const QString& old_name,
-                                        const QString& new_name)
-  {
-    // Clear old list of file data and declare a structure for file data
-    m_tmp_closed_files.clear ();
-    removed_file_data f_data;
-
-    // Preprocessing old name(s)
-    QString old_name_clean = old_name.trimmed ();
-    int s = old_name_clean.size ();
-
-    if (s > 1 && old_name_clean.at (0) == QChar ('\"')
-        && old_name_clean.at (s - 1) == QChar ('\"'))
-      old_name_clean = old_name_clean.mid (1, s - 2);
-
-    QStringList old_names = old_name_clean.split ("\" \"");
-
-    // Check if new name is a file or directory
-    QFileInfo newf (new_name);
-    bool new_is_dir = newf.isDir ();
-
-    // Now loop over all old files/dirs (several files by movefile ())
-    for (int i = 0; i < old_names.count (); i++)
-      {
-        // Check if old name is a file or directory
-        QFileInfo old (old_names.at (i));
-
-        if (old.isDir ())
-          {
-            // Call the function which handles directories and return
-            handle_dir_remove (old_names.at (i), new_name);
-          }
-        else
-          {
-            // It is a single file.  Is it open?
-            file_editor_tab *editor_tab = find_tab_widget (old_names.at (i));
-
-            if (editor_tab)
-              {
-
-                editor_tab->enable_file_watcher (false);
-
-                // For re-enabling tracking if error while removing/renaming
-                f_data.editor_tab = editor_tab;
-                // For renaming into new file (if new_file is not empty)
-                if (new_is_dir)
-                  {
-                    std::string ndir = new_name.toStdString ();
-                    std::string ofile = old.fileName ().toStdString ();
-                    f_data.new_file_name
-                      = QString::fromStdString (sys::env::make_absolute (ofile, ndir));
-                  }
-                else
-                  f_data.new_file_name = new_name;
-
-                // Add file data to list
-                m_tmp_closed_files << f_data;
-              }
-          }
-      }
-  }
-
-  // Slot for signal indicating that a file was renamed
-  void file_editor::handle_file_renamed (bool load_new)
-  {
-    m_no_focus = true;  // Remember for not focussing editor
-
-    // Loop over all files that have to be handled.  Start at the end of the
-    // list, otherwise the stored indexes are not correct.
-    for (int i = m_tmp_closed_files.count () - 1; i >= 0; i--)
-      {
-        if (load_new)
-          {
-            // Close file (remove) or rename into new file (rename)
-            if (m_tmp_closed_files.at (i).new_file_name.isEmpty ())
-              m_tmp_closed_files.at (i).editor_tab->file_has_changed (QString (), true);
-            else
-              m_tmp_closed_files.at (i).editor_tab->set_file_name (m_tmp_closed_files.at (i).new_file_name);
-          }
-        else
-          {
-            // Something went wrong while renaming or removing:
-            // Leave everything as it is but reactivate tracking
-            m_tmp_closed_files.at (i).editor_tab->enable_file_watcher (true);
-          }
-
-      }
-
-    m_no_focus = false;  // Back to normal focus
-
-    // Clear the list of file data
-    m_tmp_closed_files.clear ();
-  }
-
-  void file_editor::notice_settings ()
-  {
-    gui_settings settings;
-
-    int size_idx = settings.int_value (global_icon_size);
-    size_idx = (size_idx > 0) - (size_idx < 0) + 1;  // Make valid index from 0 to 2
-
-    QStyle *st = style ();
-    int icon_size = st->pixelMetric (global_icon_sizes[size_idx]);
-    m_tool_bar->setIconSize (QSize (icon_size, icon_size));
-
-    // Tab position and rotation
-    QTabWidget::TabPosition pos
-      = static_cast<QTabWidget::TabPosition> (settings.int_value (ed_tab_position));
-    bool rotated = settings.bool_value (ed_tabs_rotated);
-
-    m_tab_widget->setTabPosition (pos);
-
-    if (rotated)
-      m_tab_widget->setTabsClosable (false);  // No close buttons
-      // FIXME: close buttons can not be correctly placed in rotated tabs
-
-    // Get the tab bar and set the rotation
-    int rotation = rotated;
-    if (pos == QTabWidget::West)
-      rotation = -rotation;
-
-    tab_bar *bar = m_tab_widget->get_tab_bar ();
-    bar->set_rotated (rotation);
-
-    // Get suitable height of a tab related to font and icon size
-    int height = 1.5*QFontMetrics (m_tab_widget->font ()).height ();
-    int is = 1.5*m_tab_widget->iconSize ().height ();
-    if (is > height)
-      height = is;
-
-    // Calculate possibly limited width and set the elide mode
-    int chars = settings.int_value (ed_tabs_max_width);
-    int width = 9999;
-    if (chars > 0)
-      width = chars * QFontMetrics (m_tab_widget->font ()).averageCharWidth ();
-
-    // Get tab bar size properties for style sheet depending on rotation
-    QString width_str ("width");
-    QString height_str ("height");
-    if ((pos == QTabWidget::West) || (pos == QTabWidget::East))
-      {
-        width_str = QString ("height");
-        height_str = QString ("width");
-      }
-
-    QString style_sheet
-        = QString ("QTabBar::tab {max-" + height_str + ": %1px;\n"
-                                 "max-" + width_str + ": %2px; }")
-                          .arg (height).arg (width);
+    }
+
+  QObject *saveFileObject = sender ();
+  QWidget *saveFileWidget = nullptr;
+
+  for (int i = 0; i < m_tab_widget->count (); i++)
+    {
+      if (m_tab_widget->widget (i) == saveFileObject)
+        {
+          saveFileWidget = m_tab_widget->widget (i);
+          break;
+        }
+    }
+  if (! saveFileWidget)
+    {
+      // Create a NonModal message about error.
+      QMessageBox *msgBox
+        = new QMessageBox (QMessageBox::Critical, tr ("Octave Editor"),
+                           tr ("The associated file editor tab has disappeared."),
+                           QMessageBox::Ok, nullptr);
+
+      msgBox->setWindowModality (Qt::NonModal);
+      msgBox->setAttribute (Qt::WA_DeleteOnClose);
+      msgBox->show ();
+
+      return;
+    }
+
+  // Can save without conflict, have the file editor tab do so.
+  emit fetab_save_file (saveFileWidget, saveFileName, remove_on_success);
+}
+
+void file_editor::handle_insert_debugger_pointer_request (const QString& file,
+                                                          int line)
+{
+  request_open_file (file, QString (), line, true); // default encoding
+}
+
+void file_editor::handle_delete_debugger_pointer_request (const QString& file,
+                                                          int line)
+{
+  if (! file.isEmpty ())
+    {
+      // Check whether this file is already open in the editor.
+      file_editor_tab *tab = find_tab_widget (file);
+
+      if (tab)
+        {
+          m_tab_widget->setCurrentWidget (tab);
+
+          if (line > 0)
+            emit fetab_delete_debugger_pointer (tab, line);
+
+          emit fetab_set_focus (tab);
+        }
+    }
+}
+
+void file_editor::handle_update_breakpoint_marker_request (bool insert,
+                                                           const QString& file,
+                                                           int line,
+                                                           const QString& cond)
+{
+  request_open_file (file, QString (), line, false, true, insert, cond);
+}
+
+void file_editor::handle_edit_file_request (const QString& file)
+{
+  request_open_file (file);
+}
+
+// Slot used for signals indicating that a file was changed/renamed or
+// is going to be deleted/renamed
+void file_editor::handle_file_remove (const QString& old_name,
+                                      const QString& new_name)
+{
+  // Clear old list of file data and declare a structure for file data
+  m_tmp_closed_files.clear ();
+  removed_file_data f_data;
+
+  // Preprocessing old name(s)
+  QString old_name_clean = old_name.trimmed ();
+  int s = old_name_clean.size ();
+
+  if (s > 1 && old_name_clean.at (0) == QChar ('\"')
+      && old_name_clean.at (s - 1) == QChar ('\"'))
+    old_name_clean = old_name_clean.mid (1, s - 2);
+
+  QStringList old_names = old_name_clean.split ("\" \"");
+
+  // Check if new name is a file or directory
+  QFileInfo newf (new_name);
+  bool new_is_dir = newf.isDir ();
+
+  // Now loop over all old files/dirs (several files by movefile ())
+  for (int i = 0; i < old_names.count (); i++)
+    {
+      // Check if old name is a file or directory
+      QFileInfo old (old_names.at (i));
+
+      if (old.isDir ())
+        {
+          // Call the function which handles directories and return
+          handle_dir_remove (old_names.at (i), new_name);
+        }
+      else
+        {
+          // It is a single file.  Is it open?
+          file_editor_tab *editor_tab = find_tab_widget (old_names.at (i));
+
+          if (editor_tab)
+            {
+
+              editor_tab->enable_file_watcher (false);
+
+              // For re-enabling tracking if error while removing/renaming
+              f_data.editor_tab = editor_tab;
+              // For renaming into new file (if new_file is not empty)
+              if (new_is_dir)
+                {
+                  std::string ndir = new_name.toStdString ();
+                  std::string ofile = old.fileName ().toStdString ();
+                  f_data.new_file_name
+                    = QString::fromStdString (sys::env::make_absolute (ofile, ndir));
+                }
+              else
+                f_data.new_file_name = new_name;
+
+              // Add file data to list
+              m_tmp_closed_files << f_data;
+            }
+        }
+    }
+}
+
+// Slot for signal indicating that a file was renamed
+void file_editor::handle_file_renamed (bool load_new)
+{
+  m_no_focus = true;  // Remember for not focussing editor
+
+  // Loop over all files that have to be handled.  Start at the end of the
+  // list, otherwise the stored indexes are not correct.
+  for (int i = m_tmp_closed_files.count () - 1; i >= 0; i--)
+    {
+      if (load_new)
+        {
+          // Close file (remove) or rename into new file (rename)
+          if (m_tmp_closed_files.at (i).new_file_name.isEmpty ())
+            m_tmp_closed_files.at (i).editor_tab->file_has_changed (QString (), true);
+          else
+            m_tmp_closed_files.at (i).editor_tab->set_file_name (m_tmp_closed_files.at (i).new_file_name);
+        }
+      else
+        {
+          // Something went wrong while renaming or removing:
+          // Leave everything as it is but reactivate tracking
+          m_tmp_closed_files.at (i).editor_tab->enable_file_watcher (true);
+        }
+
+    }
+
+  m_no_focus = false;  // Back to normal focus
+
+  // Clear the list of file data
+  m_tmp_closed_files.clear ();
+}
+
+void file_editor::notice_settings ()
+{
+  gui_settings settings;
+
+  int size_idx = settings.int_value (global_icon_size);
+  size_idx = (size_idx > 0) - (size_idx < 0) + 1;  // Make valid index from 0 to 2
+
+  QStyle *st = style ();
+  int icon_size = st->pixelMetric (global_icon_sizes[size_idx]);
+  m_tool_bar->setIconSize (QSize (icon_size, icon_size));
+
+  // Tab position and rotation
+  QTabWidget::TabPosition pos
+    = static_cast<QTabWidget::TabPosition> (settings.int_value (ed_tab_position));
+  bool rotated = settings.bool_value (ed_tabs_rotated);
+
+  m_tab_widget->setTabPosition (pos);
+
+  if (rotated)
+    m_tab_widget->setTabsClosable (false);  // No close buttons
+    // FIXME: close buttons can not be correctly placed in rotated tabs
+
+  // Get the tab bar and set the rotation
+  int rotation = rotated;
+  if (pos == QTabWidget::West)
+    rotation = -rotation;
+
+  tab_bar *bar = m_tab_widget->get_tab_bar ();
+  bar->set_rotated (rotation);
+
+  // Get suitable height of a tab related to font and icon size
+  int height = 1.5*QFontMetrics (m_tab_widget->font ()).height ();
+  int is = 1.5*m_tab_widget->iconSize ().height ();
+  if (is > height)
+    height = is;
+
+  // Calculate possibly limited width and set the elide mode
+  int chars = settings.int_value (ed_tabs_max_width);
+  int width = 9999;
+  if (chars > 0)
+    width = chars * QFontMetrics (m_tab_widget->font ()).averageCharWidth ();
+
+  // Get tab bar size properties for style sheet depending on rotation
+  QString width_str ("width");
+  QString height_str ("height");
+  if ((pos == QTabWidget::West) || (pos == QTabWidget::East))
+    {
+      width_str = QString ("height");
+      height_str = QString ("width");
+    }
+
+  QString style_sheet
+      = QString ("QTabBar::tab {max-" + height_str + ": %1px;\n"
+                               "max-" + width_str + ": %2px; }")
+                        .arg (height).arg (width);
 
 #if defined (Q_OS_MAC)
-    // FIXME: This is a workaround for missing tab close buttons on MacOS
-    // in several Qt versions (https://bugreports.qt.io/browse/QTBUG-61092)
-    if (! rotated)
-      {
-        QString icon = global_icon_paths.at (ICON_THEME_OCTAVE) + "widget-close.png";
-
-        QString close_button_css_mac
-          ("QTabBar::close-button"
-           " { image: url(" + icon + ");"
-           " padding: 4px;"
-           "   subcontrol-position: bottom; }\n"
-           "QTabBar::close-button:hover"
-           "  { background-color: #cccccc; }");
-
-        style_sheet = style_sheet + close_button_css_mac;
-      }
+  // FIXME: This is a workaround for missing tab close buttons on MacOS
+  // in several Qt versions (https://bugreports.qt.io/browse/QTBUG-61092)
+  if (! rotated)
+    {
+      QString icon = global_icon_paths.at (ICON_THEME_OCTAVE) + "widget-close.png";
+
+      QString close_button_css_mac
+        ("QTabBar::close-button"
+         " { image: url(" + icon + ");"
+         " padding: 4px;"
+         "   subcontrol-position: bottom; }\n"
+         "QTabBar::close-button:hover"
+         "  { background-color: #cccccc; }");
+
+      style_sheet = style_sheet + close_button_css_mac;
+    }
 #endif
 
-    m_tab_widget->setStyleSheet (style_sheet);
-
-    bool show_it;
-    show_it = settings.bool_value (ed_show_line_numbers);
-    m_show_linenum_action->setChecked (show_it);
-    show_it = settings.bool_value (ed_show_white_space);
-    m_show_whitespace_action->setChecked (show_it);
-    show_it = settings.bool_value (ed_show_eol_chars);
-    m_show_eol_action->setChecked (show_it);
-    show_it = settings.bool_value (ed_show_indent_guides);
-    m_show_indguide_action->setChecked (show_it);
-    show_it = settings.bool_value (ed_long_line_marker);
-    m_show_longline_action->setChecked (show_it);
-
-    show_it = settings.bool_value (ed_show_toolbar);
-    m_show_toolbar_action->setChecked (show_it);
-    m_tool_bar->setVisible (show_it);
-    show_it = settings.bool_value (ed_show_edit_status_bar);
-    m_show_statusbar_action->setChecked (show_it);
-    show_it = settings.bool_value (ed_show_hscroll_bar);
-    m_show_hscrollbar_action->setChecked (show_it);
-
-    set_shortcuts ();
-
-    // Find dialog with the same icon as the editor
-    if (m_find_dialog)
-      m_find_dialog->setWindowIcon (windowIcon ());
-
-    // Relay signal to file editor tabs.
-    emit fetab_settings_changed ();
-  }
-
-  void file_editor::set_shortcuts ()
-  {
-    // Shortcuts also available in the main window, as well as the related
-    // shortcuts, are defined in main_window and added to the editor
-
-    gui_settings settings;
-
-    // File menu
-    settings.set_shortcut (m_edit_function_action, sc_edit_file_edit_function);
-    settings.set_shortcut (m_save_action, sc_edit_file_save);
-    settings.set_shortcut (m_save_as_action, sc_edit_file_save_as);
-    settings.set_shortcut (m_close_action, sc_edit_file_close);
-    settings.set_shortcut (m_close_all_action, sc_edit_file_close_all);
-    settings.set_shortcut (m_close_others_action, sc_edit_file_close_other);
-    settings.set_shortcut (m_print_action, sc_edit_file_print);
-
-    // Edit menu
-    settings.set_shortcut (m_redo_action, sc_edit_edit_redo);
-    settings.set_shortcut (m_cut_action, sc_edit_edit_cut);
-    settings.set_shortcut (m_find_action, sc_edit_edit_find_replace);
-    settings.set_shortcut (m_find_next_action, sc_edit_edit_find_next);
-    settings.set_shortcut (m_find_previous_action, sc_edit_edit_find_previous);
-
-    settings.set_shortcut (m_delete_start_word_action, sc_edit_edit_delete_start_word);
-    settings.set_shortcut (m_delete_end_word_action, sc_edit_edit_delete_end_word);
-    settings.set_shortcut (m_delete_start_line_action, sc_edit_edit_delete_start_line);
-    settings.set_shortcut (m_delete_end_line_action, sc_edit_edit_delete_end_line);
-    settings.set_shortcut (m_delete_line_action, sc_edit_edit_delete_line);
-    settings.set_shortcut (m_copy_line_action, sc_edit_edit_copy_line);
-    settings.set_shortcut (m_cut_line_action, sc_edit_edit_cut_line);
-    settings.set_shortcut (m_duplicate_selection_action, sc_edit_edit_duplicate_selection);
-    settings.set_shortcut (m_transpose_line_action, sc_edit_edit_transpose_line);
-    settings.set_shortcut (m_comment_selection_action, sc_edit_edit_comment_selection);
-    settings.set_shortcut (m_uncomment_selection_action, sc_edit_edit_uncomment_selection);
-    settings.set_shortcut (m_comment_var_selection_action, sc_edit_edit_comment_var_selection);
-
-    settings.set_shortcut (m_upper_case_action, sc_edit_edit_upper_case);
-    settings.set_shortcut (m_lower_case_action, sc_edit_edit_lower_case);
-    settings.set_shortcut (m_indent_selection_action, sc_edit_edit_indent_selection);
-    settings.set_shortcut (m_unindent_selection_action, sc_edit_edit_unindent_selection);
-    settings.set_shortcut (m_smart_indent_line_or_selection_action, sc_edit_edit_smart_indent_line_or_selection);
-    settings.set_shortcut (m_completion_action, sc_edit_edit_completion_list);
-    settings.set_shortcut (m_goto_line_action, sc_edit_edit_goto_line);
-    settings.set_shortcut (m_move_to_matching_brace, sc_edit_edit_move_to_brace);
-    settings.set_shortcut (m_sel_to_matching_brace, sc_edit_edit_select_to_brace);
-    settings.set_shortcut (m_toggle_bookmark_action, sc_edit_edit_toggle_bookmark);
-    settings.set_shortcut (m_next_bookmark_action, sc_edit_edit_next_bookmark);
-    settings.set_shortcut (m_previous_bookmark_action, sc_edit_edit_previous_bookmark);
-    settings.set_shortcut (m_remove_bookmark_action, sc_edit_edit_remove_bookmark);
-    settings.set_shortcut (m_preferences_action, sc_edit_edit_preferences);
-    settings.set_shortcut (m_styles_preferences_action, sc_edit_edit_styles_preferences);
-
-    settings.set_shortcut (m_conv_eol_windows_action, sc_edit_edit_conv_eol_winows);
-    settings.set_shortcut (m_conv_eol_unix_action,    sc_edit_edit_conv_eol_unix);
-    settings.set_shortcut (m_conv_eol_mac_action,     sc_edit_edit_conv_eol_mac);
-
-    // View menu
-    settings.set_shortcut (m_show_linenum_action, sc_edit_view_show_line_numbers);
-    settings.set_shortcut (m_show_whitespace_action, sc_edit_view_show_white_spaces);
-    settings.set_shortcut (m_show_eol_action, sc_edit_view_show_eol_chars);
-    settings.set_shortcut (m_show_indguide_action, sc_edit_view_show_ind_guides);
-    settings.set_shortcut (m_show_longline_action, sc_edit_view_show_long_line);
-    settings.set_shortcut (m_show_toolbar_action, sc_edit_view_show_toolbar);
-    settings.set_shortcut (m_show_statusbar_action, sc_edit_view_show_statusbar);
-    settings.set_shortcut (m_show_hscrollbar_action, sc_edit_view_show_hscrollbar);
-    settings.set_shortcut (m_zoom_in_action, sc_edit_view_zoom_in);
-    settings.set_shortcut (m_zoom_out_action, sc_edit_view_zoom_out);
-    settings.set_shortcut (m_zoom_normal_action, sc_edit_view_zoom_normal);
-    settings.set_shortcut (m_sort_tabs_action, sc_edit_view_sort_tabs);
-
-    // Debug menu
-    settings.set_shortcut (m_toggle_breakpoint_action, sc_edit_debug_toggle_breakpoint);
-    settings.set_shortcut (m_next_breakpoint_action, sc_edit_debug_next_breakpoint);
-    settings.set_shortcut (m_previous_breakpoint_action, sc_edit_debug_previous_breakpoint);
-    settings.set_shortcut (m_remove_all_breakpoints_action, sc_edit_debug_remove_breakpoints);
-
-    // Run menu
-    settings.set_shortcut (m_run_action, sc_edit_run_run_file);
-    settings.set_shortcut (m_run_selection_action, sc_edit_run_run_selection);
-
-    // Help menu
-    settings.set_shortcut (m_context_help_action, sc_edit_help_help_keyword);
-    settings.set_shortcut (m_context_doc_action,  sc_edit_help_doc_keyword);
-
-    // Tab navigation without menu entries
-    settings.set_shortcut (m_switch_left_tab_action, sc_edit_tabs_switch_left_tab);
-    settings.set_shortcut (m_switch_right_tab_action, sc_edit_tabs_switch_right_tab);
-    settings.set_shortcut (m_move_tab_left_action, sc_edit_tabs_move_tab_left);
-    settings.set_shortcut (m_move_tab_right_action, sc_edit_tabs_move_tab_right);
-  }
-
-  // This slot is a reimplementation of the virtual slot in octave_dock_widget.
-  // We need this for creating an empty script when the editor has no open
-  // files and is made visible.
-  void file_editor::handle_visibility (bool visible)
-  {
-    octave_dock_widget::handle_visibility (visible);
-
-    if (! m_editor_ready)
-      return;
-
-    if (m_closed && visible)
-      {
-        m_closed = false;
-
-        restore_session ();
-      }
-
-    empty_script (false, visible);
-  }
-
-  // This slot is a reimplementation of the virtual slot in octave_dock_widget.
-  // We need this for updating the parent of the find dialog
-  void file_editor::toplevel_change (bool)
-  {
-    if (m_find_dialog)
-      {
-        // close current dialog
-        m_find_dialog->close ();
-
-        // re-create dialog with the new parent (editor or main-win)
-        find_create ();
-        m_find_dialog->activateWindow ();
-      }
-  }
-
-  void file_editor::update_octave_directory (const QString& dir)
-  {
-    m_ced = dir;
-    emit fetab_set_directory (m_ced);  // for save dialog
-  }
-
-  void file_editor::copyClipboard ()
-  {
-    if (editor_tab_has_focus ())
-      emit fetab_scintilla_command (m_tab_widget->currentWidget (),
-                                    QsciScintillaBase::SCI_COPY);
-  }
-
-  void file_editor::pasteClipboard ()
-  {
-    if (editor_tab_has_focus ())
-      emit fetab_scintilla_command (m_tab_widget->currentWidget (),
-                                    QsciScintillaBase::SCI_PASTE);
-  }
-
-  void file_editor::selectAll ()
-  {
-    if (editor_tab_has_focus ())
-      emit fetab_scintilla_command (m_tab_widget->currentWidget (),
-                                    QsciScintillaBase::SCI_SELECTALL);
-  }
-
-  void file_editor::do_undo ()
-  {
-    if (editor_tab_has_focus ())
-      emit fetab_scintilla_command (m_tab_widget->currentWidget (),
-                                    QsciScintillaBase::SCI_UNDO);
-  }
-
-  // Open a file, if not already open, and mark the current execution location
-  // and/or a breakpoint with condition cond.
-  void file_editor::request_open_file (const QString& openFileName,
-                                       const QString& encoding,
-                                       int line, bool debug_pointer,
-                                       bool breakpoint_marker, bool insert,
-                                       const QString& cond, int index,
-                                       const QString& bookmarks)
-  {
-    gui_settings settings;
-
-    if (settings.bool_value (global_use_custom_editor))
-      {
-        // Custom editor
-        if (debug_pointer || breakpoint_marker)
-          return;   // Do not call custom editor during debugging
-
-        if (call_custom_editor (openFileName, line))
-          return;   // Custom editor called
-      }
-
-    bool show_dbg_file = settings.bool_value (ed_show_dbg_file);
-
-    if (openFileName.isEmpty ())
-      {
-        // This happens if edit is called without an argument
-        // Open editor with empty edit area instead (as new file would do)
-        request_new_file ("");
-      }
-    else
-      {
-        // Check whether this file is already open in the editor.
-        file_editor_tab *tab = find_tab_widget (openFileName);
-
-        if (tab)
-          {
-            m_tab_widget->setCurrentWidget (tab);
-
-            if (line > 0)
-              {
-                if (insert)
-                  emit fetab_goto_line (tab, line);
-
-                if (debug_pointer)
-                  emit fetab_insert_debugger_pointer (tab, line);
-
-                if (breakpoint_marker)
-                  emit fetab_do_breakpoint_marker (insert, tab, line, cond);
-              }
-
-            if (show_dbg_file && ! ((breakpoint_marker || debug_pointer)
-                                    && is_editor_console_tabbed ()))
-              {
-                emit fetab_set_focus (tab);
-                activate ();
-              }
-          }
-        else
-          {
-            if (! show_dbg_file && (breakpoint_marker  || debug_pointer))
-              return;   // Do not open a file for showing dbg markers
-
-            if (breakpoint_marker && ! insert)
-              return;   // Never open a file when removing breakpoints
-
-            file_editor_tab *fileEditorTab = nullptr;
-            // Reuse <unnamed> tab if it hasn't yet been modified.
-            bool reusing = false;
-            tab = find_tab_widget ("");
-            if (tab)
-              {
-                fileEditorTab = tab;
-                if (fileEditorTab->qsci_edit_area ()->isModified ())
+  m_tab_widget->setStyleSheet (style_sheet);
+
+  bool show_it;
+  show_it = settings.bool_value (ed_show_line_numbers);
+  m_show_linenum_action->setChecked (show_it);
+  show_it = settings.bool_value (ed_show_white_space);
+  m_show_whitespace_action->setChecked (show_it);
+  show_it = settings.bool_value (ed_show_eol_chars);
+  m_show_eol_action->setChecked (show_it);
+  show_it = settings.bool_value (ed_show_indent_guides);
+  m_show_indguide_action->setChecked (show_it);
+  show_it = settings.bool_value (ed_long_line_marker);
+  m_show_longline_action->setChecked (show_it);
+
+  show_it = settings.bool_value (ed_show_toolbar);
+  m_show_toolbar_action->setChecked (show_it);
+  m_tool_bar->setVisible (show_it);
+  show_it = settings.bool_value (ed_show_edit_status_bar);
+  m_show_statusbar_action->setChecked (show_it);
+  show_it = settings.bool_value (ed_show_hscroll_bar);
+  m_show_hscrollbar_action->setChecked (show_it);
+
+  set_shortcuts ();
+
+  // Find dialog with the same icon as the editor
+  if (m_find_dialog)
+    m_find_dialog->setWindowIcon (windowIcon ());
+
+  // Relay signal to file editor tabs.
+  emit fetab_settings_changed ();
+}
+
+void file_editor::set_shortcuts ()
+{
+  // Shortcuts also available in the main window, as well as the related
+  // shortcuts, are defined in main_window and added to the editor
+
+  gui_settings settings;
+
+  // File menu
+  settings.set_shortcut (m_edit_function_action, sc_edit_file_edit_function);
+  settings.set_shortcut (m_save_action, sc_edit_file_save);
+  settings.set_shortcut (m_save_as_action, sc_edit_file_save_as);
+  settings.set_shortcut (m_close_action, sc_edit_file_close);
+  settings.set_shortcut (m_close_all_action, sc_edit_file_close_all);
+  settings.set_shortcut (m_close_others_action, sc_edit_file_close_other);
+  settings.set_shortcut (m_print_action, sc_edit_file_print);
+
+  // Edit menu
+  settings.set_shortcut (m_redo_action, sc_edit_edit_redo);
+  settings.set_shortcut (m_cut_action, sc_edit_edit_cut);
+  settings.set_shortcut (m_find_action, sc_edit_edit_find_replace);
+  settings.set_shortcut (m_find_next_action, sc_edit_edit_find_next);
+  settings.set_shortcut (m_find_previous_action, sc_edit_edit_find_previous);
+
+  settings.set_shortcut (m_delete_start_word_action, sc_edit_edit_delete_start_word);
+  settings.set_shortcut (m_delete_end_word_action, sc_edit_edit_delete_end_word);
+  settings.set_shortcut (m_delete_start_line_action, sc_edit_edit_delete_start_line);
+  settings.set_shortcut (m_delete_end_line_action, sc_edit_edit_delete_end_line);
+  settings.set_shortcut (m_delete_line_action, sc_edit_edit_delete_line);
+  settings.set_shortcut (m_copy_line_action, sc_edit_edit_copy_line);
+  settings.set_shortcut (m_cut_line_action, sc_edit_edit_cut_line);
+  settings.set_shortcut (m_duplicate_selection_action, sc_edit_edit_duplicate_selection);
+  settings.set_shortcut (m_transpose_line_action, sc_edit_edit_transpose_line);
+  settings.set_shortcut (m_comment_selection_action, sc_edit_edit_comment_selection);
+  settings.set_shortcut (m_uncomment_selection_action, sc_edit_edit_uncomment_selection);
+  settings.set_shortcut (m_comment_var_selection_action, sc_edit_edit_comment_var_selection);
+
+  settings.set_shortcut (m_upper_case_action, sc_edit_edit_upper_case);
+  settings.set_shortcut (m_lower_case_action, sc_edit_edit_lower_case);
+  settings.set_shortcut (m_indent_selection_action, sc_edit_edit_indent_selection);
+  settings.set_shortcut (m_unindent_selection_action, sc_edit_edit_unindent_selection);
+  settings.set_shortcut (m_smart_indent_line_or_selection_action, sc_edit_edit_smart_indent_line_or_selection);
+  settings.set_shortcut (m_completion_action, sc_edit_edit_completion_list);
+  settings.set_shortcut (m_goto_line_action, sc_edit_edit_goto_line);
+  settings.set_shortcut (m_move_to_matching_brace, sc_edit_edit_move_to_brace);
+  settings.set_shortcut (m_sel_to_matching_brace, sc_edit_edit_select_to_brace);
+  settings.set_shortcut (m_toggle_bookmark_action, sc_edit_edit_toggle_bookmark);
+  settings.set_shortcut (m_next_bookmark_action, sc_edit_edit_next_bookmark);
+  settings.set_shortcut (m_previous_bookmark_action, sc_edit_edit_previous_bookmark);
+  settings.set_shortcut (m_remove_bookmark_action, sc_edit_edit_remove_bookmark);
+  settings.set_shortcut (m_preferences_action, sc_edit_edit_preferences);
+  settings.set_shortcut (m_styles_preferences_action, sc_edit_edit_styles_preferences);
+
+  settings.set_shortcut (m_conv_eol_windows_action, sc_edit_edit_conv_eol_winows);
+  settings.set_shortcut (m_conv_eol_unix_action,    sc_edit_edit_conv_eol_unix);
+  settings.set_shortcut (m_conv_eol_mac_action,     sc_edit_edit_conv_eol_mac);
+
+  // View menu
+  settings.set_shortcut (m_show_linenum_action, sc_edit_view_show_line_numbers);
+  settings.set_shortcut (m_show_whitespace_action, sc_edit_view_show_white_spaces);
+  settings.set_shortcut (m_show_eol_action, sc_edit_view_show_eol_chars);
+  settings.set_shortcut (m_show_indguide_action, sc_edit_view_show_ind_guides);
+  settings.set_shortcut (m_show_longline_action, sc_edit_view_show_long_line);
+  settings.set_shortcut (m_show_toolbar_action, sc_edit_view_show_toolbar);
+  settings.set_shortcut (m_show_statusbar_action, sc_edit_view_show_statusbar);
+  settings.set_shortcut (m_show_hscrollbar_action, sc_edit_view_show_hscrollbar);
+  settings.set_shortcut (m_zoom_in_action, sc_edit_view_zoom_in);
+  settings.set_shortcut (m_zoom_out_action, sc_edit_view_zoom_out);
+  settings.set_shortcut (m_zoom_normal_action, sc_edit_view_zoom_normal);
+  settings.set_shortcut (m_sort_tabs_action, sc_edit_view_sort_tabs);
+
+  // Debug menu
+  settings.set_shortcut (m_toggle_breakpoint_action, sc_edit_debug_toggle_breakpoint);
+  settings.set_shortcut (m_next_breakpoint_action, sc_edit_debug_next_breakpoint);
+  settings.set_shortcut (m_previous_breakpoint_action, sc_edit_debug_previous_breakpoint);
+  settings.set_shortcut (m_remove_all_breakpoints_action, sc_edit_debug_remove_breakpoints);
+
+  // Run menu
+  settings.set_shortcut (m_run_action, sc_edit_run_run_file);
+  settings.set_shortcut (m_run_selection_action, sc_edit_run_run_selection);
+
+  // Help menu
+  settings.set_shortcut (m_context_help_action, sc_edit_help_help_keyword);
+  settings.set_shortcut (m_context_doc_action,  sc_edit_help_doc_keyword);
+
+  // Tab navigation without menu entries
+  settings.set_shortcut (m_switch_left_tab_action, sc_edit_tabs_switch_left_tab);
+  settings.set_shortcut (m_switch_right_tab_action, sc_edit_tabs_switch_right_tab);
+  settings.set_shortcut (m_move_tab_left_action, sc_edit_tabs_move_tab_left);
+  settings.set_shortcut (m_move_tab_right_action, sc_edit_tabs_move_tab_right);
+}
+
+// This slot is a reimplementation of the virtual slot in octave_dock_widget.
+// We need this for creating an empty script when the editor has no open
+// files and is made visible.
+void file_editor::handle_visibility (bool visible)
+{
+  octave_dock_widget::handle_visibility (visible);
+
+  if (! m_editor_ready)
+    return;
+
+  if (m_closed && visible)
+    {
+      m_closed = false;
+
+      restore_session ();
+    }
+
+  empty_script (false, visible);
+}
+
+// This slot is a reimplementation of the virtual slot in octave_dock_widget.
+// We need this for updating the parent of the find dialog
+void file_editor::toplevel_change (bool)
+{
+  if (m_find_dialog)
+    {
+      // close current dialog
+      m_find_dialog->close ();
+
+      // re-create dialog with the new parent (editor or main-win)
+      find_create ();
+      m_find_dialog->activateWindow ();
+    }
+}
+
+void file_editor::update_octave_directory (const QString& dir)
+{
+  m_ced = dir;
+  emit fetab_set_directory (m_ced);  // for save dialog
+}
+
+void file_editor::copyClipboard ()
+{
+  if (editor_tab_has_focus ())
+    emit fetab_scintilla_command (m_tab_widget->currentWidget (),
+                                  QsciScintillaBase::SCI_COPY);
+}
+
+void file_editor::pasteClipboard ()
+{
+  if (editor_tab_has_focus ())
+    emit fetab_scintilla_command (m_tab_widget->currentWidget (),
+                                  QsciScintillaBase::SCI_PASTE);
+}
+
+void file_editor::selectAll ()
+{
+  if (editor_tab_has_focus ())
+    emit fetab_scintilla_command (m_tab_widget->currentWidget (),
+                                  QsciScintillaBase::SCI_SELECTALL);
+}
+
+void file_editor::do_undo ()
+{
+  if (editor_tab_has_focus ())
+    emit fetab_scintilla_command (m_tab_widget->currentWidget (),
+                                  QsciScintillaBase::SCI_UNDO);
+}
+
+// Open a file, if not already open, and mark the current execution location
+// and/or a breakpoint with condition cond.
+void file_editor::request_open_file (const QString& openFileName,
+                                     const QString& encoding,
+                                     int line, bool debug_pointer,
+                                     bool breakpoint_marker, bool insert,
+                                     const QString& cond, int index,
+                                     const QString& bookmarks)
+{
+  gui_settings settings;
+
+  if (settings.bool_value (global_use_custom_editor))
+    {
+      // Custom editor
+      if (debug_pointer || breakpoint_marker)
+        return;   // Do not call custom editor during debugging
+
+      if (call_custom_editor (openFileName, line))
+        return;   // Custom editor called
+    }
+
+  bool show_dbg_file = settings.bool_value (ed_show_dbg_file);
+
+  if (openFileName.isEmpty ())
+    {
+      // This happens if edit is called without an argument
+      // Open editor with empty edit area instead (as new file would do)
+      request_new_file ("");
+    }
+  else
+    {
+      // Check whether this file is already open in the editor.
+      file_editor_tab *tab = find_tab_widget (openFileName);
+
+      if (tab)
+        {
+          m_tab_widget->setCurrentWidget (tab);
+
+          if (line > 0)
+            {
+              if (insert)
+                emit fetab_goto_line (tab, line);
+
+              if (debug_pointer)
+                emit fetab_insert_debugger_pointer (tab, line);
+
+              if (breakpoint_marker)
+                emit fetab_do_breakpoint_marker (insert, tab, line, cond);
+            }
+
+          if (show_dbg_file && ! ((breakpoint_marker || debug_pointer)
+                                  && is_editor_console_tabbed ()))
+            {
+              emit fetab_set_focus (tab);
+              activate ();
+            }
+        }
+      else
+        {
+          if (! show_dbg_file && (breakpoint_marker  || debug_pointer))
+            return;   // Do not open a file for showing dbg markers
+
+          if (breakpoint_marker && ! insert)
+            return;   // Never open a file when removing breakpoints
+
+          file_editor_tab *fileEditorTab = nullptr;
+          // Reuse <unnamed> tab if it hasn't yet been modified.
+          bool reusing = false;
+          tab = find_tab_widget ("");
+          if (tab)
+            {
+              fileEditorTab = tab;
+              if (fileEditorTab->qsci_edit_area ()->isModified ())
+                fileEditorTab = nullptr;
+              else
+                reusing = true;
+            }
+
+          // If <unnamed> was absent or modified, create a new tab.
+          if (! fileEditorTab)
+            fileEditorTab = make_file_editor_tab ();
+
+          fileEditorTab->set_encoding (encoding);
+          QString result = fileEditorTab->load_file (openFileName);
+          if (result == "")
+            {
+              // Supply empty title then have the file_editor_tab update
+              // with full or short name.
+              if (! reusing)
+                add_file_editor_tab (fileEditorTab, "", index);
+              fileEditorTab->update_window_title (false);
+              // file already loaded, add file to mru list here
+              QFileInfo file_info = QFileInfo (openFileName);
+              handle_mru_add_file (file_info.canonicalFilePath (),
+                                   encoding);
+
+              if (line > 0)
+                {
+                  if (insert)
+                    emit fetab_goto_line (fileEditorTab, line);
+
+                  if (debug_pointer)
+                    emit fetab_insert_debugger_pointer (fileEditorTab,
+                                                        line);
+                  if (breakpoint_marker)
+                    emit fetab_do_breakpoint_marker (insert, fileEditorTab,
+                                                     line, cond);
+                }
+            }
+          else
+            {
+              if (! reusing)
+                {
+                  delete fileEditorTab;
                   fileEditorTab = nullptr;
-                else
-                  reusing = true;
-              }
-
-            // If <unnamed> was absent or modified, create a new tab.
-            if (! fileEditorTab)
-              fileEditorTab = make_file_editor_tab ();
-
-            fileEditorTab->set_encoding (encoding);
-            QString result = fileEditorTab->load_file (openFileName);
-            if (result == "")
-              {
-                // Supply empty title then have the file_editor_tab update
-                // with full or short name.
-                if (! reusing)
-                  add_file_editor_tab (fileEditorTab, "", index);
-                fileEditorTab->update_window_title (false);
-                // file already loaded, add file to mru list here
-                QFileInfo file_info = QFileInfo (openFileName);
-                handle_mru_add_file (file_info.canonicalFilePath (),
-                                     encoding);
-
-                if (line > 0)
-                  {
-                    if (insert)
-                      emit fetab_goto_line (fileEditorTab, line);
-
-                    if (debug_pointer)
-                      emit fetab_insert_debugger_pointer (fileEditorTab,
-                                                          line);
-                    if (breakpoint_marker)
-                      emit fetab_do_breakpoint_marker (insert, fileEditorTab,
-                                                       line, cond);
-                  }
-              }
-            else
-              {
-                if (! reusing)
-                  {
-                    delete fileEditorTab;
-                    fileEditorTab = nullptr;
-                  }
-
-                if (QFile::exists (openFileName))
-                  {
-                    // File not readable:
-                    // create a NonModal message about error.
-                    QMessageBox *msgBox
-                      = new QMessageBox (QMessageBox::Critical,
-                                         tr ("Octave Editor"),
-                                         tr ("Could not open file\n%1\nfor read: %2.").
-                                         arg (openFileName).arg (result),
-                                         QMessageBox::Ok, this);
-
-                    msgBox->setWindowModality (Qt::NonModal);
-                    msgBox->setAttribute (Qt::WA_DeleteOnClose);
-                    msgBox->show ();
-                  }
-                else
-                  {
-                    // File does not exist, should it be created?
-                    bool create_file = true;
-                    QMessageBox *msgBox;
-
-                    if (! settings.bool_value (ed_create_new_file))
-                      {
-                        msgBox = new QMessageBox (QMessageBox::Question,
-                                                  tr ("Octave Editor"),
-                                                  tr ("File\n%1\ndoes not exist. "
-                                                      "Do you want to create it?").arg (openFileName),
-                                                  QMessageBox::NoButton, nullptr);
-                        QPushButton *create_button =
-                          msgBox->addButton (tr ("Create"), QMessageBox::YesRole);
-                        msgBox->addButton (tr ("Cancel"), QMessageBox::RejectRole);
-                        msgBox->setDefaultButton (create_button);
-                        msgBox->exec ();
-
-                        QAbstractButton *clicked_button = msgBox->clickedButton ();
-                        if (clicked_button != create_button)
-                          create_file = false;
-
-                        delete msgBox;
-                      }
-
-                    if (create_file)
-                      {
-                        // create the file and call the editor again
-                        QFile file (openFileName);
-                        if (! file.open (QIODevice::WriteOnly))
-                          {
-                            // error opening the file
-                            msgBox = new QMessageBox (QMessageBox::Critical,
-                                                      tr ("Octave Editor"),
-                                                      tr ("Could not open file\n%1\nfor write: %2.").
-                                                      arg (openFileName).arg (file.errorString ()),
-                                                      QMessageBox::Ok, this);
-
-                            msgBox->setWindowModality (Qt::NonModal);
-                            msgBox->setAttribute (Qt::WA_DeleteOnClose);
-                            msgBox->show ();
-                          }
-                        else
-                          {
-                            file.close ();
-                            request_open_file (openFileName);
-                          }
-                      }
-                  }
-              }
-
-            if (! bookmarks.isEmpty ())
-              {
-                // Restore bookmarks
-                for (const auto& bms : bookmarks.split (','))
-                  {
-                    int bm = bms.toInt ();
-                    if (fileEditorTab)
-                      fileEditorTab->qsci_edit_area ()->markerAdd (bm, marker::bookmark);
-                  }
-              }
-
-            if (! ((breakpoint_marker || debug_pointer) && is_editor_console_tabbed ()))
-              {
-                // update breakpoint pointers, really show editor
-                // and the current editor tab
-                if (fileEditorTab)
-                  fileEditorTab->update_breakpoints ();
-                activate ();
-                emit file_loaded_signal ();
-              }
-          }
-      }
-  }
-
-  void file_editor::request_preferences (bool)
-  {
-    emit request_settings_dialog ("editor");
-  }
-
-  void file_editor::request_styles_preferences (bool)
-  {
-    emit request_settings_dialog ("editor_styles");
-  }
-
-  void file_editor::show_line_numbers (bool)
-  {
-    toggle_preference (ed_show_line_numbers);
-  }
-
-  void file_editor::show_white_space (bool)
-  {
-    toggle_preference (ed_show_white_space);
-  }
-
-  void file_editor::show_eol_chars (bool)
-  {
-    toggle_preference (ed_show_eol_chars);
-  }
-
-  void file_editor::show_indent_guides (bool)
-  {
-    toggle_preference (ed_show_indent_guides);
-  }
-
-  void file_editor::show_long_line (bool)
-  {
-    toggle_preference (ed_long_line_marker);
-  }
-
-  void file_editor::show_toolbar (bool)
-  {
-    toggle_preference (ed_show_toolbar);
-  }
-
-  void file_editor::show_statusbar (bool)
-  {
-    toggle_preference (ed_show_edit_status_bar);
-  }
-
-  void file_editor::show_hscrollbar (bool)
-  {
-    toggle_preference (ed_show_hscroll_bar);
-  }
-
-  void file_editor::zoom_in (bool)
-  {
-    emit fetab_zoom_in (m_tab_widget->currentWidget ());
-  }
-
-  void file_editor::zoom_out (bool)
-  {
-    emit fetab_zoom_out (m_tab_widget->currentWidget ());
-  }
-
-  void file_editor::zoom_normal (bool)
-  {
-    emit fetab_zoom_normal (m_tab_widget->currentWidget ());
-  }
-
-  void file_editor::create_context_menu (QMenu *menu)
-  {
-    // remove all standard actions from scintilla
-    QList<QAction *> all_actions = menu->actions ();
-
-    for (auto *a : all_actions)
-      menu->removeAction (a);
-
-    // add editor's actions with icons and customized shortcuts
-    menu->addAction (m_cut_action);
-    menu->addAction (m_copy_action);
-    menu->addAction (m_paste_action);
-    menu->addSeparator ();
-    menu->addAction (m_selectall_action);
-    menu->addSeparator ();
-    menu->addAction (m_find_files_action);
-    menu->addAction (m_find_action);
-    menu->addAction (m_find_next_action);
-    menu->addAction (m_find_previous_action);
-    menu->addSeparator ();
-    menu->addMenu (m_edit_cmd_menu);
-    menu->addMenu (m_edit_fmt_menu);
-    menu->addMenu (m_edit_nav_menu);
-    menu->addSeparator ();
-    menu->addAction (m_run_selection_action);
-  }
-
-  void file_editor::edit_status_update (bool undo, bool redo)
-  {
-    if (m_undo_action)
-      m_undo_action->setEnabled (undo);
-    m_redo_action->setEnabled (redo);
-  }
-
-  // handler for the close event
-  void file_editor::closeEvent (QCloseEvent *e)
-  {
-    gui_settings settings;
-
-    if (settings.bool_value (ed_hiding_closes_files))
-      {
-        if (check_closing ())
-          {
-            // All tabs are closed without cancelling,
-            // store closing state for restoring session when shown again.
-            // Editor is closing when session data is stored in preferences
-            m_closed = true;
-            e->ignore ();
-          }
-        else
-          {
-            e->ignore ();
-            return;
-          }
-      }
-    else
-      e->accept ();
-
-    octave_dock_widget::closeEvent (e);
-  }
-
-  void file_editor::dragEnterEvent (QDragEnterEvent *e)
-  {
-    if (e->mimeData ()->hasUrls ())
-      {
-        e->acceptProposedAction ();
-      }
-  }
-
-  void file_editor::dropEvent (QDropEvent *e)
-  {
-    if (e->mimeData ()->hasUrls ())
-      {
-        for (const auto& url : e->mimeData ()->urls ())
-          request_open_file (url.toLocalFile ());
-      }
-  }
-
-  bool file_editor::is_editor_console_tabbed ()
-  {
-    // FIXME: is there a way to do this job that doesn't require casting
-    // the parent to a main_window object?
-
-    main_window *w = dynamic_cast<main_window *> (parentWidget ());
-
-    if (w)
-      {
-        QList<QDockWidget *> w_list = w->tabifiedDockWidgets (this);
-        QDockWidget *console =
-          static_cast<QDockWidget *> (w->get_dock_widget_list ().at (0));
-
-        for (int i = 0; i < w_list.count (); i++)
-          {
-            if (w_list.at (i) == console)
-              return true;
-          }
-      }
-
-    return false;
-  }
-
-  void file_editor::construct ()
-  {
-    QWidget *editor_widget = new QWidget (this);
-
-    // FIXME: what was the intended purpose of this unused variable?
-    // QStyle *editor_style = QApplication::style ();
-
-    // Menu bar: do not set it native, required in macOS and Ubuntu Unity (Qt5)
-    // for a visible menu bar in the editor widget.  This property is ignored
-    // on other platforms.
-    m_menu_bar = new QMenuBar (editor_widget);
-    m_menu_bar->setNativeMenuBar (false);
-
-    m_tool_bar = new QToolBar (editor_widget);
-    m_tool_bar->setMovable (true);
-
-    m_tab_widget = new file_editor_tab_widget (editor_widget, this);
-
-    // the mru-list and an empty array of actions
-
-    gui_settings settings;
-
-    m_mru_files = settings.string_list_value (ed_mru_file_list);
-    m_mru_files_encodings = settings.string_list_value (ed_mru_file_encodings);
-
-    if (m_mru_files_encodings.count () != m_mru_files.count ())
-      {
-        // encodings don't have the same count -> do not use them!
-        m_mru_files_encodings = QStringList ();
-        for (int i = 0; i < m_mru_files.count (); i++)
-          m_mru_files_encodings << QString ();
-      }
-
-    for (int i = 0; i < MaxMRUFiles; ++i)
-      {
-        m_mru_file_actions[i] = new QAction (this);
-        m_mru_file_actions[i]->setVisible (false);
-      }
-
-    // menu bar
-
-    // file menu
-
-    m_fileMenu = add_menu (m_menu_bar, tr ("&File"));
-
-    // new and open menus are inserted later by the main window
-    m_mru_file_menu = new QMenu (tr ("&Recent Editor Files"), m_fileMenu);
-    for (int i = 0; i < MaxMRUFiles; ++i)
-      m_mru_file_menu->addAction (m_mru_file_actions[i]);
-    m_fileMenu->addMenu (m_mru_file_menu);
-
-    m_fileMenu->addSeparator ();
-
-    m_edit_function_action
-      = add_action (m_fileMenu,
-                    tr ("&Edit Function"),
-                    SLOT (request_context_edit (bool)));
-
-    m_fileMenu->addSeparator ();
-
-    m_save_action
-      = add_action (m_fileMenu, settings.icon ("document-save"),
-                    tr ("&Save File"), SLOT (request_save_file (bool)));
-
-    m_save_as_action
-      = add_action (m_fileMenu, settings.icon ("document-save-as"),
-                    tr ("Save File &As..."),
-                    SLOT (request_save_file_as (bool)));
-
-    m_fileMenu->addSeparator ();
-
-    m_close_action
-      = add_action (m_fileMenu, settings.icon ("window-close", false),
-                    tr ("&Close"), SLOT (request_close_file (bool)));
-
-    m_close_all_action
-      = add_action (m_fileMenu, settings.icon ("window-close", false),
-                    tr ("Close All"), SLOT (request_close_all_files (bool)));
-
-    m_close_others_action
-      = add_action (m_fileMenu, settings.icon ("window-close", false),
-                    tr ("Close Other Files"),
-                    SLOT (request_close_other_files (bool)));
-
-    m_fileMenu->addSeparator ();
-
-    m_print_action
-      = add_action (m_fileMenu, settings.icon ("document-print"),
-                    tr ("Print..."), SLOT (request_print_file (bool)));
-
-    // edit menu (undo, copy, paste and select all later via main window)
-
-    m_edit_menu = add_menu (m_menu_bar, tr ("&Edit"));
-
-    m_redo_action
-      = add_action (m_edit_menu, settings.icon ("edit-redo"),
-                    tr ("&Redo"), SLOT (request_redo (bool)));
-    m_redo_action->setEnabled (false);
-
-    m_edit_menu->addSeparator ();
-
-    m_cut_action
-      = add_action (m_edit_menu, settings.icon ("edit-cut"),
-                    tr ("Cu&t"), SLOT (request_cut (bool)));
-    m_cut_action->setEnabled (false);
-
-    m_find_action
-      = add_action (m_edit_menu, settings.icon ("edit-find-replace"),
-                    tr ("&Find and Replace..."), SLOT (request_find (bool)));
-
-    m_find_next_action
-      = add_action (m_edit_menu, tr ("Find &Next..."),
-                    SLOT (request_find_next (bool)));
-
-    m_find_previous_action
-      = add_action (m_edit_menu, tr ("Find &Previous..."),
-                    SLOT (request_find_previous (bool)));
-
-    m_edit_menu->addSeparator ();
-
-    m_edit_cmd_menu = m_edit_menu->addMenu (tr ("&Commands"));
-
-    m_delete_line_action
-      = add_action (m_edit_cmd_menu, tr ("Delete Line"),
-                    SLOT (request_delete_line (bool)));
-
-    m_copy_line_action
-      = add_action (m_edit_cmd_menu, tr ("Copy Line"),
-                    SLOT (request_copy_line (bool)));
-
-    m_cut_line_action
-      = add_action (m_edit_cmd_menu, tr ("Cut Line"),
-                    SLOT (request_cut_line (bool)));
-
-    m_edit_cmd_menu->addSeparator ();
-
-    m_delete_start_word_action
-      = add_action (m_edit_cmd_menu, tr ("Delete to Start of Word"),
-                    SLOT (request_delete_start_word (bool)));
-
-    m_delete_end_word_action
-      = add_action (m_edit_cmd_menu, tr ("Delete to End of Word"),
-                    SLOT (request_delete_end_word (bool)));
-
-    m_delete_start_line_action
-      = add_action (m_edit_cmd_menu, tr ("Delete to Start of Line"),
-                    SLOT (request_delete_start_line (bool)));
-
-    m_delete_end_line_action
-      = add_action (m_edit_cmd_menu, tr ("Delete to End of Line"),
-                    SLOT (request_delete_end_line (bool)));
-
-    m_edit_cmd_menu->addSeparator ();
-
-    m_duplicate_selection_action
-      = add_action (m_edit_cmd_menu, tr ("Duplicate Selection/Line"),
-                    SLOT (request_duplicate_selection (bool)));
-
-    m_transpose_line_action
-      = add_action (m_edit_cmd_menu, tr ("Transpose Line"),
-                    SLOT (request_transpose_line (bool)));
-
-    m_edit_cmd_menu->addSeparator ();
-
-    m_completion_action
-      = add_action (m_edit_cmd_menu, tr ("&Show Completion List"),
-                    SLOT (request_completion (bool)));
-
-    m_edit_fmt_menu = m_edit_menu->addMenu (tr ("&Format"));
-
-    m_upper_case_action
-      = add_action (m_edit_fmt_menu, tr ("&Uppercase Selection"),
-                    SLOT (request_upper_case (bool)));
-
-    m_lower_case_action
-      = add_action (m_edit_fmt_menu, tr ("&Lowercase Selection"),
-                    SLOT (request_lower_case (bool)));
-
-    m_edit_fmt_menu->addSeparator ();
-
-    m_comment_selection_action
-      = add_action (m_edit_fmt_menu, tr ("&Comment"),
-                    SLOT (request_comment_selected_text (bool)));
-
-    m_uncomment_selection_action
-      = add_action (m_edit_fmt_menu, tr ("&Uncomment"),
-                    SLOT (request_uncomment_selected_text (bool)));
-
-    m_comment_var_selection_action
-      = add_action (m_edit_fmt_menu, tr ("Comment (Choosing String)"),
-                    SLOT (request_comment_var_selected_text (bool)));
-
-    m_edit_fmt_menu->addSeparator ();
-
-    m_indent_selection_action
-      = add_action (m_edit_fmt_menu, tr ("&Indent Selection Rigidly"),
-                    SLOT (request_indent_selected_text (bool)));
-
-    m_unindent_selection_action
-      = add_action (m_edit_fmt_menu, tr ("&Unindent Selection Rigidly"),
-                    SLOT (request_unindent_selected_text (bool)));
-
-    m_smart_indent_line_or_selection_action
-      = add_action (m_edit_fmt_menu, tr ("Indent Code"),
-                    SLOT (request_smart_indent_line_or_selected_text ()));
-
-    m_edit_fmt_menu->addSeparator ();
-
-    m_conv_eol_windows_action
-      = add_action (m_edit_fmt_menu,
-                    tr ("Convert Line Endings to &Windows (CRLF)"),
-                    SLOT (request_conv_eol_windows (bool)));
-
-    m_conv_eol_unix_action
-      = add_action (m_edit_fmt_menu, tr ("Convert Line Endings to &Unix (LF)"),
-                    SLOT (request_conv_eol_unix (bool)));
-
-    m_conv_eol_mac_action
-      = add_action (m_edit_fmt_menu,
-                    tr ("Convert Line Endings to Legacy &Mac (CR)"),
-                    SLOT (request_conv_eol_mac (bool)));
-
-    m_edit_nav_menu = m_edit_menu->addMenu (tr ("Navi&gation"));
-
-    m_goto_line_action
-      = add_action (m_edit_nav_menu, tr ("Go &to Line..."),
-                    SLOT (request_goto_line (bool)));
-
-    m_edit_cmd_menu->addSeparator ();
-
-    m_move_to_matching_brace
-      = add_action (m_edit_nav_menu, tr ("Move to Matching Brace"),
-                    SLOT (request_move_match_brace (bool)));
-
-    m_sel_to_matching_brace
-      = add_action (m_edit_nav_menu, tr ("Select to Matching Brace"),
-                    SLOT (request_sel_match_brace (bool)));
-
-    m_edit_nav_menu->addSeparator ();
-
-    m_next_bookmark_action
-      = add_action (m_edit_nav_menu, tr ("&Next Bookmark"),
-                    SLOT (request_next_bookmark (bool)));
-
-    m_previous_bookmark_action
-      = add_action (m_edit_nav_menu, tr ("Pre&vious Bookmark"),
-                    SLOT (request_previous_bookmark (bool)));
-
-    m_toggle_bookmark_action
-      = add_action (m_edit_nav_menu, tr ("Toggle &Bookmark"),
-                    SLOT (request_toggle_bookmark (bool)));
-
-    m_remove_bookmark_action
-      = add_action (m_edit_nav_menu, tr ("&Remove All Bookmarks"),
-                    SLOT (request_remove_bookmark (bool)));
-
-    m_edit_menu->addSeparator ();
-
-    m_preferences_action
-      = add_action (m_edit_menu, settings.icon ("preferences-system"),
-                    tr ("&Preferences..."),
-                    SLOT (request_preferences (bool)));
-
-    m_styles_preferences_action
-      = add_action (m_edit_menu, settings.icon ("preferences-system"),
-                    tr ("&Styles Preferences..."),
-                    SLOT (request_styles_preferences (bool)));
-
-    // view menu
-
-    QMenu *view_menu = add_menu (m_menu_bar, tr ("&View"));
-
-    m_view_editor_menu = view_menu->addMenu (tr ("&Editor"));
-
-    m_show_linenum_action
-      = add_action (m_view_editor_menu, tr ("Show &Line Numbers"),
-                    SLOT (show_line_numbers (bool)));
-    m_show_linenum_action->setCheckable (true);
-
-    m_show_whitespace_action
-      = add_action (m_view_editor_menu, tr ("Show &Whitespace Characters"),
-                    SLOT (show_white_space (bool)));
-    m_show_whitespace_action->setCheckable (true);
-
-    m_show_eol_action
-      = add_action (m_view_editor_menu, tr ("Show Line &Endings"),
-                    SLOT (show_eol_chars (bool)));
-    m_show_eol_action->setCheckable (true);
-
-    m_show_indguide_action
-      = add_action (m_view_editor_menu, tr ("Show &Indentation Guides"),
-                    SLOT (show_indent_guides (bool)));
-    m_show_indguide_action->setCheckable (true);
-
-    m_show_longline_action
-      = add_action (m_view_editor_menu, tr ("Show Long Line &Marker"),
-                    SLOT (show_long_line (bool)));
-    m_show_longline_action->setCheckable (true);
-
-    m_view_editor_menu->addSeparator ();
-
-    m_show_toolbar_action
-      = add_action (m_view_editor_menu, tr ("Show &Toolbar"),
-                    SLOT (show_toolbar (bool)));
-    m_show_toolbar_action->setCheckable (true);
-
-    m_show_statusbar_action
-      = add_action (m_view_editor_menu, tr ("Show &Statusbar"),
-                    SLOT (show_statusbar (bool)));
-    m_show_statusbar_action->setCheckable (true);
-
-    m_show_hscrollbar_action
-      = add_action (m_view_editor_menu, tr ("Show &Horizontal Scrollbar"),
-                    SLOT (show_hscrollbar (bool)));
-    m_show_hscrollbar_action->setCheckable (true);
-
-    view_menu->addSeparator ();
-
-    m_zoom_in_action
-      = add_action (view_menu, settings.icon ("view-zoom-in"), tr ("Zoom &In"),
-                    SLOT (zoom_in (bool)));
-
-    m_zoom_out_action
-      = add_action (view_menu, settings.icon ("view-zoom-out"),
-                    tr ("Zoom &Out"), SLOT (zoom_out (bool)));
-
-    m_zoom_normal_action
-      = add_action (view_menu, settings.icon ("view-zoom-original"),
-                    tr ("&Normal Size"), SLOT (zoom_normal (bool)));
-
-    view_menu->addSeparator ();
-
-    m_sort_tabs_action
-      = add_action (view_menu, tr ("&Sort Tabs Alphabetically"),
-                    SLOT (sort_tabs_alph ()),
-                    m_tab_widget->get_tab_bar ());
-
-    m_menu_bar->addMenu (view_menu);
-
-    // debug menu
-
-    m_debug_menu = add_menu (m_menu_bar, tr ("&Debug"));
-
-    m_toggle_breakpoint_action
-      = add_action (m_debug_menu, settings.icon ("bp-toggle"),
-                    tr ("Toggle &Breakpoint"),
-                    SLOT (request_toggle_breakpoint (bool)));
-
-    m_next_breakpoint_action
-      = add_action (m_debug_menu, settings.icon ("bp-next"),
-                    tr ("&Next Breakpoint"),
-                    SLOT (request_next_breakpoint (bool)));
-
-    m_previous_breakpoint_action
-      = add_action (m_debug_menu, settings.icon ("bp-prev"),
-                    tr ("Pre&vious Breakpoint"),
-                    SLOT (request_previous_breakpoint (bool)));
-
-    m_remove_all_breakpoints_action
-      = add_action (m_debug_menu, settings.icon ("bp-rm-all"),
-                    tr ("&Remove All Breakpoints"),
-                    SLOT (request_remove_breakpoint (bool)));
-
-    m_debug_menu->addSeparator ();
-
-    // The other debug actions will be added by the main window.
-
-    // run menu
-
-    QMenu *_run_menu = add_menu (m_menu_bar, tr ("&Run"));
-
-    m_run_action
-      = add_action (_run_menu,
-                    settings.icon ("system-run"),
-                    tr ("Save File and Run / Continue"),
-                    SLOT (request_run_file (bool)));
-
-    m_run_selection_action
-      = add_action (_run_menu,
-                    tr ("Run &Selection"),
-                    SLOT (request_context_run (bool)));
-    m_run_selection_action->setEnabled (false);
-
-    // help menu
-
-    QMenu *_help_menu = add_menu (m_menu_bar, tr ("&Help"));
-
-    m_context_help_action
-      = add_action (_help_menu,
-                    tr ("&Help on Keyword"),
-                    SLOT (request_context_help (bool)));
-
-    m_context_doc_action
-      = add_action (_help_menu,
-                    tr ("&Documentation on Keyword"),
-                    SLOT (request_context_doc (bool)));
-
-    // tab navigation (no menu, only actions; slots in tab_bar)
-
-    m_switch_left_tab_action
-      = add_action (nullptr, "", SLOT (switch_left_tab ()),
-                    m_tab_widget->get_tab_bar ());
-
-    m_switch_right_tab_action
-      = add_action (nullptr, "", SLOT (switch_right_tab ()),
-                    m_tab_widget->get_tab_bar ());
-
-    m_move_tab_left_action
-      = add_action (nullptr, "", SLOT (move_tab_left ()),
-                    m_tab_widget->get_tab_bar ());
-
-    m_move_tab_right_action
-      = add_action (nullptr, "", SLOT (move_tab_right ()),
-                    m_tab_widget->get_tab_bar ());
-
-    // toolbar
-
-    // popdown menu with mru files
-    QToolButton *popdown_button = new QToolButton ();
-    popdown_button->setToolTip (tr ("Recent Files"));
-    popdown_button->setMenu (m_mru_file_menu);
-    popdown_button->setPopupMode (QToolButton::InstantPopup);
-    popdown_button->setArrowType (Qt::DownArrow);
-    popdown_button->setToolButtonStyle (Qt::ToolButtonTextOnly);
-
-    // new and open actions are inserted later from main window
-    m_popdown_mru_action = m_tool_bar->addWidget (popdown_button);
-    m_tool_bar->addAction (m_save_action);
-    m_tool_bar->addAction (m_save_as_action);
-    m_tool_bar->addAction (m_print_action);
-    m_tool_bar->addSeparator ();
-    // m_undo_action: later via main window
-    m_tool_bar->addAction (m_redo_action);
-    m_tool_bar->addSeparator ();
-    m_tool_bar->addAction (m_cut_action);
-    // m_copy_action: later via the main window
-    // m_paste_action: later via the main window
-    m_tool_bar->addAction (m_find_action);
-    //m_tool_bar->addAction (m_find_next_action);
-    //m_tool_bar->addAction (m_find_previous_action);
-    m_tool_bar->addSeparator ();
-    m_tool_bar->addAction (m_run_action);
-    m_tool_bar->addSeparator ();
-    m_tool_bar->addAction (m_toggle_breakpoint_action);
-    m_tool_bar->addAction (m_previous_breakpoint_action);
-    m_tool_bar->addAction (m_next_breakpoint_action);
-    m_tool_bar->addAction (m_remove_all_breakpoints_action);
-
-    // layout
-    QVBoxLayout *vbox_layout = new QVBoxLayout ();
-    vbox_layout->addWidget (m_menu_bar);
-    vbox_layout->addWidget (m_tool_bar);
-    vbox_layout->addWidget (m_tab_widget);
-    vbox_layout->setMargin (0);
-    vbox_layout->setSpacing (0);
-    editor_widget->setLayout (vbox_layout);
-    setWidget (editor_widget);
-
-    // Create the basic context menu of the tab bar with editor actions.
-    // Actions for selecting an tab are added when the menu is activated.
-    tab_bar *bar = m_tab_widget->get_tab_bar ();
-    QMenu *ctx_men = bar->get_context_menu ();
-    ctx_men->addSeparator ();
-    ctx_men->addAction (m_close_action);
-    ctx_men->addAction (m_close_all_action);
-    ctx_men->addAction (m_close_others_action);
-    ctx_men->addSeparator ();
-    ctx_men->addAction (m_sort_tabs_action);
-    add_action (ctx_men, tr ("Copy Full File &Path"),
-                SLOT (copy_full_file_path (bool)), this);
-
-    // signals
-    connect (m_mru_file_menu, &QMenu::triggered,
-             this, &file_editor::request_mru_open_file);
-
-    mru_menu_update ();
-
-    connect (m_tab_widget, &file_editor_tab_widget::tabCloseRequested,
-             this, &file_editor::handle_tab_close_request);
-
-    connect (m_tab_widget, &file_editor_tab_widget::currentChanged,
-             this, &file_editor::active_tab_changed);
-
-    resize (500, 400);
-    set_title (tr ("Editor"));
-
-    check_actions ();
-  }
-
-  // Slot when autocompletion list was cancelled
-  void file_editor::handle_autoc_cancelled ()
-  {
-    // List was cancelled but somehow still active and blocking the
-    // edit area from accepting shortcuts. Only after another keypress
-    // shortcuts and lists are working againnas expected. This is
-    // probably caused by qt bug https://bugreports.qt.io/browse/QTBUG-83720
-    // Hack: Accept the list, which is hidden but still active
-    //       and undo the text insertion, if any
-
-    file_editor_tab *f = reset_focus ();
-    octave_qscintilla *qsci = f->qsci_edit_area ();
-
-    int line, col;
-    qsci->getCursorPosition (&line, &col);
-    int l1 = qsci->lineLength (line); // Current line length
-
-    // Accept autocompletion
-    qsci->SendScintilla (QsciScintillaBase::SCI_AUTOCCOMPLETE);
-
-    // Was text inserted? If yes, undo
-    if (qsci->text (line).length () - l1)
-      qsci->undo ();
-  }
-
-  file_editor_tab *file_editor::reset_focus ()
-  {
-    // Reset the focus of the tab and the related edit area
-    file_editor_tab *f
-      = static_cast<file_editor_tab *> (m_tab_widget->currentWidget ());
-    emit fetab_set_focus (f);
-    return f;
-  }
-
-  file_editor_tab *
-  file_editor::make_file_editor_tab (const QString& directory)
-  {
-    file_editor_tab *f = new file_editor_tab (directory);
-
-    // signals from the qscintilla edit area
-    connect (f->qsci_edit_area (), &octave_qscintilla::show_symbol_tooltip_signal,
-             this, &file_editor::show_symbol_tooltip_signal);
-
-    connect (f->qsci_edit_area (), &octave_qscintilla::status_update,
-             this, &file_editor::edit_status_update);
-
-    connect (f->qsci_edit_area (), &octave_qscintilla::create_context_menu_signal,
-             this, &file_editor::create_context_menu);
-
-    connect (f->qsci_edit_area (),
-             SIGNAL (SCN_AUTOCCOMPLETED (const char *, int, int, int)),
-             this, SLOT (reset_focus ()));
-
-    connect (f->qsci_edit_area (), SIGNAL (SCN_AUTOCCANCELLED ()),
-             this, SLOT (handle_autoc_cancelled ()));
-
-    // signals from the qscintilla edit area
-    connect (this, &file_editor::enter_debug_mode_signal,
-             f->qsci_edit_area (), &octave_qscintilla::handle_enter_debug_mode);
-
-    connect (this, &file_editor::exit_debug_mode_signal,
-             f->qsci_edit_area (), &octave_qscintilla::handle_exit_debug_mode);
-
-    // Signals from the file editor_tab
-    connect (f, &file_editor_tab::autoc_closed,
-             this, &file_editor::reset_focus);
-
-    connect (f, &file_editor_tab::file_name_changed,
-             this, &file_editor::handle_file_name_changed);
-
-    connect (f, &file_editor_tab::editor_state_changed,
-             this, &file_editor::handle_editor_state_changed);
-
-    connect (f, &file_editor_tab::tab_remove_request,
-             this, &file_editor::handle_tab_remove_request);
-
-    connect (f, &file_editor_tab::editor_check_conflict_save,
-             this, &file_editor::check_conflict_save);
-
-    connect (f, &file_editor_tab::mru_add_file,
-             this, &file_editor::handle_mru_add_file);
-
-    connect (f, &file_editor_tab::request_open_file,
-             this, [=] (const QString& fname, const QString& encoding) { request_open_file (fname, encoding); });
-
-    connect (f, &file_editor_tab::edit_area_changed,
-             this, &file_editor::edit_area_changed);
-
-    connect (f, &file_editor_tab::set_focus_editor_signal,
-             this, &file_editor::set_focus);
-
-    // Signals from the file_editor or main-win non-trivial operations
-    connect (this, &file_editor::fetab_settings_changed,
-             f, [=] () { f->notice_settings (); });
-
-    connect (this, &file_editor::fetab_change_request,
-             f, &file_editor_tab::change_editor_state);
-
-    connect (this, QOverload<const QWidget *, const QString&, bool>::of (&file_editor::fetab_save_file),
-             f, QOverload<const QWidget *, const QString&, bool>::of (&file_editor_tab::save_file));
-
-    // Signals from the file_editor trivial operations
-    connect (this, &file_editor::fetab_recover_from_exit,
-             f, &file_editor_tab::recover_from_exit);
-
-    connect (this, &file_editor::fetab_set_directory,
-             f, &file_editor_tab::set_current_directory);
-
-    connect (this, &file_editor::fetab_zoom_in,
-             f, &file_editor_tab::zoom_in);
-    connect (this, &file_editor::fetab_zoom_out,
-             f, &file_editor_tab::zoom_out);
-    connect (this, &file_editor::fetab_zoom_normal,
-             f, &file_editor_tab::zoom_normal);
-
-    connect (this, &file_editor::fetab_context_help,
-             f, &file_editor_tab::context_help);
-
-    connect (this, &file_editor::fetab_context_edit,
-             f, &file_editor_tab::context_edit);
-
-    connect (this, QOverload<const QWidget *>::of (&file_editor::fetab_save_file),
-             f, QOverload<const QWidget *>::of (&file_editor_tab::save_file));
-
-    connect (this, &file_editor::fetab_save_file_as,
-             f, QOverload<const QWidget *>::of (&file_editor_tab::save_file_as));
-
-    connect (this, &file_editor::fetab_print_file,
-             f, &file_editor_tab::print_file);
-
-    connect (this, &file_editor::fetab_run_file,
-             f, &file_editor_tab::run_file);
-
-    connect (this, &file_editor::fetab_context_run,
-             f, &file_editor_tab::context_run);
-
-    connect (this, &file_editor::fetab_toggle_bookmark,
-             f, &file_editor_tab::toggle_bookmark);
-
-    connect (this, &file_editor::fetab_next_bookmark,
-             f, &file_editor_tab::next_bookmark);
-
-    connect (this, &file_editor::fetab_previous_bookmark,
-             f, &file_editor_tab::previous_bookmark);
-
-    connect (this, &file_editor::fetab_remove_bookmark,
-             f, &file_editor_tab::remove_bookmark);
-
-    connect (this, &file_editor::fetab_toggle_breakpoint,
-             f, &file_editor_tab::toggle_breakpoint);
-
-    connect (this, &file_editor::fetab_next_breakpoint,
-             f, &file_editor_tab::next_breakpoint);
-
-    connect (this, &file_editor::fetab_previous_breakpoint,
-             f, &file_editor_tab::previous_breakpoint);
-
-    connect (this, &file_editor::fetab_remove_all_breakpoints,
-             f, &file_editor_tab::remove_all_breakpoints);
-
-    connect (this, &file_editor::fetab_scintilla_command,
-             f, &file_editor_tab::scintilla_command);
-
-    connect (this, &file_editor::fetab_comment_selected_text,
-             f, &file_editor_tab::comment_selected_text);
-
-    connect (this, &file_editor::fetab_uncomment_selected_text,
-             f, &file_editor_tab::uncomment_selected_text);
-
-    connect (this, &file_editor::fetab_indent_selected_text,
-             f, &file_editor_tab::indent_selected_text);
-
-    connect (this, &file_editor::fetab_unindent_selected_text,
-             f, &file_editor_tab::unindent_selected_text);
-
-    connect (this, &file_editor::fetab_smart_indent_line_or_selected_text,
-             f, &file_editor_tab::smart_indent_line_or_selected_text);
-
-    connect (this, &file_editor::fetab_convert_eol,
-             f, &file_editor_tab::convert_eol);
-
-    connect (this, &file_editor::fetab_goto_line,
-             f, &file_editor_tab::goto_line);
-
-    connect (this, &file_editor::fetab_move_match_brace,
-             f, &file_editor_tab::move_match_brace);
-
-    connect (this, &file_editor::fetab_completion,
-             f, &file_editor_tab::show_auto_completion);
-
-    connect (this, &file_editor::fetab_set_focus,
-             f, &file_editor_tab::set_focus);
-
-    connect (this, &file_editor::fetab_insert_debugger_pointer,
-             f, &file_editor_tab::insert_debugger_pointer);
-
-    connect (this, &file_editor::fetab_delete_debugger_pointer,
-             f, &file_editor_tab::delete_debugger_pointer);
-
-    connect (this, &file_editor::fetab_do_breakpoint_marker,
-             f, &file_editor_tab::do_breakpoint_marker);
-
-    connect (this, &file_editor::update_gui_lexer_signal,
-             f, &file_editor_tab::update_lexer_settings);
-
-    // Convert other signals from the edit area and tab to editor signals.
-
-    connect (f->qsci_edit_area (), &octave_qscintilla::execute_command_in_terminal_signal,
-             this, &file_editor::execute_command_in_terminal_signal);
-
-    connect (f->qsci_edit_area (), &octave_qscintilla::focus_console_after_command_signal,
-             this, &file_editor::focus_console_after_command_signal);
-
-    connect (f, &file_editor_tab::run_file_signal,
-             this, &file_editor::run_file_signal);
-
-    connect (f, &file_editor_tab::edit_mfile_request,
-             this, &file_editor::edit_mfile_request);
-
-    connect (f, &file_editor_tab::debug_quit_signal,
-             this, &file_editor::debug_quit_signal);
-
-    // Any interpreter_event signal from a file_editor_tab_widget is
-    // handled the same as for the parent main_window object.
-
-    connect (f, QOverload<const fcn_callback&>::of (&file_editor_tab::interpreter_event),
-             this, QOverload<const fcn_callback&>::of (&file_editor::interpreter_event));
-
-    connect (f, QOverload<const meth_callback&>::of (&file_editor_tab::interpreter_event),
-             this, QOverload<const meth_callback&>::of (&file_editor::interpreter_event));
-
-    return f;
-  }
-
-  void file_editor::add_file_editor_tab (file_editor_tab *f, const QString& fn,
-                                         int index)
-  {
-    if (index == -1)
-      m_tab_widget->addTab (f, fn);
-    else
-      m_tab_widget->insertTab (index, f, fn);
-
-    m_tab_widget->setCurrentWidget (f);
-
-    check_actions ();
-  }
-
-  void file_editor::mru_menu_update ()
-  {
-    int num_files = qMin (m_mru_files.size (), int (MaxMRUFiles));
-
-    // configure and show active actions of mru-menu
-    for (int i = 0; i < num_files; ++i)
-      {
-        QString text = QString ("&%1 %2").
-          arg ((i+1) % int (MaxMRUFiles)).arg (m_mru_files.at (i));
-        m_mru_file_actions[i]->setText (text);
-
-        QStringList action_data;
-        action_data << m_mru_files.at (i) << m_mru_files_encodings.at (i);
-        m_mru_file_actions[i]->setData (action_data);
-
-        m_mru_file_actions[i]->setVisible (true);
-      }
-
-    // hide unused mru-menu entries
-    for (int j = num_files; j < MaxMRUFiles; ++j)
-      m_mru_file_actions[j]->setVisible (false);
-
-    // delete entries in string-list beyond MaxMRUFiles
-    while (m_mru_files.size () > MaxMRUFiles)
-      {
-        m_mru_files.removeLast ();
-        m_mru_files_encodings.removeLast ();
-      }
-
-    // save actual mru-list in settings
-
-    gui_settings settings;
-
-    settings.setValue (ed_mru_file_list.settings_key (),  m_mru_files);
-    settings.setValue (ed_mru_file_encodings.settings_key (),  m_mru_files_encodings);
-
-    settings.sync ();
-  }
-
-  bool file_editor::call_custom_editor (const QString& file_name, int line)
-  {
-    // Check if the user wants to use a custom file editor.
-
-    gui_settings settings;
-
-    if (settings.value (global_use_custom_editor.settings_key (),
-                         global_use_custom_editor.def ()).toBool ())
-      {
-        // use the external editor interface for handling the call
-        emit request_open_file_external (file_name, line);
-
-        if (line < 0 && ! file_name.isEmpty ())
-          handle_mru_add_file (QFileInfo (file_name).canonicalFilePath (),
-                               QString ());
-
-        return true;
-      }
-
-    return false;
-  }
-
-  void file_editor::toggle_preference (const gui_pref& preference)
-  {
-    gui_settings settings;
-
-    bool old = settings.bool_value (preference);
-    settings.setValue (preference.settings_key (), ! old);
-    notice_settings ();
-  }
-
-  // Function for closing the files in a removed directory
-  void file_editor::handle_dir_remove (const QString& old_name,
-                                       const QString& new_name)
-  {
-    QDir old_dir (old_name);
-    removed_file_data f_data;
-
-    std::list<file_editor_tab *> editor_tab_lst = m_tab_widget->tab_list ();
-
-    for (auto editor_tab : editor_tab_lst)
-      {
-        QString file_name = editor_tab->file_name ();
-
-        if (file_name.isEmpty ())
-          continue;   // Nothing to do, no valid file name
-
-        // Get abs. file path and its path relative to the removed directory
-        QString rel_path_to_file = old_dir.relativeFilePath (file_name);
-        QString abs_path_to_file = old_dir.absoluteFilePath (file_name);
-
-        // Test whether the file is located within the directory that will
-        // be removed.  For this, two conditions must be met:
-        // 1. The path of the file rel. to the dir is not equal to the
-        //    its absolute one.
-        //    If both are equal, then there is no relative path and removed
-        //    directory and file are on different drives (e.g. on windows)
-        // 2. The (real) relative path does not start with "../", i.e.,
-        //    the file can be reached from the directory by descending only
-        if ((rel_path_to_file != abs_path_to_file)
-            && (rel_path_to_file.left (3) != QString ("../")))
-          {
-            // The currently considered file is included in the
-            // removed/renamed diectory: remeber it
-            if (editor_tab)
-              {
-                editor_tab->enable_file_watcher (false);
-                f_data.editor_tab = editor_tab;
-
-                // Add the new file path and the encoding for later reloading
-                // if new_name is given
-                if (! new_name.isEmpty ())
-                  {
-                    QDir new_dir (new_name);
-                    QString append_to_new_dir;
-                    if (new_dir.exists ())
-                      {
-                        // The new directory already exists (movefile was used).
-                        // This means, we have to add the name (not the path)
-                        // of the old dir and the relative path to the file
-                        // to new dir.
-                        append_to_new_dir
-                          = old_dir.dirName () + "/" + rel_path_to_file;
-                      }
-                    else
-                      append_to_new_dir = rel_path_to_file;
-
-                    f_data.new_file_name
-                      = new_dir.absoluteFilePath (append_to_new_dir);
-                  }
-                else
-                  f_data.new_file_name = ""; // no new name, just removing this file
-
-                // Store data in list for later reloading
-                m_tmp_closed_files << f_data;
-              }
-          }
-      }
-  }
-
-  bool file_editor::editor_tab_has_focus ()
-  {
-    QWidget *foc_w = focusWidget ();
-    if (foc_w && foc_w->inherits ("octave::octave_qscintilla"))
+                }
+
+              if (QFile::exists (openFileName))
+                {
+                  // File not readable:
+                  // create a NonModal message about error.
+                  QMessageBox *msgBox
+                    = new QMessageBox (QMessageBox::Critical,
+                                       tr ("Octave Editor"),
+                                       tr ("Could not open file\n%1\nfor read: %2.").
+                                       arg (openFileName).arg (result),
+                                       QMessageBox::Ok, this);
+
+                  msgBox->setWindowModality (Qt::NonModal);
+                  msgBox->setAttribute (Qt::WA_DeleteOnClose);
+                  msgBox->show ();
+                }
+              else
+                {
+                  // File does not exist, should it be created?
+                  bool create_file = true;
+                  QMessageBox *msgBox;
+
+                  if (! settings.bool_value (ed_create_new_file))
+                    {
+                      msgBox = new QMessageBox (QMessageBox::Question,
+                                                tr ("Octave Editor"),
+                                                tr ("File\n%1\ndoes not exist. "
+                                                    "Do you want to create it?").arg (openFileName),
+                                                QMessageBox::NoButton, nullptr);
+                      QPushButton *create_button =
+                        msgBox->addButton (tr ("Create"), QMessageBox::YesRole);
+                      msgBox->addButton (tr ("Cancel"), QMessageBox::RejectRole);
+                      msgBox->setDefaultButton (create_button);
+                      msgBox->exec ();
+
+                      QAbstractButton *clicked_button = msgBox->clickedButton ();
+                      if (clicked_button != create_button)
+                        create_file = false;
+
+                      delete msgBox;
+                    }
+
+                  if (create_file)
+                    {
+                      // create the file and call the editor again
+                      QFile file (openFileName);
+                      if (! file.open (QIODevice::WriteOnly))
+                        {
+                          // error opening the file
+                          msgBox = new QMessageBox (QMessageBox::Critical,
+                                                    tr ("Octave Editor"),
+                                                    tr ("Could not open file\n%1\nfor write: %2.").
+                                                    arg (openFileName).arg (file.errorString ()),
+                                                    QMessageBox::Ok, this);
+
+                          msgBox->setWindowModality (Qt::NonModal);
+                          msgBox->setAttribute (Qt::WA_DeleteOnClose);
+                          msgBox->show ();
+                        }
+                      else
+                        {
+                          file.close ();
+                          request_open_file (openFileName);
+                        }
+                    }
+                }
+            }
+
+          if (! bookmarks.isEmpty ())
+            {
+              // Restore bookmarks
+              for (const auto& bms : bookmarks.split (','))
+                {
+                  int bm = bms.toInt ();
+                  if (fileEditorTab)
+                    fileEditorTab->qsci_edit_area ()->markerAdd (bm, marker::bookmark);
+                }
+            }
+
+          if (! ((breakpoint_marker || debug_pointer) && is_editor_console_tabbed ()))
+            {
+              // update breakpoint pointers, really show editor
+              // and the current editor tab
+              if (fileEditorTab)
+                fileEditorTab->update_breakpoints ();
+              activate ();
+              emit file_loaded_signal ();
+            }
+        }
+    }
+}
+
+void file_editor::request_preferences (bool)
+{
+  emit request_settings_dialog ("editor");
+}
+
+void file_editor::request_styles_preferences (bool)
+{
+  emit request_settings_dialog ("editor_styles");
+}
+
+void file_editor::show_line_numbers (bool)
+{
+  toggle_preference (ed_show_line_numbers);
+}
+
+void file_editor::show_white_space (bool)
+{
+  toggle_preference (ed_show_white_space);
+}
+
+void file_editor::show_eol_chars (bool)
+{
+  toggle_preference (ed_show_eol_chars);
+}
+
+void file_editor::show_indent_guides (bool)
+{
+  toggle_preference (ed_show_indent_guides);
+}
+
+void file_editor::show_long_line (bool)
+{
+  toggle_preference (ed_long_line_marker);
+}
+
+void file_editor::show_toolbar (bool)
+{
+  toggle_preference (ed_show_toolbar);
+}
+
+void file_editor::show_statusbar (bool)
+{
+  toggle_preference (ed_show_edit_status_bar);
+}
+
+void file_editor::show_hscrollbar (bool)
+{
+  toggle_preference (ed_show_hscroll_bar);
+}
+
+void file_editor::zoom_in (bool)
+{
+  emit fetab_zoom_in (m_tab_widget->currentWidget ());
+}
+
+void file_editor::zoom_out (bool)
+{
+  emit fetab_zoom_out (m_tab_widget->currentWidget ());
+}
+
+void file_editor::zoom_normal (bool)
+{
+  emit fetab_zoom_normal (m_tab_widget->currentWidget ());
+}
+
+void file_editor::create_context_menu (QMenu *menu)
+{
+  // remove all standard actions from scintilla
+  QList<QAction *> all_actions = menu->actions ();
+
+  for (auto *a : all_actions)
+    menu->removeAction (a);
+
+  // add editor's actions with icons and customized shortcuts
+  menu->addAction (m_cut_action);
+  menu->addAction (m_copy_action);
+  menu->addAction (m_paste_action);
+  menu->addSeparator ();
+  menu->addAction (m_selectall_action);
+  menu->addSeparator ();
+  menu->addAction (m_find_files_action);
+  menu->addAction (m_find_action);
+  menu->addAction (m_find_next_action);
+  menu->addAction (m_find_previous_action);
+  menu->addSeparator ();
+  menu->addMenu (m_edit_cmd_menu);
+  menu->addMenu (m_edit_fmt_menu);
+  menu->addMenu (m_edit_nav_menu);
+  menu->addSeparator ();
+  menu->addAction (m_run_selection_action);
+}
+
+void file_editor::edit_status_update (bool undo, bool redo)
+{
+  if (m_undo_action)
+    m_undo_action->setEnabled (undo);
+  m_redo_action->setEnabled (redo);
+}
+
+// handler for the close event
+void file_editor::closeEvent (QCloseEvent *e)
+{
+  gui_settings settings;
+
+  if (settings.bool_value (ed_hiding_closes_files))
+    {
+      if (check_closing ())
+        {
+          // All tabs are closed without cancelling,
+          // store closing state for restoring session when shown again.
+          // Editor is closing when session data is stored in preferences
+          m_closed = true;
+          e->ignore ();
+        }
+      else
+        {
+          e->ignore ();
+          return;
+        }
+    }
+  else
+    e->accept ();
+
+  octave_dock_widget::closeEvent (e);
+}
+
+void file_editor::dragEnterEvent (QDragEnterEvent *e)
+{
+  if (e->mimeData ()->hasUrls ())
+    {
+      e->acceptProposedAction ();
+    }
+}
+
+void file_editor::dropEvent (QDropEvent *e)
+{
+  if (e->mimeData ()->hasUrls ())
+    {
+      for (const auto& url : e->mimeData ()->urls ())
+        request_open_file (url.toLocalFile ());
+    }
+}
+
+bool file_editor::is_editor_console_tabbed ()
+{
+  // FIXME: is there a way to do this job that doesn't require casting
+  // the parent to a main_window object?
+
+  main_window *w = dynamic_cast<main_window *> (parentWidget ());
+
+  if (w)
+    {
+      QList<QDockWidget *> w_list = w->tabifiedDockWidgets (this);
+      QDockWidget *console =
+        static_cast<QDockWidget *> (w->get_dock_widget_list ().at (0));
+
+      for (int i = 0; i < w_list.count (); i++)
+        {
+          if (w_list.at (i) == console)
+            return true;
+        }
+    }
+
+  return false;
+}
+
+void file_editor::construct ()
+{
+  QWidget *editor_widget = new QWidget (this);
+
+  // FIXME: what was the intended purpose of this unused variable?
+  // QStyle *editor_style = QApplication::style ();
+
+  // Menu bar: do not set it native, required in macOS and Ubuntu Unity (Qt5)
+  // for a visible menu bar in the editor widget.  This property is ignored
+  // on other platforms.
+  m_menu_bar = new QMenuBar (editor_widget);
+  m_menu_bar->setNativeMenuBar (false);
+
+  m_tool_bar = new QToolBar (editor_widget);
+  m_tool_bar->setMovable (true);
+
+  m_tab_widget = new file_editor_tab_widget (editor_widget, this);
+
+  // the mru-list and an empty array of actions
+
+  gui_settings settings;
+
+  m_mru_files = settings.string_list_value (ed_mru_file_list);
+  m_mru_files_encodings = settings.string_list_value (ed_mru_file_encodings);
+
+  if (m_mru_files_encodings.count () != m_mru_files.count ())
+    {
+      // encodings don't have the same count -> do not use them!
+      m_mru_files_encodings = QStringList ();
+      for (int i = 0; i < m_mru_files.count (); i++)
+        m_mru_files_encodings << QString ();
+    }
+
+  for (int i = 0; i < MaxMRUFiles; ++i)
+    {
+      m_mru_file_actions[i] = new QAction (this);
+      m_mru_file_actions[i]->setVisible (false);
+    }
+
+  // menu bar
+
+  // file menu
+
+  m_fileMenu = add_menu (m_menu_bar, tr ("&File"));
+
+  // new and open menus are inserted later by the main window
+  m_mru_file_menu = new QMenu (tr ("&Recent Editor Files"), m_fileMenu);
+  for (int i = 0; i < MaxMRUFiles; ++i)
+    m_mru_file_menu->addAction (m_mru_file_actions[i]);
+  m_fileMenu->addMenu (m_mru_file_menu);
+
+  m_fileMenu->addSeparator ();
+
+  m_edit_function_action
+    = add_action (m_fileMenu,
+                  tr ("&Edit Function"),
+                  SLOT (request_context_edit (bool)));
+
+  m_fileMenu->addSeparator ();
+
+  m_save_action
+    = add_action (m_fileMenu, settings.icon ("document-save"),
+                  tr ("&Save File"), SLOT (request_save_file (bool)));
+
+  m_save_as_action
+    = add_action (m_fileMenu, settings.icon ("document-save-as"),
+                  tr ("Save File &As..."),
+                  SLOT (request_save_file_as (bool)));
+
+  m_fileMenu->addSeparator ();
+
+  m_close_action
+    = add_action (m_fileMenu, settings.icon ("window-close", false),
+                  tr ("&Close"), SLOT (request_close_file (bool)));
+
+  m_close_all_action
+    = add_action (m_fileMenu, settings.icon ("window-close", false),
+                  tr ("Close All"), SLOT (request_close_all_files (bool)));
+
+  m_close_others_action
+    = add_action (m_fileMenu, settings.icon ("window-close", false),
+                  tr ("Close Other Files"),
+                  SLOT (request_close_other_files (bool)));
+
+  m_fileMenu->addSeparator ();
+
+  m_print_action
+    = add_action (m_fileMenu, settings.icon ("document-print"),
+                  tr ("Print..."), SLOT (request_print_file (bool)));
+
+  // edit menu (undo, copy, paste and select all later via main window)
+
+  m_edit_menu = add_menu (m_menu_bar, tr ("&Edit"));
+
+  m_redo_action
+    = add_action (m_edit_menu, settings.icon ("edit-redo"),
+                  tr ("&Redo"), SLOT (request_redo (bool)));
+  m_redo_action->setEnabled (false);
+
+  m_edit_menu->addSeparator ();
+
+  m_cut_action
+    = add_action (m_edit_menu, settings.icon ("edit-cut"),
+                  tr ("Cu&t"), SLOT (request_cut (bool)));
+  m_cut_action->setEnabled (false);
+
+  m_find_action
+    = add_action (m_edit_menu, settings.icon ("edit-find-replace"),
+                  tr ("&Find and Replace..."), SLOT (request_find (bool)));
+
+  m_find_next_action
+    = add_action (m_edit_menu, tr ("Find &Next..."),
+                  SLOT (request_find_next (bool)));
+
+  m_find_previous_action
+    = add_action (m_edit_menu, tr ("Find &Previous..."),
+                  SLOT (request_find_previous (bool)));
+
+  m_edit_menu->addSeparator ();
+
+  m_edit_cmd_menu = m_edit_menu->addMenu (tr ("&Commands"));
+
+  m_delete_line_action
+    = add_action (m_edit_cmd_menu, tr ("Delete Line"),
+                  SLOT (request_delete_line (bool)));
+
+  m_copy_line_action
+    = add_action (m_edit_cmd_menu, tr ("Copy Line"),
+                  SLOT (request_copy_line (bool)));
+
+  m_cut_line_action
+    = add_action (m_edit_cmd_menu, tr ("Cut Line"),
+                  SLOT (request_cut_line (bool)));
+
+  m_edit_cmd_menu->addSeparator ();
+
+  m_delete_start_word_action
+    = add_action (m_edit_cmd_menu, tr ("Delete to Start of Word"),
+                  SLOT (request_delete_start_word (bool)));
+
+  m_delete_end_word_action
+    = add_action (m_edit_cmd_menu, tr ("Delete to End of Word"),
+                  SLOT (request_delete_end_word (bool)));
+
+  m_delete_start_line_action
+    = add_action (m_edit_cmd_menu, tr ("Delete to Start of Line"),
+                  SLOT (request_delete_start_line (bool)));
+
+  m_delete_end_line_action
+    = add_action (m_edit_cmd_menu, tr ("Delete to End of Line"),
+                  SLOT (request_delete_end_line (bool)));
+
+  m_edit_cmd_menu->addSeparator ();
+
+  m_duplicate_selection_action
+    = add_action (m_edit_cmd_menu, tr ("Duplicate Selection/Line"),
+                  SLOT (request_duplicate_selection (bool)));
+
+  m_transpose_line_action
+    = add_action (m_edit_cmd_menu, tr ("Transpose Line"),
+                  SLOT (request_transpose_line (bool)));
+
+  m_edit_cmd_menu->addSeparator ();
+
+  m_completion_action
+    = add_action (m_edit_cmd_menu, tr ("&Show Completion List"),
+                  SLOT (request_completion (bool)));
+
+  m_edit_fmt_menu = m_edit_menu->addMenu (tr ("&Format"));
+
+  m_upper_case_action
+    = add_action (m_edit_fmt_menu, tr ("&Uppercase Selection"),
+                  SLOT (request_upper_case (bool)));
+
+  m_lower_case_action
+    = add_action (m_edit_fmt_menu, tr ("&Lowercase Selection"),
+                  SLOT (request_lower_case (bool)));
+
+  m_edit_fmt_menu->addSeparator ();
+
+  m_comment_selection_action
+    = add_action (m_edit_fmt_menu, tr ("&Comment"),
+                  SLOT (request_comment_selected_text (bool)));
+
+  m_uncomment_selection_action
+    = add_action (m_edit_fmt_menu, tr ("&Uncomment"),
+                  SLOT (request_uncomment_selected_text (bool)));
+
+  m_comment_var_selection_action
+    = add_action (m_edit_fmt_menu, tr ("Comment (Choosing String)"),
+                  SLOT (request_comment_var_selected_text (bool)));
+
+  m_edit_fmt_menu->addSeparator ();
+
+  m_indent_selection_action
+    = add_action (m_edit_fmt_menu, tr ("&Indent Selection Rigidly"),
+                  SLOT (request_indent_selected_text (bool)));
+
+  m_unindent_selection_action
+    = add_action (m_edit_fmt_menu, tr ("&Unindent Selection Rigidly"),
+                  SLOT (request_unindent_selected_text (bool)));
+
+  m_smart_indent_line_or_selection_action
+    = add_action (m_edit_fmt_menu, tr ("Indent Code"),
+                  SLOT (request_smart_indent_line_or_selected_text ()));
+
+  m_edit_fmt_menu->addSeparator ();
+
+  m_conv_eol_windows_action
+    = add_action (m_edit_fmt_menu,
+                  tr ("Convert Line Endings to &Windows (CRLF)"),
+                  SLOT (request_conv_eol_windows (bool)));
+
+  m_conv_eol_unix_action
+    = add_action (m_edit_fmt_menu, tr ("Convert Line Endings to &Unix (LF)"),
+                  SLOT (request_conv_eol_unix (bool)));
+
+  m_conv_eol_mac_action
+    = add_action (m_edit_fmt_menu,
+                  tr ("Convert Line Endings to Legacy &Mac (CR)"),
+                  SLOT (request_conv_eol_mac (bool)));
+
+  m_edit_nav_menu = m_edit_menu->addMenu (tr ("Navi&gation"));
+
+  m_goto_line_action
+    = add_action (m_edit_nav_menu, tr ("Go &to Line..."),
+                  SLOT (request_goto_line (bool)));
+
+  m_edit_cmd_menu->addSeparator ();
+
+  m_move_to_matching_brace
+    = add_action (m_edit_nav_menu, tr ("Move to Matching Brace"),
+                  SLOT (request_move_match_brace (bool)));
+
+  m_sel_to_matching_brace
+    = add_action (m_edit_nav_menu, tr ("Select to Matching Brace"),
+                  SLOT (request_sel_match_brace (bool)));
+
+  m_edit_nav_menu->addSeparator ();
+
+  m_next_bookmark_action
+    = add_action (m_edit_nav_menu, tr ("&Next Bookmark"),
+                  SLOT (request_next_bookmark (bool)));
+
+  m_previous_bookmark_action
+    = add_action (m_edit_nav_menu, tr ("Pre&vious Bookmark"),
+                  SLOT (request_previous_bookmark (bool)));
+
+  m_toggle_bookmark_action
+    = add_action (m_edit_nav_menu, tr ("Toggle &Bookmark"),
+                  SLOT (request_toggle_bookmark (bool)));
+
+  m_remove_bookmark_action
+    = add_action (m_edit_nav_menu, tr ("&Remove All Bookmarks"),
+                  SLOT (request_remove_bookmark (bool)));
+
+  m_edit_menu->addSeparator ();
+
+  m_preferences_action
+    = add_action (m_edit_menu, settings.icon ("preferences-system"),
+                  tr ("&Preferences..."),
+                  SLOT (request_preferences (bool)));
+
+  m_styles_preferences_action
+    = add_action (m_edit_menu, settings.icon ("preferences-system"),
+                  tr ("&Styles Preferences..."),
+                  SLOT (request_styles_preferences (bool)));
+
+  // view menu
+
+  QMenu *view_menu = add_menu (m_menu_bar, tr ("&View"));
+
+  m_view_editor_menu = view_menu->addMenu (tr ("&Editor"));
+
+  m_show_linenum_action
+    = add_action (m_view_editor_menu, tr ("Show &Line Numbers"),
+                  SLOT (show_line_numbers (bool)));
+  m_show_linenum_action->setCheckable (true);
+
+  m_show_whitespace_action
+    = add_action (m_view_editor_menu, tr ("Show &Whitespace Characters"),
+                  SLOT (show_white_space (bool)));
+  m_show_whitespace_action->setCheckable (true);
+
+  m_show_eol_action
+    = add_action (m_view_editor_menu, tr ("Show Line &Endings"),
+                  SLOT (show_eol_chars (bool)));
+  m_show_eol_action->setCheckable (true);
+
+  m_show_indguide_action
+    = add_action (m_view_editor_menu, tr ("Show &Indentation Guides"),
+                  SLOT (show_indent_guides (bool)));
+  m_show_indguide_action->setCheckable (true);
+
+  m_show_longline_action
+    = add_action (m_view_editor_menu, tr ("Show Long Line &Marker"),
+                  SLOT (show_long_line (bool)));
+  m_show_longline_action->setCheckable (true);
+
+  m_view_editor_menu->addSeparator ();
+
+  m_show_toolbar_action
+    = add_action (m_view_editor_menu, tr ("Show &Toolbar"),
+                  SLOT (show_toolbar (bool)));
+  m_show_toolbar_action->setCheckable (true);
+
+  m_show_statusbar_action
+    = add_action (m_view_editor_menu, tr ("Show &Statusbar"),
+                  SLOT (show_statusbar (bool)));
+  m_show_statusbar_action->setCheckable (true);
+
+  m_show_hscrollbar_action
+    = add_action (m_view_editor_menu, tr ("Show &Horizontal Scrollbar"),
+                  SLOT (show_hscrollbar (bool)));
+  m_show_hscrollbar_action->setCheckable (true);
+
+  view_menu->addSeparator ();
+
+  m_zoom_in_action
+    = add_action (view_menu, settings.icon ("view-zoom-in"), tr ("Zoom &In"),
+                  SLOT (zoom_in (bool)));
+
+  m_zoom_out_action
+    = add_action (view_menu, settings.icon ("view-zoom-out"),
+                  tr ("Zoom &Out"), SLOT (zoom_out (bool)));
+
+  m_zoom_normal_action
+    = add_action (view_menu, settings.icon ("view-zoom-original"),
+                  tr ("&Normal Size"), SLOT (zoom_normal (bool)));
+
+  view_menu->addSeparator ();
+
+  m_sort_tabs_action
+    = add_action (view_menu, tr ("&Sort Tabs Alphabetically"),
+                  SLOT (sort_tabs_alph ()),
+                  m_tab_widget->get_tab_bar ());
+
+  m_menu_bar->addMenu (view_menu);
+
+  // debug menu
+
+  m_debug_menu = add_menu (m_menu_bar, tr ("&Debug"));
+
+  m_toggle_breakpoint_action
+    = add_action (m_debug_menu, settings.icon ("bp-toggle"),
+                  tr ("Toggle &Breakpoint"),
+                  SLOT (request_toggle_breakpoint (bool)));
+
+  m_next_breakpoint_action
+    = add_action (m_debug_menu, settings.icon ("bp-next"),
+                  tr ("&Next Breakpoint"),
+                  SLOT (request_next_breakpoint (bool)));
+
+  m_previous_breakpoint_action
+    = add_action (m_debug_menu, settings.icon ("bp-prev"),
+                  tr ("Pre&vious Breakpoint"),
+                  SLOT (request_previous_breakpoint (bool)));
+
+  m_remove_all_breakpoints_action
+    = add_action (m_debug_menu, settings.icon ("bp-rm-all"),
+                  tr ("&Remove All Breakpoints"),
+                  SLOT (request_remove_breakpoint (bool)));
+
+  m_debug_menu->addSeparator ();
+
+  // The other debug actions will be added by the main window.
+
+  // run menu
+
+  QMenu *_run_menu = add_menu (m_menu_bar, tr ("&Run"));
+
+  m_run_action
+    = add_action (_run_menu,
+                  settings.icon ("system-run"),
+                  tr ("Save File and Run / Continue"),
+                  SLOT (request_run_file (bool)));
+
+  m_run_selection_action
+    = add_action (_run_menu,
+                  tr ("Run &Selection"),
+                  SLOT (request_context_run (bool)));
+  m_run_selection_action->setEnabled (false);
+
+  // help menu
+
+  QMenu *_help_menu = add_menu (m_menu_bar, tr ("&Help"));
+
+  m_context_help_action
+    = add_action (_help_menu,
+                  tr ("&Help on Keyword"),
+                  SLOT (request_context_help (bool)));
+
+  m_context_doc_action
+    = add_action (_help_menu,
+                  tr ("&Documentation on Keyword"),
+                  SLOT (request_context_doc (bool)));
+
+  // tab navigation (no menu, only actions; slots in tab_bar)
+
+  m_switch_left_tab_action
+    = add_action (nullptr, "", SLOT (switch_left_tab ()),
+                  m_tab_widget->get_tab_bar ());
+
+  m_switch_right_tab_action
+    = add_action (nullptr, "", SLOT (switch_right_tab ()),
+                  m_tab_widget->get_tab_bar ());
+
+  m_move_tab_left_action
+    = add_action (nullptr, "", SLOT (move_tab_left ()),
+                  m_tab_widget->get_tab_bar ());
+
+  m_move_tab_right_action
+    = add_action (nullptr, "", SLOT (move_tab_right ()),
+                  m_tab_widget->get_tab_bar ());
+
+  // toolbar
+
+  // popdown menu with mru files
+  QToolButton *popdown_button = new QToolButton ();
+  popdown_button->setToolTip (tr ("Recent Files"));
+  popdown_button->setMenu (m_mru_file_menu);
+  popdown_button->setPopupMode (QToolButton::InstantPopup);
+  popdown_button->setArrowType (Qt::DownArrow);
+  popdown_button->setToolButtonStyle (Qt::ToolButtonTextOnly);
+
+  // new and open actions are inserted later from main window
+  m_popdown_mru_action = m_tool_bar->addWidget (popdown_button);
+  m_tool_bar->addAction (m_save_action);
+  m_tool_bar->addAction (m_save_as_action);
+  m_tool_bar->addAction (m_print_action);
+  m_tool_bar->addSeparator ();
+  // m_undo_action: later via main window
+  m_tool_bar->addAction (m_redo_action);
+  m_tool_bar->addSeparator ();
+  m_tool_bar->addAction (m_cut_action);
+  // m_copy_action: later via the main window
+  // m_paste_action: later via the main window
+  m_tool_bar->addAction (m_find_action);
+  //m_tool_bar->addAction (m_find_next_action);
+  //m_tool_bar->addAction (m_find_previous_action);
+  m_tool_bar->addSeparator ();
+  m_tool_bar->addAction (m_run_action);
+  m_tool_bar->addSeparator ();
+  m_tool_bar->addAction (m_toggle_breakpoint_action);
+  m_tool_bar->addAction (m_previous_breakpoint_action);
+  m_tool_bar->addAction (m_next_breakpoint_action);
+  m_tool_bar->addAction (m_remove_all_breakpoints_action);
+
+  // layout
+  QVBoxLayout *vbox_layout = new QVBoxLayout ();
+  vbox_layout->addWidget (m_menu_bar);
+  vbox_layout->addWidget (m_tool_bar);
+  vbox_layout->addWidget (m_tab_widget);
+  vbox_layout->setMargin (0);
+  vbox_layout->setSpacing (0);
+  editor_widget->setLayout (vbox_layout);
+  setWidget (editor_widget);
+
+  // Create the basic context menu of the tab bar with editor actions.
+  // Actions for selecting an tab are added when the menu is activated.
+  tab_bar *bar = m_tab_widget->get_tab_bar ();
+  QMenu *ctx_men = bar->get_context_menu ();
+  ctx_men->addSeparator ();
+  ctx_men->addAction (m_close_action);
+  ctx_men->addAction (m_close_all_action);
+  ctx_men->addAction (m_close_others_action);
+  ctx_men->addSeparator ();
+  ctx_men->addAction (m_sort_tabs_action);
+  add_action (ctx_men, tr ("Copy Full File &Path"),
+              SLOT (copy_full_file_path (bool)), this);
+
+  // signals
+  connect (m_mru_file_menu, &QMenu::triggered,
+           this, &file_editor::request_mru_open_file);
+
+  mru_menu_update ();
+
+  connect (m_tab_widget, &file_editor_tab_widget::tabCloseRequested,
+           this, &file_editor::handle_tab_close_request);
+
+  connect (m_tab_widget, &file_editor_tab_widget::currentChanged,
+           this, &file_editor::active_tab_changed);
+
+  resize (500, 400);
+  set_title (tr ("Editor"));
+
+  check_actions ();
+}
+
+// Slot when autocompletion list was cancelled
+void file_editor::handle_autoc_cancelled ()
+{
+  // List was cancelled but somehow still active and blocking the
+  // edit area from accepting shortcuts. Only after another keypress
+  // shortcuts and lists are working againnas expected. This is
+  // probably caused by qt bug https://bugreports.qt.io/browse/QTBUG-83720
+  // Hack: Accept the list, which is hidden but still active
+  //       and undo the text insertion, if any
+
+  file_editor_tab *f = reset_focus ();
+  octave_qscintilla *qsci = f->qsci_edit_area ();
+
+  int line, col;
+  qsci->getCursorPosition (&line, &col);
+  int l1 = qsci->lineLength (line); // Current line length
+
+  // Accept autocompletion
+  qsci->SendScintilla (QsciScintillaBase::SCI_AUTOCCOMPLETE);
+
+  // Was text inserted? If yes, undo
+  if (qsci->text (line).length () - l1)
+    qsci->undo ();
+}
+
+file_editor_tab *file_editor::reset_focus ()
+{
+  // Reset the focus of the tab and the related edit area
+  file_editor_tab *f
+    = static_cast<file_editor_tab *> (m_tab_widget->currentWidget ());
+  emit fetab_set_focus (f);
+  return f;
+}
+
+file_editor_tab *
+file_editor::make_file_editor_tab (const QString& directory)
+{
+  file_editor_tab *f = new file_editor_tab (directory);
+
+  // signals from the qscintilla edit area
+  connect (f->qsci_edit_area (), &octave_qscintilla::show_symbol_tooltip_signal,
+           this, &file_editor::show_symbol_tooltip_signal);
+
+  connect (f->qsci_edit_area (), &octave_qscintilla::status_update,
+           this, &file_editor::edit_status_update);
+
+  connect (f->qsci_edit_area (), &octave_qscintilla::create_context_menu_signal,
+           this, &file_editor::create_context_menu);
+
+  connect (f->qsci_edit_area (),
+           SIGNAL (SCN_AUTOCCOMPLETED (const char *, int, int, int)),
+           this, SLOT (reset_focus ()));
+
+  connect (f->qsci_edit_area (), SIGNAL (SCN_AUTOCCANCELLED ()),
+           this, SLOT (handle_autoc_cancelled ()));
+
+  // signals from the qscintilla edit area
+  connect (this, &file_editor::enter_debug_mode_signal,
+           f->qsci_edit_area (), &octave_qscintilla::handle_enter_debug_mode);
+
+  connect (this, &file_editor::exit_debug_mode_signal,
+           f->qsci_edit_area (), &octave_qscintilla::handle_exit_debug_mode);
+
+  // Signals from the file editor_tab
+  connect (f, &file_editor_tab::autoc_closed,
+           this, &file_editor::reset_focus);
+
+  connect (f, &file_editor_tab::file_name_changed,
+           this, &file_editor::handle_file_name_changed);
+
+  connect (f, &file_editor_tab::editor_state_changed,
+           this, &file_editor::handle_editor_state_changed);
+
+  connect (f, &file_editor_tab::tab_remove_request,
+           this, &file_editor::handle_tab_remove_request);
+
+  connect (f, &file_editor_tab::editor_check_conflict_save,
+           this, &file_editor::check_conflict_save);
+
+  connect (f, &file_editor_tab::mru_add_file,
+           this, &file_editor::handle_mru_add_file);
+
+  connect (f, &file_editor_tab::request_open_file,
+           this, [=] (const QString& fname, const QString& encoding) { request_open_file (fname, encoding); });
+
+  connect (f, &file_editor_tab::edit_area_changed,
+           this, &file_editor::edit_area_changed);
+
+  connect (f, &file_editor_tab::set_focus_editor_signal,
+           this, &file_editor::set_focus);
+
+  // Signals from the file_editor or main-win non-trivial operations
+  connect (this, &file_editor::fetab_settings_changed,
+           f, [=] () { f->notice_settings (); });
+
+  connect (this, &file_editor::fetab_change_request,
+           f, &file_editor_tab::change_editor_state);
+
+  connect (this, QOverload<const QWidget *, const QString&, bool>::of (&file_editor::fetab_save_file),
+           f, QOverload<const QWidget *, const QString&, bool>::of (&file_editor_tab::save_file));
+
+  // Signals from the file_editor trivial operations
+  connect (this, &file_editor::fetab_recover_from_exit,
+           f, &file_editor_tab::recover_from_exit);
+
+  connect (this, &file_editor::fetab_set_directory,
+           f, &file_editor_tab::set_current_directory);
+
+  connect (this, &file_editor::fetab_zoom_in,
+           f, &file_editor_tab::zoom_in);
+  connect (this, &file_editor::fetab_zoom_out,
+           f, &file_editor_tab::zoom_out);
+  connect (this, &file_editor::fetab_zoom_normal,
+           f, &file_editor_tab::zoom_normal);
+
+  connect (this, &file_editor::fetab_context_help,
+           f, &file_editor_tab::context_help);
+
+  connect (this, &file_editor::fetab_context_edit,
+           f, &file_editor_tab::context_edit);
+
+  connect (this, QOverload<const QWidget *>::of (&file_editor::fetab_save_file),
+           f, QOverload<const QWidget *>::of (&file_editor_tab::save_file));
+
+  connect (this, &file_editor::fetab_save_file_as,
+           f, QOverload<const QWidget *>::of (&file_editor_tab::save_file_as));
+
+  connect (this, &file_editor::fetab_print_file,
+           f, &file_editor_tab::print_file);
+
+  connect (this, &file_editor::fetab_run_file,
+           f, &file_editor_tab::run_file);
+
+  connect (this, &file_editor::fetab_context_run,
+           f, &file_editor_tab::context_run);
+
+  connect (this, &file_editor::fetab_toggle_bookmark,
+           f, &file_editor_tab::toggle_bookmark);
+
+  connect (this, &file_editor::fetab_next_bookmark,
+           f, &file_editor_tab::next_bookmark);
+
+  connect (this, &file_editor::fetab_previous_bookmark,
+           f, &file_editor_tab::previous_bookmark);
+
+  connect (this, &file_editor::fetab_remove_bookmark,
+           f, &file_editor_tab::remove_bookmark);
+
+  connect (this, &file_editor::fetab_toggle_breakpoint,
+           f, &file_editor_tab::toggle_breakpoint);
+
+  connect (this, &file_editor::fetab_next_breakpoint,
+           f, &file_editor_tab::next_breakpoint);
+
+  connect (this, &file_editor::fetab_previous_breakpoint,
+           f, &file_editor_tab::previous_breakpoint);
+
+  connect (this, &file_editor::fetab_remove_all_breakpoints,
+           f, &file_editor_tab::remove_all_breakpoints);
+
+  connect (this, &file_editor::fetab_scintilla_command,
+           f, &file_editor_tab::scintilla_command);
+
+  connect (this, &file_editor::fetab_comment_selected_text,
+           f, &file_editor_tab::comment_selected_text);
+
+  connect (this, &file_editor::fetab_uncomment_selected_text,
+           f, &file_editor_tab::uncomment_selected_text);
+
+  connect (this, &file_editor::fetab_indent_selected_text,
+           f, &file_editor_tab::indent_selected_text);
+
+  connect (this, &file_editor::fetab_unindent_selected_text,
+           f, &file_editor_tab::unindent_selected_text);
+
+  connect (this, &file_editor::fetab_smart_indent_line_or_selected_text,
+           f, &file_editor_tab::smart_indent_line_or_selected_text);
+
+  connect (this, &file_editor::fetab_convert_eol,
+           f, &file_editor_tab::convert_eol);
+
+  connect (this, &file_editor::fetab_goto_line,
+           f, &file_editor_tab::goto_line);
+
+  connect (this, &file_editor::fetab_move_match_brace,
+           f, &file_editor_tab::move_match_brace);
+
+  connect (this, &file_editor::fetab_completion,
+           f, &file_editor_tab::show_auto_completion);
+
+  connect (this, &file_editor::fetab_set_focus,
+           f, &file_editor_tab::set_focus);
+
+  connect (this, &file_editor::fetab_insert_debugger_pointer,
+           f, &file_editor_tab::insert_debugger_pointer);
+
+  connect (this, &file_editor::fetab_delete_debugger_pointer,
+           f, &file_editor_tab::delete_debugger_pointer);
+
+  connect (this, &file_editor::fetab_do_breakpoint_marker,
+           f, &file_editor_tab::do_breakpoint_marker);
+
+  connect (this, &file_editor::update_gui_lexer_signal,
+           f, &file_editor_tab::update_lexer_settings);
+
+  // Convert other signals from the edit area and tab to editor signals.
+
+  connect (f->qsci_edit_area (), &octave_qscintilla::execute_command_in_terminal_signal,
+           this, &file_editor::execute_command_in_terminal_signal);
+
+  connect (f->qsci_edit_area (), &octave_qscintilla::focus_console_after_command_signal,
+           this, &file_editor::focus_console_after_command_signal);
+
+  connect (f, &file_editor_tab::run_file_signal,
+           this, &file_editor::run_file_signal);
+
+  connect (f, &file_editor_tab::edit_mfile_request,
+           this, &file_editor::edit_mfile_request);
+
+  connect (f, &file_editor_tab::debug_quit_signal,
+           this, &file_editor::debug_quit_signal);
+
+  // Any interpreter_event signal from a file_editor_tab_widget is
+  // handled the same as for the parent main_window object.
+
+  connect (f, QOverload<const fcn_callback&>::of (&file_editor_tab::interpreter_event),
+           this, QOverload<const fcn_callback&>::of (&file_editor::interpreter_event));
+
+  connect (f, QOverload<const meth_callback&>::of (&file_editor_tab::interpreter_event),
+           this, QOverload<const meth_callback&>::of (&file_editor::interpreter_event));
+
+  return f;
+}
+
+void file_editor::add_file_editor_tab (file_editor_tab *f, const QString& fn,
+                                       int index)
+{
+  if (index == -1)
+    m_tab_widget->addTab (f, fn);
+  else
+    m_tab_widget->insertTab (index, f, fn);
+
+  m_tab_widget->setCurrentWidget (f);
+
+  check_actions ();
+}
+
+void file_editor::mru_menu_update ()
+{
+  int num_files = qMin (m_mru_files.size (), int (MaxMRUFiles));
+
+  // configure and show active actions of mru-menu
+  for (int i = 0; i < num_files; ++i)
+    {
+      QString text = QString ("&%1 %2").
+        arg ((i+1) % int (MaxMRUFiles)).arg (m_mru_files.at (i));
+      m_mru_file_actions[i]->setText (text);
+
+      QStringList action_data;
+      action_data << m_mru_files.at (i) << m_mru_files_encodings.at (i);
+      m_mru_file_actions[i]->setData (action_data);
+
+      m_mru_file_actions[i]->setVisible (true);
+    }
+
+  // hide unused mru-menu entries
+  for (int j = num_files; j < MaxMRUFiles; ++j)
+    m_mru_file_actions[j]->setVisible (false);
+
+  // delete entries in string-list beyond MaxMRUFiles
+  while (m_mru_files.size () > MaxMRUFiles)
+    {
+      m_mru_files.removeLast ();
+      m_mru_files_encodings.removeLast ();
+    }
+
+  // save actual mru-list in settings
+
+  gui_settings settings;
+
+  settings.setValue (ed_mru_file_list.settings_key (),  m_mru_files);
+  settings.setValue (ed_mru_file_encodings.settings_key (),  m_mru_files_encodings);
+
+  settings.sync ();
+}
+
+bool file_editor::call_custom_editor (const QString& file_name, int line)
+{
+  // Check if the user wants to use a custom file editor.
+
+  gui_settings settings;
+
+  if (settings.value (global_use_custom_editor.settings_key (),
+                       global_use_custom_editor.def ()).toBool ())
+    {
+      // use the external editor interface for handling the call
+      emit request_open_file_external (file_name, line);
+
+      if (line < 0 && ! file_name.isEmpty ())
+        handle_mru_add_file (QFileInfo (file_name).canonicalFilePath (),
+                             QString ());
+
       return true;
-    return false;
-  }
-
-  // Check whether this file is already open in the editor.
-  file_editor_tab *file_editor::find_tab_widget (const QString& file)
-  {
-    std::string std_file = file.toStdString ();
-
-    std::list<file_editor_tab *> fe_tab_lst = m_tab_widget->tab_list ();
-
-    for (auto fe_tab : fe_tab_lst)
-      {
-        QString tab_file = fe_tab->file_name ();
-
-        // We check file == tab_file because
-        //
-        //   same_file ("", "")
-        //
-        // is false
-
-        if (same_file (std_file, tab_file.toStdString ()) || file == tab_file)
-          return fe_tab;
-      }
-
-    return nullptr;
-  }
-
-  QAction * file_editor::add_action (QMenu *menu, const QString& text,
-                                     const char *member,
-                                     QWidget *receiver)
-  {
-    return add_action (menu, QIcon (), text, member, receiver);
-  }
-
-  QAction * file_editor::add_action (QMenu *menu, const QIcon& icon,
-                                     const QString& text, const char *member,
-                                     QWidget *receiver)
-  {
-    QAction *a;
-    QWidget *r = this;
-
-    if (receiver != nullptr)
-      r = receiver;
-
-    if (menu)
-      a = menu->addAction (icon, text, r, member);
-    else
-      {
-        a = new QAction (this);
-        connect (a, SIGNAL (triggered ()), r, member);
-      }
-
-    addAction (a);  // important for shortcut context
-    a->setShortcutContext (Qt::WidgetWithChildrenShortcut);
-
-    return a;
-  }
-
-  QMenu* file_editor::add_menu (QMenuBar *p, QString name)
-  {
-    QMenu *menu = p->addMenu (name);
-
-    QString base_name = name;  // get a copy
-    // replace intended '&' ("&&") by a temp. string
-    base_name.replace ("&&", "___octave_amp_replacement___");
-    // remove single '&' (shortcut)
-    base_name.remove ("&");
-    // restore intended '&'
-    base_name.replace ("___octave_amp_replacement___", "&&");
-
-    // remember names with and without shortcut
-    m_hash_menu_text[menu] = QStringList () << name << base_name;
-
-    return menu;
-  }
+    }
+
+  return false;
+}
+
+void file_editor::toggle_preference (const gui_pref& preference)
+{
+  gui_settings settings;
+
+  bool old = settings.bool_value (preference);
+  settings.setValue (preference.settings_key (), ! old);
+  notice_settings ();
+}
+
+// Function for closing the files in a removed directory
+void file_editor::handle_dir_remove (const QString& old_name,
+                                     const QString& new_name)
+{
+  QDir old_dir (old_name);
+  removed_file_data f_data;
+
+  std::list<file_editor_tab *> editor_tab_lst = m_tab_widget->tab_list ();
+
+  for (auto editor_tab : editor_tab_lst)
+    {
+      QString file_name = editor_tab->file_name ();
+
+      if (file_name.isEmpty ())
+        continue;   // Nothing to do, no valid file name
+
+      // Get abs. file path and its path relative to the removed directory
+      QString rel_path_to_file = old_dir.relativeFilePath (file_name);
+      QString abs_path_to_file = old_dir.absoluteFilePath (file_name);
+
+      // Test whether the file is located within the directory that will
+      // be removed.  For this, two conditions must be met:
+      // 1. The path of the file rel. to the dir is not equal to the
+      //    its absolute one.
+      //    If both are equal, then there is no relative path and removed
+      //    directory and file are on different drives (e.g. on windows)
+      // 2. The (real) relative path does not start with "../", i.e.,
+      //    the file can be reached from the directory by descending only
+      if ((rel_path_to_file != abs_path_to_file)
+          && (rel_path_to_file.left (3) != QString ("../")))
+        {
+          // The currently considered file is included in the
+          // removed/renamed diectory: remeber it
+          if (editor_tab)
+            {
+              editor_tab->enable_file_watcher (false);
+              f_data.editor_tab = editor_tab;
+
+              // Add the new file path and the encoding for later reloading
+              // if new_name is given
+              if (! new_name.isEmpty ())
+                {
+                  QDir new_dir (new_name);
+                  QString append_to_new_dir;
+                  if (new_dir.exists ())
+                    {
+                      // The new directory already exists (movefile was used).
+                      // This means, we have to add the name (not the path)
+                      // of the old dir and the relative path to the file
+                      // to new dir.
+                      append_to_new_dir
+                        = old_dir.dirName () + "/" + rel_path_to_file;
+                    }
+                  else
+                    append_to_new_dir = rel_path_to_file;
+
+                  f_data.new_file_name
+                    = new_dir.absoluteFilePath (append_to_new_dir);
+                }
+              else
+                f_data.new_file_name = ""; // no new name, just removing this file
+
+              // Store data in list for later reloading
+              m_tmp_closed_files << f_data;
+            }
+        }
+    }
+}
+
+bool file_editor::editor_tab_has_focus ()
+{
+  QWidget *foc_w = focusWidget ();
+  if (foc_w && foc_w->inherits ("octave::octave_qscintilla"))
+    return true;
+  return false;
+}
+
+// Check whether this file is already open in the editor.
+file_editor_tab *file_editor::find_tab_widget (const QString& file)
+{
+  std::string std_file = file.toStdString ();
+
+  std::list<file_editor_tab *> fe_tab_lst = m_tab_widget->tab_list ();
+
+  for (auto fe_tab : fe_tab_lst)
+    {
+      QString tab_file = fe_tab->file_name ();
+
+      // We check file == tab_file because
+      //
+      //   same_file ("", "")
+      //
+      // is false
+
+      if (same_file (std_file, tab_file.toStdString ()) || file == tab_file)
+        return fe_tab;
+    }
+
+  return nullptr;
+}
+
+QAction * file_editor::add_action (QMenu *menu, const QString& text,
+                                   const char *member,
+                                   QWidget *receiver)
+{
+  return add_action (menu, QIcon (), text, member, receiver);
+}
+
+QAction * file_editor::add_action (QMenu *menu, const QIcon& icon,
+                                   const QString& text, const char *member,
+                                   QWidget *receiver)
+{
+  QAction *a;
+  QWidget *r = this;
+
+  if (receiver != nullptr)
+    r = receiver;
+
+  if (menu)
+    a = menu->addAction (icon, text, r, member);
+  else
+    {
+      a = new QAction (this);
+      connect (a, SIGNAL (triggered ()), r, member);
+    }
+
+  addAction (a);  // important for shortcut context
+  a->setShortcutContext (Qt::WidgetWithChildrenShortcut);
+
+  return a;
+}
+
+QMenu* file_editor::add_menu (QMenuBar *p, QString name)
+{
+  QMenu *menu = p->addMenu (name);
+
+  QString base_name = name;  // get a copy
+  // replace intended '&' ("&&") by a temp. string
+  base_name.replace ("&&", "___octave_amp_replacement___");
+  // remove single '&' (shortcut)
+  base_name.remove ("&");
+  // restore intended '&'
+  base_name.replace ("___octave_amp_replacement___", "&&");
+
+  // remember names with and without shortcut
+  m_hash_menu_text[menu] = QStringList () << name << base_name;
+
+  return menu;
+}
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/src/m-editor/file-editor.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/m-editor/file-editor.h	Thu Feb 02 12:25:51 2023 -0800
@@ -46,459 +46,459 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class base_qobject;
-  class file_editor;
+class base_qobject;
+class file_editor;
+
+// subclassed QTabWidget for using custom tabbar
+
+class file_editor_tab_widget : public QTabWidget
+{
+  Q_OBJECT
+
+public:
+
+  file_editor_tab_widget (QWidget *p, file_editor *fe);
 
-  // subclassed QTabWidget for using custom tabbar
+  ~file_editor_tab_widget () = default;
+
+  tab_bar * get_tab_bar () const;
+
+  std::list<file_editor_tab *> tab_list () const;
+};
 
-  class file_editor_tab_widget : public QTabWidget
-  {
-    Q_OBJECT
+// the class for the file editor
+
+class file_editor : public file_editor_interface
+{
+  Q_OBJECT
+
+public:
 
-  public:
+  // struct that allows to sort with respect to the tab index
+  struct session_data
+  {
+    int index;
+    int line;
+    QString file_name;
+    QString new_file_name;
+    QString encoding;
+    QString bookmarks;
 
-    file_editor_tab_widget (QWidget *p, file_editor *fe);
+    bool operator < (const session_data& other) const
+    {
+      return index < other.index;
+    }
+  };
+
+  struct removed_file_data
+  {
+    file_editor_tab *editor_tab;
+    QString new_file_name;
+  };
 
-    ~file_editor_tab_widget () = default;
+  file_editor (QWidget *p);
+
+  ~file_editor () = default;
+
+  QMenu * get_mru_menu () { return m_mru_file_menu; }
+
+  QMenu * debug_menu () { return m_debug_menu; }
+
+  QToolBar * toolbar () { return m_tool_bar; }
+
+  QMenuBar * menubar () { return m_menu_bar; }
 
-    tab_bar * get_tab_bar () const;
+  void insert_global_actions (QList<QAction *>);
 
-    std::list<file_editor_tab *> tab_list () const;
+  enum shared_actions_idx
+  {
+    NEW_SCRIPT_ACTION = 0,
+    NEW_FUNCTION_ACTION,
+    OPEN_ACTION,
+    FIND_FILES_ACTION,
+    UNDO_ACTION,
+    COPY_ACTION,
+    PASTE_ACTION,
+    SELECTALL_ACTION
   };
 
-  // the class for the file editor
-
-  class file_editor : public file_editor_interface
-  {
-    Q_OBJECT
-
-  public:
+  void check_actions ();
+  void empty_script (bool startup, bool visible);
+  void restore_session ();
 
-    // struct that allows to sort with respect to the tab index
-    struct session_data
-    {
-      int index;
-      int line;
-      QString file_name;
-      QString new_file_name;
-      QString encoding;
-      QString bookmarks;
+signals:
 
-      bool operator < (const session_data& other) const
-      {
-        return index < other.index;
-      }
-    };
-
-    struct removed_file_data
-    {
-      file_editor_tab *editor_tab;
-      QString new_file_name;
-    };
-
-    file_editor (QWidget *p);
-
-    ~file_editor () = default;
-
-    QMenu * get_mru_menu () { return m_mru_file_menu; }
-
-    QMenu * debug_menu () { return m_debug_menu; }
-
-    QToolBar * toolbar () { return m_tool_bar; }
-
-    QMenuBar * menubar () { return m_menu_bar; }
-
-    void insert_global_actions (QList<QAction *>);
+  void fetab_settings_changed ();
+  void fetab_change_request (const QWidget *ID);
+  // Save is a ping-pong type of communication
+  void fetab_save_file (const QWidget *ID, const QString& fileName,
+                        bool remove_on_success);
+  // No fetab_open, functionality in editor
+  // No fetab_new, functionality in editor
+  void fetab_context_help (const QWidget *ID, bool);
+  void fetab_context_edit (const QWidget *ID);
+  void fetab_save_file (const QWidget *ID);
+  void fetab_save_file_as (const QWidget *ID);
+  void fetab_print_file (const QWidget *ID);
+  void fetab_run_file (const QWidget *ID, bool step_into = false);
+  void fetab_context_run (const QWidget *ID);
+  void fetab_toggle_bookmark (const QWidget *ID);
+  void fetab_next_bookmark (const QWidget *ID);
+  void fetab_previous_bookmark (const QWidget *ID);
+  void fetab_remove_bookmark (const QWidget *ID);
+  void fetab_toggle_breakpoint (const QWidget *ID);
+  void fetab_next_breakpoint (const QWidget *ID);
+  void fetab_previous_breakpoint (const QWidget *ID);
+  void fetab_remove_all_breakpoints (const QWidget *ID);
+  void fetab_comment_selected_text (const QWidget *ID, bool);
+  void fetab_uncomment_selected_text (const QWidget *ID);
+  void fetab_indent_selected_text (const QWidget *ID);
+  void fetab_unindent_selected_text (const QWidget *ID);
+  void fetab_smart_indent_line_or_selected_text (const QWidget *ID);
+  void fetab_convert_eol (const QWidget *ID, QsciScintilla::EolMode eol_mode);
+  void fetab_goto_line (const QWidget *ID, int line = -1);
+  void fetab_move_match_brace (const QWidget *ID, bool select);
+  void fetab_completion (const QWidget *);
+  void fetab_insert_debugger_pointer (const QWidget *ID, int line = -1);
+  void fetab_delete_debugger_pointer (const QWidget *ID, int line = -1);
+  void fetab_do_breakpoint_marker (bool insert, const QWidget *ID,
+                                   int line = -1, const QString& = "");
+  void fetab_set_focus (const QWidget *ID);
+  void fetab_scintilla_command (const QWidget *ID, unsigned int sci_msg);
 
-    enum shared_actions_idx
-    {
-      NEW_SCRIPT_ACTION = 0,
-      NEW_FUNCTION_ACTION,
-      OPEN_ACTION,
-      FIND_FILES_ACTION,
-      UNDO_ACTION,
-      COPY_ACTION,
-      PASTE_ACTION,
-      SELECTALL_ACTION
-    };
+  void fetab_zoom_in (const QWidget *ID);
+  void fetab_zoom_out (const QWidget *ID);
+  void fetab_zoom_normal (const QWidget *ID);
+
+  void fetab_set_directory (const QString& dir);
+  void fetab_recover_from_exit ();
+
+  void edit_area_changed (octave_qscintilla *edit_area);
 
-    void check_actions ();
-    void empty_script (bool startup, bool visible);
-    void restore_session ();
+  void request_settings_dialog (const QString&);
+  void request_open_file_external (const QString& file_name, int line);
+  void file_loaded_signal ();
 
-  signals:
+  void editor_tabs_changed_signal (bool, bool);
+  void request_dbcont_signal ();
+
+  void enter_debug_mode_signal ();
+  void exit_debug_mode_signal ();
 
-    void fetab_settings_changed ();
-    void fetab_change_request (const QWidget *ID);
-    // Save is a ping-pong type of communication
-    void fetab_save_file (const QWidget *ID, const QString& fileName,
-                          bool remove_on_success);
-    // No fetab_open, functionality in editor
-    // No fetab_new, functionality in editor
-    void fetab_context_help (const QWidget *ID, bool);
-    void fetab_context_edit (const QWidget *ID);
-    void fetab_save_file (const QWidget *ID);
-    void fetab_save_file_as (const QWidget *ID);
-    void fetab_print_file (const QWidget *ID);
-    void fetab_run_file (const QWidget *ID, bool step_into = false);
-    void fetab_context_run (const QWidget *ID);
-    void fetab_toggle_bookmark (const QWidget *ID);
-    void fetab_next_bookmark (const QWidget *ID);
-    void fetab_previous_bookmark (const QWidget *ID);
-    void fetab_remove_bookmark (const QWidget *ID);
-    void fetab_toggle_breakpoint (const QWidget *ID);
-    void fetab_next_breakpoint (const QWidget *ID);
-    void fetab_previous_breakpoint (const QWidget *ID);
-    void fetab_remove_all_breakpoints (const QWidget *ID);
-    void fetab_comment_selected_text (const QWidget *ID, bool);
-    void fetab_uncomment_selected_text (const QWidget *ID);
-    void fetab_indent_selected_text (const QWidget *ID);
-    void fetab_unindent_selected_text (const QWidget *ID);
-    void fetab_smart_indent_line_or_selected_text (const QWidget *ID);
-    void fetab_convert_eol (const QWidget *ID, QsciScintilla::EolMode eol_mode);
-    void fetab_goto_line (const QWidget *ID, int line = -1);
-    void fetab_move_match_brace (const QWidget *ID, bool select);
-    void fetab_completion (const QWidget *);
-    void fetab_insert_debugger_pointer (const QWidget *ID, int line = -1);
-    void fetab_delete_debugger_pointer (const QWidget *ID, int line = -1);
-    void fetab_do_breakpoint_marker (bool insert, const QWidget *ID,
-                                     int line = -1, const QString& = "");
-    void fetab_set_focus (const QWidget *ID);
-    void fetab_scintilla_command (const QWidget *ID, unsigned int sci_msg);
+  void update_gui_lexer_signal (bool);
+  void execute_command_in_terminal_signal (const QString&);
+  void focus_console_after_command_signal ();
+  void run_file_signal (const QFileInfo&);
+  void edit_mfile_request (const QString&, const QString&, const QString&, int);
+  void debug_quit_signal ();
+
+  void show_symbol_tooltip_signal (const QPoint&, const QString&);
+
+public slots:
 
-    void fetab_zoom_in (const QWidget *ID);
-    void fetab_zoom_out (const QWidget *ID);
-    void fetab_zoom_normal (const QWidget *ID);
+  void activate ();
+  void set_focus (QWidget *fet);
+  void enable_menu_shortcuts (bool);
+  void save_session ();
+  bool check_closing ();
+  void handle_tab_ready_to_close ();
 
-    void fetab_set_directory (const QString& dir);
-    void fetab_recover_from_exit ();
+  void handle_enter_debug_mode ();
+  void handle_exit_debug_mode ();
+
+  void request_new_file (const QString& commands);
+  void request_close_file (bool);
+  void request_close_all_files (bool);
+  void request_close_other_files (bool);
+  void copy_full_file_path (bool);
+  void request_mru_open_file (QAction *action);
+  void request_print_file (bool);
 
-    void edit_area_changed (octave_qscintilla *edit_area);
-
-    void request_settings_dialog (const QString&);
-    void request_open_file_external (const QString& file_name, int line);
-    void file_loaded_signal ();
-
-    void editor_tabs_changed_signal (bool, bool);
-    void request_dbcont_signal ();
+  void request_redo (bool);
+  void request_cut (bool);
+  void request_context_help (bool);
+  void request_context_doc (bool);
+  void request_context_edit (bool);
+  void request_save_file (bool);
+  void request_save_file_as (bool);
+  void request_run_file (bool);
+  void request_step_into_file ();
+  void request_context_run (bool);
+  void request_toggle_bookmark (bool);
+  void request_next_bookmark (bool);
+  void request_previous_bookmark (bool);
+  void request_remove_bookmark (bool);
 
-    void enter_debug_mode_signal ();
-    void exit_debug_mode_signal ();
-
-    void update_gui_lexer_signal (bool);
-    void execute_command_in_terminal_signal (const QString&);
-    void focus_console_after_command_signal ();
-    void run_file_signal (const QFileInfo&);
-    void edit_mfile_request (const QString&, const QString&, const QString&, int);
-    void debug_quit_signal ();
+  void request_move_match_brace (bool);
+  void request_sel_match_brace (bool);
+  void request_toggle_breakpoint (bool);
+  void request_next_breakpoint (bool);
+  void request_previous_breakpoint (bool);
+  void request_remove_breakpoint (bool);
 
-    void show_symbol_tooltip_signal (const QPoint&, const QString&);
-
-  public slots:
-
-    void activate ();
-    void set_focus (QWidget *fet);
-    void enable_menu_shortcuts (bool);
-    void save_session ();
-    bool check_closing ();
-    void handle_tab_ready_to_close ();
+  void request_delete_start_word (bool);
+  void request_delete_end_word (bool);
+  void request_delete_start_line (bool);
+  void request_delete_end_line (bool);
+  void request_delete_line (bool);
+  void request_copy_line (bool);
+  void request_cut_line (bool);
+  void request_duplicate_selection (bool);
+  void request_transpose_line (bool);
 
-    void handle_enter_debug_mode ();
-    void handle_exit_debug_mode ();
+  void request_comment_selected_text (bool);
+  void request_uncomment_selected_text (bool);
+  void request_comment_var_selected_text (bool);
 
-    void request_new_file (const QString& commands);
-    void request_close_file (bool);
-    void request_close_all_files (bool);
-    void request_close_other_files (bool);
-    void copy_full_file_path (bool);
-    void request_mru_open_file (QAction *action);
-    void request_print_file (bool);
+  void request_upper_case (bool);
+  void request_lower_case (bool);
+  void request_indent_selected_text (bool);
+  void request_unindent_selected_text (bool);
+  void request_smart_indent_line_or_selected_text ();
+  void request_conv_eol_windows (bool);
+  void request_conv_eol_unix (bool);
+  void request_conv_eol_mac (bool);
 
-    void request_redo (bool);
-    void request_cut (bool);
-    void request_context_help (bool);
-    void request_context_doc (bool);
-    void request_context_edit (bool);
-    void request_save_file (bool);
-    void request_save_file_as (bool);
-    void request_run_file (bool);
-    void request_step_into_file ();
-    void request_context_run (bool);
-    void request_toggle_bookmark (bool);
-    void request_next_bookmark (bool);
-    void request_previous_bookmark (bool);
-    void request_remove_bookmark (bool);
+  void request_find (bool);
+  void request_find_next (bool);
+  void request_find_previous (bool);
+
+  void request_goto_line (bool);
+  void request_completion (bool);
 
-    void request_move_match_brace (bool);
-    void request_sel_match_brace (bool);
-    void request_toggle_breakpoint (bool);
-    void request_next_breakpoint (bool);
-    void request_previous_breakpoint (bool);
-    void request_remove_breakpoint (bool);
+  void handle_file_name_changed (const QString& fileName,
+                                 const QString& toolTip,
+                                 bool modified);
+  void handle_tab_close_request (int index);
+  void handle_tab_remove_request ();
+  void active_tab_changed (int index);
+  void handle_editor_state_changed (bool enableCopy, bool is_octave_file,
+                                    bool is_modified);
+  void handle_mru_add_file (const QString& file_name, const QString& encoding);
+  void check_conflict_save (const QString& fileName, bool remove_on_success);
 
-    void request_delete_start_word (bool);
-    void request_delete_end_word (bool);
-    void request_delete_start_line (bool);
-    void request_delete_end_line (bool);
-    void request_delete_line (bool);
-    void request_copy_line (bool);
-    void request_cut_line (bool);
-    void request_duplicate_selection (bool);
-    void request_transpose_line (bool);
+  void handle_insert_debugger_pointer_request (const QString& file, int line);
+  void handle_delete_debugger_pointer_request (const QString& file, int line);
+  void handle_update_breakpoint_marker_request (bool insert,
+                                                const QString& file, int line,
+                                                const QString& cond);
 
-    void request_comment_selected_text (bool);
-    void request_uncomment_selected_text (bool);
-    void request_comment_var_selected_text (bool);
+  void handle_edit_file_request (const QString& file);
+
+  void handle_file_remove (const QString&, const QString&);
+  void handle_file_renamed (bool load_new = true);
 
-    void request_upper_case (bool);
-    void request_lower_case (bool);
-    void request_indent_selected_text (bool);
-    void request_unindent_selected_text (bool);
-    void request_smart_indent_line_or_selected_text ();
-    void request_conv_eol_windows (bool);
-    void request_conv_eol_unix (bool);
-    void request_conv_eol_mac (bool);
+  // Tells the editor to react on changed settings.
+  void notice_settings ();
 
-    void request_find (bool);
-    void request_find_next (bool);
-    void request_find_previous (bool);
+  void set_shortcuts ();
+
+  void handle_visibility (bool visible);
 
-    void request_goto_line (bool);
-    void request_completion (bool);
+  void update_octave_directory (const QString& dir);
+
+  void toplevel_change (bool toplevel);
+
+  void handle_autoc_cancelled ();
 
-    void handle_file_name_changed (const QString& fileName,
-                                   const QString& toolTip,
-                                   bool modified);
-    void handle_tab_close_request (int index);
-    void handle_tab_remove_request ();
-    void active_tab_changed (int index);
-    void handle_editor_state_changed (bool enableCopy, bool is_octave_file,
-                                      bool is_modified);
-    void handle_mru_add_file (const QString& file_name, const QString& encoding);
-    void check_conflict_save (const QString& fileName, bool remove_on_success);
+  file_editor_tab * reset_focus ();
+
+protected slots:
 
-    void handle_insert_debugger_pointer_request (const QString& file, int line);
-    void handle_delete_debugger_pointer_request (const QString& file, int line);
-    void handle_update_breakpoint_marker_request (bool insert,
-                                                  const QString& file, int line,
-                                                  const QString& cond);
+  void copyClipboard ();
+  void pasteClipboard ();
+  void selectAll ();
+  void do_undo ();
 
-    void handle_edit_file_request (const QString& file);
-
-    void handle_file_remove (const QString&, const QString&);
-    void handle_file_renamed (bool load_new = true);
+private slots:
 
-    // Tells the editor to react on changed settings.
-    void notice_settings ();
-
-    void set_shortcuts ();
+  void request_open_file (const QString& fileName,
+                          const QString& encoding = QString (),
+                          int line = -1, bool debug_pointer = false,
+                          bool breakpoint_marker = false, bool insert = true,
+                          const QString& cond = "", int index = -1,
+                          const QString& bookmarks = QString ());
+  void request_preferences (bool);
+  void request_styles_preferences (bool);
 
-    void handle_visibility (bool visible);
-
-    void update_octave_directory (const QString& dir);
-
-    void toplevel_change (bool toplevel);
-
-    void handle_autoc_cancelled ();
-
-    file_editor_tab * reset_focus ();
-
-  protected slots:
+  void show_line_numbers (bool);
+  void show_white_space (bool);
+  void show_eol_chars (bool);
+  void show_indent_guides (bool);
+  void show_long_line (bool);
+  void show_toolbar (bool);
+  void show_statusbar (bool);
+  void show_hscrollbar (bool);
+  void zoom_in (bool);
+  void zoom_out (bool);
+  void zoom_normal (bool);
 
-    void copyClipboard ();
-    void pasteClipboard ();
-    void selectAll ();
-    void do_undo ();
+  void create_context_menu (QMenu *);
+  void edit_status_update (bool, bool);
+
+protected:
 
-  private slots:
+  void closeEvent (QCloseEvent *event);
+  void dragEnterEvent (QDragEnterEvent *event);
+  void dropEvent (QDropEvent *event);
+  void focusInEvent (QFocusEvent *e);
 
-    void request_open_file (const QString& fileName,
-                            const QString& encoding = QString (),
-                            int line = -1, bool debug_pointer = false,
-                            bool breakpoint_marker = false, bool insert = true,
-                            const QString& cond = "", int index = -1,
-                            const QString& bookmarks = QString ());
-    void request_preferences (bool);
-    void request_styles_preferences (bool);
+private:
+
+  file_editor_tab * make_file_editor_tab (const QString& directory = "");
 
-    void show_line_numbers (bool);
-    void show_white_space (bool);
-    void show_eol_chars (bool);
-    void show_indent_guides (bool);
-    void show_long_line (bool);
-    void show_toolbar (bool);
-    void show_statusbar (bool);
-    void show_hscrollbar (bool);
-    void zoom_in (bool);
-    void zoom_out (bool);
-    void zoom_normal (bool);
+  bool is_editor_console_tabbed ();
+  void construct ();
+  void add_file_editor_tab (file_editor_tab *f, const QString& fn,
+                            int index = -1);
+  void mru_menu_update ();
+  bool call_custom_editor (const QString& file_name = QString (), int line = -1);
+
+  void toggle_preference (const gui_pref& preference);
 
-    void create_context_menu (QMenu *);
-    void edit_status_update (bool, bool);
-
-  protected:
+  void handle_dir_remove (const QString& old_name, const QString& new_name);
 
-    void closeEvent (QCloseEvent *event);
-    void dragEnterEvent (QDragEnterEvent *event);
-    void dropEvent (QDropEvent *event);
-    void focusInEvent (QFocusEvent *e);
+  bool editor_tab_has_focus ();
 
-  private:
+  void find_create ();
 
-    file_editor_tab * make_file_editor_tab (const QString& directory = "");
+  file_editor_tab * find_tab_widget (const QString& openFileName);
+  QAction * add_action (QMenu *menu, const QString& text,
+                        const char *member, QWidget *receiver = nullptr);
+  QAction * add_action (QMenu *menu, const QIcon& icon, const QString& text,
+                        const char *member, QWidget *receiver = nullptr);
+
+  QMenu * add_menu (QMenuBar *p, QString text);
 
-    bool is_editor_console_tabbed ();
-    void construct ();
-    void add_file_editor_tab (file_editor_tab *f, const QString& fn,
-                              int index = -1);
-    void mru_menu_update ();
-    bool call_custom_editor (const QString& file_name = QString (), int line = -1);
+  int m_number_of_tabs;
+  QHash<QMenu *, QStringList> m_hash_menu_text;
 
-    void toggle_preference (const gui_pref& preference);
+  QString m_ced;
 
-    void handle_dir_remove (const QString& old_name, const QString& new_name);
+  QMenuBar *m_menu_bar;
+  QToolBar *m_tool_bar;
+  QMenu *m_debug_menu;
 
-    bool editor_tab_has_focus ();
-
-    void find_create ();
-
-    file_editor_tab * find_tab_widget (const QString& openFileName);
-    QAction * add_action (QMenu *menu, const QString& text,
-                          const char *member, QWidget *receiver = nullptr);
-    QAction * add_action (QMenu *menu, const QIcon& icon, const QString& text,
-                          const char *member, QWidget *receiver = nullptr);
-
-    QMenu * add_menu (QMenuBar *p, QString text);
+  QAction *m_new_action;
+  QAction *m_new_function_action;
+  QAction *m_open_action;
 
-    int m_number_of_tabs;
-    QHash<QMenu *, QStringList> m_hash_menu_text;
-
-    QString m_ced;
+  QAction *m_upper_case_action;
+  QAction *m_lower_case_action;
+  QAction *m_comment_selection_action;
+  QAction *m_comment_var_selection_action;
+  QAction *m_uncomment_selection_action;
+  QAction *m_indent_selection_action;
+  QAction *m_unindent_selection_action;
+  QAction *m_smart_indent_line_or_selection_action;
+  QAction *m_conv_eol_windows_action;
+  QAction *m_conv_eol_unix_action;
+  QAction *m_conv_eol_mac_action;
 
-    QMenuBar *m_menu_bar;
-    QToolBar *m_tool_bar;
-    QMenu *m_debug_menu;
-
-    QAction *m_new_action;
-    QAction *m_new_function_action;
-    QAction *m_open_action;
+  QAction *m_copy_action;
+  QAction *m_cut_action;
+  QAction *m_paste_action;
+  QAction *m_selectall_action;
+  QAction *m_context_help_action;
+  QAction *m_context_doc_action;
 
-    QAction *m_upper_case_action;
-    QAction *m_lower_case_action;
-    QAction *m_comment_selection_action;
-    QAction *m_comment_var_selection_action;
-    QAction *m_uncomment_selection_action;
-    QAction *m_indent_selection_action;
-    QAction *m_unindent_selection_action;
-    QAction *m_smart_indent_line_or_selection_action;
-    QAction *m_conv_eol_windows_action;
-    QAction *m_conv_eol_unix_action;
-    QAction *m_conv_eol_mac_action;
+  QAction *m_show_linenum_action;
+  QAction *m_show_whitespace_action;
+  QAction *m_show_eol_action;
+  QAction *m_show_indguide_action;
+  QAction *m_show_longline_action;
+  QAction *m_show_toolbar_action;
+  QAction *m_show_statusbar_action;
+  QAction *m_show_hscrollbar_action;
+  QAction *m_zoom_in_action;
+  QAction *m_zoom_out_action;
+  QAction *m_zoom_normal_action;
 
-    QAction *m_copy_action;
-    QAction *m_cut_action;
-    QAction *m_paste_action;
-    QAction *m_selectall_action;
-    QAction *m_context_help_action;
-    QAction *m_context_doc_action;
+  QAction *m_delete_start_word_action;
+  QAction *m_delete_end_word_action;
+  QAction *m_delete_start_line_action;
+  QAction *m_delete_end_line_action;
+  QAction *m_delete_line_action;
+  QAction *m_copy_line_action;
+  QAction *m_cut_line_action;
+  QAction *m_duplicate_selection_action;
+  QAction *m_transpose_line_action;
 
-    QAction *m_show_linenum_action;
-    QAction *m_show_whitespace_action;
-    QAction *m_show_eol_action;
-    QAction *m_show_indguide_action;
-    QAction *m_show_longline_action;
-    QAction *m_show_toolbar_action;
-    QAction *m_show_statusbar_action;
-    QAction *m_show_hscrollbar_action;
-    QAction *m_zoom_in_action;
-    QAction *m_zoom_out_action;
-    QAction *m_zoom_normal_action;
+  QAction *m_find_action;
+  QAction *m_find_next_action;
+  QAction *m_find_previous_action;
+  QAction *m_find_files_action;
+  QAction *m_goto_line_action;
+  QAction *m_completion_action;
 
-    QAction *m_delete_start_word_action;
-    QAction *m_delete_end_word_action;
-    QAction *m_delete_start_line_action;
-    QAction *m_delete_end_line_action;
-    QAction *m_delete_line_action;
-    QAction *m_copy_line_action;
-    QAction *m_cut_line_action;
-    QAction *m_duplicate_selection_action;
-    QAction *m_transpose_line_action;
+  QAction *m_move_to_matching_brace;
+  QAction *m_sel_to_matching_brace;
+  QAction *m_next_bookmark_action;
+  QAction *m_previous_bookmark_action;
+  QAction *m_toggle_bookmark_action;
+  QAction *m_remove_bookmark_action;
 
-    QAction *m_find_action;
-    QAction *m_find_next_action;
-    QAction *m_find_previous_action;
-    QAction *m_find_files_action;
-    QAction *m_goto_line_action;
-    QAction *m_completion_action;
+  QAction *m_print_action;
+  QAction *m_run_action;
+  QAction *m_run_selection_action;
 
-    QAction *m_move_to_matching_brace;
-    QAction *m_sel_to_matching_brace;
-    QAction *m_next_bookmark_action;
-    QAction *m_previous_bookmark_action;
-    QAction *m_toggle_bookmark_action;
-    QAction *m_remove_bookmark_action;
+  QAction *m_edit_function_action;
+  QAction *m_popdown_mru_action;
+  QAction *m_save_action;
+  QAction *m_save_as_action;
+  QAction *m_close_action;
+  QAction *m_close_all_action;
+  QAction *m_close_others_action;
 
-    QAction *m_print_action;
-    QAction *m_run_action;
-    QAction *m_run_selection_action;
+  QAction *m_redo_action;
+  QAction *m_undo_action;
 
-    QAction *m_edit_function_action;
-    QAction *m_popdown_mru_action;
-    QAction *m_save_action;
-    QAction *m_save_as_action;
-    QAction *m_close_action;
-    QAction *m_close_all_action;
-    QAction *m_close_others_action;
+  QAction *m_preferences_action;
+  QAction *m_styles_preferences_action;
 
-    QAction *m_redo_action;
-    QAction *m_undo_action;
-
-    QAction *m_preferences_action;
-    QAction *m_styles_preferences_action;
+  QAction *m_switch_left_tab_action;
+  QAction *m_switch_right_tab_action;
+  QAction *m_move_tab_left_action;
+  QAction *m_move_tab_right_action;
+  QAction *m_sort_tabs_action;
 
-    QAction *m_switch_left_tab_action;
-    QAction *m_switch_right_tab_action;
-    QAction *m_move_tab_left_action;
-    QAction *m_move_tab_right_action;
-    QAction *m_sort_tabs_action;
+  QAction *m_toggle_breakpoint_action;
+  QAction *m_next_breakpoint_action;
+  QAction *m_previous_breakpoint_action;
+  QAction *m_remove_all_breakpoints_action;
 
-    QAction *m_toggle_breakpoint_action;
-    QAction *m_next_breakpoint_action;
-    QAction *m_previous_breakpoint_action;
-    QAction *m_remove_all_breakpoints_action;
+  bool m_copy_action_enabled;
+  bool m_undo_action_enabled;
+  bool m_is_octave_file;
+  bool m_current_tab_modified;
 
-    bool m_copy_action_enabled;
-    bool m_undo_action_enabled;
-    bool m_is_octave_file;
-    bool m_current_tab_modified;
+  QMenu *m_edit_menu;
+  QMenu *m_edit_cmd_menu;
+  QMenu *m_edit_fmt_menu;
+  QMenu *m_edit_nav_menu;
+  QMenu *m_fileMenu;
+  QMenu *m_view_editor_menu;
 
-    QMenu *m_edit_menu;
-    QMenu *m_edit_cmd_menu;
-    QMenu *m_edit_fmt_menu;
-    QMenu *m_edit_nav_menu;
-    QMenu *m_fileMenu;
-    QMenu *m_view_editor_menu;
+  file_editor_tab_widget *m_tab_widget;
 
-    file_editor_tab_widget *m_tab_widget;
-
-    int m_marker_breakpoint;
+  int m_marker_breakpoint;
 
-    bool m_closing_canceled;
-    bool m_closed;
-    bool m_no_focus;
-    bool m_editor_ready;
+  bool m_closing_canceled;
+  bool m_closed;
+  bool m_no_focus;
+  bool m_editor_ready;
 
-    enum { MaxMRUFiles = 10 };
-    QMenu *m_mru_file_menu;
-    QAction *m_mru_file_actions[MaxMRUFiles];
-    QStringList m_mru_files;
-    QStringList m_mru_files_encodings;
+  enum { MaxMRUFiles = 10 };
+  QMenu *m_mru_file_menu;
+  QAction *m_mru_file_actions[MaxMRUFiles];
+  QStringList m_mru_files;
+  QStringList m_mru_files_encodings;
 
-    QPointer<find_dialog> m_find_dialog;
+  QPointer<find_dialog> m_find_dialog;
 
-    // List of data on temporarily closed files for later reloading.
-    QList<removed_file_data> m_tmp_closed_files;
-  };
+  // List of data on temporarily closed files for later reloading.
+  QList<removed_file_data> m_tmp_closed_files;
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/src/m-editor/find-dialog.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/m-editor/find-dialog.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -86,582 +86,582 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  find_dialog::find_dialog (octave_dock_widget *ed, QWidget *p)
-    : QDialog (p), m_editor (ed), m_in_sel (false),
-      m_sel_beg (-1), m_sel_end (-1)
-  {
-    setWindowTitle (tr ("Editor: Find and Replace"));
+find_dialog::find_dialog (octave_dock_widget *ed, QWidget *p)
+  : QDialog (p), m_editor (ed), m_in_sel (false),
+    m_sel_beg (-1), m_sel_end (-1)
+{
+  setWindowTitle (tr ("Editor: Find and Replace"));
 
-    m_search_label = new QLabel (tr ("Find &what:"));
-    m_search_line_edit = new QComboBox (this);
-    m_search_line_edit->setToolTip (tr ("Enter text to search for"));
-    m_search_line_edit->setEditable (true);
-    m_search_line_edit->setMaxCount (m_mru_length);
-    m_search_line_edit->completer ()->setCaseSensitivity (Qt::CaseSensitive);
-    m_search_label->setBuddy (m_search_line_edit);
+  m_search_label = new QLabel (tr ("Find &what:"));
+  m_search_line_edit = new QComboBox (this);
+  m_search_line_edit->setToolTip (tr ("Enter text to search for"));
+  m_search_line_edit->setEditable (true);
+  m_search_line_edit->setMaxCount (m_mru_length);
+  m_search_line_edit->completer ()->setCaseSensitivity (Qt::CaseSensitive);
+  m_search_label->setBuddy (m_search_line_edit);
 
-    m_replace_label = new QLabel (tr ("Re&place with:"));
-    m_replace_line_edit = new QComboBox (this);
-    m_replace_line_edit->setToolTip (tr ("Enter new text replacing search hits"));
-    m_replace_line_edit->setEditable (true);
-    m_replace_line_edit->setMaxCount (m_mru_length);
-    m_replace_line_edit->completer ()->setCaseSensitivity (Qt::CaseSensitive);
-    m_replace_label->setBuddy (m_replace_line_edit);
+  m_replace_label = new QLabel (tr ("Re&place with:"));
+  m_replace_line_edit = new QComboBox (this);
+  m_replace_line_edit->setToolTip (tr ("Enter new text replacing search hits"));
+  m_replace_line_edit->setEditable (true);
+  m_replace_line_edit->setMaxCount (m_mru_length);
+  m_replace_line_edit->completer ()->setCaseSensitivity (Qt::CaseSensitive);
+  m_replace_label->setBuddy (m_replace_line_edit);
 
-     int width = QFontMetrics (m_search_line_edit->font ()).averageCharWidth();
-     m_search_line_edit->setFixedWidth (20*width);
-     m_replace_line_edit->setFixedWidth (20*width);
+   int width = QFontMetrics (m_search_line_edit->font ()).averageCharWidth();
+   m_search_line_edit->setFixedWidth (20*width);
+   m_replace_line_edit->setFixedWidth (20*width);
 
-    m_case_check_box = new QCheckBox (tr ("Match &case"));
-    m_from_start_check_box = new QCheckBox (tr ("Search from &start"));
-    m_wrap_check_box = new QCheckBox (tr ("&Wrap while searching"));
-    m_wrap_check_box->setChecked (true);
-    m_find_next_button = new QPushButton (tr ("&Find Next"));
-    m_find_prev_button = new QPushButton (tr ("Find &Previous"));
-    m_replace_button = new QPushButton (tr ("&Replace"));
-    m_replace_all_button = new QPushButton (tr ("Replace &All"));
+  m_case_check_box = new QCheckBox (tr ("Match &case"));
+  m_from_start_check_box = new QCheckBox (tr ("Search from &start"));
+  m_wrap_check_box = new QCheckBox (tr ("&Wrap while searching"));
+  m_wrap_check_box->setChecked (true);
+  m_find_next_button = new QPushButton (tr ("&Find Next"));
+  m_find_prev_button = new QPushButton (tr ("Find &Previous"));
+  m_replace_button = new QPushButton (tr ("&Replace"));
+  m_replace_all_button = new QPushButton (tr ("Replace &All"));
 
-    m_more_button = new QPushButton (tr ("&More..."));
-    m_more_button->setCheckable (true);
-    m_more_button->setAutoDefault (false);
+  m_more_button = new QPushButton (tr ("&More..."));
+  m_more_button->setCheckable (true);
+  m_more_button->setAutoDefault (false);
 
-    m_button_box = new QDialogButtonBox (Qt::Vertical);
-    m_button_box->addButton (m_find_next_button, QDialogButtonBox::ActionRole);
-    m_button_box->addButton (m_find_prev_button, QDialogButtonBox::ActionRole);
-    m_button_box->addButton (m_replace_button, QDialogButtonBox::ActionRole);
-    m_button_box->addButton (m_replace_all_button, QDialogButtonBox::ActionRole);
-    m_button_box->addButton (m_more_button, QDialogButtonBox::ActionRole);
-    m_button_box->addButton (QDialogButtonBox::Close);
+  m_button_box = new QDialogButtonBox (Qt::Vertical);
+  m_button_box->addButton (m_find_next_button, QDialogButtonBox::ActionRole);
+  m_button_box->addButton (m_find_prev_button, QDialogButtonBox::ActionRole);
+  m_button_box->addButton (m_replace_button, QDialogButtonBox::ActionRole);
+  m_button_box->addButton (m_replace_all_button, QDialogButtonBox::ActionRole);
+  m_button_box->addButton (m_more_button, QDialogButtonBox::ActionRole);
+  m_button_box->addButton (QDialogButtonBox::Close);
 
-    m_extension = new QWidget (this);
-    m_whole_words_check_box = new QCheckBox (tr ("&Whole words"));
-    m_regex_check_box = new QCheckBox (tr ("Regular E&xpressions"));
-    m_backward_check_box = new QCheckBox (tr ("Search &backward"));
-    m_search_selection_check_box = new QCheckBox (tr ("Search se&lection"));
-    m_search_selection_check_box->setCheckable (true);
+  m_extension = new QWidget (this);
+  m_whole_words_check_box = new QCheckBox (tr ("&Whole words"));
+  m_regex_check_box = new QCheckBox (tr ("Regular E&xpressions"));
+  m_backward_check_box = new QCheckBox (tr ("Search &backward"));
+  m_search_selection_check_box = new QCheckBox (tr ("Search se&lection"));
+  m_search_selection_check_box->setCheckable (true);
 
-    connect (m_find_next_button, &QPushButton::clicked,
-             this, &find_dialog::find_next);
-    connect (m_find_prev_button, &QPushButton::clicked,
-             this, &find_dialog::find_prev);
-    connect (m_more_button, &QPushButton::toggled,
-             m_extension, &QWidget::setVisible);
-    connect (m_replace_button, &QPushButton::clicked,
-             this, &find_dialog::replace);
-    connect (m_replace_all_button, &QPushButton::clicked,
-             this, &find_dialog::replace_all);
-    connect (m_backward_check_box, &QCheckBox::stateChanged,
-             this, &find_dialog::handle_backward_search_changed);
-    connect (m_button_box, &QDialogButtonBox::rejected,
-             this, &find_dialog::close);
+  connect (m_find_next_button, &QPushButton::clicked,
+           this, &find_dialog::find_next);
+  connect (m_find_prev_button, &QPushButton::clicked,
+           this, &find_dialog::find_prev);
+  connect (m_more_button, &QPushButton::toggled,
+           m_extension, &QWidget::setVisible);
+  connect (m_replace_button, &QPushButton::clicked,
+           this, &find_dialog::replace);
+  connect (m_replace_all_button, &QPushButton::clicked,
+           this, &find_dialog::replace_all);
+  connect (m_backward_check_box, &QCheckBox::stateChanged,
+           this, &find_dialog::handle_backward_search_changed);
+  connect (m_button_box, &QDialogButtonBox::rejected,
+           this, &find_dialog::close);
 
-    connect (m_search_selection_check_box, &QCheckBox::stateChanged,
-             this, &find_dialog::handle_sel_search_changed);
+  connect (m_search_selection_check_box, &QCheckBox::stateChanged,
+           this, &find_dialog::handle_sel_search_changed);
 
-    QVBoxLayout *extension_layout = new QVBoxLayout ();
-    extension_layout->setMargin (0);
-    extension_layout->addWidget (m_whole_words_check_box);
-    extension_layout->addWidget (m_backward_check_box);
-    extension_layout->addWidget (m_search_selection_check_box);
-    m_extension->setLayout (extension_layout);
+  QVBoxLayout *extension_layout = new QVBoxLayout ();
+  extension_layout->setMargin (0);
+  extension_layout->addWidget (m_whole_words_check_box);
+  extension_layout->addWidget (m_backward_check_box);
+  extension_layout->addWidget (m_search_selection_check_box);
+  m_extension->setLayout (extension_layout);
 
-    QGridLayout *top_left_layout = new QGridLayout;
-    top_left_layout->addWidget (m_search_label, 1, 1);
-    top_left_layout->addWidget (m_search_line_edit, 1, 2);
-    top_left_layout->addWidget (m_replace_label, 2, 1);
-    top_left_layout->addWidget (m_replace_line_edit, 2, 2);
+  QGridLayout *top_left_layout = new QGridLayout;
+  top_left_layout->addWidget (m_search_label, 1, 1);
+  top_left_layout->addWidget (m_search_line_edit, 1, 2);
+  top_left_layout->addWidget (m_replace_label, 2, 1);
+  top_left_layout->addWidget (m_replace_line_edit, 2, 2);
 
-    QVBoxLayout *left_layout = new QVBoxLayout;
-    left_layout->addLayout (top_left_layout);
-    left_layout->insertStretch (1, 5);
-    left_layout->addWidget (m_case_check_box);
-    left_layout->addWidget (m_from_start_check_box);
-    left_layout->addWidget (m_wrap_check_box);
-    left_layout->addWidget (m_regex_check_box);
+  QVBoxLayout *left_layout = new QVBoxLayout;
+  left_layout->addLayout (top_left_layout);
+  left_layout->insertStretch (1, 5);
+  left_layout->addWidget (m_case_check_box);
+  left_layout->addWidget (m_from_start_check_box);
+  left_layout->addWidget (m_wrap_check_box);
+  left_layout->addWidget (m_regex_check_box);
 
-    QGridLayout *main_layout = new QGridLayout;
-    main_layout->setSizeConstraint (QLayout::SetFixedSize);
-    main_layout->addLayout (left_layout, 0, 0);
-    main_layout->addWidget (m_button_box, 0, 1);
-    main_layout->addWidget (m_extension, 1, 0);
-    setLayout (main_layout);
+  QGridLayout *main_layout = new QGridLayout;
+  main_layout->setSizeConstraint (QLayout::SetFixedSize);
+  main_layout->addLayout (left_layout, 0, 0);
+  main_layout->addWidget (m_button_box, 0, 1);
+  main_layout->addWidget (m_extension, 1, 0);
+  setLayout (main_layout);
 
-    m_extension->hide ();
-    m_find_next_button->setDefault (true);
-    m_find_result_available = false;
-    m_rep_all = 0;
-    m_rep_active = false;
+  m_extension->hide ();
+  m_find_next_button->setDefault (true);
+  m_find_result_available = false;
+  m_rep_all = 0;
+  m_rep_active = false;
 
-    // Connect required external signals
-    connect (ed, SIGNAL (edit_area_changed (octave_qscintilla *)),
-             this, SLOT (update_edit_area (octave_qscintilla *)));
+  // Connect required external signals
+  connect (ed, SIGNAL (edit_area_changed (octave_qscintilla *)),
+           this, SLOT (update_edit_area (octave_qscintilla *)));
 
-    setWindowModality (Qt::NonModal);
+  setWindowModality (Qt::NonModal);
 
-    setAttribute(Qt::WA_ShowWithoutActivating);
-    setAttribute(Qt::WA_DeleteOnClose);
-  }
+  setAttribute(Qt::WA_ShowWithoutActivating);
+  setAttribute(Qt::WA_DeleteOnClose);
+}
 
-  // The edit_area has changed: update relevant data of the file dialog
-  void find_dialog::update_edit_area (octave_qscintilla *edit_area)
-  {
-    m_edit_area = edit_area;
-    m_search_selection_check_box->setEnabled (edit_area->hasSelectedText ());
+// The edit_area has changed: update relevant data of the file dialog
+void find_dialog::update_edit_area (octave_qscintilla *edit_area)
+{
+  m_edit_area = edit_area;
+  m_search_selection_check_box->setEnabled (edit_area->hasSelectedText ());
 
-    connect (m_edit_area, SIGNAL (copyAvailable (bool)),
-             this,       SLOT (handle_selection_changed (bool)),
-             Qt::UniqueConnection);
-  }
+  connect (m_edit_area, SIGNAL (copyAvailable (bool)),
+           this,       SLOT (handle_selection_changed (bool)),
+           Qt::UniqueConnection);
+}
 
-  void find_dialog::save_settings ()
-  {
-    gui_settings settings;
+void find_dialog::save_settings ()
+{
+  gui_settings settings;
 
-    // Save position
-    QPoint dlg_pos = pos ();
+  // Save position
+  QPoint dlg_pos = pos ();
 
 #if defined (Q_OS_WIN32)
-    int y = dlg_pos.y ();
+  int y = dlg_pos.y ();
 #else
-    int y = dlg_pos.y () - geometry ().height () + frameGeometry ().height ();
+  int y = dlg_pos.y () - geometry ().height () + frameGeometry ().height ();
 #endif
 
-    m_last_position = QPoint (dlg_pos.x (), y);
+  m_last_position = QPoint (dlg_pos.x (), y);
+
+  settings.setValue (ed_fdlg_pos.settings_key (), m_last_position);
+
+  // Is current search/replace text in the mru list?
+  mru_update (m_search_line_edit);
+  mru_update (m_replace_line_edit);
 
-    settings.setValue (ed_fdlg_pos.settings_key (), m_last_position);
+  // Store mru lists
+  QStringList mru;
+  for (int i = 0; i < m_search_line_edit->count (); i++)
+    mru.append (m_search_line_edit->itemText (i));
+  settings.setValue (ed_fdlg_search.settings_key (), mru);
+
+  mru.clear ();
+  for (int i = 0; i < m_replace_line_edit->count (); i++)
+    mru.append (m_replace_line_edit->itemText (i));
+  settings.setValue (ed_fdlg_replace.settings_key (), mru);
 
-    // Is current search/replace text in the mru list?
-    mru_update (m_search_line_edit);
-    mru_update (m_replace_line_edit);
+  // Store dialog's options
+  int opts = 0
+             + m_extension->isVisible () * FIND_DLG_MORE
+             + m_case_check_box->isChecked () * FIND_DLG_CASE
+             + m_from_start_check_box->isChecked () * FIND_DLG_START
+             + m_wrap_check_box->isChecked () * FIND_DLG_WRAP
+             + m_regex_check_box->isChecked () * FIND_DLG_REGX
+             + m_whole_words_check_box->isChecked () * FIND_DLG_WORDS
+             + m_backward_check_box->isChecked () * FIND_DLG_BACK
+             + m_search_selection_check_box->isChecked () * FIND_DLG_SEL;
+  settings.setValue (ed_fdlg_opts.settings_key (), opts);
+
+  settings.sync ();
+}
+
+void find_dialog::restore_settings (QPoint ed_bottom_right)
+{
+  gui_settings settings;
+
+  // Get mru lists for search and replace text
+  QStringList mru = settings.value (ed_fdlg_search.settings_key ()).toStringList ();
+  while (mru.length () > m_mru_length)
+    mru.removeLast ();
+  m_search_line_edit->addItems (mru);
 
-    // Store mru lists
-    QStringList mru;
-    for (int i = 0; i < m_search_line_edit->count (); i++)
-      mru.append (m_search_line_edit->itemText (i));
-    settings.setValue (ed_fdlg_search.settings_key (), mru);
+  mru = settings.value (ed_fdlg_replace.settings_key ()).toStringList ();
+  while (mru.length () > m_mru_length)
+    mru.removeLast ();
+  m_replace_line_edit->addItems (mru);
+
+  // Get the dialog's options
+  int opts = settings.int_value (ed_fdlg_opts);
+
+  m_extension->setVisible (FIND_DLG_MORE & opts);
+  m_case_check_box->setChecked (FIND_DLG_CASE & opts);
+  m_from_start_check_box->setChecked (FIND_DLG_START & opts);
+  m_wrap_check_box->setChecked (FIND_DLG_WRAP & opts);
+  m_regex_check_box->setChecked (FIND_DLG_REGX & opts);
+  m_whole_words_check_box->setChecked (FIND_DLG_WORDS & opts);
+  m_backward_check_box->setChecked (FIND_DLG_BACK & opts);
+  m_search_selection_check_box->setChecked (FIND_DLG_SEL & opts);
+
+  // Default position:  lower right of editor's position
+  int xp = ed_bottom_right.x () - sizeHint ().width ();
+  int yp = ed_bottom_right.y () - sizeHint ().height ();
+  QRect default_geometry (xp, yp, sizeHint ().width (), sizeHint ().height ());
 
-    mru.clear ();
-    for (int i = 0; i < m_replace_line_edit->count (); i++)
-      mru.append (m_replace_line_edit->itemText (i));
-    settings.setValue (ed_fdlg_replace.settings_key (), mru);
+  // Last position from settings
+  m_last_position = settings.value (ed_fdlg_pos.settings_key (), QPoint (xp, yp)).toPoint ();
+  QRect last_geometry (m_last_position,
+                       QSize (sizeHint ().width (), sizeHint ().height ()));
+
+  // Make sure we are on the screen
+  adjust_to_screen (last_geometry, default_geometry);
+  m_last_position = last_geometry.topLeft ();
+
+  move (m_last_position);
+}
+
+// set text of "search from start" depending on backward search
+void find_dialog::handle_backward_search_changed (int backward)
+{
+  if (backward)
+    m_from_start_check_box->setText (tr ("Search from end"));
+  else
+    m_from_start_check_box->setText (tr ("Search from start"));
+}
+
+// search text has changed: reset the search
+void find_dialog::handle_search_text_changed ()
+{
+  // Return if nothing has changed
+  if (m_search_line_edit->currentText () == m_search_line_edit->itemText (0))
+    return;
+
+  if (m_search_selection_check_box->isChecked ())
+    m_find_result_available = false;
 
-    // Store dialog's options
-    int opts = 0
-               + m_extension->isVisible () * FIND_DLG_MORE
-               + m_case_check_box->isChecked () * FIND_DLG_CASE
-               + m_from_start_check_box->isChecked () * FIND_DLG_START
-               + m_wrap_check_box->isChecked () * FIND_DLG_WRAP
-               + m_regex_check_box->isChecked () * FIND_DLG_REGX
-               + m_whole_words_check_box->isChecked () * FIND_DLG_WORDS
-               + m_backward_check_box->isChecked () * FIND_DLG_BACK
-               + m_search_selection_check_box->isChecked () * FIND_DLG_SEL;
-    settings.setValue (ed_fdlg_opts.settings_key (), opts);
+  mru_update (m_search_line_edit);
+}
+
+// replaced text has changed: reset the search
+void find_dialog::handle_replace_text_changed ()
+{
+  // Return if nothing has changed
+  if (m_replace_line_edit->currentText () == m_replace_line_edit->itemText (0))
+    return;
+
+  mru_update (m_replace_line_edit);
+}
+
+// Update the mru list
+void find_dialog::mru_update (QComboBox *mru)
+{
+  // Remove possible empty entries from the mru list
+  int index;
+  while ((index = mru->findText (QString ())) >= 0)
+    mru->removeItem (index);
+
+  // Get current text and return if it is empty
+  QString text = mru->currentText ();
+
+  if (text.isEmpty ())
+    return;
+
+  // Remove occurrences of the current text in the mru list
+  while ((index = mru->findText (text)) >= 0)
+    mru->removeItem (index);
+
+  // Remove the last entry from the end if the list is full
+  if (mru->count () == m_mru_length)
+    mru->removeItem (m_mru_length -1);
+
+  // Insert new item at the beginning and set it as current item
+  mru->insertItem (0, text);
+  mru->setCurrentIndex (0);
+}
+
+void find_dialog::handle_sel_search_changed (int selected)
+{
+  m_from_start_check_box->setEnabled (! selected);
+  m_find_result_available = false;
+}
 
-    settings.sync ();
-  }
+void find_dialog::handle_selection_changed (bool has_selected)
+{
+  if (m_rep_active)
+    return;
+
+  m_search_selection_check_box->setEnabled (has_selected);
+  m_find_result_available = false;
+}
+
+// initialize search text with selected text if this is in one single line
+void find_dialog::init_search_text ()
+{
+  if (m_edit_area && m_edit_area->hasSelectedText ())
+    {
+      int lbeg, lend, cbeg, cend;
+      m_edit_area->getSelection (&lbeg, &cbeg, &lend, &cend);
+      if (lbeg == lend)
+        m_search_line_edit->setCurrentText (m_edit_area->selectedText ());
+    }
+
+  // set focus to "Find what" and select all text
+  m_search_line_edit->setFocus ();
+  m_search_line_edit->lineEdit ()->selectAll ();
 
-  void find_dialog::restore_settings (QPoint ed_bottom_right)
-  {
-    gui_settings settings;
+  // Default to "find" next time.
+  // Otherwise, it defaults to the last action, which may be "replace all".
+  m_find_next_button->setDefault (true);
+}
+
+void find_dialog::find_next ()
+{
+  find (! m_backward_check_box->isChecked ());
+}
 
-    // Get mru lists for search and replace text
-    QStringList mru = settings.value (ed_fdlg_search.settings_key ()).toStringList ();
-    while (mru.length () > m_mru_length)
-      mru.removeLast ();
-    m_search_line_edit->addItems (mru);
+void find_dialog::find_prev ()
+{
+  find (m_backward_check_box->isChecked ());
+}
+
+void find_dialog::find (bool forward)
+{
+  if (! m_edit_area)
+    return;
+
+  handle_search_text_changed ();
+
+  // line adn col: -1 means search starts at current position
+  int line = -1, col = -1;
+
+  bool do_wrap = m_wrap_check_box->isChecked ();
+  bool do_forward = forward;
 
-    mru = settings.value (ed_fdlg_replace.settings_key ()).toStringList ();
-    while (mru.length () > m_mru_length)
-      mru.removeLast ();
-    m_replace_line_edit->addItems (mru);
+  // Initialize the selection begin and end if it is the first search
+  if (! m_find_result_available)
+    {
+      if (m_search_selection_check_box->isChecked ()
+          && m_edit_area->hasSelectedText ())
+        {
+          int l1, c1, l2, c2;
+          m_edit_area->getSelection (&l1, &c1, &l2, &c2);
 
-    // Get the dialog's options
-    int opts = settings.int_value (ed_fdlg_opts);
+          // Store the position of the selection
+          m_sel_beg = m_edit_area->positionFromLineIndex (l1, c1);
+          m_sel_end = m_edit_area->positionFromLineIndex (l2, c2);
+          m_in_sel = true;
+        }
+      else
+        m_in_sel = false;
+    }
 
-    m_extension->setVisible (FIND_DLG_MORE & opts);
-    m_case_check_box->setChecked (FIND_DLG_CASE & opts);
-    m_from_start_check_box->setChecked (FIND_DLG_START & opts);
-    m_wrap_check_box->setChecked (FIND_DLG_WRAP & opts);
-    m_regex_check_box->setChecked (FIND_DLG_REGX & opts);
-    m_whole_words_check_box->setChecked (FIND_DLG_WORDS & opts);
-    m_backward_check_box->setChecked (FIND_DLG_BACK & opts);
-    m_search_selection_check_box->setChecked (FIND_DLG_SEL & opts);
+  // Get the correct line/col for beginning the search
+  if (m_rep_all)
+    {
+      // Replace All
+      if (m_rep_all == 1)
+        {
+          // Start at the beginning of file/sel if it is the first try
+          if (m_in_sel)
+            m_edit_area->lineIndexFromPosition (m_sel_beg, &line, &col);
+          else
+            {
+              line = 0;
+              col = 0;
+            }
+        }
+      do_wrap = false;  // Never wrap when replacing all
+    }
+  else
+    {
+      // Normal search (not replace all): calculate start position of
+      // search (in file or selection)
+      if (m_from_start_check_box->isChecked ()
+          || (m_in_sel && (! m_find_result_available)))
+        {
+          // From the beginning or the end of file/sel
+          if (do_forward)
+            {
+              // From the beginning
+              if (m_in_sel)
+                m_edit_area->lineIndexFromPosition (m_sel_beg, &line, &col);
+              else
+                {
+                  line = 0;
+                  col = 0;
+                }
+            }
+          else
+            {
+              // From the end
+              if (m_in_sel)
+                m_edit_area->lineIndexFromPosition (m_sel_end, &line, &col);
+              else
+                {
+                  line = m_edit_area->lines () - 1;
+                  col  = m_edit_area->text (line).length () - 1;
+                  if (col == -1)
+                    col = 0;
+                }
+            }
+        }
+      else if (! do_forward)
+        {
+          // Start from where the cursor is.  Fix QScintilla's cursor
+          // positioning
+          m_edit_area->getCursorPosition (&line, &col);
+          if (m_find_result_available && m_edit_area->hasSelectedText ())
+            {
+              int currpos = m_edit_area->positionFromLineIndex (line, col);
+              currpos -= (m_search_line_edit->currentText ().length ());
+              if (currpos < 0)
+                currpos = 0;
+              m_edit_area->lineIndexFromPosition (currpos, &line, &col);
+            }
+        }
+    }
 
-    // Default position:  lower right of editor's position
-    int xp = ed_bottom_right.x () - sizeHint ().width ();
-    int yp = ed_bottom_right.y () - sizeHint ().height ();
-    QRect default_geometry (xp, yp, sizeHint ().width (), sizeHint ().height ());
+  // Do the search
+  m_find_result_available
+    = m_edit_area->findFirst (m_search_line_edit->currentText (),
+                              m_regex_check_box->isChecked (),
+                              m_case_check_box->isChecked (),
+                              m_whole_words_check_box->isChecked (),
+                              do_wrap,
+                              do_forward,
+                              line, col,
+                              true
+#if defined (HAVE_QSCI_VERSION_2_6_0)
+                              , true
+#endif
+                             );
 
-    // Last position from settings
-    m_last_position = settings.value (ed_fdlg_pos.settings_key (), QPoint (xp, yp)).toPoint ();
-    QRect last_geometry (m_last_position,
-                         QSize (sizeHint ().width (), sizeHint ().height ()));
+  if (m_find_result_available)
+    {
+      // Search successful: reset search-from-start box and check for
+      // the current selection
+      m_from_start_check_box->setChecked (0);
+
+      if (m_in_sel)
+        {
+          m_edit_area->getCursorPosition (&line, &col);
+          int pos = m_edit_area->positionFromLineIndex (line, col);
+
+          int l1, c1, l2, c2;
+          m_edit_area->lineIndexFromPosition (m_sel_beg, &l1, &c1);
+          m_edit_area->lineIndexFromPosition (m_sel_end, &l2, &c2);
+          m_edit_area->show_selection_markers (l1, c1, l2, c2);
+
+          // Check if new start position is still within the selection
+          m_find_result_available =  pos >= m_sel_beg && pos <= m_sel_end;
+        }
+    }
 
-    // Make sure we are on the screen
-    adjust_to_screen (last_geometry, default_geometry);
-    m_last_position = last_geometry.topLeft ();
+  // No more search hits
+  if (! m_find_result_available)
+    {
+      if (m_in_sel)
+        {
+          // Restore real selection and remove marker for selection
+          int l1, c1, l2, c2;
+          m_edit_area->lineIndexFromPosition (m_sel_beg, &l1, &c1);
+          m_edit_area->lineIndexFromPosition (m_sel_end, &l2, &c2);
+          m_edit_area->setSelection (l1, c1, l2, c2);
+          m_edit_area->clear_selection_markers ();
+        }
 
-    move (m_last_position);
-  }
+      // Display message if not replace all
+      if (! m_rep_all)
+        no_matches_message ();
+    }
+
+}
+
+void find_dialog::do_replace ()
+{
+  if (m_edit_area)
+    {
+      m_rep_active = true;  // changes in selection not made by the user
 
-  // set text of "search from start" depending on backward search
-  void find_dialog::handle_backward_search_changed (int backward)
-  {
-    if (backward)
-      m_from_start_check_box->setText (tr ("Search from end"));
-    else
-      m_from_start_check_box->setText (tr ("Search from start"));
-  }
+      m_edit_area->replace (m_replace_line_edit->currentText ());
+      if (m_in_sel)
+        {
+          // Update the length of the selection
+          m_sel_end = m_sel_end
+                      - m_search_line_edit->currentText ().toUtf8 ().size ()
+                      + m_replace_line_edit->currentText ().toUtf8 ().size ();
+        }
+
+      m_rep_active = false;
+    }
+}
+
+void find_dialog::replace ()
+{
+  if (m_edit_area)
+    {
+      handle_replace_text_changed ();
+
+      // Do the replace if we have selected text
+      if (m_find_result_available && m_edit_area->hasSelectedText ())
+        do_replace ();
+
+      find_next ();
+    }
+}
 
-  // search text has changed: reset the search
-  void find_dialog::handle_search_text_changed ()
-  {
-    // Return if nothing has changed
-    if (m_search_line_edit->currentText () == m_search_line_edit->itemText (0))
-      return;
+void find_dialog::replace_all ()
+{
+  int line, col;
+
+  if (m_edit_area)
+    {
+      handle_replace_text_changed ();
+
+      m_edit_area->getCursorPosition (&line, &col);
+
+      m_rep_all = 1;
+      find_next ();  // find first occurrence (forward)
 
-    if (m_search_selection_check_box->isChecked ())
+      m_edit_area->beginUndoAction ();
+      while (m_find_result_available)   // while search string is found
+        {
+          do_replace ();
+          m_rep_all++;                                          // inc counter
+          find_next ();                                        // find next
+        }
+      m_edit_area->endUndoAction ();
+
+      QMessageBox msg_box (QMessageBox::Information, tr ("Replace Result"),
+                           tr ("%1 items replaced").arg (m_rep_all-1),
+                           QMessageBox::Ok, this);
+      msg_box.exec ();
+
+      m_rep_all = 0;
       m_find_result_available = false;
 
-    mru_update (m_search_line_edit);
-  }
-
-  // replaced text has changed: reset the search
-  void find_dialog::handle_replace_text_changed ()
-  {
-    // Return if nothing has changed
-    if (m_replace_line_edit->currentText () == m_replace_line_edit->itemText (0))
-      return;
-
-    mru_update (m_replace_line_edit);
-  }
-
-  // Update the mru list
-  void find_dialog::mru_update (QComboBox *mru)
-  {
-    // Remove possible empty entries from the mru list
-    int index;
-    while ((index = mru->findText (QString ())) >= 0)
-      mru->removeItem (index);
-
-    // Get current text and return if it is empty
-    QString text = mru->currentText ();
-
-    if (text.isEmpty ())
-      return;
-
-    // Remove occurrences of the current text in the mru list
-    while ((index = mru->findText (text)) >= 0)
-      mru->removeItem (index);
-
-    // Remove the last entry from the end if the list is full
-    if (mru->count () == m_mru_length)
-      mru->removeItem (m_mru_length -1);
-
-    // Insert new item at the beginning and set it as current item
-    mru->insertItem (0, text);
-    mru->setCurrentIndex (0);
-  }
-
-  void find_dialog::handle_sel_search_changed (int selected)
-  {
-    m_from_start_check_box->setEnabled (! selected);
-    m_find_result_available = false;
-  }
-
-  void find_dialog::handle_selection_changed (bool has_selected)
-  {
-    if (m_rep_active)
-      return;
-
-    m_search_selection_check_box->setEnabled (has_selected);
-    m_find_result_available = false;
-  }
+      if (! m_search_selection_check_box->isChecked ())
+        m_edit_area->setCursorPosition (line, col);
+    }
+}
 
-  // initialize search text with selected text if this is in one single line
-  void find_dialog::init_search_text ()
-  {
-    if (m_edit_area && m_edit_area->hasSelectedText ())
-      {
-        int lbeg, lend, cbeg, cend;
-        m_edit_area->getSelection (&lbeg, &cbeg, &lend, &cend);
-        if (lbeg == lend)
-          m_search_line_edit->setCurrentText (m_edit_area->selectedText ());
-      }
-
-    // set focus to "Find what" and select all text
-    m_search_line_edit->setFocus ();
-    m_search_line_edit->lineEdit ()->selectAll ();
-
-    // Default to "find" next time.
-    // Otherwise, it defaults to the last action, which may be "replace all".
-    m_find_next_button->setDefault (true);
-  }
-
-  void find_dialog::find_next ()
-  {
-    find (! m_backward_check_box->isChecked ());
-  }
-
-  void find_dialog::find_prev ()
-  {
-    find (m_backward_check_box->isChecked ());
-  }
+void find_dialog::no_matches_message ()
+{
+  QMessageBox msg_box (QMessageBox::Information, tr ("Find Result"),
+                       tr ("No more matches found"), QMessageBox::Ok, this);
+  msg_box.exec ();
+}
 
-  void find_dialog::find (bool forward)
-  {
-    if (! m_edit_area)
-      return;
-
-    handle_search_text_changed ();
-
-    // line adn col: -1 means search starts at current position
-    int line = -1, col = -1;
-
-    bool do_wrap = m_wrap_check_box->isChecked ();
-    bool do_forward = forward;
-
-    // Initialize the selection begin and end if it is the first search
-    if (! m_find_result_available)
-      {
-        if (m_search_selection_check_box->isChecked ()
-            && m_edit_area->hasSelectedText ())
-          {
-            int l1, c1, l2, c2;
-            m_edit_area->getSelection (&l1, &c1, &l2, &c2);
-
-            // Store the position of the selection
-            m_sel_beg = m_edit_area->positionFromLineIndex (l1, c1);
-            m_sel_end = m_edit_area->positionFromLineIndex (l2, c2);
-            m_in_sel = true;
-          }
-        else
-          m_in_sel = false;
-      }
+void find_dialog::reject ()
+{
+  close ();
+}
 
-    // Get the correct line/col for beginning the search
-    if (m_rep_all)
-      {
-        // Replace All
-        if (m_rep_all == 1)
-          {
-            // Start at the beginning of file/sel if it is the first try
-            if (m_in_sel)
-              m_edit_area->lineIndexFromPosition (m_sel_beg, &line, &col);
-            else
-              {
-                line = 0;
-                col = 0;
-              }
-          }
-        do_wrap = false;  // Never wrap when replacing all
-      }
-    else
-      {
-        // Normal search (not replace all): calculate start position of
-        // search (in file or selection)
-        if (m_from_start_check_box->isChecked ()
-            || (m_in_sel && (! m_find_result_available)))
-          {
-            // From the beginning or the end of file/sel
-            if (do_forward)
-              {
-                // From the beginning
-                if (m_in_sel)
-                  m_edit_area->lineIndexFromPosition (m_sel_beg, &line, &col);
-                else
-                  {
-                    line = 0;
-                    col = 0;
-                  }
-              }
-            else
-              {
-                // From the end
-                if (m_in_sel)
-                  m_edit_area->lineIndexFromPosition (m_sel_end, &line, &col);
-                else
-                  {
-                    line = m_edit_area->lines () - 1;
-                    col  = m_edit_area->text (line).length () - 1;
-                    if (col == -1)
-                      col = 0;
-                  }
-              }
-          }
-        else if (! do_forward)
-          {
-            // Start from where the cursor is.  Fix QScintilla's cursor
-            // positioning
-            m_edit_area->getCursorPosition (&line, &col);
-            if (m_find_result_available && m_edit_area->hasSelectedText ())
-              {
-                int currpos = m_edit_area->positionFromLineIndex (line, col);
-                currpos -= (m_search_line_edit->currentText ().length ());
-                if (currpos < 0)
-                  currpos = 0;
-                m_edit_area->lineIndexFromPosition (currpos, &line, &col);
-              }
-          }
-      }
-
-    // Do the search
-    m_find_result_available
-      = m_edit_area->findFirst (m_search_line_edit->currentText (),
-                                m_regex_check_box->isChecked (),
-                                m_case_check_box->isChecked (),
-                                m_whole_words_check_box->isChecked (),
-                                do_wrap,
-                                do_forward,
-                                line, col,
-                                true
-#if defined (HAVE_QSCI_VERSION_2_6_0)
-                                , true
-#endif
-                               );
-
-    if (m_find_result_available)
-      {
-        // Search successful: reset search-from-start box and check for
-        // the current selection
-        m_from_start_check_box->setChecked (0);
-
-        if (m_in_sel)
-          {
-            m_edit_area->getCursorPosition (&line, &col);
-            int pos = m_edit_area->positionFromLineIndex (line, col);
-
-            int l1, c1, l2, c2;
-            m_edit_area->lineIndexFromPosition (m_sel_beg, &l1, &c1);
-            m_edit_area->lineIndexFromPosition (m_sel_end, &l2, &c2);
-            m_edit_area->show_selection_markers (l1, c1, l2, c2);
-
-            // Check if new start position is still within the selection
-            m_find_result_available =  pos >= m_sel_beg && pos <= m_sel_end;
-          }
-      }
+void find_dialog::closeEvent (QCloseEvent *e)
+{
+  save_settings ();
+  e->accept ();
+}
 
-    // No more search hits
-    if (! m_find_result_available)
-      {
-        if (m_in_sel)
-          {
-            // Restore real selection and remove marker for selection
-            int l1, c1, l2, c2;
-            m_edit_area->lineIndexFromPosition (m_sel_beg, &l1, &c1);
-            m_edit_area->lineIndexFromPosition (m_sel_end, &l2, &c2);
-            m_edit_area->setSelection (l1, c1, l2, c2);
-            m_edit_area->clear_selection_markers ();
-          }
-
-        // Display message if not replace all
-        if (! m_rep_all)
-          no_matches_message ();
-      }
-
-  }
-
-  void find_dialog::do_replace ()
-  {
-    if (m_edit_area)
-      {
-        m_rep_active = true;  // changes in selection not made by the user
-
-        m_edit_area->replace (m_replace_line_edit->currentText ());
-        if (m_in_sel)
-          {
-            // Update the length of the selection
-            m_sel_end = m_sel_end
-                        - m_search_line_edit->currentText ().toUtf8 ().size ()
-                        + m_replace_line_edit->currentText ().toUtf8 ().size ();
-          }
-
-        m_rep_active = false;
-      }
-  }
-
-  void find_dialog::replace ()
-  {
-    if (m_edit_area)
-      {
-        handle_replace_text_changed ();
-
-        // Do the replace if we have selected text
-        if (m_find_result_available && m_edit_area->hasSelectedText ())
-          do_replace ();
-
-        find_next ();
-      }
-  }
-
-  void find_dialog::replace_all ()
-  {
-    int line, col;
-
-    if (m_edit_area)
-      {
-        handle_replace_text_changed ();
-
-        m_edit_area->getCursorPosition (&line, &col);
-
-        m_rep_all = 1;
-        find_next ();  // find first occurrence (forward)
-
-        m_edit_area->beginUndoAction ();
-        while (m_find_result_available)   // while search string is found
-          {
-            do_replace ();
-            m_rep_all++;                                          // inc counter
-            find_next ();                                        // find next
-          }
-        m_edit_area->endUndoAction ();
-
-        QMessageBox msg_box (QMessageBox::Information, tr ("Replace Result"),
-                             tr ("%1 items replaced").arg (m_rep_all-1),
-                             QMessageBox::Ok, this);
-        msg_box.exec ();
-
-        m_rep_all = 0;
-        m_find_result_available = false;
-
-        if (! m_search_selection_check_box->isChecked ())
-          m_edit_area->setCursorPosition (line, col);
-      }
-  }
-
-  void find_dialog::no_matches_message ()
-  {
-    QMessageBox msg_box (QMessageBox::Information, tr ("Find Result"),
-                         tr ("No more matches found"), QMessageBox::Ok, this);
-    msg_box.exec ();
-  }
-
-  void find_dialog::reject ()
-  {
-    close ();
-  }
-
-  void find_dialog::closeEvent (QCloseEvent *e)
-  {
-    save_settings ();
-    e->accept ();
-  }
-
-  // Show and hide with (re-)storing position, otherwise there is always
-  // a small shift each time the dialog is shown again
-  void find_dialog::set_visible (bool visible)
-  {
-    if (visible)
-      {
-        show ();
-        move (m_last_position);
-      }
-    else
-      {
-        m_last_position = pos ();
-        hide ();
-      }
-  }
+// Show and hide with (re-)storing position, otherwise there is always
+// a small shift each time the dialog is shown again
+void find_dialog::set_visible (bool visible)
+{
+  if (visible)
+    {
+      show ();
+      move (m_last_position);
+    }
+  else
+    {
+      m_last_position = pos ();
+      hide ();
+    }
+}
 
 OCTAVE_END_NAMESPACE(octave)
 #endif
--- a/libgui/src/m-editor/find-dialog.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/m-editor/find-dialog.h	Thu Feb 02 12:25:51 2023 -0800
@@ -79,99 +79,99 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class file_editor;
+class file_editor;
 
-  class find_dialog : public QDialog
-  {
-    Q_OBJECT
+class find_dialog : public QDialog
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    find_dialog (octave_dock_widget *ed, QWidget *p);
+  find_dialog (octave_dock_widget *ed, QWidget *p);
 
-    //! Set dialog visible or not and storing the new visibility state
-    void set_visible (bool visible);
+  //! Set dialog visible or not and storing the new visibility state
+  void set_visible (bool visible);
 
-    //! Init the search text with the selected text in the editor tab
-    void init_search_text ();
+  //! Init the search text with the selected text in the editor tab
+  void init_search_text ();
 
-    //! Restore position and the search options from the given settings
-    //! where def_pos is the default position suitable for the current
-    //! editor position
-    void restore_settings (QPoint def_pos);
+  //! Restore position and the search options from the given settings
+  //! where def_pos is the default position suitable for the current
+  //! editor position
+  void restore_settings (QPoint def_pos);
 
-  public slots:
+public slots:
 
-    void find_next ();
-    void find_prev ();
+  void find_next ();
+  void find_prev ();
 
-    //! Slot for updating the edit area when the active tab has changed
-    void update_edit_area (octave_qscintilla *);
+  //! Slot for updating the edit area when the active tab has changed
+  void update_edit_area (octave_qscintilla *);
 
-  private slots:
+private slots:
 
-    void handle_sel_search_changed (int);
-    void handle_selection_changed (bool has_selected);
+  void handle_sel_search_changed (int);
+  void handle_selection_changed (bool has_selected);
 
-    void handle_backward_search_changed (int);
+  void handle_backward_search_changed (int);
 
-    void find (bool forward = true);
-    void replace ();
-    void replace_all ();
+  void find (bool forward = true);
+  void replace ();
+  void replace_all ();
 
-  private:
+private:
 
-    //! Save position and the search options in the given settings
-    void save_settings ();
+  //! Save position and the search options in the given settings
+  void save_settings ();
 
-    //! Reimplemented slot: close instead of hiding
-    void reject ();
+  //! Reimplemented slot: close instead of hiding
+  void reject ();
 
-    //! Reimplemented close event
-    void closeEvent (QCloseEvent *e);
+  //! Reimplemented close event
+  void closeEvent (QCloseEvent *e);
 
-    //! Update mru lists with new entry
-    void mru_update (QComboBox *mru);
+  //! Update mru lists with new entry
+  void mru_update (QComboBox *mru);
 
-    void no_matches_message ();
-    void do_replace ();
+  void no_matches_message ();
+  void do_replace ();
 
-    void handle_search_text_changed ();
-    void handle_replace_text_changed ();
+  void handle_search_text_changed ();
+  void handle_replace_text_changed ();
 
-    octave_dock_widget *m_editor;
+  octave_dock_widget *m_editor;
 
-    QLabel *m_search_label;
-    QComboBox *m_search_line_edit;
-    QLabel *m_replace_label;
-    QComboBox *m_replace_line_edit;
-    QCheckBox *m_case_check_box;
-    QCheckBox *m_from_start_check_box;
-    QCheckBox *m_wrap_check_box;
-    QCheckBox *m_whole_words_check_box;
-    QCheckBox *m_regex_check_box;
-    QCheckBox *m_search_selection_check_box;
-    QCheckBox *m_backward_check_box;
-    QDialogButtonBox *m_button_box;
-    QPushButton *m_find_next_button;
-    QPushButton *m_find_prev_button;
-    QPushButton *m_replace_button;
-    QPushButton *m_replace_all_button;
-    QPushButton *m_more_button;
-    QWidget *m_extension;
-    octave_qscintilla *m_edit_area;
-    bool m_find_result_available;
-    int m_rep_all;
-    bool m_rep_active;
+  QLabel *m_search_label;
+  QComboBox *m_search_line_edit;
+  QLabel *m_replace_label;
+  QComboBox *m_replace_line_edit;
+  QCheckBox *m_case_check_box;
+  QCheckBox *m_from_start_check_box;
+  QCheckBox *m_wrap_check_box;
+  QCheckBox *m_whole_words_check_box;
+  QCheckBox *m_regex_check_box;
+  QCheckBox *m_search_selection_check_box;
+  QCheckBox *m_backward_check_box;
+  QDialogButtonBox *m_button_box;
+  QPushButton *m_find_next_button;
+  QPushButton *m_find_prev_button;
+  QPushButton *m_replace_button;
+  QPushButton *m_replace_all_button;
+  QPushButton *m_more_button;
+  QWidget *m_extension;
+  octave_qscintilla *m_edit_area;
+  bool m_find_result_available;
+  int m_rep_all;
+  bool m_rep_active;
 
-    bool m_in_sel;
-    int m_sel_beg;
-    int m_sel_end;
+  bool m_in_sel;
+  int m_sel_beg;
+  int m_sel_end;
 
-    QPoint m_last_position;
+  QPoint m_last_position;
 
-    const int m_mru_length = 10;
-  };
+  const int m_mru_length = 10;
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/src/m-editor/octave-qscintilla.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/m-editor/octave-qscintilla.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -74,1334 +74,1334 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  static bool
-  is_end (const QString& candidate, const QString& opening)
-  {
-    bool retval = false;
+static bool
+is_end (const QString& candidate, const QString& opening)
+{
+  bool retval = false;
 
-    if (opening == "do")          // The only one that can't be ended by "end"
-      {
-        if (candidate == "until")
-          retval = true;
-      }
-    else
-      {
-        if (candidate == "end")
-          retval =  true;
-        else
-          {
-            if (opening == "try")
-              {
-                if (candidate == "catch" || candidate == "end_try_catch")
-                  retval = true;
-              }
-            else if (opening == "unwind_protect")
-              {
-                if (candidate == "unwind_protect_cleanup"
-                    || candidate == "end_unwind_protect")
-                  retval = true;
-              }
-            else if (candidate == "end" + opening)
-              retval = true;
-            else if (opening == "if" && candidate == "else")
-              retval = true;
-          }
-      }
+  if (opening == "do")          // The only one that can't be ended by "end"
+    {
+      if (candidate == "until")
+        retval = true;
+    }
+  else
+    {
+      if (candidate == "end")
+        retval =  true;
+      else
+        {
+          if (opening == "try")
+            {
+              if (candidate == "catch" || candidate == "end_try_catch")
+                retval = true;
+            }
+          else if (opening == "unwind_protect")
+            {
+              if (candidate == "unwind_protect_cleanup"
+                  || candidate == "end_unwind_protect")
+                retval = true;
+            }
+          else if (candidate == "end" + opening)
+            retval = true;
+          else if (opening == "if" && candidate == "else")
+            retval = true;
+        }
+    }
 
-    return retval;
-  }
+  return retval;
+}
 
-  octave_qscintilla::octave_qscintilla (QWidget *p)
-    : QsciScintilla (p), m_debug_mode (false), m_word_at_cursor (),
-      m_selection (), m_selection_replacement (), m_selection_line (-1),
-      m_selection_col (-1), m_indicator_id (1)
-  {
-    connect (this, SIGNAL (textChanged ()),
-             this, SLOT (text_changed ()));
+octave_qscintilla::octave_qscintilla (QWidget *p)
+  : QsciScintilla (p), m_debug_mode (false), m_word_at_cursor (),
+    m_selection (), m_selection_replacement (), m_selection_line (-1),
+    m_selection_col (-1), m_indicator_id (1)
+{
+  connect (this, SIGNAL (textChanged ()),
+           this, SLOT (text_changed ()));
 
-    connect (this, SIGNAL (cursorPositionChanged (int, int)),
-             this, SLOT (cursor_position_changed (int, int)));
+  connect (this, SIGNAL (cursorPositionChanged (int, int)),
+           this, SLOT (cursor_position_changed (int, int)));
 
-    connect (this, &octave_qscintilla::ctx_menu_run_finished_signal,
-             this, &octave_qscintilla::ctx_menu_run_finished,
-             Qt::QueuedConnection);
+  connect (this, &octave_qscintilla::ctx_menu_run_finished_signal,
+           this, &octave_qscintilla::ctx_menu_run_finished,
+           Qt::QueuedConnection);
 
-    // clear scintilla edit shortcuts that are handled by the editor
-    QsciCommandSet *cmd_set = standardCommands ();
+  // clear scintilla edit shortcuts that are handled by the editor
+  QsciCommandSet *cmd_set = standardCommands ();
 
-    // Disable buffered drawing on all systems
-    SendScintilla (SCI_SETBUFFEREDDRAW, false);
+  // Disable buffered drawing on all systems
+  SendScintilla (SCI_SETBUFFEREDDRAW, false);
 
 #if defined (HAVE_QSCI_VERSION_2_6_0)
-    // find () was added in QScintilla 2.6
-    cmd_set->find (QsciCommand::SelectionCopy)->setKey (0);
-    cmd_set->find (QsciCommand::SelectionCut)->setKey (0);
-    cmd_set->find (QsciCommand::Paste)->setKey (0);
-    cmd_set->find (QsciCommand::SelectAll)->setKey (0);
-    cmd_set->find (QsciCommand::SelectionDuplicate)->setKey (0);
-    cmd_set->find (QsciCommand::LineTranspose)->setKey (0);
-    cmd_set->find (QsciCommand::Undo)->setKey (0);
-    cmd_set->find (QsciCommand::Redo)->setKey (0);
-    cmd_set->find (QsciCommand::SelectionUpperCase)->setKey (0);
-    cmd_set->find (QsciCommand::SelectionLowerCase)->setKey (0);
-    cmd_set->find (QsciCommand::ZoomIn)->setKey (0);
-    cmd_set->find (QsciCommand::ZoomOut)->setKey (0);
-    cmd_set->find (QsciCommand::DeleteWordLeft)->setKey (0);
-    cmd_set->find (QsciCommand::DeleteWordRight)->setKey (0);
-    cmd_set->find (QsciCommand::DeleteLineLeft)->setKey (0);
-    cmd_set->find (QsciCommand::DeleteLineRight)->setKey (0);
-    cmd_set->find (QsciCommand::LineDelete)->setKey (0);
-    cmd_set->find (QsciCommand::LineCut)->setKey (0);
-    cmd_set->find (QsciCommand::LineCopy)->setKey (0);
+  // find () was added in QScintilla 2.6
+  cmd_set->find (QsciCommand::SelectionCopy)->setKey (0);
+  cmd_set->find (QsciCommand::SelectionCut)->setKey (0);
+  cmd_set->find (QsciCommand::Paste)->setKey (0);
+  cmd_set->find (QsciCommand::SelectAll)->setKey (0);
+  cmd_set->find (QsciCommand::SelectionDuplicate)->setKey (0);
+  cmd_set->find (QsciCommand::LineTranspose)->setKey (0);
+  cmd_set->find (QsciCommand::Undo)->setKey (0);
+  cmd_set->find (QsciCommand::Redo)->setKey (0);
+  cmd_set->find (QsciCommand::SelectionUpperCase)->setKey (0);
+  cmd_set->find (QsciCommand::SelectionLowerCase)->setKey (0);
+  cmd_set->find (QsciCommand::ZoomIn)->setKey (0);
+  cmd_set->find (QsciCommand::ZoomOut)->setKey (0);
+  cmd_set->find (QsciCommand::DeleteWordLeft)->setKey (0);
+  cmd_set->find (QsciCommand::DeleteWordRight)->setKey (0);
+  cmd_set->find (QsciCommand::DeleteLineLeft)->setKey (0);
+  cmd_set->find (QsciCommand::DeleteLineRight)->setKey (0);
+  cmd_set->find (QsciCommand::LineDelete)->setKey (0);
+  cmd_set->find (QsciCommand::LineCut)->setKey (0);
+  cmd_set->find (QsciCommand::LineCopy)->setKey (0);
 #else
-    // find commands via its default key (tricky way without find ())
-    QList< QsciCommand * > cmd_list = cmd_set->commands ();
-    for (int i = 0; i < cmd_list.length (); i++)
-      {
-        int cmd_key = cmd_list.at (i)->key ();
-        switch (cmd_key)
-          {
-          case Qt::Key_C | Qt::CTRL :               // SelectionCopy
-          case Qt::Key_X | Qt::CTRL :               // SelectionCut
-          case Qt::Key_V | Qt::CTRL :               // Paste
-          case Qt::Key_A | Qt::CTRL :               // SelectAll
-          case Qt::Key_D | Qt::CTRL :               // SelectionDuplicate
-          case Qt::Key_T | Qt::CTRL :               // LineTranspose
-          case Qt::Key_Z | Qt::CTRL :               // Undo
-          case Qt::Key_Y | Qt::CTRL :               // Redo
-          case Qt::Key_Z | Qt::CTRL | Qt::SHIFT :   // Redo
-          case Qt::Key_U | Qt::CTRL :               // SelectionLowerCase
-          case Qt::Key_U | Qt::CTRL | Qt::SHIFT :   // SelectionUpperCase
-          case Qt::Key_Plus | Qt::CTRL :            // ZoomIn
-          case Qt::Key_Minus | Qt::CTRL :           // ZoomOut
-          case Qt::Key_Backspace | Qt::CTRL | Qt::SHIFT :   // DeleteLineLeft
-          case Qt::Key_Delete | Qt::CTRL | Qt::SHIFT :      // DeleteLineRight
-          case Qt::Key_K | Qt::META :                       // DeleteLineRight
-          case Qt::Key_Backspace | Qt::CTRL :       // DeleteWordLeft
-          case Qt::Key_Delete | Qt::CTRL :          // DeleteWordRight
-          case Qt::Key_L | Qt::CTRL | Qt::SHIFT :   // LineDelete
-          case Qt::Key_L | Qt::CTRL :               // LineCut
-          case Qt::Key_T | Qt::CTRL | Qt::SHIFT :   // LineCopy
-            cmd_list.at (i)->setKey (0);
-          }
-      }
+  // find commands via its default key (tricky way without find ())
+  QList< QsciCommand * > cmd_list = cmd_set->commands ();
+  for (int i = 0; i < cmd_list.length (); i++)
+    {
+      int cmd_key = cmd_list.at (i)->key ();
+      switch (cmd_key)
+        {
+        case Qt::Key_C | Qt::CTRL :               // SelectionCopy
+        case Qt::Key_X | Qt::CTRL :               // SelectionCut
+        case Qt::Key_V | Qt::CTRL :               // Paste
+        case Qt::Key_A | Qt::CTRL :               // SelectAll
+        case Qt::Key_D | Qt::CTRL :               // SelectionDuplicate
+        case Qt::Key_T | Qt::CTRL :               // LineTranspose
+        case Qt::Key_Z | Qt::CTRL :               // Undo
+        case Qt::Key_Y | Qt::CTRL :               // Redo
+        case Qt::Key_Z | Qt::CTRL | Qt::SHIFT :   // Redo
+        case Qt::Key_U | Qt::CTRL :               // SelectionLowerCase
+        case Qt::Key_U | Qt::CTRL | Qt::SHIFT :   // SelectionUpperCase
+        case Qt::Key_Plus | Qt::CTRL :            // ZoomIn
+        case Qt::Key_Minus | Qt::CTRL :           // ZoomOut
+        case Qt::Key_Backspace | Qt::CTRL | Qt::SHIFT :   // DeleteLineLeft
+        case Qt::Key_Delete | Qt::CTRL | Qt::SHIFT :      // DeleteLineRight
+        case Qt::Key_K | Qt::META :                       // DeleteLineRight
+        case Qt::Key_Backspace | Qt::CTRL :       // DeleteWordLeft
+        case Qt::Key_Delete | Qt::CTRL :          // DeleteWordRight
+        case Qt::Key_L | Qt::CTRL | Qt::SHIFT :   // LineDelete
+        case Qt::Key_L | Qt::CTRL :               // LineCut
+        case Qt::Key_T | Qt::CTRL | Qt::SHIFT :   // LineCopy
+          cmd_list.at (i)->setKey (0);
+        }
+    }
 #endif
 
 #if defined (Q_OS_MAC)
-    // Octave interprets Cmd key as Meta whereas Qscintilla interprets it
-    // as Ctrl.  We thus invert Meta/Ctrl in Qscintilla's shortcuts list.
-    QList< QsciCommand * > cmd_list_mac = cmd_set->commands ();
-    for (int i = 0; i < cmd_list_mac.length (); i++)
-      {
-        // Primary key
-        int key = cmd_list_mac.at (i)->key ();
+  // Octave interprets Cmd key as Meta whereas Qscintilla interprets it
+  // as Ctrl.  We thus invert Meta/Ctrl in Qscintilla's shortcuts list.
+  QList< QsciCommand * > cmd_list_mac = cmd_set->commands ();
+  for (int i = 0; i < cmd_list_mac.length (); i++)
+    {
+      // Primary key
+      int key = cmd_list_mac.at (i)->key ();
 
-        if (static_cast<int> (key | Qt::META) == key
-            && static_cast<int> (key | Qt::CTRL) != key)
-          key = (key ^ Qt::META) | Qt::CTRL;
-        else if (static_cast<int> (key | Qt::CTRL) == key)
-          key = (key ^ Qt::CTRL) | Qt::META;
+      if (static_cast<int> (key | Qt::META) == key
+          && static_cast<int> (key | Qt::CTRL) != key)
+        key = (key ^ Qt::META) | Qt::CTRL;
+      else if (static_cast<int> (key | Qt::CTRL) == key)
+        key = (key ^ Qt::CTRL) | Qt::META;
 
-        cmd_list_mac.at (i)->setKey (key);
+      cmd_list_mac.at (i)->setKey (key);
 
-        // Alternate key
-        key = cmd_list_mac.at (i)->alternateKey ();
+      // Alternate key
+      key = cmd_list_mac.at (i)->alternateKey ();
 
-        if (static_cast<int> (key | Qt::META) == key
-            && static_cast<int> (key | Qt::CTRL) != key)
-          key = (key ^ Qt::META) | Qt::CTRL;
-        else if (static_cast<int> (key | Qt::CTRL) == key)
-          key = (key ^ Qt::CTRL) | Qt::META;
+      if (static_cast<int> (key | Qt::META) == key
+          && static_cast<int> (key | Qt::CTRL) != key)
+        key = (key ^ Qt::META) | Qt::CTRL;
+      else if (static_cast<int> (key | Qt::CTRL) == key)
+        key = (key ^ Qt::CTRL) | Qt::META;
 
-        cmd_list_mac.at (i)->setAlternateKey (key);
-      }
+      cmd_list_mac.at (i)->setAlternateKey (key);
+    }
 #endif
 
-    // selection markers
+  // selection markers
 
-    m_indicator_id = indicatorDefine (QsciScintilla::StraightBoxIndicator);
-    if (m_indicator_id == -1)
-      m_indicator_id = 1;
+  m_indicator_id = indicatorDefine (QsciScintilla::StraightBoxIndicator);
+  if (m_indicator_id == -1)
+    m_indicator_id = 1;
 
-    setIndicatorDrawUnder (true, m_indicator_id);
+  setIndicatorDrawUnder (true, m_indicator_id);
 
-    markerDefine (QsciScintilla::Minus, marker::selection);
+  markerDefine (QsciScintilla::Minus, marker::selection);
 
-    // init state of undo/redo action for this tab
-    emit status_update (isUndoAvailable (), isRedoAvailable ());
-  }
+  // init state of undo/redo action for this tab
+  emit status_update (isUndoAvailable (), isRedoAvailable ());
+}
 
-  void octave_qscintilla::setCursorPosition (int line, int col)
-  {
-    QsciScintilla::setCursorPosition (line, col);
-    emit update_rowcol_indicator_signal (line, col);
-  }
+void octave_qscintilla::setCursorPosition (int line, int col)
+{
+  QsciScintilla::setCursorPosition (line, col);
+  emit update_rowcol_indicator_signal (line, col);
+}
 
-  void octave_qscintilla::set_selection_marker_color (const QColor& c)
-  {
-    QColor ic = c;
-    ic.setAlphaF (0.45);
-    setIndicatorForegroundColor (ic, m_indicator_id);
-    setIndicatorOutlineColor (ic, m_indicator_id);
+void octave_qscintilla::set_selection_marker_color (const QColor& c)
+{
+  QColor ic = c;
+  ic.setAlphaF (0.45);
+  setIndicatorForegroundColor (ic, m_indicator_id);
+  setIndicatorOutlineColor (ic, m_indicator_id);
 
-    setMarkerForegroundColor (c, marker::selection);
-    setMarkerBackgroundColor (c, marker::selection);
-  }
+  setMarkerForegroundColor (c, marker::selection);
+  setMarkerBackgroundColor (c, marker::selection);
+}
 
-  // context menu requested
-  void octave_qscintilla::contextMenuEvent (QContextMenuEvent *e)
-  {
+// context menu requested
+void octave_qscintilla::contextMenuEvent (QContextMenuEvent *e)
+{
 #if defined (HAVE_QSCI_VERSION_2_6_0)
-    QPoint global_pos, local_pos;                         // the menu's position
-    QMenu *context_menu = createStandardContextMenu ();  // standard menu
+  QPoint global_pos, local_pos;                         // the menu's position
+  QMenu *context_menu = createStandardContextMenu ();  // standard menu
 
-    bool in_left_margin = false;
+  bool in_left_margin = false;
 
-    // determine position depending on mouse or keyboard event
-    if (e->reason () == QContextMenuEvent::Mouse)
-      {
-        // context menu by mouse
-        global_pos = e->globalPos ();            // global mouse position
-        local_pos  = e->pos ();                  // local mouse position
-        if (e->x () < marginWidth (1) + marginWidth (2))
-          in_left_margin = true;
-      }
-    else
-      {
-        // context menu by keyboard or other: get point of text cursor
-        get_global_textcursor_pos (&global_pos, &local_pos);
-        QRect editor_rect = geometry ();      // editor rect mapped to global
-        editor_rect.moveTopLeft
-          (parentWidget ()->mapToGlobal (editor_rect.topLeft ()));
-        if (! editor_rect.contains (global_pos))  // is cursor outside editor?
-          global_pos = editor_rect.topLeft ();   // yes, take top left corner
-      }
+  // determine position depending on mouse or keyboard event
+  if (e->reason () == QContextMenuEvent::Mouse)
+    {
+      // context menu by mouse
+      global_pos = e->globalPos ();            // global mouse position
+      local_pos  = e->pos ();                  // local mouse position
+      if (e->x () < marginWidth (1) + marginWidth (2))
+        in_left_margin = true;
+    }
+  else
+    {
+      // context menu by keyboard or other: get point of text cursor
+      get_global_textcursor_pos (&global_pos, &local_pos);
+      QRect editor_rect = geometry ();      // editor rect mapped to global
+      editor_rect.moveTopLeft
+        (parentWidget ()->mapToGlobal (editor_rect.topLeft ()));
+      if (! editor_rect.contains (global_pos))  // is cursor outside editor?
+        global_pos = editor_rect.topLeft ();   // yes, take top left corner
+    }
 
 #  if defined (HAVE_QSCI_VERSION_2_6_0)
-    if (! in_left_margin)
+  if (! in_left_margin)
 #  endif
-      {
-        // fill context menu with editor's standard actions
-        emit create_context_menu_signal (context_menu);
+    {
+      // fill context menu with editor's standard actions
+      emit create_context_menu_signal (context_menu);
 
-        // additional custom entries of the context menu
-        context_menu->addSeparator ();   // separator before custom entries
+      // additional custom entries of the context menu
+      context_menu->addSeparator ();   // separator before custom entries
 
-        // help menu: get the position of the mouse or the text cursor
-        // (only for octave files)
-        QString lexer_name = lexer ()->lexer ();
-        if (lexer_name == "octave" || lexer_name == "matlab")
-          {
-            m_word_at_cursor = wordAtPoint (local_pos);
-            if (! m_word_at_cursor.isEmpty ())
-              {
-                context_menu->addAction (tr ("Help on") + ' ' + m_word_at_cursor,
-                                         this, &octave_qscintilla::contextmenu_help);
-                context_menu->addAction (tr ("Documentation on")
-                                         + ' ' + m_word_at_cursor,
-                                         this, &octave_qscintilla::contextmenu_doc);
-                context_menu->addAction (tr ("Edit") + ' ' + m_word_at_cursor,
-                                         this, &octave_qscintilla::contextmenu_edit);
-              }
-          }
-      }
+      // help menu: get the position of the mouse or the text cursor
+      // (only for octave files)
+      QString lexer_name = lexer ()->lexer ();
+      if (lexer_name == "octave" || lexer_name == "matlab")
+        {
+          m_word_at_cursor = wordAtPoint (local_pos);
+          if (! m_word_at_cursor.isEmpty ())
+            {
+              context_menu->addAction (tr ("Help on") + ' ' + m_word_at_cursor,
+                                       this, &octave_qscintilla::contextmenu_help);
+              context_menu->addAction (tr ("Documentation on")
+                                       + ' ' + m_word_at_cursor,
+                                       this, &octave_qscintilla::contextmenu_doc);
+              context_menu->addAction (tr ("Edit") + ' ' + m_word_at_cursor,
+                                       this, &octave_qscintilla::contextmenu_edit);
+            }
+        }
+    }
 #  if defined (HAVE_QSCI_VERSION_2_6_0)
-    else
-      {
-        // remove all standard actions from scintilla
-        QList<QAction *> all_actions = context_menu->actions ();
+  else
+    {
+      // remove all standard actions from scintilla
+      QList<QAction *> all_actions = context_menu->actions ();
 
-        for (auto *a : all_actions)
-          context_menu->removeAction (a);
+      for (auto *a : all_actions)
+        context_menu->removeAction (a);
 
-        QAction *act
-          = context_menu->addAction (tr ("dbstop if ..."), this,
-                                     &octave_qscintilla::contextmenu_break_condition);
-        act->setData (local_pos);
-      }
+      QAction *act
+        = context_menu->addAction (tr ("dbstop if ..."), this,
+                                   &octave_qscintilla::contextmenu_break_condition);
+      act->setData (local_pos);
+    }
 #  endif
 
-    // finally show the menu
-    context_menu->exec (global_pos);
+  // finally show the menu
+  context_menu->exec (global_pos);
 
 #else
 
-    octave_unused_parameter (e);
+  octave_unused_parameter (e);
 
 #endif
-  }
+}
 
-  // common function with flag for documentation
-  void octave_qscintilla::contextmenu_help_doc (bool documentation)
-  {
-    if (documentation)
-      {
-        std::string name = m_word_at_cursor.toStdString ();
+// common function with flag for documentation
+void octave_qscintilla::contextmenu_help_doc (bool documentation)
+{
+  if (documentation)
+    {
+      std::string name = m_word_at_cursor.toStdString ();
 
-        emit interpreter_event
-          ([=] (interpreter& interp)
-           {
-             // INTERPRETER THREAD
+      emit interpreter_event
+        ([=] (interpreter& interp)
+         {
+           // INTERPRETER THREAD
 
-             F__event_manager_show_documentation__ (interp, ovl (name));
-           });
-      }
-    else
-      emit execute_command_in_terminal_signal ("help " + m_word_at_cursor);
-  }
+           F__event_manager_show_documentation__ (interp, ovl (name));
+         });
+    }
+  else
+    emit execute_command_in_terminal_signal ("help " + m_word_at_cursor);
+}
 
-  // call edit the function related to the current word
-  void octave_qscintilla::context_edit ()
-  {
-    if (get_actual_word ())
-      contextmenu_edit (true);
-  }
+// call edit the function related to the current word
+void octave_qscintilla::context_edit ()
+{
+  if (get_actual_word ())
+    contextmenu_edit (true);
+}
 
-  // call edit the function related to the current word
-  void octave_qscintilla::context_run ()
-  {
-    if (hasSelectedText ())
-      {
-        contextmenu_run (true);
+// call edit the function related to the current word
+void octave_qscintilla::context_run ()
+{
+  if (hasSelectedText ())
+    {
+      contextmenu_run (true);
 
-        emit interpreter_event
-          ([] (interpreter&)
-            { command_editor::erase_empty_line (false); });
-      }
-  }
+      emit interpreter_event
+        ([] (interpreter&)
+          { command_editor::erase_empty_line (false); });
+    }
+}
 
-  void octave_qscintilla::get_global_textcursor_pos (QPoint *global_pos,
-                                                     QPoint *local_pos)
-  {
-    long position = SendScintilla (SCI_GETCURRENTPOS);
-    long point_x  = SendScintilla (SCI_POINTXFROMPOSITION, 0, position);
-    long point_y  = SendScintilla (SCI_POINTYFROMPOSITION, 0, position);
-    *local_pos = QPoint (point_x, point_y); // local cursor position
-    *global_pos = mapToGlobal (*local_pos); // global position of cursor
-  }
+void octave_qscintilla::get_global_textcursor_pos (QPoint *global_pos,
+                                                   QPoint *local_pos)
+{
+  long position = SendScintilla (SCI_GETCURRENTPOS);
+  long point_x  = SendScintilla (SCI_POINTXFROMPOSITION, 0, position);
+  long point_y  = SendScintilla (SCI_POINTYFROMPOSITION, 0, position);
+  *local_pos = QPoint (point_x, point_y); // local cursor position
+  *global_pos = mapToGlobal (*local_pos); // global position of cursor
+}
 
-  // determine the actual word and whether we are in an octave or matlab script
-  bool octave_qscintilla::get_actual_word ()
-  {
-    QPoint global_pos, local_pos;
-    get_global_textcursor_pos (&global_pos, &local_pos);
-    m_word_at_cursor = wordAtPoint (local_pos);
-    QString lexer_name = lexer ()->lexer ();
-    return ((lexer_name == "octave" || lexer_name == "matlab")
-            && ! m_word_at_cursor.isEmpty ());
-  }
+// determine the actual word and whether we are in an octave or matlab script
+bool octave_qscintilla::get_actual_word ()
+{
+  QPoint global_pos, local_pos;
+  get_global_textcursor_pos (&global_pos, &local_pos);
+  m_word_at_cursor = wordAtPoint (local_pos);
+  QString lexer_name = lexer ()->lexer ();
+  return ((lexer_name == "octave" || lexer_name == "matlab")
+          && ! m_word_at_cursor.isEmpty ());
+}
 
-  // helper function for clearing all indicators of a specific style
-  void octave_qscintilla::clear_selection_markers ()
-  {
-    int end_pos = text ().length ();
-    int end_line, end_col;
-    lineIndexFromPosition (end_pos, &end_line, &end_col);
-    clearIndicatorRange (0, 0, end_line, end_col, m_indicator_id);
+// helper function for clearing all indicators of a specific style
+void octave_qscintilla::clear_selection_markers ()
+{
+  int end_pos = text ().length ();
+  int end_line, end_col;
+  lineIndexFromPosition (end_pos, &end_line, &end_col);
+  clearIndicatorRange (0, 0, end_line, end_col, m_indicator_id);
 
-    markerDeleteAll (marker::selection);
-  }
+  markerDeleteAll (marker::selection);
+}
 
-  QString octave_qscintilla::eol_string ()
-  {
-    switch (eolMode ())
-      {
-      case QsciScintilla::EolWindows:
-        return ("\r\n");
-      case QsciScintilla::EolMac:
-        return ("\r");
-      case QsciScintilla::EolUnix:
-        return ("\n");
-      }
+QString octave_qscintilla::eol_string ()
+{
+  switch (eolMode ())
+    {
+    case QsciScintilla::EolWindows:
+      return ("\r\n");
+    case QsciScintilla::EolMac:
+      return ("\r");
+    case QsciScintilla::EolUnix:
+      return ("\n");
+    }
 
-    // Last resort, if the above goes wrong (should never happen)
-    return ("\r\n");
-  }
+  // Last resort, if the above goes wrong (should never happen)
+  return ("\r\n");
+}
 
-  // Function returning the true cursor position where the tab length
-  // is taken into account.
-  void octave_qscintilla::get_current_position (int *pos, int *line, int *col)
-  {
-    *pos = SendScintilla (QsciScintillaBase::SCI_GETCURRENTPOS);
-    *line = SendScintilla (QsciScintillaBase::SCI_LINEFROMPOSITION, *pos);
-    *col = SendScintilla (QsciScintillaBase::SCI_GETCOLUMN, *pos);
-  }
+// Function returning the true cursor position where the tab length
+// is taken into account.
+void octave_qscintilla::get_current_position (int *pos, int *line, int *col)
+{
+  *pos = SendScintilla (QsciScintillaBase::SCI_GETCURRENTPOS);
+  *line = SendScintilla (QsciScintillaBase::SCI_LINEFROMPOSITION, *pos);
+  *col = SendScintilla (QsciScintillaBase::SCI_GETCOLUMN, *pos);
+}
 
-  // Function returning the comment string of the current lexer
-  QStringList octave_qscintilla::comment_string (bool comment)
-  {
-    int lexer = SendScintilla (SCI_GETLEXER);
+// Function returning the comment string of the current lexer
+QStringList octave_qscintilla::comment_string (bool comment)
+{
+  int lexer = SendScintilla (SCI_GETLEXER);
 
-    switch (lexer)
-      {
+  switch (lexer)
+    {
 #if defined (HAVE_LEXER_OCTAVE) || defined (HAVE_LEXER_MATLAB)
 #if defined (HAVE_LEXER_OCTAVE)
-      case SCLEX_OCTAVE:
+    case SCLEX_OCTAVE:
 #else
-      case SCLEX_MATLAB:
+    case SCLEX_MATLAB:
 #endif
-        {
-          gui_settings settings;
-
-          int comment_string;
-
-          if (comment)
-            {
-              // The commenting string is requested
-              if (settings.contains (ed_comment_str.settings_key ()))
-                // new version (radio buttons)
-                comment_string = settings.int_value (ed_comment_str);
-              else
-                // old version (combo box)
-                comment_string = settings.value (ed_comment_str_old.settings_key (),
-                                                 ed_comment_str.def ()).toInt ();
-
-              return (QStringList (ed_comment_strings.at (comment_string)));
-            }
-          else
-            {
-              QStringList c_str;
-
-              // The possible uncommenting string(s) are requested
-              comment_string = settings.int_value (ed_uncomment_str);
-
-              for (int i = 0; i < ed_comment_strings_count; i++)
-                {
-                  if (1 << i & comment_string)
-                    c_str.append (ed_comment_strings.at (i));
-                }
-
-              return c_str;
-            }
-
-        }
-#endif
-
-      case SCLEX_PERL:
-      case SCLEX_BASH:
-      case SCLEX_DIFF:
-        return QStringList ("#");
+      {
+        gui_settings settings;
 
-      case SCLEX_CPP:
-        return QStringList ("//");
-
-      case SCLEX_BATCH:
-        return QStringList ("REM ");
-      }
-
-    return QStringList ("%");  // should never happen
-  }
-
-  // provide the style at a specific position
-  int octave_qscintilla::get_style (int pos)
-  {
-    int position;
-    if (pos < 0)
-      // The positition has to be reduced by 2 for getting the real style (?)
-      position = SendScintilla (QsciScintillaBase::SCI_GETCURRENTPOS) - 2;
-    else
-      position = pos;
-
-    return SendScintilla (QsciScintillaBase::SCI_GETSTYLEAT, position);
-  }
-
-  // Is a specific cursor position in a line or block comment?
-  int octave_qscintilla::is_style_comment (int pos)
-  {
-    int lexer = SendScintilla (QsciScintillaBase::SCI_GETLEXER);
-    int style = get_style (pos);
-
-    switch (lexer)
-      {
-      case SCLEX_CPP:
-        return (ST_LINE_COMMENT * (style == QsciLexerCPP::CommentLine
-                                   || style == QsciLexerCPP::CommentLineDoc)
-                + ST_BLOCK_COMMENT * (style == QsciLexerCPP::Comment
-                                      || style == QsciLexerCPP::CommentDoc
-                                      || style == QsciLexerCPP::CommentDocKeyword
-                                      || style == QsciLexerCPP::CommentDocKeywordError));
-
-#if defined (HAVE_LEXER_MATLAB)
-      case SCLEX_MATLAB:
-        return (ST_LINE_COMMENT * (style == QsciLexerMatlab::Comment));
-#endif
-#if  defined (HAVE_LEXER_OCTAVE)
-      case SCLEX_OCTAVE:
-        return (ST_LINE_COMMENT * (style == QsciLexerOctave::Comment));
-#endif
+        int comment_string;
 
-      case SCLEX_PERL:
-        return (ST_LINE_COMMENT * (style == QsciLexerPerl::Comment));
-
-      case SCLEX_BATCH:
-        return (ST_LINE_COMMENT * (style == QsciLexerBatch::Comment));
-
-      case SCLEX_DIFF:
-        return (ST_LINE_COMMENT * (style == QsciLexerDiff::Comment));
-
-      case SCLEX_BASH:
-        return (ST_LINE_COMMENT * (style == QsciLexerBash::Comment));
-
-      }
-
-    return ST_NONE;
-  }
-
-  // Do smart indentation after if, for, ...
-  void octave_qscintilla::smart_indent (bool do_smart_indent, int do_auto_close,
-                                        int line, int ind_char_width)
-  {
-    QString prevline = text (line);
-
-    QRegExp bkey = QRegExp ("^[\t ]*(if|for|while|switch"
-                            "|do|function|properties|events|classdef"
-                            "|unwind_protect|try"
-                            "|parfor|methods)"
-                            "[\r]?[\n\t #%]");
-    // last word except for comments, assuming no ' or " in comment.
-    // rx_end = QRegExp ("(\\w+)[ \t;\r\n]*([%#][^\"']*)?$");
-
-    // last word except for comments,
-    // allowing % and # in single or double quoted strings
-    // FIXME: This will get confused by transpose.
-    QRegExp ekey = QRegExp ("(?:(?:['\"][^'\"]*['\"])?[^%#]*)*"
-                            "(\\w+)[ \t;\r\n]*(?:[%#].*)?$");
-
-    int bpos = bkey.indexIn (prevline, 0);
-    int epos;
-
-    if (bpos > -1)
-      {
-        // Found keyword after that indentation should be added
+        if (comment)
+          {
+            // The commenting string is requested
+            if (settings.contains (ed_comment_str.settings_key ()))
+              // new version (radio buttons)
+              comment_string = settings.int_value (ed_comment_str);
+            else
+              // old version (combo box)
+              comment_string = settings.value (ed_comment_str_old.settings_key (),
+                                               ed_comment_str.def ()).toInt ();
 
-        // Check for existing end statement in the same line
-        epos = ekey.indexIn (prevline, bpos);
-        QString first_word = bkey.cap(1);
-        bool inline_end = (epos > -1) && is_end (ekey.cap(1), first_word);
-
-        if (do_smart_indent && ! inline_end)
-          {
-            // Do smart indent in the current line (line+1)
-            indent (line+1);
-            setCursorPosition (line+1, indentation (line+1) / ind_char_width);
-          }
-
-        if (do_auto_close
-            && ! inline_end
-            && ! first_word.contains (QRegExp ("(?:case|otherwise|unwind_protect_cleanup)")))
-          {
-            // Do auto close
-            auto_close (do_auto_close, line, prevline, first_word);
-          }
-
-        return;
-      }
-
-    QRegExp mkey = QRegExp ("^[\t ]*(?:else|elseif|catch|unwind_protect_cleanup)"
-                            "[\r]?[\t #%\n]");
-    if (prevline.contains (mkey))
-      {
-        int prev_ind = indentation (line-1);
-        int act_ind = indentation (line);
-
-        if (prev_ind == act_ind)
-          unindent (line);
-        else if (prev_ind > act_ind)
-          {
-            setIndentation (line+1, prev_ind);
-            setCursorPosition (line+1, prev_ind);
-          }
-        return;
-      }
-
-    QRegExp case_key = QRegExp ("^[\t ]*(?:case|otherwise)[\r]?[\t #%\n]");
-    if (prevline.contains (case_key) && do_smart_indent)
-      {
-        QString last_line = text (line-1);
-        int prev_ind = indentation (line-1);
-        int act_ind = indentation (line);
-
-        if (last_line.contains (QRegExp ("^[\t ]*switch")))
-          {
-            indent (line+1);
-            act_ind = indentation (line+1);
+            return (QStringList (ed_comment_strings.at (comment_string)));
           }
         else
           {
-            if (prev_ind == act_ind)
-              unindent (line);
-            else if (prev_ind > act_ind)
-              act_ind = prev_ind;
-          }
-
-        setIndentation (line+1, act_ind);
-        setCursorPosition (line+1, act_ind);
-      }
+            QStringList c_str;
 
-    ekey = QRegExp ("^[\t ]*(?:end|endif|endfor|endwhile|until|endfunction"
-                    "|endswitch|end_try_catch|end_unwind_protect)[\r]?[\t #%\n(;]");
-    if (prevline.contains (ekey))
-      {
-        if (indentation (line-1) <= indentation (line))
-          {
-            unindent (line+1);
-            unindent (line);
-            if (prevline.contains ("endswitch"))
-              {
-                // endswitch has to me unndented twice
-                unindent (line+1);
-                unindent (line);
-              }
-            setCursorPosition (line+1,
-                               indentation (line));
-          }
-        return;
-      }
-  }
-
-  // Do smart indentation of current selection or line.
-  void octave_qscintilla::smart_indent_line_or_selected_text (int lineFrom,
-                                                              int lineTo)
-  {
-    QRegExp blank_line_regexp = QRegExp ("^[\t ]*$");
-
-    // end[xxxxx] [# comment] at end of a line
-    QRegExp end_word_regexp
-      = QRegExp ("(?:(?:['\"][^'\"]*['\"])?[^%#]*)*"
-                 "(?:end\\w*)[\r\n\t ;]*(?:[%#].*)?$");
+            // The possible uncommenting string(s) are requested
+            comment_string = settings.int_value (ed_uncomment_str);
 
-    QRegExp begin_block_regexp
-      = QRegExp ("^[\t ]*(?:if|elseif|else"
-                 "|for|while|do|parfor"
-                 "|switch|case|otherwise"
-                 "|function"
-                 "|classdef|properties|events|enumeration|methods"
-                 "|unwind_protect|unwind_protect_cleanup|try|catch)"
-                 "[\r\n\t #%]");
-
-    QRegExp mid_block_regexp
-      = QRegExp ("^[\t ]*(?:elseif|else"
-                 "|unwind_protect_cleanup|catch)"
-                 "[\r\n\t #%]");
-
-    QRegExp end_block_regexp
-      = QRegExp ("^[\t ]*(?:end"
-                 "|end(for|function|if|parfor|switch|while"
-                 "|classdef|enumeration|events|methods|properties)"
-                 "|end_(try_catch|unwind_protect)"
-                 "|until)"
-                 "[\r\n\t #%]");
-
-    QRegExp case_block_regexp
-      = QRegExp ("^[\t ]*(?:case|otherwise)"
-                 "[\r\n\t #%]");
-
-    int indent_column = -1;
-    int indent_increment = indentationWidth ();
-    bool in_switch = false;
-
-    for (int line = lineFrom-1; line >= 0; line--)
-      {
-        QString line_text = text (line);
-
-        if (blank_line_regexp.indexIn (line_text) < 0)
-          {
-            // Found first non-blank line above beginning of region or
-            // current line.  Base indentation from this line, increasing
-            // indentation by indentationWidth if it looks like the
-            // beginning of a code block.
-
-            indent_column = indentation (line);
-
-            if (begin_block_regexp.indexIn (line_text) > -1)
+            for (int i = 0; i < ed_comment_strings_count; i++)
               {
-                indent_column += indent_increment;
-                if (line_text.contains ("switch"))
-                  in_switch = true;
+                if (1 << i & comment_string)
+                  c_str.append (ed_comment_strings.at (i));
               }
 
-            break;
-          }
-      }
-
-    if (indent_column < 0)
-      indent_column = indentation (lineFrom);
-
-    QString prev_line;
-    for (int line = lineFrom; line <= lineTo; line++)
-      {
-        QString line_text = text (line);
-
-        if (end_block_regexp.indexIn (line_text) > -1)
-          {
-            indent_column -= indent_increment;
-            if (line_text.contains ("endswitch"))
-              {
-                // need a double de-indent for endswitch
-                if (in_switch)
-                  indent_column -= indent_increment;
-                in_switch = false;
-              }
-          }
-
-        if (mid_block_regexp.indexIn (line_text) > -1)
-          indent_column -= indent_increment;
-
-        if (case_block_regexp.indexIn (line_text) > -1)
-          {
-            if (case_block_regexp.indexIn (prev_line) < 0
-                && !prev_line.contains("switch"))
-              indent_column -= indent_increment;
-            in_switch = true;
-          }
-
-        setIndentation (line, indent_column);
-
-        int bpos = begin_block_regexp.indexIn (line_text);
-        if (bpos > -1)
-          {
-            // Check for existing end statement in the same line
-            int epos = end_word_regexp.indexIn (line_text, bpos);
-            if (epos == -1)
-              indent_column += indent_increment;
-            if (line_text.contains ("switch"))
-              in_switch = true;
-          }
-
-        if (blank_line_regexp.indexIn (line_text) < 0)
-          prev_line = line_text;
-      }
-  }
-
-  void octave_qscintilla::set_word_selection (const QString& word)
-  {
-    m_selection = word;
-
-    if (word.isEmpty ())
-      {
-        m_selection_line = -1;
-        m_selection_col = -1;
-
-        m_selection_replacement = "";
-
-        clear_selection_markers ();
-
-        QToolTip::hideText ();
-      }
-    else
-      {
-        int pos;
-        get_current_position (&pos, &m_selection_line, &m_selection_col);
-      }
-  }
-
-  void octave_qscintilla::show_selection_markers (int l1, int c1, int l2, int c2)
-  {
-    fillIndicatorRange (l1, c1, l2, c2, m_indicator_id);
-
-    if (l1 == l2)
-      markerAdd (l1, marker::selection);
-  }
-
-  void octave_qscintilla::contextmenu_help (bool)
-  {
-    contextmenu_help_doc (false);
-  }
-
-  void octave_qscintilla::contextmenu_doc (bool)
-  {
-    contextmenu_help_doc (true);
-  }
-
-  void octave_qscintilla::context_help_doc (bool documentation)
-  {
-    if (get_actual_word ())
-      contextmenu_help_doc (documentation);
-  }
-
-  void octave_qscintilla::contextmenu_edit (bool)
-  {
-    emit context_menu_edit_signal (m_word_at_cursor);
-  }
-
-  void octave_qscintilla::contextmenu_run_temp_error ()
-  {
-    QMessageBox::critical (this, tr ("Octave Editor"),
-                           tr ("Creating temporary files failed.\n"
-                               "Make sure you have write access to temp. directory\n"
-                               "%1\n\n"
-                               "\"Run Selection\" requires temporary files.").arg (QDir::tempPath ()));
-  }
-
-  void octave_qscintilla::contextmenu_run (bool)
-  {
-    // Take selected code and extend it by commands for echoing each
-    // evaluated line and for adding the line to the history (use script)
-    QString code = QString ();
-    QString hist = QString ();
-
-    // Split contents into single lines and complete commands
-    QStringList lines = selectedText ().split (QRegExp ("[\r\n]"),
-#if defined (HAVE_QT_SPLITBEHAVIOR_ENUM)
-                                               Qt::SkipEmptyParts);
-#else
-                                               QString::SkipEmptyParts);
-#endif
-    for (int i = 0; i < lines.count (); i++)
-      {
-        QString line = lines.at (i);
-        if (line.trimmed ().isEmpty ())
-          continue;
-        QString line_escaped = line;
-        line_escaped.replace (QString ("'"), QString ("''"));
-        QString line_history = line;
-
-        // Prevent output of breakpoint in temp. file for keyboard
-        QString next_bp_quiet;
-        QString next_bp_quiet_reset;
-        if (line.contains ("keyboard"))
-          {
-            // Define commands for not showing bp location and for resetting
-            // this in case "keyboard" was within a comment
-            next_bp_quiet = "__db_next_breakpoint_quiet__;\n";
-            next_bp_quiet_reset = "\n__db_next_breakpoint_quiet__(false);";
+            return c_str;
           }
 
-        // Add codeline
-        code += next_bp_quiet + line + next_bp_quiet_reset + "\n";
-        hist += line_history + "\n";
       }
+#endif
+
+    case SCLEX_PERL:
+    case SCLEX_BASH:
+    case SCLEX_DIFF:
+      return QStringList ("#");
+
+    case SCLEX_CPP:
+      return QStringList ("//");
 
-    octave_stdout << hist.toStdString ();
+    case SCLEX_BATCH:
+      return QStringList ("REM ");
+    }
+
+  return QStringList ("%");  // should never happen
+}
 
-    // Create tmp file with the code to be executed by the interpreter
-    QPointer<QTemporaryFile> tmp_file = create_tmp_file ("m", code);
+// provide the style at a specific position
+int octave_qscintilla::get_style (int pos)
+{
+  int position;
+  if (pos < 0)
+    // The positition has to be reduced by 2 for getting the real style (?)
+    position = SendScintilla (QsciScintillaBase::SCI_GETCURRENTPOS) - 2;
+  else
+    position = pos;
 
-    if (tmp_file && tmp_file->open ())
-      tmp_file->close ();
-    else
-      {
-        // tmp files not working: use old way to run selection
-        contextmenu_run_temp_error ();
-        return;
-      }
+  return SendScintilla (QsciScintillaBase::SCI_GETSTYLEAT, position);
+}
+
+// Is a specific cursor position in a line or block comment?
+int octave_qscintilla::is_style_comment (int pos)
+{
+  int lexer = SendScintilla (QsciScintillaBase::SCI_GETLEXER);
+  int style = get_style (pos);
 
-    // Create tmp file required for adding command to history
-    QPointer<QTemporaryFile> tmp_hist = create_tmp_file ("", hist);
+  switch (lexer)
+    {
+    case SCLEX_CPP:
+      return (ST_LINE_COMMENT * (style == QsciLexerCPP::CommentLine
+                                 || style == QsciLexerCPP::CommentLineDoc)
+              + ST_BLOCK_COMMENT * (style == QsciLexerCPP::Comment
+                                    || style == QsciLexerCPP::CommentDoc
+                                    || style == QsciLexerCPP::CommentDocKeyword
+                                    || style == QsciLexerCPP::CommentDocKeywordError));
+
+#if defined (HAVE_LEXER_MATLAB)
+    case SCLEX_MATLAB:
+      return (ST_LINE_COMMENT * (style == QsciLexerMatlab::Comment));
+#endif
+#if  defined (HAVE_LEXER_OCTAVE)
+    case SCLEX_OCTAVE:
+      return (ST_LINE_COMMENT * (style == QsciLexerOctave::Comment));
+#endif
 
-    if (tmp_hist && tmp_hist->open ())
-      tmp_hist->close ();
-    else
-      {
-        // tmp files not working: use old way to run selection
-        contextmenu_run_temp_error ();
-        return;
-      }
+    case SCLEX_PERL:
+      return (ST_LINE_COMMENT * (style == QsciLexerPerl::Comment));
+
+    case SCLEX_BATCH:
+      return (ST_LINE_COMMENT * (style == QsciLexerBatch::Comment));
+
+    case SCLEX_DIFF:
+      return (ST_LINE_COMMENT * (style == QsciLexerDiff::Comment));
 
-    // Add commands to the history
-    emit interpreter_event
-      ([=] (interpreter& interp)
-        {
-          // INTERPRETER THREAD
+    case SCLEX_BASH:
+      return (ST_LINE_COMMENT * (style == QsciLexerBash::Comment));
+
+    }
 
-          if (tmp_hist.isNull ())
-            return;
+  return ST_NONE;
+}
+
+// Do smart indentation after if, for, ...
+void octave_qscintilla::smart_indent (bool do_smart_indent, int do_auto_close,
+                                      int line, int ind_char_width)
+{
+  QString prevline = text (line);
 
-          std::string opt = "-r";
-          std::string  path = tmp_hist->fileName ().toStdString ();
+  QRegExp bkey = QRegExp ("^[\t ]*(if|for|while|switch"
+                          "|do|function|properties|events|classdef"
+                          "|unwind_protect|try"
+                          "|parfor|methods)"
+                          "[\r]?[\n\t #%]");
+  // last word except for comments, assuming no ' or " in comment.
+  // rx_end = QRegExp ("(\\w+)[ \t;\r\n]*([%#][^\"']*)?$");
 
-          Fhistory (interp, ovl (opt, path));
-        });
-
-    // Disable opening a file at a breakpoint in case keyboard () is used
-    gui_settings settings;
+  // last word except for comments,
+  // allowing % and # in single or double quoted strings
+  // FIXME: This will get confused by transpose.
+  QRegExp ekey = QRegExp ("(?:(?:['\"][^'\"]*['\"])?[^%#]*)*"
+                          "(\\w+)[ \t;\r\n]*(?:[%#].*)?$");
 
-  bool show_dbg_file = settings.bool_value (ed_show_dbg_file);
-    settings.setValue (ed_show_dbg_file.settings_key (), false);
+  int bpos = bkey.indexIn (prevline, 0);
+  int epos;
+
+  if (bpos > -1)
+    {
+      // Found keyword after that indentation should be added
 
-    // The interpreter_event callback function below emits a signal.
-    // Because we don't control when that happens, use a guarded pointer
-    // so that the callback can abort if this object is no longer valid.
+      // Check for existing end statement in the same line
+      epos = ekey.indexIn (prevline, bpos);
+      QString first_word = bkey.cap(1);
+      bool inline_end = (epos > -1) && is_end (ekey.cap(1), first_word);
 
-    QPointer<octave_qscintilla> this_oq (this);
+      if (do_smart_indent && ! inline_end)
+        {
+          // Do smart indent in the current line (line+1)
+          indent (line+1);
+          setCursorPosition (line+1, indentation (line+1) / ind_char_width);
+        }
 
-    // Let the interpreter execute the tmp file
-    emit interpreter_event
-      ([=] (interpreter& interp)
-       {
-         // INTERPRETER THREAD
+      if (do_auto_close
+          && ! inline_end
+          && ! first_word.contains (QRegExp ("(?:case|otherwise|unwind_protect_cleanup)")))
+        {
+          // Do auto close
+          auto_close (do_auto_close, line, prevline, first_word);
+        }
 
-         // FIXME: For now, just skip the entire callback if THIS_OQ is
-         // no longer valid.  Maybe there is a better way to do this
-         // job?
+      return;
+    }
 
-         if (this_oq.isNull ())
-           return;
+  QRegExp mkey = QRegExp ("^[\t ]*(?:else|elseif|catch|unwind_protect_cleanup)"
+                          "[\r]?[\t #%\n]");
+  if (prevline.contains (mkey))
+    {
+      int prev_ind = indentation (line-1);
+      int act_ind = indentation (line);
 
-         std::string file = tmp_file->fileName ().toStdString ();
+      if (prev_ind == act_ind)
+        unindent (line);
+      else if (prev_ind > act_ind)
+        {
+          setIndentation (line+1, prev_ind);
+          setCursorPosition (line+1, prev_ind);
+        }
+      return;
+    }
 
-         std::string pending_input = command_editor::get_current_line ();
-
-         int err_line = -1;   // For storing the line of a poss. error
+  QRegExp case_key = QRegExp ("^[\t ]*(?:case|otherwise)[\r]?[\t #%\n]");
+  if (prevline.contains (case_key) && do_smart_indent)
+    {
+      QString last_line = text (line-1);
+      int prev_ind = indentation (line-1);
+      int act_ind = indentation (line);
 
-         // Get current state of auto command repeat in debug mode
-         octave_value_list ovl_dbg = Fisdebugmode (interp);
-         bool dbg = ovl_dbg(0).bool_value ();
-         octave_value_list ovl_auto_repeat = ovl (true);
-         if (dbg)
-           ovl_auto_repeat = Fauto_repeat_debug_command (interp, ovl (false), 1);
-         bool auto_repeat = ovl_auto_repeat(0).bool_value ();
+      if (last_line.contains (QRegExp ("^[\t ]*switch")))
+        {
+          indent (line+1);
+          act_ind = indentation (line+1);
+        }
+      else
+        {
+          if (prev_ind == act_ind)
+            unindent (line);
+          else if (prev_ind > act_ind)
+            act_ind = prev_ind;
+        }
+
+      setIndentation (line+1, act_ind);
+      setCursorPosition (line+1, act_ind);
+    }
 
-         try
-           {
-             // Do the job
-             interp.source_file (file);
-           }
-         catch (const execution_exception& ee)
-           {
-             // Catch errors otherwise the rest of the interpreter
-             // will not be executed (cleaning up).
+  ekey = QRegExp ("^[\t ]*(?:end|endif|endfor|endwhile|until|endfunction"
+                  "|endswitch|end_try_catch|end_unwind_protect)[\r]?[\t #%\n(;]");
+  if (prevline.contains (ekey))
+    {
+      if (indentation (line-1) <= indentation (line))
+        {
+          unindent (line+1);
+          unindent (line);
+          if (prevline.contains ("endswitch"))
+            {
+              // endswitch has to me unndented twice
+              unindent (line+1);
+              unindent (line);
+            }
+          setCursorPosition (line+1,
+                             indentation (line));
+        }
+      return;
+    }
+}
 
-             // New error message and error stack
-             QString new_msg = QString::fromStdString (ee.message ());
-             std::list<frame_info> stack = ee.stack_info ();
+// Do smart indentation of current selection or line.
+void octave_qscintilla::smart_indent_line_or_selected_text (int lineFrom,
+                                                            int lineTo)
+{
+  QRegExp blank_line_regexp = QRegExp ("^[\t ]*$");
+
+  // end[xxxxx] [# comment] at end of a line
+  QRegExp end_word_regexp
+    = QRegExp ("(?:(?:['\"][^'\"]*['\"])?[^%#]*)*"
+               "(?:end\\w*)[\r\n\t ;]*(?:[%#].*)?$");
 
-             // Remove line and column from first line of error message only
-             // if it is related to the tmp itself, i.e. only if the
-             // the error stack size is 0, 1, or, if in debug mode, 2
-             size_t max_stack_size = 1;
-             if (dbg)
-               max_stack_size = 2;
-             if (stack.size () <= max_stack_size)
-               {
-                 QRegExp rx ("source: error sourcing file [^\n]*$");
-                 if (new_msg.contains (rx))
-                   {
-                     // Selected code has syntax errors
-                     new_msg.replace (rx, "error sourcing selected code");
-                     err_line = 0;  // Nothing into history?
-                   }
-                 else
-                   {
-                     // Normal error, detect line and remove file
-                     // name from message
-                     QStringList rx_list;
-                     rx_list << "near line (\\d+),[^\n]*\n";
-                     rx_list << "near line (\\d+),[^\n]*$";
+  QRegExp begin_block_regexp
+    = QRegExp ("^[\t ]*(?:if|elseif|else"
+               "|for|while|do|parfor"
+               "|switch|case|otherwise"
+               "|function"
+               "|classdef|properties|events|enumeration|methods"
+               "|unwind_protect|unwind_protect_cleanup|try|catch)"
+               "[\r\n\t #%]");
+
+  QRegExp mid_block_regexp
+    = QRegExp ("^[\t ]*(?:elseif|else"
+               "|unwind_protect_cleanup|catch)"
+               "[\r\n\t #%]");
 
-                     QStringList replace_list;
-                     replace_list << "\n";
-                     replace_list << "";
+  QRegExp end_block_regexp
+    = QRegExp ("^[\t ]*(?:end"
+               "|end(for|function|if|parfor|switch|while"
+               "|classdef|enumeration|events|methods|properties)"
+               "|end_(try_catch|unwind_protect)"
+               "|until)"
+               "[\r\n\t #%]");
+
+  QRegExp case_block_regexp
+    = QRegExp ("^[\t ]*(?:case|otherwise)"
+               "[\r\n\t #%]");
+
+  int indent_column = -1;
+  int indent_increment = indentationWidth ();
+  bool in_switch = false;
+
+  for (int line = lineFrom-1; line >= 0; line--)
+    {
+      QString line_text = text (line);
 
-                     for (int i = 0; i < rx_list.length (); i++)
-                       {
-                         int pos = 0;
-                         rx = QRegExp (rx_list.at (i));
-                         pos = rx.indexIn (new_msg, pos);
-                         if (pos != -1)
-                           {
-                             err_line = rx.cap (1).toInt ();
-                             new_msg = new_msg.replace (rx, replace_list.at (i));
-                           }
-                       }
-                   }
-               }
+      if (blank_line_regexp.indexIn (line_text) < 0)
+        {
+          // Found first non-blank line above beginning of region or
+          // current line.  Base indentation from this line, increasing
+          // indentation by indentationWidth if it looks like the
+          // beginning of a code block.
+
+          indent_column = indentation (line);
+
+          if (begin_block_regexp.indexIn (line_text) > -1)
+            {
+              indent_column += indent_increment;
+              if (line_text.contains ("switch"))
+                in_switch = true;
+            }
+
+          break;
+        }
+    }
+
+  if (indent_column < 0)
+    indent_column = indentation (lineFrom);
 
-             // Drop first stack level, which is the temporary function file,
-             // or, if in debug mode, drop first two stack levels
-             if (stack.size () > 0)
-               stack.pop_back ();
-             if (dbg && (stack.size () > 0))
-               stack.pop_back ();
+  QString prev_line;
+  for (int line = lineFrom; line <= lineTo; line++)
+    {
+      QString line_text = text (line);
 
-             // Clean up before throwing the modified error.
-             emit ctx_menu_run_finished_signal (show_dbg_file, err_line,
-                                                tmp_file, tmp_hist,
-                                                dbg, auto_repeat);
+      if (end_block_regexp.indexIn (line_text) > -1)
+        {
+          indent_column -= indent_increment;
+          if (line_text.contains ("endswitch"))
+            {
+              // need a double de-indent for endswitch
+              if (in_switch)
+                indent_column -= indent_increment;
+              in_switch = false;
+            }
+        }
 
-             // New exception with updated message and stack
-             execution_exception nee (ee.err_type (), ee.identifier (),
-                                      new_msg.toStdString (), stack);
+      if (mid_block_regexp.indexIn (line_text) > -1)
+        indent_column -= indent_increment;
 
-             // Throw
-             throw (nee);
-           }
+      if (case_block_regexp.indexIn (line_text) > -1)
+        {
+          if (case_block_regexp.indexIn (prev_line) < 0
+              && !prev_line.contains("switch"))
+            indent_column -= indent_increment;
+          in_switch = true;
+        }
+
+      setIndentation (line, indent_column);
 
-         // Clean up
-
-         emit ctx_menu_run_finished_signal (show_dbg_file, err_line,
-                                            tmp_file, tmp_hist,
-                                            dbg, auto_repeat);
+      int bpos = begin_block_regexp.indexIn (line_text);
+      if (bpos > -1)
+        {
+          // Check for existing end statement in the same line
+          int epos = end_word_regexp.indexIn (line_text, bpos);
+          if (epos == -1)
+            indent_column += indent_increment;
+          if (line_text.contains ("switch"))
+            in_switch = true;
+        }
 
-         command_editor::erase_empty_line (true);
-         command_editor::replace_line ("");
-         command_editor::set_initial_input (pending_input);
-         command_editor::redisplay ();
-         command_editor::interrupt_event_loop ();
-         command_editor::accept_line ();
-         command_editor::erase_empty_line (true);
+      if (blank_line_regexp.indexIn (line_text) < 0)
+        prev_line = line_text;
+    }
+}
+
+void octave_qscintilla::set_word_selection (const QString& word)
+{
+  m_selection = word;
 
-       });
-  }
+  if (word.isEmpty ())
+    {
+      m_selection_line = -1;
+      m_selection_col = -1;
+
+      m_selection_replacement = "";
+
+      clear_selection_markers ();
 
-  void octave_qscintilla::ctx_menu_run_finished
-    (bool show_dbg_file, int, QPointer<QTemporaryFile> tmp_file,
-     QPointer<QTemporaryFile> tmp_hist, bool dbg, bool auto_repeat)
-  {
-    emit focus_console_after_command_signal ();
+      QToolTip::hideText ();
+    }
+  else
+    {
+      int pos;
+      get_current_position (&pos, &m_selection_line, &m_selection_col);
+    }
+}
+
+void octave_qscintilla::show_selection_markers (int l1, int c1, int l2, int c2)
+{
+  fillIndicatorRange (l1, c1, l2, c2, m_indicator_id);
 
-    // TODO: Use line nr. (int argument) of possible error for removing
-    //       lines from history that were never executed. For this,
-    //       possible lines from commands at a debug prompt must be
-    //       taken into consideration.
+  if (l1 == l2)
+    markerAdd (l1, marker::selection);
+}
+
+void octave_qscintilla::contextmenu_help (bool)
+{
+  contextmenu_help_doc (false);
+}
 
-    gui_settings settings;
+void octave_qscintilla::contextmenu_doc (bool)
+{
+  contextmenu_help_doc (true);
+}
 
-    settings.setValue (ed_show_dbg_file.settings_key (), show_dbg_file);
-
-    if (tmp_file && tmp_file->exists ())
-      tmp_file->remove ();
+void octave_qscintilla::context_help_doc (bool documentation)
+{
+  if (get_actual_word ())
+    contextmenu_help_doc (documentation);
+}
 
-    if (tmp_hist && tmp_hist->exists ())
-      tmp_hist->remove ();
+void octave_qscintilla::contextmenu_edit (bool)
+{
+  emit context_menu_edit_signal (m_word_at_cursor);
+}
 
-    emit interpreter_event
-      ([=] (interpreter& interp)
-       {
-         // INTERPRETER THREAD
-         if (dbg)
-           Fauto_repeat_debug_command (interp, ovl (auto_repeat));
-       });
-  }
-
-  // wrappers for dbstop related context menu items
+void octave_qscintilla::contextmenu_run_temp_error ()
+{
+  QMessageBox::critical (this, tr ("Octave Editor"),
+                         tr ("Creating temporary files failed.\n"
+                             "Make sure you have write access to temp. directory\n"
+                             "%1\n\n"
+                             "\"Run Selection\" requires temporary files.").arg (QDir::tempPath ()));
+}
 
-  // FIXME: Why can't the data be sent as the argument to the function???
-  void octave_qscintilla::contextmenu_break_condition (bool)
-  {
-#if defined (HAVE_QSCI_VERSION_2_6_0)
-    QAction *action = qobject_cast<QAction *>(sender ());
-    QPoint local_pos = action->data ().value<QPoint> ();
-
-    // pick point just right of margins, so lineAt doesn't give -1
-    int margins = marginWidth (1) + marginWidth (2) + marginWidth (3);
-    local_pos = QPoint (margins + 1, local_pos.y ());
+void octave_qscintilla::contextmenu_run (bool)
+{
+  // Take selected code and extend it by commands for echoing each
+  // evaluated line and for adding the line to the history (use script)
+  QString code = QString ();
+  QString hist = QString ();
 
-    emit context_menu_break_condition_signal (lineAt (local_pos));
-#endif
-  }
-
-  void octave_qscintilla::contextmenu_break_once (const QPoint& local_pos)
-  {
-#if defined (HAVE_QSCI_VERSION_2_6_0)
-    emit context_menu_break_once (lineAt (local_pos));
+  // Split contents into single lines and complete commands
+  QStringList lines = selectedText ().split (QRegExp ("[\r\n]"),
+#if defined (HAVE_QT_SPLITBEHAVIOR_ENUM)
+                                             Qt::SkipEmptyParts);
 #else
-    octave_unused_parameter (local_pos);
+                                             QString::SkipEmptyParts);
 #endif
-  }
+  for (int i = 0; i < lines.count (); i++)
+    {
+      QString line = lines.at (i);
+      if (line.trimmed ().isEmpty ())
+        continue;
+      QString line_escaped = line;
+      line_escaped.replace (QString ("'"), QString ("''"));
+      QString line_history = line;
 
-  void octave_qscintilla::text_changed ()
-  {
-    emit status_update (isUndoAvailable (), isRedoAvailable ());
-  }
+      // Prevent output of breakpoint in temp. file for keyboard
+      QString next_bp_quiet;
+      QString next_bp_quiet_reset;
+      if (line.contains ("keyboard"))
+        {
+          // Define commands for not showing bp location and for resetting
+          // this in case "keyboard" was within a comment
+          next_bp_quiet = "__db_next_breakpoint_quiet__;\n";
+          next_bp_quiet_reset = "\n__db_next_breakpoint_quiet__(false);";
+        }
 
-  void octave_qscintilla::cursor_position_changed (int line, int col)
-  {
-    // Clear the selection if we move away from it.  We have to check the
-    // position, because we allow entering text at the point of the
-    // selection to trigger a search and replace that does not clear the
-    // selection until it is complete.
+      // Add codeline
+      code += next_bp_quiet + line + next_bp_quiet_reset + "\n";
+      hist += line_history + "\n";
+    }
+
+  octave_stdout << hist.toStdString ();
+
+  // Create tmp file with the code to be executed by the interpreter
+  QPointer<QTemporaryFile> tmp_file = create_tmp_file ("m", code);
+
+  if (tmp_file && tmp_file->open ())
+    tmp_file->close ();
+  else
+    {
+      // tmp files not working: use old way to run selection
+      contextmenu_run_temp_error ();
+      return;
+    }
+
+  // Create tmp file required for adding command to history
+  QPointer<QTemporaryFile> tmp_hist = create_tmp_file ("", hist);
 
-    if (! m_selection.isEmpty ()
-        && (line != m_selection_line || col != m_selection_col))
-      set_word_selection ();
-  }
+  if (tmp_hist && tmp_hist->open ())
+    tmp_hist->close ();
+  else
+    {
+      // tmp files not working: use old way to run selection
+      contextmenu_run_temp_error ();
+      return;
+    }
 
-  // when edit area gets focus update information on undo/redo actions
-  void octave_qscintilla::focusInEvent (QFocusEvent *focusEvent)
-  {
-    emit status_update (isUndoAvailable (), isRedoAvailable ());
+  // Add commands to the history
+  emit interpreter_event
+    ([=] (interpreter& interp)
+      {
+        // INTERPRETER THREAD
+
+        if (tmp_hist.isNull ())
+          return;
+
+        std::string opt = "-r";
+        std::string  path = tmp_hist->fileName ().toStdString ();
+
+        Fhistory (interp, ovl (opt, path));
+      });
 
-    QsciScintilla::focusInEvent (focusEvent);
-  }
+  // Disable opening a file at a breakpoint in case keyboard () is used
+  gui_settings settings;
+
+bool show_dbg_file = settings.bool_value (ed_show_dbg_file);
+  settings.setValue (ed_show_dbg_file.settings_key (), false);
+
+  // The interpreter_event callback function below emits a signal.
+  // Because we don't control when that happens, use a guarded pointer
+  // so that the callback can abort if this object is no longer valid.
+
+  QPointer<octave_qscintilla> this_oq (this);
 
-  void octave_qscintilla::show_replace_action_tooltip ()
-  {
-    int pos;
-    get_current_position (&pos, &m_selection_line, &m_selection_col);
+  // Let the interpreter execute the tmp file
+  emit interpreter_event
+    ([=] (interpreter& interp)
+     {
+       // INTERPRETER THREAD
 
-    // Offer to replace other instances.
+       // FIXME: For now, just skip the entire callback if THIS_OQ is
+       // no longer valid.  Maybe there is a better way to do this
+       // job?
 
-    QKeySequence keyseq = Qt::SHIFT + Qt::Key_Return;
+       if (this_oq.isNull ())
+         return;
 
-    QString msg = (tr ("Press '%1' to replace all occurrences of '%2' with '%3'.")
-                   . arg (keyseq.toString ())
-                   . arg (m_selection)
-                   . arg (m_selection_replacement));
+       std::string file = tmp_file->fileName ().toStdString ();
+
+       std::string pending_input = command_editor::get_current_line ();
+
+       int err_line = -1;   // For storing the line of a poss. error
 
-    QPoint global_pos;
-    QPoint local_pos;
-
-    get_global_textcursor_pos (&global_pos, &local_pos);
+       // Get current state of auto command repeat in debug mode
+       octave_value_list ovl_dbg = Fisdebugmode (interp);
+       bool dbg = ovl_dbg(0).bool_value ();
+       octave_value_list ovl_auto_repeat = ovl (true);
+       if (dbg)
+         ovl_auto_repeat = Fauto_repeat_debug_command (interp, ovl (false), 1);
+       bool auto_repeat = ovl_auto_repeat(0).bool_value ();
 
-    QFontMetrics ttfm (QToolTip::font ());
-
-    // Try to avoid overlapping with the text completion dialog
-    // and the text that is currently being edited.
+       try
+         {
+           // Do the job
+           interp.source_file (file);
+         }
+       catch (const execution_exception& ee)
+         {
+           // Catch errors otherwise the rest of the interpreter
+           // will not be executed (cleaning up).
 
-    global_pos += QPoint (2*ttfm.maxWidth (), -3*ttfm.height ());
-
-    QToolTip::showText (global_pos, msg);
-  }
+           // New error message and error stack
+           QString new_msg = QString::fromStdString (ee.message ());
+           std::list<frame_info> stack = ee.stack_info ();
 
-  void octave_qscintilla::replace_all (const QString& o_str, const QString& n_str,
-                                       bool re, bool cs, bool wo)
-  {
-    // get the resulting cursor position
-    int pos, line, col, nline, ncol;
-    get_current_position (&pos, &line, &col);
+           // Remove line and column from first line of error message only
+           // if it is related to the tmp itself, i.e. only if the
+           // the error stack size is 0, 1, or, if in debug mode, 2
+           size_t max_stack_size = 1;
+           if (dbg)
+             max_stack_size = 2;
+           if (stack.size () <= max_stack_size)
+             {
+               QRegExp rx ("source: error sourcing file [^\n]*$");
+               if (new_msg.contains (rx))
+                 {
+                   // Selected code has syntax errors
+                   new_msg.replace (rx, "error sourcing selected code");
+                   err_line = 0;  // Nothing into history?
+                 }
+               else
+                 {
+                   // Normal error, detect line and remove file
+                   // name from message
+                   QStringList rx_list;
+                   rx_list << "near line (\\d+),[^\n]*\n";
+                   rx_list << "near line (\\d+),[^\n]*$";
 
-    // remember first visible line for restoring the view afterwards
-    int first_line = firstVisibleLine ();
+                   QStringList replace_list;
+                   replace_list << "\n";
+                   replace_list << "";
 
-    // search for first occurrence of the detected word
-    bool find_result_available = findFirst (o_str, re, cs, wo,
-                                            false, true, 0, 0);
-    // replace and find more occurrences in a loop
-    beginUndoAction ();
-    while (find_result_available)
-      {
-        // findNext doesn't work properly if the length of the replacement
-        // text is different from the original
-        replace (n_str);
-        get_current_position (&pos, &nline, &ncol);
+                   for (int i = 0; i < rx_list.length (); i++)
+                     {
+                       int pos = 0;
+                       rx = QRegExp (rx_list.at (i));
+                       pos = rx.indexIn (new_msg, pos);
+                       if (pos != -1)
+                         {
+                           err_line = rx.cap (1).toInt ();
+                           new_msg = new_msg.replace (rx, replace_list.at (i));
+                         }
+                     }
+                 }
+             }
+
+           // Drop first stack level, which is the temporary function file,
+           // or, if in debug mode, drop first two stack levels
+           if (stack.size () > 0)
+             stack.pop_back ();
+           if (dbg && (stack.size () > 0))
+             stack.pop_back ();
+
+           // Clean up before throwing the modified error.
+           emit ctx_menu_run_finished_signal (show_dbg_file, err_line,
+                                              tmp_file, tmp_hist,
+                                              dbg, auto_repeat);
 
-        find_result_available = findFirst (o_str, re, cs, wo,
-                                           false, true, nline, ncol);
-      }
-    endUndoAction ();
+           // New exception with updated message and stack
+           execution_exception nee (ee.err_type (), ee.identifier (),
+                                    new_msg.toStdString (), stack);
 
-    // restore the visible area
-    setFirstVisibleLine (first_line);
+           // Throw
+           throw (nee);
+         }
+
+       // Clean up
+
+       emit ctx_menu_run_finished_signal (show_dbg_file, err_line,
+                                          tmp_file, tmp_hist,
+                                          dbg, auto_repeat);
 
-    // fix cursor column if outside of new line length
-    int eol_len = eol_string ().length ();
-    if (line == lines () - 1)
-      eol_len = 0;
-    const int col_max = text (line).length () - eol_len;
-    if (col_max < col)
-      col = col_max;
+       command_editor::erase_empty_line (true);
+       command_editor::replace_line ("");
+       command_editor::set_initial_input (pending_input);
+       command_editor::redisplay ();
+       command_editor::interrupt_event_loop ();
+       command_editor::accept_line ();
+       command_editor::erase_empty_line (true);
 
-    setCursorPosition (line, col);
-  }
+     });
+}
+
+void octave_qscintilla::ctx_menu_run_finished
+  (bool show_dbg_file, int, QPointer<QTemporaryFile> tmp_file,
+   QPointer<QTemporaryFile> tmp_hist, bool dbg, bool auto_repeat)
+{
+  emit focus_console_after_command_signal ();
 
-  bool octave_qscintilla::event (QEvent *e)
-  {
-    if (m_debug_mode && e->type() == QEvent::ToolTip)
-      {
-        // FIXME: can we handle display of a tooltip using an
-        // interpreter event or a custom signal/slot connection?
+  // TODO: Use line nr. (int argument) of possible error for removing
+  //       lines from history that were never executed. For this,
+  //       possible lines from commands at a debug prompt must be
+  //       taken into consideration.
+
+  gui_settings settings;
+
+  settings.setValue (ed_show_dbg_file.settings_key (), show_dbg_file);
+
+  if (tmp_file && tmp_file->exists ())
+    tmp_file->remove ();
 
-        QHelpEvent *help_e = static_cast<QHelpEvent *> (e);
-        QString symbol = wordAtPoint (help_e->pos());
+  if (tmp_hist && tmp_hist->exists ())
+    tmp_hist->remove ();
 
-        emit show_symbol_tooltip_signal (help_e->globalPos (), symbol);
+  emit interpreter_event
+    ([=] (interpreter& interp)
+     {
+       // INTERPRETER THREAD
+       if (dbg)
+         Fauto_repeat_debug_command (interp, ovl (auto_repeat));
+     });
+}
 
-        return true;
-      }
+// wrappers for dbstop related context menu items
 
-    return QsciScintilla::event(e);
-  }
+// FIXME: Why can't the data be sent as the argument to the function???
+void octave_qscintilla::contextmenu_break_condition (bool)
+{
+#if defined (HAVE_QSCI_VERSION_2_6_0)
+  QAction *action = qobject_cast<QAction *>(sender ());
+  QPoint local_pos = action->data ().value<QPoint> ();
+
+  // pick point just right of margins, so lineAt doesn't give -1
+  int margins = marginWidth (1) + marginWidth (2) + marginWidth (3);
+  local_pos = QPoint (margins + 1, local_pos.y ());
 
-  void octave_qscintilla::keyPressEvent (QKeyEvent *key_event)
-  {
-    if (m_selection.isEmpty ())
-      QsciScintilla::keyPressEvent (key_event);
-    else
-      {
-        int key = key_event->key ();
-        Qt::KeyboardModifiers modifiers = key_event->modifiers ();
+  emit context_menu_break_condition_signal (lineAt (local_pos));
+#endif
+}
 
-        if (key == Qt::Key_Return && modifiers == Qt::ShiftModifier)
-          {
-            replace_all (m_selection, m_selection_replacement,
-                         false, true, true);
+void octave_qscintilla::contextmenu_break_once (const QPoint& local_pos)
+{
+#if defined (HAVE_QSCI_VERSION_2_6_0)
+  emit context_menu_break_once (lineAt (local_pos));
+#else
+  octave_unused_parameter (local_pos);
+#endif
+}
+
+void octave_qscintilla::text_changed ()
+{
+  emit status_update (isUndoAvailable (), isRedoAvailable ());
+}
 
-            // Clear the selection.
-            set_word_selection ();
-          }
-        else
-          {
-            // The idea here is to allow backspace to remove the last
-            // character of the replacement text to allow minimal editing
-            // and to also end the selection replacement action if text is
-            // not valid as a word constituent (control characters,
-            // etc.).  Is there a better way than having special cases for
-            // DEL and ESC here?
+void octave_qscintilla::cursor_position_changed (int line, int col)
+{
+  // Clear the selection if we move away from it.  We have to check the
+  // position, because we allow entering text at the point of the
+  // selection to trigger a search and replace that does not clear the
+  // selection until it is complete.
+
+  if (! m_selection.isEmpty ()
+      && (line != m_selection_line || col != m_selection_col))
+    set_word_selection ();
+}
 
-            QString text = key_event->text ();
+// when edit area gets focus update information on undo/redo actions
+void octave_qscintilla::focusInEvent (QFocusEvent *focusEvent)
+{
+  emit status_update (isUndoAvailable (), isRedoAvailable ());
+
+  QsciScintilla::focusInEvent (focusEvent);
+}
 
-            bool cancel_replacement = false;
+void octave_qscintilla::show_replace_action_tooltip ()
+{
+  int pos;
+  get_current_position (&pos, &m_selection_line, &m_selection_col);
+
+  // Offer to replace other instances.
+
+  QKeySequence keyseq = Qt::SHIFT + Qt::Key_Return;
 
-            if (key == Qt::Key_Backspace)
-              {
-                if (m_selection_replacement.isEmpty ())
-                  cancel_replacement = true;
-                else
-                  m_selection_replacement.chop (1);
-              }
-            else if (key == Qt::Key_Delete || key == Qt::Key_Escape)
-              cancel_replacement = true;
-            else if (! text.isEmpty ())
-              m_selection_replacement += text;
-            else if (modifiers != Qt::ShiftModifier)
-              cancel_replacement = true;
+  QString msg = (tr ("Press '%1' to replace all occurrences of '%2' with '%3'.")
+                 . arg (keyseq.toString ())
+                 . arg (m_selection)
+                 . arg (m_selection_replacement));
+
+  QPoint global_pos;
+  QPoint local_pos;
+
+  get_global_textcursor_pos (&global_pos, &local_pos);
+
+  QFontMetrics ttfm (QToolTip::font ());
+
+  // Try to avoid overlapping with the text completion dialog
+  // and the text that is currently being edited.
 
-            // Perform default action.
+  global_pos += QPoint (2*ttfm.maxWidth (), -3*ttfm.height ());
+
+  QToolTip::showText (global_pos, msg);
+}
 
-            QsciScintilla::keyPressEvent (key_event);
+void octave_qscintilla::replace_all (const QString& o_str, const QString& n_str,
+                                     bool re, bool cs, bool wo)
+{
+  // get the resulting cursor position
+  int pos, line, col, nline, ncol;
+  get_current_position (&pos, &line, &col);
 
-            if (cancel_replacement)
-              set_word_selection ();
+  // remember first visible line for restoring the view afterwards
+  int first_line = firstVisibleLine ();
 
-            if (! m_selection_replacement.isEmpty ())
-              show_replace_action_tooltip ();
-          }
-      }
-  }
+  // search for first occurrence of the detected word
+  bool find_result_available = findFirst (o_str, re, cs, wo,
+                                          false, true, 0, 0);
+  // replace and find more occurrences in a loop
+  beginUndoAction ();
+  while (find_result_available)
+    {
+      // findNext doesn't work properly if the length of the replacement
+      // text is different from the original
+      replace (n_str);
+      get_current_position (&pos, &nline, &ncol);
 
-  void octave_qscintilla::auto_close (int auto_endif, int linenr,
-                                      const QString& line, QString& first_word)
-  {
-    // Insert an "end" for an "if" etc., if needed.
-    // (Use of "while" allows "return" to skip the rest.
-    // It may be clearer to use "if" and "goto",
-    // but that violates the coding standards.)
+      find_result_available = findFirst (o_str, re, cs, wo,
+                                         false, true, nline, ncol);
+    }
+  endUndoAction ();
+
+  // restore the visible area
+  setFirstVisibleLine (first_line);
+
+  // fix cursor column if outside of new line length
+  int eol_len = eol_string ().length ();
+  if (line == lines () - 1)
+    eol_len = 0;
+  const int col_max = text (line).length () - eol_len;
+  if (col_max < col)
+    col = col_max;
 
-    bool autofill_simple_end = (auto_endif == 2);
+  setCursorPosition (line, col);
+}
 
-    std::size_t start = line.toStdString ().find_first_not_of (" \t");
+bool octave_qscintilla::event (QEvent *e)
+{
+  if (m_debug_mode && e->type() == QEvent::ToolTip)
+    {
+      // FIXME: can we handle display of a tooltip using an
+      // interpreter event or a custom signal/slot connection?
+
+      QHelpEvent *help_e = static_cast<QHelpEvent *> (e);
+      QString symbol = wordAtPoint (help_e->pos());
+
+      emit show_symbol_tooltip_signal (help_e->globalPos (), symbol);
 
-    // Check if following line has the same or less indentation
-    // Check if the following line does not start with
-    //       end* (until) (catch)
-    if (linenr < lines () - 1)
-      {
-        int offset = 2;     // linenr is the old line, thus, linnr+1 is the
-                            // new one and can not be taken into account
-        std::size_t next_start;
-        QString next_line;
+      return true;
+    }
+
+  return QsciScintilla::event(e);
+}
+
+void octave_qscintilla::keyPressEvent (QKeyEvent *key_event)
+{
+  if (m_selection.isEmpty ())
+    QsciScintilla::keyPressEvent (key_event);
+  else
+    {
+      int key = key_event->key ();
+      Qt::KeyboardModifiers modifiers = key_event->modifiers ();
 
-        do                            // find next non-blank line
-          {
-            next_line = text (linenr + offset++);
-            next_start = next_line.toStdString ().find_first_not_of (" \t\n");
-          }
-        while (linenr + offset < lines ()
-               && next_start == std::string::npos);
+      if (key == Qt::Key_Return && modifiers == Qt::ShiftModifier)
+        {
+          replace_all (m_selection, m_selection_replacement,
+                       false, true, true);
+
+          // Clear the selection.
+          set_word_selection ();
+        }
+      else
+        {
+          // The idea here is to allow backspace to remove the last
+          // character of the replacement text to allow minimal editing
+          // and to also end the selection replacement action if text is
+          // not valid as a word constituent (control characters,
+          // etc.).  Is there a better way than having special cases for
+          // DEL and ESC here?
+
+          QString text = key_event->text ();
+
+          bool cancel_replacement = false;
 
-        if (next_start == std::string::npos)
-          next_start = 0;
-        if (start == 0 && next_start == 0)
-          return;                     // bug #56160, don't add at 0
-        if (next_start > start)       // more indented => don't add "end"
-          return;
-        if (next_start == start)      // same => check if already is "end"
-          {
-            QRegExp rx_start = QRegExp (R"((\w+))");
-            int tmp = rx_start.indexIn (next_line, start);
-            if (tmp != -1 && is_end (rx_start.cap(1), first_word))
-              return;
-          }
-      }
+          if (key == Qt::Key_Backspace)
+            {
+              if (m_selection_replacement.isEmpty ())
+                cancel_replacement = true;
+              else
+                m_selection_replacement.chop (1);
+            }
+          else if (key == Qt::Key_Delete || key == Qt::Key_Escape)
+            cancel_replacement = true;
+          else if (! text.isEmpty ())
+            m_selection_replacement += text;
+          else if (modifiers != Qt::ShiftModifier)
+            cancel_replacement = true;
+
+          // Perform default action.
+
+          QsciScintilla::keyPressEvent (key_event);
 
-    // If all of the above, insert a new line, with matching indent
-    // and either 'end' or 'end...', depending on a flag.
+          if (cancel_replacement)
+            set_word_selection ();
 
-    // If we insert directly after the last line, the "end" is autoindented,
-    // so add a dummy line.
-    if (linenr + 2 == lines ())
-      insertAt (QString ("\n"), linenr + 2, 0);
+          if (! m_selection_replacement.isEmpty ())
+            show_replace_action_tooltip ();
+        }
+    }
+}
 
-    // For try/catch/end, fill "end" first, so "catch" is top of undo stack
-    if (first_word == "try")
-      insertAt (QString (start, ' ')
-                + (autofill_simple_end ? "end\n" : "end_try_catch\n"),
-                linenr + 2, 0);
-    else if (first_word == "unwind_protect")
-      insertAt (QString (start, ' ')
-                + (autofill_simple_end ? "end\n" : "end_unwind_protect\n"),
-                linenr + 2, 0);
+void octave_qscintilla::auto_close (int auto_endif, int linenr,
+                                    const QString& line, QString& first_word)
+{
+  // Insert an "end" for an "if" etc., if needed.
+  // (Use of "while" allows "return" to skip the rest.
+  // It may be clearer to use "if" and "goto",
+  // but that violates the coding standards.)
+
+  bool autofill_simple_end = (auto_endif == 2);
+
+  std::size_t start = line.toStdString ().find_first_not_of (" \t");
 
-    QString next_line;
-    if (first_word == "do")
-      next_line = "until\n";
-    else if (first_word == "try")
-      next_line = "catch\n";
-    else if (first_word == "unwind_protect")
-      next_line = "unwind_protect_cleanup\n";
-    else if (autofill_simple_end)
-      next_line = "end\n";
-    else
-      {
-        if (first_word == "unwind_protect")
-          first_word = '_' + first_word;
-        next_line = "end" + first_word + "\n";
-      }
+  // Check if following line has the same or less indentation
+  // Check if the following line does not start with
+  //       end* (until) (catch)
+  if (linenr < lines () - 1)
+    {
+      int offset = 2;     // linenr is the old line, thus, linnr+1 is the
+                          // new one and can not be taken into account
+      std::size_t next_start;
+      QString next_line;
+
+      do                            // find next non-blank line
+        {
+          next_line = text (linenr + offset++);
+          next_start = next_line.toStdString ().find_first_not_of (" \t\n");
+        }
+      while (linenr + offset < lines ()
+             && next_start == std::string::npos);
 
-    //insertAt (QString (start, ' ') + next_line, linenr + 2, 0);
-    insertAt (next_line, linenr + 2, 0);
-    setIndentation (linenr + 2, indentation (linenr));
-  }
+      if (next_start == std::string::npos)
+        next_start = 0;
+      if (start == 0 && next_start == 0)
+        return;                     // bug #56160, don't add at 0
+      if (next_start > start)       // more indented => don't add "end"
+        return;
+      if (next_start == start)      // same => check if already is "end"
+        {
+          QRegExp rx_start = QRegExp (R"((\w+))");
+          int tmp = rx_start.indexIn (next_line, start);
+          if (tmp != -1 && is_end (rx_start.cap(1), first_word))
+            return;
+        }
+    }
+
+  // If all of the above, insert a new line, with matching indent
+  // and either 'end' or 'end...', depending on a flag.
+
+  // If we insert directly after the last line, the "end" is autoindented,
+  // so add a dummy line.
+  if (linenr + 2 == lines ())
+    insertAt (QString ("\n"), linenr + 2, 0);
+
+  // For try/catch/end, fill "end" first, so "catch" is top of undo stack
+  if (first_word == "try")
+    insertAt (QString (start, ' ')
+              + (autofill_simple_end ? "end\n" : "end_try_catch\n"),
+              linenr + 2, 0);
+  else if (first_word == "unwind_protect")
+    insertAt (QString (start, ' ')
+              + (autofill_simple_end ? "end\n" : "end_unwind_protect\n"),
+              linenr + 2, 0);
 
-  void octave_qscintilla::dragEnterEvent (QDragEnterEvent *e)
-  {
-    // if is not dragging a url, pass to qscintilla to handle,
-    // otherwise ignore it so that it will be handled by
-    // the parent
-    if (!e->mimeData ()->hasUrls ())
-      {
-        QsciScintilla::dragEnterEvent (e);
-      }
-    else
-      {
-        e->ignore();
-      }
-  }
+  QString next_line;
+  if (first_word == "do")
+    next_line = "until\n";
+  else if (first_word == "try")
+    next_line = "catch\n";
+  else if (first_word == "unwind_protect")
+    next_line = "unwind_protect_cleanup\n";
+  else if (autofill_simple_end)
+    next_line = "end\n";
+  else
+    {
+      if (first_word == "unwind_protect")
+        first_word = '_' + first_word;
+      next_line = "end" + first_word + "\n";
+    }
 
-  void octave_qscintilla::handle_enter_debug_mode ()
-  {
-    m_debug_mode = true;
-  }
+  //insertAt (QString (start, ' ') + next_line, linenr + 2, 0);
+  insertAt (next_line, linenr + 2, 0);
+  setIndentation (linenr + 2, indentation (linenr));
+}
 
-  void octave_qscintilla::handle_exit_debug_mode ()
-  {
-    m_debug_mode = false;
-  }
+void octave_qscintilla::dragEnterEvent (QDragEnterEvent *e)
+{
+  // if is not dragging a url, pass to qscintilla to handle,
+  // otherwise ignore it so that it will be handled by
+  // the parent
+  if (!e->mimeData ()->hasUrls ())
+    {
+      QsciScintilla::dragEnterEvent (e);
+    }
+  else
+    {
+      e->ignore();
+    }
+}
 
-  QPointer<QTemporaryFile>
-  octave_qscintilla::create_tmp_file (const QString& extension,
-                                      const QString& contents)
-  {
-    QString ext = extension;
-    if ((! ext.isEmpty ()) && (! ext.startsWith ('.')))
-      ext = QString (".") + ext;
+void octave_qscintilla::handle_enter_debug_mode ()
+{
+  m_debug_mode = true;
+}
 
-    // Create octave dir within temp. dir
-    QString tmp_dir = QString::fromStdString (sys::env::get_temp_directory ());
+void octave_qscintilla::handle_exit_debug_mode ()
+{
+  m_debug_mode = false;
+}
 
-    QString tmp_name = tmp_dir + QDir::separator() + "octave_XXXXXX" + ext;
-
-    QPointer<QTemporaryFile> tmp_file (new QTemporaryFile (tmp_name, this));
+QPointer<QTemporaryFile>
+octave_qscintilla::create_tmp_file (const QString& extension,
+                                    const QString& contents)
+{
+  QString ext = extension;
+  if ((! ext.isEmpty ()) && (! ext.startsWith ('.')))
+    ext = QString (".") + ext;
 
-    if (! contents.isEmpty () && tmp_file && tmp_file->open ())
-      {
-        tmp_file->write (contents.toUtf8 ());
-        tmp_file->close ();
-      }
+  // Create octave dir within temp. dir
+  QString tmp_dir = QString::fromStdString (sys::env::get_temp_directory ());
+
+  QString tmp_name = tmp_dir + QDir::separator() + "octave_XXXXXX" + ext;
+
+  QPointer<QTemporaryFile> tmp_file (new QTemporaryFile (tmp_name, this));
 
-    return tmp_file;
-  }
+  if (! contents.isEmpty () && tmp_file && tmp_file->open ())
+    {
+      tmp_file->write (contents.toUtf8 ());
+      tmp_file->close ();
+    }
+
+  return tmp_file;
+}
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/src/main-window.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/main-window.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -90,2811 +90,2811 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  main_window::main_window (base_qobject& oct_qobj)
-    : QMainWindow (), m_octave_qobj (oct_qobj),
-      m_status_bar (nullptr),
-      m_command_window (nullptr),
-      m_history_window (nullptr),
-      m_file_browser_window (nullptr),
-      m_editor_window (nullptr),
-      m_workspace_window (nullptr),
-      m_external_editor (new external_editor_interface (this)),
-      m_active_editor (m_external_editor), m_settings_dlg (nullptr),
-      m_find_files_dlg (nullptr), m_set_path_dlg (nullptr),
-      m_clipboard (QApplication::clipboard ()),
-      m_prevent_readline_conflicts (true),
-      m_prevent_readline_conflicts_menu (false),
-      m_suppress_dbg_location (true),
-      m_closing (false), m_file_encoding (QString ())
-  {
-    gui_settings settings;
-
-    if (! settings.bool_value (global_skip_welcome_wizard))
-      {
-        // Before wizard.
-        m_octave_qobj.config_translators ();
-
-        welcome_wizard welcomeWizard;
-
-        if (welcomeWizard.exec () == QDialog::Rejected)
-          exit (1);
-
-        settings.setValue (global_skip_welcome_wizard.settings_key (), QVariant (true));
-
-        // Install settings file.
-        settings.reload ();
-      }
-    else
-      {
-        // Get settings file.
-        settings.reload ();
-
-        // After settings.
-        m_octave_qobj.config_translators ();
-      }
-
-    setObjectName (gui_obj_name_main_window);
-
-    settings.config_icon_theme ();
-
-    settings.update_network_settings ();
-
-    // We provide specific terminal capabilities, so ensure that
-    // TERM is always set appropriately.
+main_window::main_window (base_qobject& oct_qobj)
+  : QMainWindow (), m_octave_qobj (oct_qobj),
+    m_status_bar (nullptr),
+    m_command_window (nullptr),
+    m_history_window (nullptr),
+    m_file_browser_window (nullptr),
+    m_editor_window (nullptr),
+    m_workspace_window (nullptr),
+    m_external_editor (new external_editor_interface (this)),
+    m_active_editor (m_external_editor), m_settings_dlg (nullptr),
+    m_find_files_dlg (nullptr), m_set_path_dlg (nullptr),
+    m_clipboard (QApplication::clipboard ()),
+    m_prevent_readline_conflicts (true),
+    m_prevent_readline_conflicts_menu (false),
+    m_suppress_dbg_location (true),
+    m_closing (false), m_file_encoding (QString ())
+{
+  gui_settings settings;
+
+  if (! settings.bool_value (global_skip_welcome_wizard))
+    {
+      // Before wizard.
+      m_octave_qobj.config_translators ();
+
+      welcome_wizard welcomeWizard;
+
+      if (welcomeWizard.exec () == QDialog::Rejected)
+        exit (1);
+
+      settings.setValue (global_skip_welcome_wizard.settings_key (), QVariant (true));
+
+      // Install settings file.
+      settings.reload ();
+    }
+  else
+    {
+      // Get settings file.
+      settings.reload ();
+
+      // After settings.
+      m_octave_qobj.config_translators ();
+    }
+
+  setObjectName (gui_obj_name_main_window);
+
+  settings.config_icon_theme ();
+
+  settings.update_network_settings ();
+
+  // We provide specific terminal capabilities, so ensure that
+  // TERM is always set appropriately.
 
 #if defined (OCTAVE_USE_WINDOWS_API)
-    sys::env::putenv ("TERM", "cygwin");
+  sys::env::putenv ("TERM", "cygwin");
 #else
-    sys::env::putenv ("TERM", "xterm");
+  sys::env::putenv ("TERM", "xterm");
 #endif
 
-    construct_central_widget ();
-
-    m_status_bar = new QStatusBar (this);
-    m_profiler_status_indicator = new led_indicator ();
-    QLabel *text = new QLabel (tr ("Profiler"));
-    m_status_bar->addPermanentWidget (text);
-    m_status_bar->addPermanentWidget (m_profiler_status_indicator);
-
-    adopt_dock_widgets ();
-
-    QGuiApplication::setDesktopFileName ("org.octave.Octave.desktop");
-
-    QApplication *qapp = m_octave_qobj.qapplication ();
-
-    m_default_style = qapp->style ()->objectName ();
-    m_default_palette = qapp->palette ();
-
-    bool connect_to_web = true;
-    QDateTime last_checked;
-    int serial = 0;
-    m_active_dock = nullptr;
-
-    connect_to_web = settings.bool_value (nr_allow_connection);
-    last_checked = settings.date_time_value (nr_last_time);
-    serial = settings.int_value (nr_last_news);
-    m_default_encoding = settings.string_value (ed_default_enc);
-
-    QDateTime current = QDateTime::currentDateTime ();
-    QDateTime one_day_ago = current.addDays (-1);
-
-    if (connect_to_web
-        && (! last_checked.isValid () || one_day_ago > last_checked))
-      emit show_community_news_signal (serial);
-
-    construct_octave_qt_link ();
-
-    // We have to set up all our windows, before we finally launch
-    // octave.
-
-    construct ();
-
-    read_settings ();
-
-    init_terminal_size ();
-
-    emit init_window_menu ();
-
-    focus_command_window ();
-  }
-
-  main_window::~main_window () { }
-
-  void main_window::adopt_dock_widgets ()
-  {
-    adopt_terminal_widget ();
-    adopt_documentation_widget ();
-    adopt_file_browser_widget ();
-    adopt_history_widget ();
-    adopt_workspace_widget ();
-    adopt_editor_widget ();
-    adopt_variable_editor_widget ();
-
-    m_previous_dock = m_command_window;
-  }
-
-  void main_window::adopt_terminal_widget ()
-  {
-    m_command_window = m_octave_qobj.terminal_widget (this);
-
-    make_dock_widget_connections (m_command_window);
-
-    connect (this, &main_window::settings_changed,
-             m_command_window, &terminal_dock_widget::notice_settings);
-
-    if (! m_octave_qobj.experimental_terminal_widget ())
-      {
-        QTerminal *cmd_widget = m_command_window->get_qterminal ();
-
-        // The following connections were previously made in
-        // QTerminal::construct, QWinTerminalImpl::QWinTerminalImpl, and
-        // QUnixTerminalImpl::QUnixTerminalImpl.  Similar actions should
-        // probably be possible for the new command widget.
-
-        connect (cmd_widget, &QTerminal::report_status_message,
-                 this, &main_window::report_status_message);
-
-        connect (cmd_widget, &QTerminal::edit_mfile_request,
-                 this, &main_window::edit_mfile);
-
-        connect (cmd_widget, &QTerminal::execute_command_in_terminal_signal,
-                 this, &main_window::execute_command_in_terminal);
-
-        connect (this, &main_window::init_terminal_size_signal,
-                 cmd_widget, &QTerminal::init_terminal_size);
-
-        connect (this, &main_window::copyClipboard_signal,
-                 cmd_widget, &QTerminal::copyClipboard);
-
-        connect (this, &main_window::pasteClipboard_signal,
-                 cmd_widget, &QTerminal::pasteClipboard);
-
-        connect (this, &main_window::selectAll_signal,
-                 cmd_widget, &QTerminal::selectAll);
-
-        connect (cmd_widget, &QTerminal::request_edit_mfile_signal,
-                 this, &main_window::edit_mfile);
-
-        connect (cmd_widget, &QTerminal::request_open_file_signal,
-                 this, QOverload<const QString&, const QString&, int>::of (&main_window::open_file_signal));
-
-        connect (cmd_widget, &QTerminal::set_screen_size_signal,
-                 this, &main_window::set_screen_size);
-
-        connect (cmd_widget, &QTerminal::clear_command_window_request,
-                 this, &main_window::handle_clear_command_window_request);
-      }
-    else
-      {
-        connect (this, &main_window::execute_command_signal,
-                 m_command_window, &terminal_dock_widget::execute_command_signal);
-      }
-  }
-
-  void main_window::adopt_documentation_widget ()
-  {
-    m_doc_browser_window = m_octave_qobj.documentation_widget (this);
-
-    make_dock_widget_connections (m_doc_browser_window);
-  }
-
-  void main_window::adopt_file_browser_widget ()
-  {
-    m_file_browser_window = m_octave_qobj.file_browser_widget (this);
-
-    make_dock_widget_connections (m_file_browser_window);
-
-    connect (m_file_browser_window, &files_dock_widget::open_file,
-             this, QOverload<const QString&>::of (&main_window::open_file_signal));
-    connect (m_file_browser_window,
-             &files_dock_widget::displayed_directory_changed,
-             this, &main_window::set_current_working_directory);
-
-    connect (m_file_browser_window, &files_dock_widget::modify_path_signal,
-             this, &main_window::modify_path);
-
-    connect (m_file_browser_window, &files_dock_widget::run_file_signal,
-             this, &main_window::run_file_in_terminal);
-
-    connect (m_file_browser_window, &files_dock_widget::load_file_signal,
-             this, &main_window::handle_load_workspace_request);
-
-    connect (m_file_browser_window, &files_dock_widget::open_any_signal,
-             this, &main_window::handle_open_any_request);
-
-    connect (m_file_browser_window, &files_dock_widget::find_files_signal,
-             this, &main_window::find_files);
-  }
-
-  void main_window::adopt_history_widget ()
-  {
-    m_history_window = m_octave_qobj.history_widget (this);
-
-    make_dock_widget_connections (m_history_window);
-
-    connect (m_history_window, &history_dock_widget::command_create_script,
-             this, &main_window::new_file_signal);
-
-    connect (m_history_window, &history_dock_widget::command_double_clicked,
-             this, &main_window::execute_command_in_terminal);
-  }
-
-  void main_window::adopt_workspace_widget ()
-  {
-    m_workspace_window = m_octave_qobj.workspace_widget (this);
-
-    make_dock_widget_connections (m_workspace_window);
-
-    connect (m_workspace_window, &workspace_view::command_requested,
-             this, &main_window::execute_command_in_terminal);
-  }
-
-  void main_window::adopt_editor_widget ()
-  {
-    interpreter_qobject *interp_qobj = m_octave_qobj.interpreter_qobj ();
-
-    qt_interpreter_events *qt_link = interp_qobj->qt_link ();
+  construct_central_widget ();
+
+  m_status_bar = new QStatusBar (this);
+  m_profiler_status_indicator = new led_indicator ();
+  QLabel *text = new QLabel (tr ("Profiler"));
+  m_status_bar->addPermanentWidget (text);
+  m_status_bar->addPermanentWidget (m_profiler_status_indicator);
+
+  adopt_dock_widgets ();
+
+  QGuiApplication::setDesktopFileName ("org.octave.Octave.desktop");
+
+  QApplication *qapp = m_octave_qobj.qapplication ();
+
+  m_default_style = qapp->style ()->objectName ();
+  m_default_palette = qapp->palette ();
+
+  bool connect_to_web = true;
+  QDateTime last_checked;
+  int serial = 0;
+  m_active_dock = nullptr;
+
+  connect_to_web = settings.bool_value (nr_allow_connection);
+  last_checked = settings.date_time_value (nr_last_time);
+  serial = settings.int_value (nr_last_news);
+  m_default_encoding = settings.string_value (ed_default_enc);
+
+  QDateTime current = QDateTime::currentDateTime ();
+  QDateTime one_day_ago = current.addDays (-1);
+
+  if (connect_to_web
+      && (! last_checked.isValid () || one_day_ago > last_checked))
+    emit show_community_news_signal (serial);
+
+  construct_octave_qt_link ();
+
+  // We have to set up all our windows, before we finally launch
+  // octave.
+
+  construct ();
+
+  read_settings ();
+
+  init_terminal_size ();
+
+  emit init_window_menu ();
+
+  focus_command_window ();
+}
+
+main_window::~main_window () { }
+
+void main_window::adopt_dock_widgets ()
+{
+  adopt_terminal_widget ();
+  adopt_documentation_widget ();
+  adopt_file_browser_widget ();
+  adopt_history_widget ();
+  adopt_workspace_widget ();
+  adopt_editor_widget ();
+  adopt_variable_editor_widget ();
+
+  m_previous_dock = m_command_window;
+}
+
+void main_window::adopt_terminal_widget ()
+{
+  m_command_window = m_octave_qobj.terminal_widget (this);
+
+  make_dock_widget_connections (m_command_window);
+
+  connect (this, &main_window::settings_changed,
+           m_command_window, &terminal_dock_widget::notice_settings);
+
+  if (! m_octave_qobj.experimental_terminal_widget ())
+    {
+      QTerminal *cmd_widget = m_command_window->get_qterminal ();
+
+      // The following connections were previously made in
+      // QTerminal::construct, QWinTerminalImpl::QWinTerminalImpl, and
+      // QUnixTerminalImpl::QUnixTerminalImpl.  Similar actions should
+      // probably be possible for the new command widget.
+
+      connect (cmd_widget, &QTerminal::report_status_message,
+               this, &main_window::report_status_message);
+
+      connect (cmd_widget, &QTerminal::edit_mfile_request,
+               this, &main_window::edit_mfile);
+
+      connect (cmd_widget, &QTerminal::execute_command_in_terminal_signal,
+               this, &main_window::execute_command_in_terminal);
+
+      connect (this, &main_window::init_terminal_size_signal,
+               cmd_widget, &QTerminal::init_terminal_size);
+
+      connect (this, &main_window::copyClipboard_signal,
+               cmd_widget, &QTerminal::copyClipboard);
+
+      connect (this, &main_window::pasteClipboard_signal,
+               cmd_widget, &QTerminal::pasteClipboard);
+
+      connect (this, &main_window::selectAll_signal,
+               cmd_widget, &QTerminal::selectAll);
+
+      connect (cmd_widget, &QTerminal::request_edit_mfile_signal,
+               this, &main_window::edit_mfile);
+
+      connect (cmd_widget, &QTerminal::request_open_file_signal,
+               this, QOverload<const QString&, const QString&, int>::of (&main_window::open_file_signal));
+
+      connect (cmd_widget, &QTerminal::set_screen_size_signal,
+               this, &main_window::set_screen_size);
+
+      connect (cmd_widget, &QTerminal::clear_command_window_request,
+               this, &main_window::handle_clear_command_window_request);
+    }
+  else
+    {
+      connect (this, &main_window::execute_command_signal,
+               m_command_window, &terminal_dock_widget::execute_command_signal);
+    }
+}
+
+void main_window::adopt_documentation_widget ()
+{
+  m_doc_browser_window = m_octave_qobj.documentation_widget (this);
+
+  make_dock_widget_connections (m_doc_browser_window);
+}
+
+void main_window::adopt_file_browser_widget ()
+{
+  m_file_browser_window = m_octave_qobj.file_browser_widget (this);
+
+  make_dock_widget_connections (m_file_browser_window);
+
+  connect (m_file_browser_window, &files_dock_widget::open_file,
+           this, QOverload<const QString&>::of (&main_window::open_file_signal));
+  connect (m_file_browser_window,
+           &files_dock_widget::displayed_directory_changed,
+           this, &main_window::set_current_working_directory);
+
+  connect (m_file_browser_window, &files_dock_widget::modify_path_signal,
+           this, &main_window::modify_path);
+
+  connect (m_file_browser_window, &files_dock_widget::run_file_signal,
+           this, &main_window::run_file_in_terminal);
+
+  connect (m_file_browser_window, &files_dock_widget::load_file_signal,
+           this, &main_window::handle_load_workspace_request);
+
+  connect (m_file_browser_window, &files_dock_widget::open_any_signal,
+           this, &main_window::handle_open_any_request);
+
+  connect (m_file_browser_window, &files_dock_widget::find_files_signal,
+           this, &main_window::find_files);
+}
+
+void main_window::adopt_history_widget ()
+{
+  m_history_window = m_octave_qobj.history_widget (this);
+
+  make_dock_widget_connections (m_history_window);
+
+  connect (m_history_window, &history_dock_widget::command_create_script,
+           this, &main_window::new_file_signal);
+
+  connect (m_history_window, &history_dock_widget::command_double_clicked,
+           this, &main_window::execute_command_in_terminal);
+}
+
+void main_window::adopt_workspace_widget ()
+{
+  m_workspace_window = m_octave_qobj.workspace_widget (this);
+
+  make_dock_widget_connections (m_workspace_window);
+
+  connect (m_workspace_window, &workspace_view::command_requested,
+           this, &main_window::execute_command_in_terminal);
+}
+
+void main_window::adopt_editor_widget ()
+{
+  interpreter_qobject *interp_qobj = m_octave_qobj.interpreter_qobj ();
+
+  qt_interpreter_events *qt_link = interp_qobj->qt_link ();
+
+#if defined (HAVE_QSCINTILLA)
+  file_editor *editor = new file_editor (this);
+
+  make_dock_widget_connections (editor);
+
+  // The editor is currently different from other dock widgets.  Until
+  // those differences are resolved, make interpreter_event
+  // connections here instead of in base_qobject::editor_widget.
+  m_octave_qobj.connect_interpreter_events (editor);
+
+  connect (editor, &file_editor::show_symbol_tooltip_signal,
+           m_octave_qobj.get_workspace_model (),
+           &workspace_model::show_symbol_tooltip);
+
+  connect (editor, &file_editor::request_settings_dialog,
+           this, QOverload<const QString&>::of (&main_window::process_settings_dialog_request));
+
+  connect (editor, &file_editor::request_dbcont_signal,
+           this, &main_window::debug_continue);
+
+  connect (this, &main_window::update_gui_lexer_signal,
+           editor, &file_editor::update_gui_lexer_signal);
+
+  connect (editor, &file_editor::execute_command_in_terminal_signal,
+           this, &main_window::execute_command_in_terminal);
+
+  connect (editor, &file_editor::focus_console_after_command_signal,
+           this, &main_window::focus_console_after_command);
+
+  connect (editor, &file_editor::run_file_signal,
+           this, &main_window::run_file_in_terminal);
+
+  connect (editor, &file_editor::edit_mfile_request,
+           this, &main_window::handle_edit_mfile_request);
+
+  connect (editor, &file_editor::debug_quit_signal,
+           this, &main_window::debug_quit);
+
+  connect (this, &main_window::editor_focus_changed,
+           editor, &file_editor::enable_menu_shortcuts);
+
+  connect (this, &main_window::step_into_file_signal,
+           editor, &file_editor::request_step_into_file);
+
+  connect (editor, &file_editor::editor_tabs_changed_signal,
+           this, &main_window::editor_tabs_changed);
+
+  connect (editor, &file_editor::request_open_file_external,
+           m_external_editor, &external_editor_interface::call_custom_editor);
+
+  connect (m_external_editor, &external_editor_interface::request_settings_dialog,
+           this, &main_window::process_settings_dialog_request);
+
+  connect (this, &main_window::insert_debugger_pointer_signal,
+           editor, &file_editor::handle_insert_debugger_pointer_request);
+
+  connect (this, &main_window::delete_debugger_pointer_signal,
+           editor, &file_editor::handle_delete_debugger_pointer_request);
+
+  connect (this, &main_window::update_breakpoint_marker_signal,
+           editor, &file_editor::handle_update_breakpoint_marker_request);
+
+  // Signals for removing/renaming files/dirs in the file browser
+  connect (m_file_browser_window, &files_dock_widget::file_remove_signal,
+           editor, &file_editor::handle_file_remove);
+
+  connect (m_file_browser_window, &files_dock_widget::file_renamed_signal,
+           editor, &file_editor::handle_file_renamed);
+
+  // Signals for removing/renaming files/dirs in the terminal window
+  connect (qt_link, &qt_interpreter_events::file_renamed_signal,
+           editor, &file_editor::handle_file_renamed);
+
+  // Signals for entering/exiting debug mode
+  connect (qt_link, &qt_interpreter_events::enter_debugger_signal,
+           editor, &file_editor::handle_enter_debug_mode);
+
+  connect (qt_link, &qt_interpreter_events::exit_debugger_signal,
+           editor, &file_editor::handle_exit_debug_mode);
+
+  connect (qt_link, &qt_interpreter_events::directory_changed_signal,
+           editor, &file_editor::update_octave_directory);
+
+  m_editor_window = editor;
+
+  m_editor_menubar = m_editor_window->menubar ();
+
+  m_active_editor = m_editor_window;
+
+  m_editor_window->enable_menu_shortcuts (false);
+#else
+  m_editor_window = nullptr;
+
+  m_editor_menubar = nullptr;
+
+  m_active_editor = m_external_editor;
+#endif
+
+  connect (qt_link, SIGNAL (edit_file_signal (const QString&)),
+           m_active_editor, SLOT (handle_edit_file_request (const QString&)));
+}
+
+void main_window::adopt_variable_editor_widget ()
+{
+  m_variable_editor_window = m_octave_qobj.variable_editor_widget (this);
+
+  make_dock_widget_connections (m_variable_editor_window);
+}
+
+void main_window::make_dock_widget_connections (octave_dock_widget *dw)
+{
+  connect (this, &main_window::init_window_menu,
+           dw, &octave_dock_widget::init_window_menu_entry);
+
+  connect (this, &main_window::settings_changed,
+           dw, &octave_dock_widget::handle_settings);
+
+  connect (this, &main_window::active_dock_changed,
+           dw, &octave_dock_widget::handle_active_dock_changed);
+
+  // FIXME: shouldn't this action should be associated with closing
+  // the main window, not with exiting the application?  At one time,
+  // those two actions happened together, but now it is possible to
+  // close the main window without exiting the application.
+  connect (qApp, &QApplication::aboutToQuit,
+           dw, &octave_dock_widget::save_settings);
+
+  // The following is required when the exp. terminal widget is used
+  // and the main window is closed (no exit via interpreter)
+  connect (this, &main_window::close_gui_signal,
+           dw, &octave_dock_widget::save_settings);
+}
+
+bool main_window::command_window_has_focus () const
+{
+  return m_command_window->has_focus ();
+}
+
+void main_window::focus_command_window ()
+{
+  m_command_window->activate ();
+}
+
+void main_window::focus_window (const QString& win_name)
+{
+  if (win_name == "command")
+    m_command_window->activate ();
+  else if (win_name == "history")
+    m_history_window->activate ();
+  else if (win_name == "workspace")
+    m_workspace_window->activate ();
+  else if (win_name == "filebrowser")
+    m_file_browser_window->activate ();
+}
+
+bool main_window::confirm_shutdown ()
+{
+  bool closenow = true;
+
+  gui_settings settings;
+
+  if (settings.value (global_prompt_to_exit.settings_key (),
+                      global_prompt_to_exit.def ()).toBool ())
+    {
+      int ans = QMessageBox::question (this, tr ("Octave"),
+                                       tr ("Are you sure you want to exit Octave?"),
+                                       (QMessageBox::Ok
+                                        | QMessageBox::Cancel),
+                                       QMessageBox::Ok);
+
+      if (ans != QMessageBox::Ok)
+        closenow = false;
+    }
 
 #if defined (HAVE_QSCINTILLA)
-    file_editor *editor = new file_editor (this);
-
-    make_dock_widget_connections (editor);
-
-    // The editor is currently different from other dock widgets.  Until
-    // those differences are resolved, make interpreter_event
-    // connections here instead of in base_qobject::editor_widget.
-    m_octave_qobj.connect_interpreter_events (editor);
-
-    connect (editor, &file_editor::show_symbol_tooltip_signal,
-             m_octave_qobj.get_workspace_model (),
-             &workspace_model::show_symbol_tooltip);
-
-    connect (editor, &file_editor::request_settings_dialog,
-             this, QOverload<const QString&>::of (&main_window::process_settings_dialog_request));
-
-    connect (editor, &file_editor::request_dbcont_signal,
-             this, &main_window::debug_continue);
-
-    connect (this, &main_window::update_gui_lexer_signal,
-             editor, &file_editor::update_gui_lexer_signal);
-
-    connect (editor, &file_editor::execute_command_in_terminal_signal,
-             this, &main_window::execute_command_in_terminal);
-
-    connect (editor, &file_editor::focus_console_after_command_signal,
-             this, &main_window::focus_console_after_command);
-
-    connect (editor, &file_editor::run_file_signal,
-             this, &main_window::run_file_in_terminal);
-
-    connect (editor, &file_editor::edit_mfile_request,
-             this, &main_window::handle_edit_mfile_request);
-
-    connect (editor, &file_editor::debug_quit_signal,
-             this, &main_window::debug_quit);
-
-    connect (this, &main_window::editor_focus_changed,
-             editor, &file_editor::enable_menu_shortcuts);
-
-    connect (this, &main_window::step_into_file_signal,
-             editor, &file_editor::request_step_into_file);
-
-    connect (editor, &file_editor::editor_tabs_changed_signal,
-             this, &main_window::editor_tabs_changed);
-
-    connect (editor, &file_editor::request_open_file_external,
-             m_external_editor, &external_editor_interface::call_custom_editor);
-
-    connect (m_external_editor, &external_editor_interface::request_settings_dialog,
-             this, &main_window::process_settings_dialog_request);
-
-    connect (this, &main_window::insert_debugger_pointer_signal,
-             editor, &file_editor::handle_insert_debugger_pointer_request);
-
-    connect (this, &main_window::delete_debugger_pointer_signal,
-             editor, &file_editor::handle_delete_debugger_pointer_request);
-
-    connect (this, &main_window::update_breakpoint_marker_signal,
-             editor, &file_editor::handle_update_breakpoint_marker_request);
-
-    // Signals for removing/renaming files/dirs in the file browser
-    connect (m_file_browser_window, &files_dock_widget::file_remove_signal,
-             editor, &file_editor::handle_file_remove);
-
-    connect (m_file_browser_window, &files_dock_widget::file_renamed_signal,
-             editor, &file_editor::handle_file_renamed);
-
-    // Signals for removing/renaming files/dirs in the terminal window
-    connect (qt_link, &qt_interpreter_events::file_renamed_signal,
-             editor, &file_editor::handle_file_renamed);
-
-    // Signals for entering/exiting debug mode
-    connect (qt_link, &qt_interpreter_events::enter_debugger_signal,
-             editor, &file_editor::handle_enter_debug_mode);
-
-    connect (qt_link, &qt_interpreter_events::exit_debugger_signal,
-             editor, &file_editor::handle_exit_debug_mode);
-
-    connect (qt_link, &qt_interpreter_events::directory_changed_signal,
-             editor, &file_editor::update_octave_directory);
-
-    m_editor_window = editor;
-
-    m_editor_menubar = m_editor_window->menubar ();
-
-    m_active_editor = m_editor_window;
-
-    m_editor_window->enable_menu_shortcuts (false);
+  if (closenow)
+    closenow = m_editor_window->check_closing ();
+#endif
+
+  return closenow;
+}
+
+// catch focus changes and determine the active dock widget
+void main_window::focus_changed (QWidget *, QWidget *new_widget)
+{
+  // If there is no new widget or the new widget is a menu bar
+  // (when pressing <alt>), we can return immediately and reset the
+  // focus to the previous widget
+  if (! new_widget
+      || (new_widget == menuBar ())
+      || (new_widget == m_editor_menubar))
+    {
+      if (m_active_dock)
+        m_active_dock->setFocus ();
+
+      return;
+    }
+
+  octave_dock_widget *dock = nullptr;
+  QWidget *w_new = new_widget;  // get a copy of new focus widget
+  QWidget *start = w_new;       // Save it as start of our search
+  int count = 0;                // fallback to prevent endless loop
+
+  QList<octave_dock_widget *> w_list = dock_widget_list ();
+
+  while (w_new && w_new != m_main_tool_bar && count < 100)
+    {
+      // Go through all dock widgets and check whether the current widget
+      // with focus is a child of one of them.
+      for (auto w : w_list)
+        {
+          if (w->isAncestorOf (w_new))
+            dock = w;
+        }
+
+      if (dock)
+        break;
+
+      // If not yet found (in case w_new is not a child of its dock widget),
+      // test next widget in the focus chain
+      w_new = qobject_cast<QWidget *> (w_new->previousInFocusChain ());
+
+      // Measures preventing an endless loop
+      if (w_new == start)
+        break;  // We have arrived where we began ==> exit loop
+      count++;  // Limited number of trials
+    }
+
+  // editor and terminal needs extra handling
+  octave_dock_widget *edit_dock_widget
+    = static_cast<octave_dock_widget *> (m_editor_window);
+  octave_dock_widget *cmd_dock_widget
+    = static_cast<octave_dock_widget *> (m_command_window);
+
+  // if new dock has focus, emit signal and store active focus
+  // except editor changes to a dialog (dock=0)
+  if ((dock || m_active_dock != edit_dock_widget) && (dock != m_active_dock))
+    {
+      // signal to all dock widgets for updating the style
+      emit active_dock_changed (m_active_dock, dock);
+
+      if (dock)
+        {
+          QList<QDockWidget *> tabbed = tabifiedDockWidgets (dock);
+          if (tabbed.contains (m_active_dock))
+            dock->set_predecessor_widget (m_active_dock);
+        }
+
+      // Check whether editor loses or gains focus
+      int editor = 0;
+      if (edit_dock_widget == dock)
+        {
+          emit editor_focus_changed (true);
+          editor = 1;
+        }
+      else if (edit_dock_widget == m_active_dock)
+        {
+          emit editor_focus_changed (false);
+          editor = -1;
+        }
+
+      // Check whether terminal loses or gains focus
+      int cmd_involved = 0;
+      if (cmd_dock_widget == dock)
+        cmd_involved = 1;
+      else if (cmd_dock_widget == m_active_dock)
+        cmd_involved = -1;
+
+      // If we have to take care of Alt+? accelerators of the main
+      // window, take result of test for terminal widget above
+      int command = 0;
+      if (m_prevent_readline_conflicts_menu)
+        command = cmd_involved;
+
+      // If editor or command gets/looses focus, disable/enable
+      // main menu accelerators (Alt + ?)
+      if (editor || command)
+        {
+          int sum = editor + command;
+          if (sum > 0)
+            disable_menu_shortcuts (true);
+          else if (sum < 0)
+            disable_menu_shortcuts (false);
+        }
+
+      if (m_active_dock)
+        m_previous_dock = m_active_dock;
+      m_active_dock = dock;
+
+      // En-/disable global shortcuts (preventing conflicts with
+      // readline. Do it here because it relies on m_active_dock
+      if (cmd_involved)
+        configure_shortcuts ();
+    }
+}
+
+void main_window::request_reload_settings ()
+{
+  emit settings_changed ();
+}
+
+void main_window::report_status_message (const QString& statusMessage)
+{
+  m_status_bar->showMessage (statusMessage, 1000);
+}
+
+void main_window::handle_save_workspace_request ()
+{
+  // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
+  int opts = 0;  // No options by default.
+
+  gui_settings settings;
+
+  if (! settings.bool_value (global_use_native_dialogs))
+    opts = QFileDialog::DontUseNativeDialog;
+
+  QString file
+    = QFileDialog::getSaveFileName (this, tr ("Save Workspace As"), ".",
+                                    nullptr, nullptr, QFileDialog::Option (opts));
+
+  if (! file.isEmpty ())
+    {
+      emit interpreter_event
+        ([=] (interpreter& interp)
+         {
+           // INTERPRETER THREAD
+
+           Fsave (interp, ovl (file.toStdString ()));
+         });
+    }
+}
+
+void main_window::handle_load_workspace_request (const QString& file_arg)
+{
+  // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
+  int opts = 0;  // No options by default.
+
+  gui_settings settings;
+
+  if (! settings.bool_value (global_use_native_dialogs))
+    opts = QFileDialog::DontUseNativeDialog;
+
+  QString file = file_arg;
+
+  if (file.isEmpty ())
+    file = QFileDialog::getOpenFileName (this, tr ("Load Workspace"), ".",
+                                         nullptr, nullptr, QFileDialog::Option (opts));
+
+  if (! file.isEmpty ())
+    {
+      emit interpreter_event
+        ([=] (interpreter& interp)
+         {
+           // INTERPRETER THREAD
+
+           Fload (interp, ovl (file.toStdString ()));
+
+           tree_evaluator& tw = interp.get_evaluator ();
+
+           event_manager& xevmgr = interp.get_event_manager ();
+
+           xevmgr.set_workspace (true, tw.get_symbol_info ());
+         });
+    }
+}
+
+void main_window::handle_open_any_request (const QString& file_arg)
+{
+  if (! file_arg.isEmpty ())
+    {
+      std::string file = file_arg.toStdString ();
+
+      emit interpreter_event
+        ([=] (interpreter& interp)
+         {
+           // INTERPRETER THREAD
+
+           interp.feval ("open", ovl (file));
+
+           // Update the workspace since open.m may have loaded new
+           // variables.
+           tree_evaluator& tw = interp.get_evaluator ();
+
+           event_manager& xevmgr = interp.get_event_manager ();
+
+           xevmgr.set_workspace (true, tw.get_symbol_info ());
+         });
+    }
+}
+
+void main_window::handle_clear_workspace_request ()
+{
+  emit interpreter_event
+    ([] (interpreter& interp)
+     {
+       // INTERPRETER THREAD
+
+       Fclear (interp);
+     });
+}
+
+void main_window::handle_clear_command_window_request ()
+{
+  emit interpreter_event
+    ([] ()
+     {
+       // INTERPRETER THREAD
+
+       command_editor::kill_full_line ();
+       command_editor::clear_screen ();
+     });
+}
+
+void main_window::handle_clear_history_request ()
+{
+  emit interpreter_event
+    ([] (interpreter& interp)
+     {
+       // INTERPRETER THREAD
+
+       history_system& history_sys = interp.get_history_system ();
+
+       history_sys.do_history (ovl ("-c"));
+     });
+}
+
+void main_window::handle_undo_request ()
+{
+  if (command_window_has_focus ())
+    {
+      emit interpreter_event
+        ([] ()
+         {
+           // INTERPRETER THREAD
+
+           command_editor::undo ();
+           command_editor::redisplay ();
+         });
+    }
+  else
+    emit undo_signal ();
+}
+
+void main_window::modify_path (const QStringList& dir_list,
+                               bool rm, bool subdirs)
+{
+  emit interpreter_event
+    ([=] (interpreter& interp)
+    {
+      // INTERPRETER THREAD
+
+      octave_value_list paths;
+
+      // Loop over all directories in order to get all subdirs
+      for (octave_idx_type i = 0; i < dir_list.length (); i++)
+        {
+          std::string dir = dir_list.at(i).toStdString ();
+
+          if (subdirs)
+            paths.append (Fgenpath (ovl (dir)));
+          else
+            paths.append (dir);
+        }
+
+      if (rm)
+        Frmpath (interp, paths);
+      else
+        Faddpath (interp, paths);
+    });
+}
+
+void main_window::edit_mfile (const QString& name, int line)
+{
+  handle_edit_mfile_request (name, QString (), QString (), line);
+}
+
+void main_window::file_remove_proxy (const QString& o, const QString& n)
+{
+  interpreter_qobject *interp_qobj = m_octave_qobj.interpreter_qobj ();
+
+  qt_interpreter_events *qt_link = interp_qobj->qt_link ();
+
+  // Wait for worker to suspend
+  qt_link->lock ();
+  // Close the file if opened
+#if defined (HAVE_QSCINTILLA)
+  m_editor_window->handle_file_remove (o, n);
 #else
-    m_editor_window = nullptr;
-
-    m_editor_menubar = nullptr;
-
-    m_active_editor = m_external_editor;
-#endif
-
-    connect (qt_link, SIGNAL (edit_file_signal (const QString&)),
-             m_active_editor, SLOT (handle_edit_file_request (const QString&)));
-  }
-
-  void main_window::adopt_variable_editor_widget ()
-  {
-    m_variable_editor_window = m_octave_qobj.variable_editor_widget (this);
-
-    make_dock_widget_connections (m_variable_editor_window);
-  }
-
-  void main_window::make_dock_widget_connections (octave_dock_widget *dw)
-  {
-    connect (this, &main_window::init_window_menu,
-             dw, &octave_dock_widget::init_window_menu_entry);
-
-    connect (this, &main_window::settings_changed,
-             dw, &octave_dock_widget::handle_settings);
-
-    connect (this, &main_window::active_dock_changed,
-             dw, &octave_dock_widget::handle_active_dock_changed);
-
-    // FIXME: shouldn't this action should be associated with closing
-    // the main window, not with exiting the application?  At one time,
-    // those two actions happened together, but now it is possible to
-    // close the main window without exiting the application.
-    connect (qApp, &QApplication::aboutToQuit,
-             dw, &octave_dock_widget::save_settings);
-
-    // The following is required when the exp. terminal widget is used
-    // and the main window is closed (no exit via interpreter)
-    connect (this, &main_window::close_gui_signal,
-             dw, &octave_dock_widget::save_settings);
-  }
-
-  bool main_window::command_window_has_focus () const
-  {
-    return m_command_window->has_focus ();
-  }
-
-  void main_window::focus_command_window ()
-  {
-    m_command_window->activate ();
-  }
-
-  void main_window::focus_window (const QString& win_name)
-  {
-    if (win_name == "command")
-      m_command_window->activate ();
-    else if (win_name == "history")
-      m_history_window->activate ();
-    else if (win_name == "workspace")
-      m_workspace_window->activate ();
-    else if (win_name == "filebrowser")
-      m_file_browser_window->activate ();
-  }
-
-  bool main_window::confirm_shutdown ()
-  {
-    bool closenow = true;
-
-    gui_settings settings;
-
-    if (settings.value (global_prompt_to_exit.settings_key (),
-                        global_prompt_to_exit.def ()).toBool ())
-      {
-        int ans = QMessageBox::question (this, tr ("Octave"),
-                                         tr ("Are you sure you want to exit Octave?"),
-                                         (QMessageBox::Ok
-                                          | QMessageBox::Cancel),
-                                         QMessageBox::Ok);
-
-        if (ans != QMessageBox::Ok)
-          closenow = false;
-      }
-
-#if defined (HAVE_QSCINTILLA)
-    if (closenow)
-      closenow = m_editor_window->check_closing ();
+  octave_unused_parameter (o);
+  octave_unused_parameter (n);
 #endif
 
-    return closenow;
-  }
-
-  // catch focus changes and determine the active dock widget
-  void main_window::focus_changed (QWidget *, QWidget *new_widget)
-  {
-    // If there is no new widget or the new widget is a menu bar
-    // (when pressing <alt>), we can return immediately and reset the
-    // focus to the previous widget
-    if (! new_widget
-        || (new_widget == menuBar ())
-        || (new_widget == m_editor_menubar))
-      {
-        if (m_active_dock)
-          m_active_dock->setFocus ();
-
-        return;
-      }
-
-    octave_dock_widget *dock = nullptr;
-    QWidget *w_new = new_widget;  // get a copy of new focus widget
-    QWidget *start = w_new;       // Save it as start of our search
-    int count = 0;                // fallback to prevent endless loop
-
-    QList<octave_dock_widget *> w_list = dock_widget_list ();
-
-    while (w_new && w_new != m_main_tool_bar && count < 100)
-      {
-        // Go through all dock widgets and check whether the current widget
-        // with focus is a child of one of them.
-        for (auto w : w_list)
-          {
-            if (w->isAncestorOf (w_new))
-              dock = w;
-          }
-
-        if (dock)
-          break;
-
-        // If not yet found (in case w_new is not a child of its dock widget),
-        // test next widget in the focus chain
-        w_new = qobject_cast<QWidget *> (w_new->previousInFocusChain ());
-
-        // Measures preventing an endless loop
-        if (w_new == start)
-          break;  // We have arrived where we began ==> exit loop
-        count++;  // Limited number of trials
-      }
-
-    // editor and terminal needs extra handling
-    octave_dock_widget *edit_dock_widget
-      = static_cast<octave_dock_widget *> (m_editor_window);
-    octave_dock_widget *cmd_dock_widget
-      = static_cast<octave_dock_widget *> (m_command_window);
-
-    // if new dock has focus, emit signal and store active focus
-    // except editor changes to a dialog (dock=0)
-    if ((dock || m_active_dock != edit_dock_widget) && (dock != m_active_dock))
-      {
-        // signal to all dock widgets for updating the style
-        emit active_dock_changed (m_active_dock, dock);
-
-        if (dock)
-          {
-            QList<QDockWidget *> tabbed = tabifiedDockWidgets (dock);
-            if (tabbed.contains (m_active_dock))
-              dock->set_predecessor_widget (m_active_dock);
-          }
-
-        // Check whether editor loses or gains focus
-        int editor = 0;
-        if (edit_dock_widget == dock)
-          {
-            emit editor_focus_changed (true);
-            editor = 1;
-          }
-        else if (edit_dock_widget == m_active_dock)
-          {
-            emit editor_focus_changed (false);
-            editor = -1;
-          }
-
-        // Check whether terminal loses or gains focus
-        int cmd_involved = 0;
-        if (cmd_dock_widget == dock)
-          cmd_involved = 1;
-        else if (cmd_dock_widget == m_active_dock)
-          cmd_involved = -1;
-
-        // If we have to take care of Alt+? accelerators of the main
-        // window, take result of test for terminal widget above
-        int command = 0;
-        if (m_prevent_readline_conflicts_menu)
-          command = cmd_involved;
-
-        // If editor or command gets/looses focus, disable/enable
-        // main menu accelerators (Alt + ?)
-        if (editor || command)
-          {
-            int sum = editor + command;
-            if (sum > 0)
-              disable_menu_shortcuts (true);
-            else if (sum < 0)
-              disable_menu_shortcuts (false);
-          }
-
-        if (m_active_dock)
-          m_previous_dock = m_active_dock;
-        m_active_dock = dock;
-
-        // En-/disable global shortcuts (preventing conflicts with
-        // readline. Do it here because it relies on m_active_dock
-        if (cmd_involved)
-          configure_shortcuts ();
-      }
-  }
-
-  void main_window::request_reload_settings ()
-  {
-    emit settings_changed ();
-  }
-
-  void main_window::report_status_message (const QString& statusMessage)
-  {
-    m_status_bar->showMessage (statusMessage, 1000);
-  }
-
-  void main_window::handle_save_workspace_request ()
-  {
-    // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
-    int opts = 0;  // No options by default.
-
-    gui_settings settings;
-
-    if (! settings.bool_value (global_use_native_dialogs))
-      opts = QFileDialog::DontUseNativeDialog;
-
-    QString file
-      = QFileDialog::getSaveFileName (this, tr ("Save Workspace As"), ".",
-                                      nullptr, nullptr, QFileDialog::Option (opts));
-
-    if (! file.isEmpty ())
-      {
-        emit interpreter_event
-          ([=] (interpreter& interp)
-           {
-             // INTERPRETER THREAD
-
-             Fsave (interp, ovl (file.toStdString ()));
-           });
-      }
-  }
-
-  void main_window::handle_load_workspace_request (const QString& file_arg)
-  {
-    // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
-    int opts = 0;  // No options by default.
-
-    gui_settings settings;
-
-    if (! settings.bool_value (global_use_native_dialogs))
-      opts = QFileDialog::DontUseNativeDialog;
-
-    QString file = file_arg;
-
-    if (file.isEmpty ())
-      file = QFileDialog::getOpenFileName (this, tr ("Load Workspace"), ".",
-                                           nullptr, nullptr, QFileDialog::Option (opts));
-
-    if (! file.isEmpty ())
-      {
-        emit interpreter_event
-          ([=] (interpreter& interp)
-           {
-             // INTERPRETER THREAD
-
-             Fload (interp, ovl (file.toStdString ()));
-
-             tree_evaluator& tw = interp.get_evaluator ();
-
-             event_manager& xevmgr = interp.get_event_manager ();
-
-             xevmgr.set_workspace (true, tw.get_symbol_info ());
-           });
-      }
-  }
-
-  void main_window::handle_open_any_request (const QString& file_arg)
-  {
-    if (! file_arg.isEmpty ())
-      {
-        std::string file = file_arg.toStdString ();
-
-        emit interpreter_event
-          ([=] (interpreter& interp)
-           {
-             // INTERPRETER THREAD
-
-             interp.feval ("open", ovl (file));
-
-             // Update the workspace since open.m may have loaded new
-             // variables.
-             tree_evaluator& tw = interp.get_evaluator ();
-
-             event_manager& xevmgr = interp.get_event_manager ();
-
-             xevmgr.set_workspace (true, tw.get_symbol_info ());
-           });
-      }
-  }
-
-  void main_window::handle_clear_workspace_request ()
-  {
-    emit interpreter_event
-      ([] (interpreter& interp)
-       {
-         // INTERPRETER THREAD
-
-         Fclear (interp);
-       });
-  }
-
-  void main_window::handle_clear_command_window_request ()
-  {
-    emit interpreter_event
-      ([] ()
-       {
-         // INTERPRETER THREAD
-
-         command_editor::kill_full_line ();
-         command_editor::clear_screen ();
-       });
-  }
-
-  void main_window::handle_clear_history_request ()
-  {
-    emit interpreter_event
-      ([] (interpreter& interp)
-       {
-         // INTERPRETER THREAD
-
-         history_system& history_sys = interp.get_history_system ();
-
-         history_sys.do_history (ovl ("-c"));
-       });
-  }
-
-  void main_window::handle_undo_request ()
-  {
-    if (command_window_has_focus ())
-      {
-        emit interpreter_event
-          ([] ()
-           {
-             // INTERPRETER THREAD
-
-             command_editor::undo ();
-             command_editor::redisplay ();
-           });
-      }
-    else
-      emit undo_signal ();
-  }
-
-  void main_window::modify_path (const QStringList& dir_list,
-                                 bool rm, bool subdirs)
-  {
-    emit interpreter_event
-      ([=] (interpreter& interp)
+  // We are done: Unlock and wake the worker thread
+  qt_link->unlock ();
+  qt_link->wake_all ();
+}
+
+void main_window::open_online_documentation_page ()
+{
+  QDesktopServices::openUrl
+    (QUrl ("https://octave.org/doc/interpreter/index.html"));
+}
+
+void main_window::open_bug_tracker_page ()
+{
+  QDesktopServices::openUrl (QUrl ("https://octave.org/bugs.html"));
+}
+
+void main_window::open_octave_packages_page ()
+{
+  QDesktopServices::openUrl (QUrl ("https://packages.octave.org/index.html"));
+}
+
+void main_window::open_contribute_page ()
+{
+  QDesktopServices::openUrl (QUrl ("https://octave.org/contribute.html"));
+}
+
+void main_window::open_donate_page ()
+{
+  QDesktopServices::openUrl (QUrl ("https://octave.org/donate.html"));
+}
+
+void main_window::process_settings_dialog_request (const QString& desired_tab)
+{
+  if (m_settings_dlg)  // m_settings_dlg is a guarded pointer!
+    {
+      // here the dialog is still open and called once again
+      if (! desired_tab.isEmpty ())
+        m_settings_dlg->show_tab (desired_tab);
+      return;
+    }
+
+  m_settings_dlg = new settings_dialog (this, desired_tab);
+
+  connect (m_settings_dlg, &settings_dialog::apply_new_settings,
+           this, &main_window::request_reload_settings);
+
+  m_settings_dlg->setModal (false);
+  m_settings_dlg->setAttribute (Qt::WA_DeleteOnClose);
+  m_settings_dlg->show ();
+}
+
+void main_window::show_about_octave ()
+{
+  std::string message
+    = octave_name_version_copyright_copying_warranty_and_bugs (true);
+
+  QMessageBox::about (this, tr ("About Octave"),
+                      QString::fromStdString (message));
+}
+
+void main_window::notice_settings (bool update_by_worker)
+{
+  gui_settings settings;
+
+  // Get desired style from preferences or take the default one if
+  // the desired one is not found
+  QString preferred_style = settings.string_value (global_style);
+
+  if (preferred_style == global_style.def ().toString ())
+    preferred_style = m_default_style;
+
+  QApplication* qapp = m_octave_qobj.qapplication();
+
+  if (preferred_style == global_extra_styles.at (EXTRA_STYLE_FUSION_DARK))
+    {
+      QStyle *new_style = QStyleFactory::create (QStringLiteral("Fusion"));
+      if (new_style)
+        qapp->setStyle (new_style);
+      qapp->setPalette (getFusionDarkPalette());
+      qapp->setStyleSheet ("QToolTip { color: #ffffff; background-color: #2a82da; border: 1px solid white; }");
+    }
+  else
+    {
+      QStyle *new_style = QStyleFactory::create (preferred_style);
+      if (new_style)
+        {
+          qapp->setPalette (m_default_palette);
+          qapp->setStyle (new_style);
+        }
+    }
+
+  // the widget's icons (when floating)
+  QString icon_set = settings.string_value (dw_icon_set);
+
+  QString icon;
+  for (auto *widget : dock_widget_list ())
+    {
+      QString name = widget->objectName ();
+      if (! name.isEmpty ())
+        {
+          // if child has a name
+          icon = dw_icon_set_names[icon_set];
+          if (icon_set != "NONE")
+            icon += name + ".png"; // add widget name and ext.
+          widget->setWindowIcon (QIcon (icon));
+        }
+    }
+
+  int size_idx = settings.int_value (global_icon_size);
+  size_idx = (size_idx > 0) - (size_idx < 0) + 1;  // Make valid index from 0 to 2
+
+  QStyle *st = style ();
+  int icon_size = st->pixelMetric (global_icon_sizes[size_idx]);
+  m_main_tool_bar->setIconSize (QSize (icon_size, icon_size));
+
+  if (settings.bool_value (global_status_bar))
+    m_status_bar->show ();
+  else
+    m_status_bar->hide ();
+
+  m_prevent_readline_conflicts
+    = settings.bool_value (sc_prevent_rl_conflicts);
+
+  m_prevent_readline_conflicts_menu
+    = settings.bool_value (sc_prevent_rl_conflicts_menu);
+
+  m_suppress_dbg_location
+    = ! settings.bool_value (cs_dbg_location);
+
+  settings.update_network_settings ();
+
+  emit active_dock_changed (nullptr, m_active_dock); // update dock widget styles
+
+  configure_shortcuts ();
+
+  bool do_disable_main_menu_shortcuts
+    = (m_active_dock == m_editor_window)
+      || (m_prevent_readline_conflicts_menu
+          && (m_active_dock == m_command_window));
+
+  disable_menu_shortcuts (do_disable_main_menu_shortcuts);
+
+  // Check whether some octave internal preferences have to be updated
+  QString new_default_encoding
+    = settings.string_value (ed_default_enc);
+  // Do not update internal pref only if a) this update was not initiated
+  // by the worker and b) the pref has really changes
+  if (! update_by_worker && (new_default_encoding != m_default_encoding))
+    update_default_encoding (new_default_encoding);
+
+  // Set cursor blinking depending on the settings
+  // Cursor blinking: consider old terminal related setting if not yet set
+  // TODO: This pref. can be deprecated / removed if Qt adds support for
+  //       getting the cursor blink preferences from all OS environments
+  bool cursor_blinking;
+
+  if (settings.contains (global_cursor_blinking.settings_key ()))
+    cursor_blinking = settings.bool_value (global_cursor_blinking);
+  else
+    cursor_blinking = settings.bool_value (cs_cursor_blinking);
+
+  if (cursor_blinking)
+    QApplication::setCursorFlashTime (1000);  // 1000 ms flash time
+  else
+    QApplication::setCursorFlashTime (0);  // no flashing
+
+}
+
+QPalette main_window::getFusionDarkPalette()
+{
+  QPalette darkPalette;
+  darkPalette.setColor(QPalette::Window, QColor(53, 53, 53));
+  darkPalette.setColor(QPalette::WindowText, Qt::white);
+  darkPalette.setColor(QPalette::Disabled, QPalette::WindowText, QColor(127, 127, 127));
+  darkPalette.setColor(QPalette::Base, QColor(42, 42, 42));
+  darkPalette.setColor(QPalette::AlternateBase, QColor(66, 66, 66));
+  darkPalette.setColor(QPalette::ToolTipBase, Qt::white);
+  darkPalette.setColor(QPalette::ToolTipText, Qt::white);
+  darkPalette.setColor(QPalette::Text, Qt::white);
+  darkPalette.setColor(QPalette::Disabled, QPalette::Text, QColor(127, 127, 127));
+  darkPalette.setColor(QPalette::Dark, QColor(35, 35, 35));
+  darkPalette.setColor(QPalette::Shadow, QColor(20, 20, 20));
+  darkPalette.setColor(QPalette::Button, QColor(53, 53, 53));
+  darkPalette.setColor(QPalette::ButtonText, Qt::white);
+  darkPalette.setColor(QPalette::Disabled, QPalette::ButtonText, QColor(127, 127, 127));
+  darkPalette.setColor(QPalette::BrightText, Qt::red);
+  darkPalette.setColor(QPalette::Link, QColor(42, 130, 218));
+  darkPalette.setColor(QPalette::Highlight, QColor(42, 130, 218));
+  darkPalette.setColor(QPalette::Disabled, QPalette::Highlight, QColor(80, 80, 80));
+  darkPalette.setColor(QPalette::HighlightedText, Qt::white);
+  darkPalette.setColor(QPalette::Disabled, QPalette::HighlightedText, QColor(127, 127, 127));
+
+  return darkPalette;
+}
+
+void main_window::prepare_to_exit ()
+{
+  // Find files dialog is constructed dynamically, not at time of main_window
+  // construction.  Connecting it to qApp aboutToQuit signal would have
+  // caused it to run after gui_settings is deleted.
+  if (m_find_files_dlg)
+    m_find_files_dlg->save_settings ();
+
+  if (m_set_path_dlg)
+    m_set_path_dlg->save_settings ();
+
+  write_settings ();
+
+  // No more active dock, otherwise, focus_changed would try to set
+  // the focus to a dock widget that might not exist anymore
+  m_active_dock = nullptr;
+}
+
+void main_window::go_to_previous_widget ()
+{
+  m_previous_dock->activate ();
+}
+
+void main_window::update_octave_directory (const QString& dir)
+{
+  // Remove existing entry, if any, then add new directory at top and
+  // mark it as the current directory.  Finally, update the file list
+  // widget.
+
+  int index = m_current_directory_combo_box->findText (dir);
+
+  if (index >= 0)
+    m_current_directory_combo_box->removeItem (index);
+
+  m_current_directory_combo_box->insertItem (0, dir);
+  m_current_directory_combo_box->setCurrentIndex (0);
+}
+
+void main_window::browse_for_directory ()
+{
+  // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
+  int opts = QFileDialog::ShowDirsOnly;
+
+  gui_settings settings;
+
+  if (! settings.bool_value (global_use_native_dialogs))
+    opts = QFileDialog::DontUseNativeDialog;
+
+  QString dir
+    = QFileDialog::getExistingDirectory (this, tr ("Browse directories"), nullptr,
+                                         QFileDialog::Option (opts));
+
+  set_current_working_directory (dir);
+
+  // FIXME: on Windows systems, the command window freezes after the
+  // previous actions.  Forcing the focus appears to unstick it.
+
+  focus_command_window ();
+}
+
+void main_window::set_current_working_directory (const QString& dir)
+{
+  // Change to dir if it is an existing directory.
+
+  QString xdir = (dir.isEmpty () ? "." : dir);
+
+  QFileInfo fileInfo (xdir);
+
+  if (fileInfo.exists () && fileInfo.isDir ())
+    {
+      emit interpreter_event
+        ([=] (interpreter& interp)
+         {
+           // INTERPRETER THREAD
+
+           interp.chdir (xdir.toStdString ());
+         });
+    }
+}
+
+void main_window::change_directory_up ()
+{
+  set_current_working_directory ("..");
+}
+
+// Slot that is called if return is pressed in the line edit of the
+// combobox to change to a new directory or a directory that is already
+// in the drop down list.
+
+void main_window::accept_directory_line_edit ()
+{
+  // Get new directory name, and change to it if it is new.  Otherwise,
+  // the combo box will trigger the "activated" signal to change to the
+  // directory.
+
+  QString dir = m_current_directory_combo_box->currentText ();
+
+  int index = m_current_directory_combo_box->findText (dir);
+
+  if (index < 0)
+    set_current_working_directory (dir);
+}
+
+void main_window::execute_command_in_terminal (const QString& command)
+{
+  if (m_octave_qobj.experimental_terminal_widget ())
+    {
+      emit execute_command_signal (command);
+    }
+  else
+    {
+      emit interpreter_event
+        ([=] ()
+         {
+           // INTERPRETER THREAD
+
+           std::string pending_input = command_editor::get_current_line ();
+
+           command_editor::set_initial_input (pending_input);
+           command_editor::replace_line (command.toStdString ());
+           command_editor::redisplay ();
+           command_editor::interrupt_event_loop ();
+           command_editor::accept_line ();
+         });
+    }
+
+  focus_console_after_command ();
+}
+
+void main_window::run_file_in_terminal (const QFileInfo& info)
+{
+  emit interpreter_event
+    ([=] (interpreter& interp)
+     {
+       // INTERPRETER THREAD
+
+       QString function_name = info.fileName ();
+       function_name.chop (info.suffix ().length () + 1);
+       std::string file_path = info.absoluteFilePath ().toStdString ();
+
+       std::string pending_input = command_editor::get_current_line ();
+
+       if (valid_identifier (function_name.toStdString ()))
+         {
+           // Valid identifier: call as function with possibility to
+           // debug.
+
+           load_path& lp = interp.get_load_path ();
+
+           std::string path = info.absolutePath ().toStdString ();
+
+           if (lp.contains_file_in_dir (file_path, path))
+             command_editor::replace_line (function_name.toStdString ());
+         }
+       else
+         {
+           // No valid identifier: use equivalent of Fsource (), no
+           // debug possible.
+
+           interp.source_file (file_path);
+
+           command_editor::replace_line ("");
+         }
+
+       command_editor::set_initial_input (pending_input);
+       command_editor::redisplay ();
+       command_editor::interrupt_event_loop ();
+       command_editor::accept_line ();
+     });
+
+  focus_console_after_command ();
+}
+
+void main_window::handle_new_figure_request ()
+{
+  emit interpreter_event
+    ([] (interpreter& interp)
+     {
+       // INTERPRETER THREAD
+
+       Fbuiltin (interp, ovl ("figure"));
+       Fdrawnow (interp);
+     });
+}
+
+void main_window::handle_enter_debugger ()
+{
+  setWindowTitle ("Octave (Debugging)");
+
+  m_debug_continue->setEnabled (true);
+  m_debug_step_into->setEnabled (true);
+  m_debug_step_over->setEnabled (true);
+  m_debug_step_out->setEnabled (true);
+  m_debug_quit->setEnabled (true);
+}
+
+void main_window::handle_exit_debugger ()
+{
+  setWindowTitle ("Octave");
+
+  m_debug_continue->setEnabled (false);
+  m_debug_step_into->setEnabled (false);
+  m_debug_step_over->setEnabled (m_editor_has_tabs && m_editor_is_octave_file);
+  m_debug_step_out->setEnabled (false);
+  m_debug_quit->setEnabled (false);
+}
+
+void main_window::debug_continue ()
+{
+  emit interpreter_event
+    ([=] (interpreter& interp)
+     {
+       // INTERPRETER THREAD
+
+       F__db_next_breakpoint_quiet__ (interp, ovl (m_suppress_dbg_location));
+       Fdbcont (interp);
+
+       command_editor::interrupt (true);
+     });
+}
+
+void main_window::debug_step_into ()
+{
+  emit interpreter_event
+    ([=] (interpreter& interp)
+     {
+       // INTERPRETER THREAD
+
+       F__db_next_breakpoint_quiet__ (interp, ovl (m_suppress_dbg_location));
+       Fdbstep (interp, ovl ("in"));
+
+       command_editor::interrupt (true);
+     });
+}
+
+void main_window::debug_step_over ()
+{
+  if (m_debug_quit->isEnabled ())
+    {
+      // We are in debug mode, just call dbstep.
+
+      emit interpreter_event
+        ([=] (interpreter& interp)
+         {
+           // INTERPRETER THREAD
+
+           F__db_next_breakpoint_quiet__ (interp,
+                                          ovl (m_suppress_dbg_location));
+           Fdbstep (interp);
+
+           command_editor::interrupt (true);
+         });
+    }
+  else
+    {
+      // Not in debug mode: "step into" the current editor file
+      emit step_into_file_signal ();
+    }
+}
+
+void main_window::debug_step_out ()
+{
+  emit interpreter_event
+    ([=] (interpreter& interp)
+     {
+       // INTERPRETER THREAD
+
+       F__db_next_breakpoint_quiet__ (interp, ovl (m_suppress_dbg_location));
+       Fdbstep (interp, ovl ("out"));
+
+       command_editor::interrupt (true);
+     });
+}
+
+void main_window::debug_quit ()
+{
+  emit interpreter_event
+    ([] (interpreter& interp)
+     {
+       // INTERPRETER THREAD
+
+       Fdbquit (interp);
+
+       command_editor::interrupt (true);
+     });
+}
+
+//
+// Functions related to file editing
+//
+// These are moved from editor to here for also using them when octave
+// is built without qscintilla
+//
+void main_window::request_open_file ()
+{
+  // Open file isn't a file_editor_tab or editor function since the file
+  // might be opened in an external editor.  Hence, functionality is here.
+
+  gui_settings settings;
+
+  bool is_internal = m_editor_window
+                     && ! settings.value (global_use_custom_editor.settings_key (),
+                                           global_use_custom_editor.def ()).toBool ();
+
+  // Create a NonModal message.
+  QWidget *p = this;
+  if (is_internal)
+    p = m_editor_window;
+  QFileDialog *fileDialog = new QFileDialog (p);
+  fileDialog->setNameFilter (tr ("Octave Files (*.m);;All Files (*)"));
+
+  fileDialog->setAcceptMode (QFileDialog::AcceptOpen);
+  fileDialog->setViewMode (QFileDialog::Detail);
+  fileDialog->setFileMode (QFileDialog::ExistingFiles);
+  fileDialog->setDirectory (m_current_directory_combo_box->itemText (0));
+
+  // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
+  if (! settings.bool_value (global_use_native_dialogs))
+    fileDialog->setOption(QFileDialog::DontUseNativeDialog);
+
+  connect (fileDialog, &QFileDialog::filesSelected,
+           this, &main_window::request_open_files);
+
+  fileDialog->setWindowModality (Qt::NonModal);
+  fileDialog->setAttribute (Qt::WA_DeleteOnClose);
+  fileDialog->show ();
+}
+
+// Create a new script
+void main_window::request_new_script (const QString& commands)
+{
+  emit new_file_signal (commands);
+}
+
+// Create a new function and open it
+void main_window::request_new_function (bool)
+{
+  bool ok;
+  // Get the name of the new function: Parent of the input dialog is the
+  // editor window or the main window.  The latter is chosen, if a custom
+  // editor is used or qscintilla is not available
+  QWidget *p = m_editor_window;
+
+  gui_settings settings;
+
+  if (! p || settings.value (global_use_custom_editor.settings_key (),
+                              global_use_custom_editor.def ()).toBool ())
+    p = this;
+  QString new_name = QInputDialog::getText (p, tr ("New Function"),
+                                            tr ("New function name:\n"), QLineEdit::Normal, "", &ok);
+
+  if (ok && new_name.length () > 0)
+    {
+      // append suffix if it does not already exist
+      if (new_name.rightRef (2) != ".m")
+        new_name.append (".m");
+      // check whether new files are created without prompt
+      if (! settings.bool_value (ed_create_new_file))
+        {
+          // no, so enable this settings and wait for end of new file loading
+          settings.setValue (ed_create_new_file.settings_key (), true);
+          connect (m_editor_window, SIGNAL (file_loaded_signal ()),
+                   this, SLOT (restore_create_file_setting ()));
+        }
+      // start the edit command
+      execute_command_in_terminal ("edit " + new_name);
+    }
+}
+
+void main_window::handle_edit_mfile_request (const QString& fname,
+                                             const QString& ffile,
+                                             const QString& curr_dir,
+                                             int line)
+{
+  // The interpreter_event callback function below emits a signal.
+  // Because we don't control when that happens, use a guarded pointer
+  // so that the callback can abort if this object is no longer valid.
+
+  QPointer<main_window> this_mw (this);
+
+  emit interpreter_event
+    ([=] (interpreter& interp)
+     {
+       // INTERPRETER THREAD
+
+       // We can skip the entire callback function because it does not
+       // make any changes to the interpreter state.
+
+       if (this_mw.isNull ())
+         return;
+
+       // Split possible subfunctions
+       QStringList fcn_list = fname.split ('>');
+       QString fcn_name = fcn_list.at (0) + ".m";
+
+       // FIXME: could use symbol_exist directly, but we may also want
+       // to fix that to be a member function in the interpreter
+       // class?
+
+       // Is it a regular function within the search path? (Call Fexist)
+       octave_value_list fct = Fexist (interp, ovl (fname.toStdString ()),0);
+       int type = fct (0).int_value ();
+
+       QString message = QString ();
+       QString filename = QString ();
+
+       switch (type)
+         {
+         case 3:
+         case 5:
+         case 103:
+           message = tr ("%1 is a built-in, compiled or inline\n"
+                         "function and can not be edited.");
+           break;
+
+         case 2:
+           // FIXME: could use a load_path function directly.
+           octave_value_list file_path
+             = Ffile_in_loadpath (interp, ovl (fcn_name.toStdString ()), 0);
+           if (file_path.length () > 0)
+             filename = QString::fromStdString (file_path (0).string_value ());
+           break;
+         }
+
+       if (filename.isEmpty () && message.isEmpty ())
+         {
+           // No error so far, but function still not known
+           // -> try directory of edited file
+           // get directory
+           QDir dir;
+           if (ffile.isEmpty ())
+             {
+               if (curr_dir.isEmpty ())
+                 dir = QDir (m_current_directory_combo_box->itemText (0));
+               else
+                 dir = QDir (curr_dir);
+             }
+           else
+             dir = QDir (QFileInfo (ffile).canonicalPath ());
+
+           QFileInfo file = QFileInfo (dir, fcn_name);
+           if (file.exists ())
+             filename = file.canonicalFilePath (); // local file exists
+           else
+             {
+               // local file does not exist -> try private directory
+               file = QFileInfo (ffile);
+               file = QFileInfo (QDir (file.canonicalPath () + "/private"),
+                                 fcn_name);
+               if (file.exists ())
+                 filename = file.canonicalFilePath ();  // private function exists
+               else
+                 message = tr ("Can not find function %1");  // no file found
+             }
+         }
+
+       if (! message.isEmpty ())
+         {
+           emit warning_function_not_found_signal (message.arg (fname));
+           return;
+         }
+
+       if (! filename.endsWith (".m"))
+         filename.append (".m");
+
+       // default encoding
+       emit open_file_signal (filename, QString (), line);
+     });
+}
+
+void main_window::warning_function_not_found (const QString& message)
+{
+  QMessageBox *msgBox = new QMessageBox (QMessageBox::Critical,
+                                         tr ("Octave Editor"),
+                                         message, QMessageBox::Ok, this);
+  msgBox->setWindowModality (Qt::NonModal);
+  msgBox->setAttribute (Qt::WA_DeleteOnClose);
+  msgBox->show ();
+}
+
+void main_window::handle_insert_debugger_pointer_request (const QString& file,
+                                                          int line)
+{
+  bool cmd_focus = command_window_has_focus ();
+
+  emit insert_debugger_pointer_signal (file, line);
+
+  if (cmd_focus)
+    focus_command_window ();
+}
+
+void main_window::handle_delete_debugger_pointer_request (const QString& file,
+                                                          int line)
+{
+  bool cmd_focus = command_window_has_focus ();
+
+  emit delete_debugger_pointer_signal (file, line);
+
+  if (cmd_focus)
+    focus_command_window ();
+}
+
+void main_window::handle_update_breakpoint_marker_request (bool insert,
+                                                           const QString& file,
+                                                           int line,
+                                                           const QString& cond)
+{
+  bool cmd_focus = command_window_has_focus ();
+
+  emit update_breakpoint_marker_signal (insert, file, line, cond);
+
+  if (cmd_focus)
+    focus_command_window ();
+}
+
+void main_window::read_settings ()
+{
+  gui_settings settings;
+
+  set_window_layout ();
+
+  // restore the list of the last directories
+  QStringList curr_dirs = settings.string_list_value (mw_dir_list);
+  for (int i=0; i < curr_dirs.size (); i++)
+    {
+      m_current_directory_combo_box->addItem (curr_dirs.at (i));
+    }
+
+  emit settings_changed ();
+}
+
+void main_window::init_terminal_size ()
+{
+  emit init_terminal_size_signal ();
+}
+
+void main_window::set_window_layout ()
+{
+  gui_settings settings;
+
+  // For resetting from some inconsistent state, first reset layout
+  // without saving or showing it
+  do_reset_windows (true, false);
+
+  // Restore main window state and geometry from settings file or, in case
+  // of an error (no pref values yet), from the default layout.
+  if (! restoreGeometry (settings.byte_array_value (mw_geometry)))
+    {
+      do_reset_windows (true);
+      return;
+    }
+
+  if (isMaximized())
+    {
+      // If the window state is restored to maximized layout, the
+      // horizontal layout is not preserved. This cann be avoided by
+      // setting the geometry to the max. available geometry. However, on
+      // X11, the available geometry (excluding task bar etc.) is equal to
+      // the total geometry leading to a full screen mode without window
+      // decorations. This in turn can be avoided by explicitly adding
+      // a title bar in the window flags.
+
+      // Get available geometry for current screen and set this
+      // window's geometry to it.
+      QScreen *s = windowHandle ()->screen ();
+      QRect av_geom = s->availableGeometry ();
+      setGeometry (av_geom);  // Set (correct) available geometry
+
+      // Force full title bar
+      setWindowFlags(Qt::WindowTitleHint
+                     | Qt::WindowMinMaxButtonsHint
+                     | Qt::WindowSystemMenuHint
+                     | Qt::WindowCloseButtonHint);
+    }
+
+  if (! restoreState (settings.byte_array_value (mw_state)))
+    {
+      do_reset_windows (true);
+      return;
+    }
+
+  // Restore the geometry of all dock-widgets
+
+  for (auto *widget : dock_widget_list ())
+    {
+      // Leave any widgets that existed before main_window was created
+      // as they were.
+
+      if (widget->adopted ())
+        continue;
+
+      QString name = widget->objectName ();
+
+      if (! name.isEmpty ())
+        {
+          bool floating = false;
+          bool visible = true;
+
+          floating = settings.value
+            (dw_is_floating.settings_key ().arg (name), dw_is_floating.def ()).toBool ();
+          visible = settings.value
+            (dw_is_visible.settings_key ().arg (name), dw_is_visible.def ()).toBool ();
+
+          // If floating, make window from widget.
+          if (floating)
+            {
+              widget->make_window ();
+
+              if (visible)
+                {
+                  if (settings.value (dw_is_minimized.settings_key ().arg (name),
+                                      dw_is_minimized.def ()).toBool ())
+                    widget->showMinimized ();
+                  else
+                    widget->setVisible (true);
+                }
+              else
+                widget->setVisible (false);
+            }
+          else  // not floating
+            {
+              if (! widget->parent ())        // should not be floating but is
+                widget->make_widget (false);  // no docking, just reparent
+
+              widget->make_widget ();
+              widget->setVisible (visible);   // not floating -> show
+            }
+        }
+    }
+
+  show ();
+}
+
+void main_window::write_settings ()
+{
+  gui_settings settings;
+
+  settings.setValue (mw_geometry.settings_key (), saveGeometry ());
+  settings.setValue (mw_state.settings_key (), saveState ());
+  // write the list of recently used directories
+  QStringList curr_dirs;
+  for (int i=0; i<m_current_directory_combo_box->count (); i++)
+    {
+      curr_dirs.append (m_current_directory_combo_box->itemText (i));
+    }
+  settings.setValue (mw_dir_list.settings_key (), curr_dirs);
+  settings.sync ();
+}
+
+void main_window::copyClipboard ()
+{
+  if (m_current_directory_combo_box->hasFocus ())
+    {
+      QLineEdit *edit = m_current_directory_combo_box->lineEdit ();
+      if (edit && edit->hasSelectedText ())
+        {
+          QClipboard *clipboard = QApplication::clipboard ();
+          clipboard->setText (edit->selectedText ());
+        }
+    }
+  else
+    emit copyClipboard_signal ();
+}
+
+void main_window::pasteClipboard ()
+{
+  if (m_current_directory_combo_box->hasFocus ())
+    {
+      QLineEdit *edit = m_current_directory_combo_box->lineEdit ();
+      QClipboard *clipboard = QApplication::clipboard ();
+      QString str = clipboard->text ();
+      if (edit && str.length () > 0)
+        {
+          edit->insert (str);
+        }
+    }
+  else
+    emit pasteClipboard_signal ();
+}
+
+void main_window::selectAll ()
+{
+  if (m_current_directory_combo_box->hasFocus ())
+    {
+      QLineEdit *edit = m_current_directory_combo_box->lineEdit ();
+      if (edit)
+        {
+          edit->selectAll ();
+        }
+    }
+  else
+    emit selectAll_signal ();
+}
+
+void main_window::handle_gui_status_update (const QString& feature,
+                                            const QString& status)
+{
+  // Put actions that are required for updating a gui features here
+
+  // Profiler on/off
+  if (! feature.compare ("profiler"))
+    {
+      if (! status.compare ("on", Qt::CaseInsensitive))
+        handle_profiler_status_update (true);
+      else if (! status.compare ("off", Qt::CaseInsensitive))
+        handle_profiler_status_update (false);
+    }
+}
+
+void main_window::handle_octave_ready ()
+{
+  // actions after the startup files are executed
+
+  gui_settings settings;
+
+  QDir startup_dir = QDir ();    // current octave dir after startup
+
+  if (settings.bool_value (global_restore_ov_dir))
+    {
+      // restore last dir from previous session
+      QStringList curr_dirs
+        = settings.string_list_value (mw_dir_list);
+      if (curr_dirs.length () > 0)
+        startup_dir = QDir (curr_dirs.at (0));  // last dir prev. session
+    }
+  else if (! settings.string_value (global_ov_startup_dir).isEmpty ())
+    {
+      // do not restore but there is a startup dir configured
+      startup_dir
+        = QDir (settings.string_value (global_ov_startup_dir));
+    }
+
+  update_default_encoding (settings.string_value (ed_default_enc));
+
+  if (! startup_dir.exists ())
+    {
+      // the configured startup dir does not exist, take actual one
+      startup_dir = QDir ();
+    }
+
+  set_current_working_directory (startup_dir.absolutePath ());
+
+  if (m_editor_window)
+    {
+#if defined (HAVE_QSCINTILLA)
+      // Octave ready, determine whether to create an empty script.
+      // This can not be done when the editor is created because all functions
+      // must be known for the lexer's auto completion information
+      m_editor_window->empty_script (true, false);
+      m_editor_window->restore_session ();
+#endif
+    }
+
+  if (m_octave_qobj.experimental_terminal_widget ())
+    {
+      // Set initial prompt.
+
+      // The interpreter_event callback function below emits a
+      // signal.  Because we don't control when that happens, use a
+      // guarded pointer so that the callback can abort if this object
+      // is no longer valid.
+
+      QPointer<main_window> this_mw (this);
+
+      emit interpreter_event
+        ([=] (interpreter& interp)
+        {
+          // INTERPRETER_THREAD
+
+          // We can skip the entire callback function because it does
+          // not make any changes to the interpreter state.
+
+          if (this_mw.isNull ())
+            return;
+
+          interp.PS1 (">> ");
+          std::string prompt = interp.PS1 ();
+
+          std::string decoded_prompt
+            = command_editor::decode_prompt_string (prompt);
+
+          emit update_prompt_signal (QString::fromStdString (decoded_prompt));
+        });
+    }
+
+  m_command_window->init_command_prompt ();
+  focus_command_window ();  // make sure that the command window has focus
+}
+
+void main_window::handle_set_path_dialog_request ()
+{
+  if (m_set_path_dlg)  // m_set_path_dlg is a guarded pointer!
+    return;
+
+  m_set_path_dlg = new set_path_dialog (this);
+
+  m_set_path_dlg->setModal (false);
+  m_set_path_dlg->setAttribute (Qt::WA_DeleteOnClose);
+  m_set_path_dlg->show ();
+
+  // Any interpreter_event signal from a set_path_dialog object is
+  // handled the same as for the main_window object.
+
+  connect (m_set_path_dlg, QOverload<const fcn_callback&>::of (&set_path_dialog::interpreter_event),
+           this, QOverload<const fcn_callback&>::of (&main_window::interpreter_event));
+
+  connect (m_set_path_dlg, QOverload<const meth_callback&>::of (&set_path_dialog::interpreter_event),
+           this, QOverload<const meth_callback&>::of (&main_window::interpreter_event));
+
+  connect (m_set_path_dlg, &set_path_dialog::modify_path_signal,
+           this, &main_window::modify_path);
+
+  interpreter_qobject *interp_qobj = m_octave_qobj.interpreter_qobj ();
+
+  qt_interpreter_events *qt_link = interp_qobj->qt_link ();
+
+  connect (qt_link, &qt_interpreter_events::update_path_dialog_signal,
+           m_set_path_dlg, &set_path_dialog::update_model);
+
+  // Now that all the signal connections are in place for the dialog
+  // we can set the initial value of the path in the model.
+
+  m_set_path_dlg->update_model ();
+}
+
+void main_window::find_files (const QString& start_dir)
+{
+
+  if (! m_find_files_dlg)
+    {
+      m_find_files_dlg = new find_files_dialog (this);
+
+      connect (m_find_files_dlg, &find_files_dialog::finished,
+               this, &main_window::find_files_finished);
+
+      connect (m_find_files_dlg, &find_files_dialog::dir_selected,
+               m_file_browser_window, &files_dock_widget::set_current_directory);
+
+      connect (m_find_files_dlg, &find_files_dialog::file_selected,
+               this, QOverload<const QString&>::of (&main_window::open_file_signal));
+
+      m_find_files_dlg->setWindowModality (Qt::NonModal);
+    }
+
+  if (! m_find_files_dlg->isVisible ())
+    {
+      m_find_files_dlg->show ();
+    }
+
+  m_find_files_dlg->set_search_dir (start_dir);
+
+  m_find_files_dlg->activateWindow ();
+
+}
+
+void main_window::set_screen_size (int ht, int wd)
+{
+  emit interpreter_event
+    ([=] ()
+     {
+       // INTERPRETER THREAD
+
+       command_editor::set_screen_size (ht, wd);
+     });
+}
+
+void main_window::clipboard_has_changed ()
+{
+  if (m_clipboard->text ().isEmpty ())
+    {
+      m_paste_action->setEnabled (false);
+      m_clear_clipboard_action->setEnabled (false);
+    }
+  else
+    {
+      m_paste_action->setEnabled (true);
+      m_clear_clipboard_action->setEnabled (true);
+    }
+}
+
+void main_window::clear_clipboard ()
+{
+  m_clipboard->clear (QClipboard::Clipboard);
+}
+
+void main_window::disable_menu_shortcuts (bool disable)
+{
+  QHash<QMenu *, QStringList>::const_iterator i = m_hash_menu_text.constBegin ();
+
+  while (i != m_hash_menu_text.constEnd ())
+    {
+      i.key ()->setTitle (i.value ().at (disable));
+      ++i;
+    }
+}
+
+void main_window::restore_create_file_setting ()
+{
+  // restore the new files creation setting
+
+  gui_settings settings;
+
+  settings.setValue (ed_create_new_file.settings_key (), false);
+  disconnect (m_editor_window, SIGNAL (file_loaded_signal ()),
+              this, SLOT (restore_create_file_setting ()));
+}
+
+void main_window::set_file_encoding (const QString& new_encoding)
+{
+  m_file_encoding = new_encoding;
+}
+
+// The following slot is called after files have been selected in the
+// open file dialog, possibly with a new selected encoding stored in
+// m_file_encoding
+void main_window::request_open_files (const QStringList& open_file_names)
+{
+  for (int i = 0; i < open_file_names.count (); i++)
+    emit open_file_signal (open_file_names.at (i), m_file_encoding, -1);
+}
+
+void main_window::profiler_session ()
+{
+  emit interpreter_event
+    ([=] (interpreter& interp)
       {
         // INTERPRETER THREAD
-
-        octave_value_list paths;
-
-        // Loop over all directories in order to get all subdirs
-        for (octave_idx_type i = 0; i < dir_list.length (); i++)
-          {
-            std::string dir = dir_list.at(i).toStdString ();
-
-            if (subdirs)
-              paths.append (Fgenpath (ovl (dir)));
-            else
-              paths.append (dir);
-          }
-
-        if (rm)
-          Frmpath (interp, paths);
-        else
-          Faddpath (interp, paths);
+        F__profiler_enable__ (interp, ovl (true));
       });
-  }
-
-  void main_window::edit_mfile (const QString& name, int line)
-  {
-    handle_edit_mfile_request (name, QString (), QString (), line);
-  }
-
-  void main_window::file_remove_proxy (const QString& o, const QString& n)
-  {
-    interpreter_qobject *interp_qobj = m_octave_qobj.interpreter_qobj ();
-
-    qt_interpreter_events *qt_link = interp_qobj->qt_link ();
-
-    // Wait for worker to suspend
-    qt_link->lock ();
-    // Close the file if opened
-#if defined (HAVE_QSCINTILLA)
-    m_editor_window->handle_file_remove (o, n);
-#else
-    octave_unused_parameter (o);
-    octave_unused_parameter (n);
-#endif
-
-    // We are done: Unlock and wake the worker thread
-    qt_link->unlock ();
-    qt_link->wake_all ();
-  }
-
-  void main_window::open_online_documentation_page ()
-  {
-    QDesktopServices::openUrl
-      (QUrl ("https://octave.org/doc/interpreter/index.html"));
-  }
-
-  void main_window::open_bug_tracker_page ()
-  {
-    QDesktopServices::openUrl (QUrl ("https://octave.org/bugs.html"));
-  }
-
-  void main_window::open_octave_packages_page ()
-  {
-    QDesktopServices::openUrl (QUrl ("https://packages.octave.org/index.html"));
-  }
-
-  void main_window::open_contribute_page ()
-  {
-    QDesktopServices::openUrl (QUrl ("https://octave.org/contribute.html"));
-  }
-
-  void main_window::open_donate_page ()
-  {
-    QDesktopServices::openUrl (QUrl ("https://octave.org/donate.html"));
-  }
-
-  void main_window::process_settings_dialog_request (const QString& desired_tab)
-  {
-    if (m_settings_dlg)  // m_settings_dlg is a guarded pointer!
-      {
-        // here the dialog is still open and called once again
-        if (! desired_tab.isEmpty ())
-          m_settings_dlg->show_tab (desired_tab);
-        return;
-      }
-
-    m_settings_dlg = new settings_dialog (this, desired_tab);
-
-    connect (m_settings_dlg, &settings_dialog::apply_new_settings,
-             this, &main_window::request_reload_settings);
-
-    m_settings_dlg->setModal (false);
-    m_settings_dlg->setAttribute (Qt::WA_DeleteOnClose);
-    m_settings_dlg->show ();
-  }
-
-  void main_window::show_about_octave ()
-  {
-    std::string message
-      = octave_name_version_copyright_copying_warranty_and_bugs (true);
-
-    QMessageBox::about (this, tr ("About Octave"),
-                        QString::fromStdString (message));
-  }
-
-  void main_window::notice_settings (bool update_by_worker)
-  {
-    gui_settings settings;
-
-    // Get desired style from preferences or take the default one if
-    // the desired one is not found
-    QString preferred_style = settings.string_value (global_style);
-
-    if (preferred_style == global_style.def ().toString ())
-      preferred_style = m_default_style;
-
-    QApplication* qapp = m_octave_qobj.qapplication();
-
-    if (preferred_style == global_extra_styles.at (EXTRA_STYLE_FUSION_DARK))
-      {
-        QStyle *new_style = QStyleFactory::create (QStringLiteral("Fusion"));
-        if (new_style)
-          qapp->setStyle (new_style);
-        qapp->setPalette (getFusionDarkPalette());
-        qapp->setStyleSheet ("QToolTip { color: #ffffff; background-color: #2a82da; border: 1px solid white; }");
-      }
-    else
-      {
-        QStyle *new_style = QStyleFactory::create (preferred_style);
-        if (new_style)
-          {
-            qapp->setPalette (m_default_palette);
-            qapp->setStyle (new_style);
-          }
-      }
-
-    // the widget's icons (when floating)
-    QString icon_set = settings.string_value (dw_icon_set);
-
-    QString icon;
-    for (auto *widget : dock_widget_list ())
+}
+
+void main_window::profiler_session_resume ()
+{
+  emit interpreter_event
+    ([=] (interpreter& interp)
       {
-        QString name = widget->objectName ();
-        if (! name.isEmpty ())
-          {
-            // if child has a name
-            icon = dw_icon_set_names[icon_set];
-            if (icon_set != "NONE")
-              icon += name + ".png"; // add widget name and ext.
-            widget->setWindowIcon (QIcon (icon));
-          }
-      }
-
-    int size_idx = settings.int_value (global_icon_size);
-    size_idx = (size_idx > 0) - (size_idx < 0) + 1;  // Make valid index from 0 to 2
-
-    QStyle *st = style ();
-    int icon_size = st->pixelMetric (global_icon_sizes[size_idx]);
-    m_main_tool_bar->setIconSize (QSize (icon_size, icon_size));
-
-    if (settings.bool_value (global_status_bar))
-      m_status_bar->show ();
-    else
-      m_status_bar->hide ();
-
-    m_prevent_readline_conflicts
-      = settings.bool_value (sc_prevent_rl_conflicts);
-
-    m_prevent_readline_conflicts_menu
-      = settings.bool_value (sc_prevent_rl_conflicts_menu);
-
-    m_suppress_dbg_location
-      = ! settings.bool_value (cs_dbg_location);
-
-    settings.update_network_settings ();
-
-    emit active_dock_changed (nullptr, m_active_dock); // update dock widget styles
-
-    configure_shortcuts ();
-
-    bool do_disable_main_menu_shortcuts
-      = (m_active_dock == m_editor_window)
-        || (m_prevent_readline_conflicts_menu
-            && (m_active_dock == m_command_window));
-
-    disable_menu_shortcuts (do_disable_main_menu_shortcuts);
-
-    // Check whether some octave internal preferences have to be updated
-    QString new_default_encoding
-      = settings.string_value (ed_default_enc);
-    // Do not update internal pref only if a) this update was not initiated
-    // by the worker and b) the pref has really changes
-    if (! update_by_worker && (new_default_encoding != m_default_encoding))
-      update_default_encoding (new_default_encoding);
-
-    // Set cursor blinking depending on the settings
-    // Cursor blinking: consider old terminal related setting if not yet set
-    // TODO: This pref. can be deprecated / removed if Qt adds support for
-    //       getting the cursor blink preferences from all OS environments
-    bool cursor_blinking;
-
-    if (settings.contains (global_cursor_blinking.settings_key ()))
-      cursor_blinking = settings.bool_value (global_cursor_blinking);
-    else
-      cursor_blinking = settings.bool_value (cs_cursor_blinking);
-
-    if (cursor_blinking)
-      QApplication::setCursorFlashTime (1000);  // 1000 ms flash time
-    else
-      QApplication::setCursorFlashTime (0);  // no flashing
-
-  }
-
-  QPalette main_window::getFusionDarkPalette()
-  {
-    QPalette darkPalette;
-    darkPalette.setColor(QPalette::Window, QColor(53, 53, 53));
-    darkPalette.setColor(QPalette::WindowText, Qt::white);
-    darkPalette.setColor(QPalette::Disabled, QPalette::WindowText, QColor(127, 127, 127));
-    darkPalette.setColor(QPalette::Base, QColor(42, 42, 42));
-    darkPalette.setColor(QPalette::AlternateBase, QColor(66, 66, 66));
-    darkPalette.setColor(QPalette::ToolTipBase, Qt::white);
-    darkPalette.setColor(QPalette::ToolTipText, Qt::white);
-    darkPalette.setColor(QPalette::Text, Qt::white);
-    darkPalette.setColor(QPalette::Disabled, QPalette::Text, QColor(127, 127, 127));
-    darkPalette.setColor(QPalette::Dark, QColor(35, 35, 35));
-    darkPalette.setColor(QPalette::Shadow, QColor(20, 20, 20));
-    darkPalette.setColor(QPalette::Button, QColor(53, 53, 53));
-    darkPalette.setColor(QPalette::ButtonText, Qt::white);
-    darkPalette.setColor(QPalette::Disabled, QPalette::ButtonText, QColor(127, 127, 127));
-    darkPalette.setColor(QPalette::BrightText, Qt::red);
-    darkPalette.setColor(QPalette::Link, QColor(42, 130, 218));
-    darkPalette.setColor(QPalette::Highlight, QColor(42, 130, 218));
-    darkPalette.setColor(QPalette::Disabled, QPalette::Highlight, QColor(80, 80, 80));
-    darkPalette.setColor(QPalette::HighlightedText, Qt::white);
-    darkPalette.setColor(QPalette::Disabled, QPalette::HighlightedText, QColor(127, 127, 127));
-
-    return darkPalette;
-  }
-
-  void main_window::prepare_to_exit ()
-  {
-    // Find files dialog is constructed dynamically, not at time of main_window
-    // construction.  Connecting it to qApp aboutToQuit signal would have
-    // caused it to run after gui_settings is deleted.
-    if (m_find_files_dlg)
-      m_find_files_dlg->save_settings ();
-
-    if (m_set_path_dlg)
-      m_set_path_dlg->save_settings ();
-
-    write_settings ();
-
-    // No more active dock, otherwise, focus_changed would try to set
-    // the focus to a dock widget that might not exist anymore
-    m_active_dock = nullptr;
-  }
-
-  void main_window::go_to_previous_widget ()
-  {
-    m_previous_dock->activate ();
-  }
-
-  void main_window::update_octave_directory (const QString& dir)
-  {
-    // Remove existing entry, if any, then add new directory at top and
-    // mark it as the current directory.  Finally, update the file list
-    // widget.
-
-    int index = m_current_directory_combo_box->findText (dir);
-
-    if (index >= 0)
-      m_current_directory_combo_box->removeItem (index);
-
-    m_current_directory_combo_box->insertItem (0, dir);
-    m_current_directory_combo_box->setCurrentIndex (0);
-  }
-
-  void main_window::browse_for_directory ()
-  {
-    // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
-    int opts = QFileDialog::ShowDirsOnly;
-
-    gui_settings settings;
-
-    if (! settings.bool_value (global_use_native_dialogs))
-      opts = QFileDialog::DontUseNativeDialog;
-
-    QString dir
-      = QFileDialog::getExistingDirectory (this, tr ("Browse directories"), nullptr,
-                                           QFileDialog::Option (opts));
-
-    set_current_working_directory (dir);
-
-    // FIXME: on Windows systems, the command window freezes after the
-    // previous actions.  Forcing the focus appears to unstick it.
-
-    focus_command_window ();
-  }
-
-  void main_window::set_current_working_directory (const QString& dir)
-  {
-    // Change to dir if it is an existing directory.
-
-    QString xdir = (dir.isEmpty () ? "." : dir);
-
-    QFileInfo fileInfo (xdir);
-
-    if (fileInfo.exists () && fileInfo.isDir ())
-      {
-        emit interpreter_event
-          ([=] (interpreter& interp)
-           {
-             // INTERPRETER THREAD
-
-             interp.chdir (xdir.toStdString ());
-           });
-      }
-  }
-
-  void main_window::change_directory_up ()
-  {
-    set_current_working_directory ("..");
-  }
-
-  // Slot that is called if return is pressed in the line edit of the
-  // combobox to change to a new directory or a directory that is already
-  // in the drop down list.
-
-  void main_window::accept_directory_line_edit ()
-  {
-    // Get new directory name, and change to it if it is new.  Otherwise,
-    // the combo box will trigger the "activated" signal to change to the
-    // directory.
-
-    QString dir = m_current_directory_combo_box->currentText ();
-
-    int index = m_current_directory_combo_box->findText (dir);
-
-    if (index < 0)
-      set_current_working_directory (dir);
-  }
-
-  void main_window::execute_command_in_terminal (const QString& command)
-  {
-    if (m_octave_qobj.experimental_terminal_widget ())
-      {
-        emit execute_command_signal (command);
-      }
-    else
-      {
-        emit interpreter_event
-          ([=] ()
-           {
-             // INTERPRETER THREAD
-
-             std::string pending_input = command_editor::get_current_line ();
-
-             command_editor::set_initial_input (pending_input);
-             command_editor::replace_line (command.toStdString ());
-             command_editor::redisplay ();
-             command_editor::interrupt_event_loop ();
-             command_editor::accept_line ();
-           });
-      }
-
-    focus_console_after_command ();
-  }
-
-  void main_window::run_file_in_terminal (const QFileInfo& info)
-  {
-    emit interpreter_event
-      ([=] (interpreter& interp)
-       {
-         // INTERPRETER THREAD
-
-         QString function_name = info.fileName ();
-         function_name.chop (info.suffix ().length () + 1);
-         std::string file_path = info.absoluteFilePath ().toStdString ();
-
-         std::string pending_input = command_editor::get_current_line ();
-
-         if (valid_identifier (function_name.toStdString ()))
-           {
-             // Valid identifier: call as function with possibility to
-             // debug.
-
-             load_path& lp = interp.get_load_path ();
-
-             std::string path = info.absolutePath ().toStdString ();
-
-             if (lp.contains_file_in_dir (file_path, path))
-               command_editor::replace_line (function_name.toStdString ());
-           }
-         else
-           {
-             // No valid identifier: use equivalent of Fsource (), no
-             // debug possible.
-
-             interp.source_file (file_path);
-
-             command_editor::replace_line ("");
-           }
-
-         command_editor::set_initial_input (pending_input);
-         command_editor::redisplay ();
-         command_editor::interrupt_event_loop ();
-         command_editor::accept_line ();
-       });
-
-    focus_console_after_command ();
-  }
-
-  void main_window::handle_new_figure_request ()
-  {
-    emit interpreter_event
-      ([] (interpreter& interp)
-       {
-         // INTERPRETER THREAD
-
-         Fbuiltin (interp, ovl ("figure"));
-         Fdrawnow (interp);
-       });
-  }
-
-  void main_window::handle_enter_debugger ()
-  {
-    setWindowTitle ("Octave (Debugging)");
-
-    m_debug_continue->setEnabled (true);
-    m_debug_step_into->setEnabled (true);
-    m_debug_step_over->setEnabled (true);
-    m_debug_step_out->setEnabled (true);
-    m_debug_quit->setEnabled (true);
-  }
-
-  void main_window::handle_exit_debugger ()
-  {
-    setWindowTitle ("Octave");
-
-    m_debug_continue->setEnabled (false);
-    m_debug_step_into->setEnabled (false);
-    m_debug_step_over->setEnabled (m_editor_has_tabs && m_editor_is_octave_file);
-    m_debug_step_out->setEnabled (false);
-    m_debug_quit->setEnabled (false);
-  }
-
-  void main_window::debug_continue ()
-  {
-    emit interpreter_event
-      ([=] (interpreter& interp)
-       {
-         // INTERPRETER THREAD
-
-         F__db_next_breakpoint_quiet__ (interp, ovl (m_suppress_dbg_location));
-         Fdbcont (interp);
-
-         command_editor::interrupt (true);
-       });
-  }
-
-  void main_window::debug_step_into ()
-  {
-    emit interpreter_event
-      ([=] (interpreter& interp)
-       {
-         // INTERPRETER THREAD
-
-         F__db_next_breakpoint_quiet__ (interp, ovl (m_suppress_dbg_location));
-         Fdbstep (interp, ovl ("in"));
-
-         command_editor::interrupt (true);
-       });
-  }
-
-  void main_window::debug_step_over ()
-  {
-    if (m_debug_quit->isEnabled ())
-      {
-        // We are in debug mode, just call dbstep.
-
-        emit interpreter_event
-          ([=] (interpreter& interp)
-           {
-             // INTERPRETER THREAD
-
-             F__db_next_breakpoint_quiet__ (interp,
-                                            ovl (m_suppress_dbg_location));
-             Fdbstep (interp);
-
-             command_editor::interrupt (true);
-           });
-      }
-    else
-      {
-        // Not in debug mode: "step into" the current editor file
-        emit step_into_file_signal ();
-      }
-  }
-
-  void main_window::debug_step_out ()
-  {
-    emit interpreter_event
-      ([=] (interpreter& interp)
-       {
-         // INTERPRETER THREAD
-
-         F__db_next_breakpoint_quiet__ (interp, ovl (m_suppress_dbg_location));
-         Fdbstep (interp, ovl ("out"));
-
-         command_editor::interrupt (true);
-       });
-  }
-
-  void main_window::debug_quit ()
-  {
-    emit interpreter_event
-      ([] (interpreter& interp)
-       {
-         // INTERPRETER THREAD
-
-         Fdbquit (interp);
-
-         command_editor::interrupt (true);
-       });
-  }
-
-  //
-  // Functions related to file editing
-  //
-  // These are moved from editor to here for also using them when octave
-  // is built without qscintilla
-  //
-  void main_window::request_open_file ()
-  {
-    // Open file isn't a file_editor_tab or editor function since the file
-    // might be opened in an external editor.  Hence, functionality is here.
-
-    gui_settings settings;
-
-    bool is_internal = m_editor_window
-                       && ! settings.value (global_use_custom_editor.settings_key (),
-                                             global_use_custom_editor.def ()).toBool ();
-
-    // Create a NonModal message.
-    QWidget *p = this;
-    if (is_internal)
-      p = m_editor_window;
-    QFileDialog *fileDialog = new QFileDialog (p);
-    fileDialog->setNameFilter (tr ("Octave Files (*.m);;All Files (*)"));
-
-    fileDialog->setAcceptMode (QFileDialog::AcceptOpen);
-    fileDialog->setViewMode (QFileDialog::Detail);
-    fileDialog->setFileMode (QFileDialog::ExistingFiles);
-    fileDialog->setDirectory (m_current_directory_combo_box->itemText (0));
-
-    // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
-    if (! settings.bool_value (global_use_native_dialogs))
-      fileDialog->setOption(QFileDialog::DontUseNativeDialog);
-
-    connect (fileDialog, &QFileDialog::filesSelected,
-             this, &main_window::request_open_files);
-
-    fileDialog->setWindowModality (Qt::NonModal);
-    fileDialog->setAttribute (Qt::WA_DeleteOnClose);
-    fileDialog->show ();
-  }
-
-  // Create a new script
-  void main_window::request_new_script (const QString& commands)
-  {
-    emit new_file_signal (commands);
-  }
-
-  // Create a new function and open it
-  void main_window::request_new_function (bool)
-  {
-    bool ok;
-    // Get the name of the new function: Parent of the input dialog is the
-    // editor window or the main window.  The latter is chosen, if a custom
-    // editor is used or qscintilla is not available
-    QWidget *p = m_editor_window;
-
-    gui_settings settings;
-
-    if (! p || settings.value (global_use_custom_editor.settings_key (),
-                                global_use_custom_editor.def ()).toBool ())
-      p = this;
-    QString new_name = QInputDialog::getText (p, tr ("New Function"),
-                                              tr ("New function name:\n"), QLineEdit::Normal, "", &ok);
-
-    if (ok && new_name.length () > 0)
+        // INTERPRETER THREAD
+        F__profiler_enable__ (interp, ovl (true));
+      });
+}
+
+void main_window::profiler_stop ()
+{
+  emit interpreter_event
+    ([=] (interpreter& interp)
       {
-        // append suffix if it does not already exist
-        if (new_name.rightRef (2) != ".m")
-          new_name.append (".m");
-        // check whether new files are created without prompt
-        if (! settings.bool_value (ed_create_new_file))
-          {
-            // no, so enable this settings and wait for end of new file loading
-            settings.setValue (ed_create_new_file.settings_key (), true);
-            connect (m_editor_window, SIGNAL (file_loaded_signal ()),
-                     this, SLOT (restore_create_file_setting ()));
-          }
-        // start the edit command
-        execute_command_in_terminal ("edit " + new_name);
-      }
-  }
-
-  void main_window::handle_edit_mfile_request (const QString& fname,
-                                               const QString& ffile,
-                                               const QString& curr_dir,
-                                               int line)
-  {
-    // The interpreter_event callback function below emits a signal.
-    // Because we don't control when that happens, use a guarded pointer
-    // so that the callback can abort if this object is no longer valid.
-
-    QPointer<main_window> this_mw (this);
-
-    emit interpreter_event
-      ([=] (interpreter& interp)
-       {
-         // INTERPRETER THREAD
-
-         // We can skip the entire callback function because it does not
-         // make any changes to the interpreter state.
-
-         if (this_mw.isNull ())
-           return;
-
-         // Split possible subfunctions
-         QStringList fcn_list = fname.split ('>');
-         QString fcn_name = fcn_list.at (0) + ".m";
-
-         // FIXME: could use symbol_exist directly, but we may also want
-         // to fix that to be a member function in the interpreter
-         // class?
-
-         // Is it a regular function within the search path? (Call Fexist)
-         octave_value_list fct = Fexist (interp, ovl (fname.toStdString ()),0);
-         int type = fct (0).int_value ();
-
-         QString message = QString ();
-         QString filename = QString ();
-
-         switch (type)
-           {
-           case 3:
-           case 5:
-           case 103:
-             message = tr ("%1 is a built-in, compiled or inline\n"
-                           "function and can not be edited.");
-             break;
-
-           case 2:
-             // FIXME: could use a load_path function directly.
-             octave_value_list file_path
-               = Ffile_in_loadpath (interp, ovl (fcn_name.toStdString ()), 0);
-             if (file_path.length () > 0)
-               filename = QString::fromStdString (file_path (0).string_value ());
-             break;
-           }
-
-         if (filename.isEmpty () && message.isEmpty ())
-           {
-             // No error so far, but function still not known
-             // -> try directory of edited file
-             // get directory
-             QDir dir;
-             if (ffile.isEmpty ())
-               {
-                 if (curr_dir.isEmpty ())
-                   dir = QDir (m_current_directory_combo_box->itemText (0));
-                 else
-                   dir = QDir (curr_dir);
-               }
-             else
-               dir = QDir (QFileInfo (ffile).canonicalPath ());
-
-             QFileInfo file = QFileInfo (dir, fcn_name);
-             if (file.exists ())
-               filename = file.canonicalFilePath (); // local file exists
-             else
-               {
-                 // local file does not exist -> try private directory
-                 file = QFileInfo (ffile);
-                 file = QFileInfo (QDir (file.canonicalPath () + "/private"),
-                                   fcn_name);
-                 if (file.exists ())
-                   filename = file.canonicalFilePath ();  // private function exists
-                 else
-                   message = tr ("Can not find function %1");  // no file found
-               }
-           }
-
-         if (! message.isEmpty ())
-           {
-             emit warning_function_not_found_signal (message.arg (fname));
-             return;
-           }
-
-         if (! filename.endsWith (".m"))
-           filename.append (".m");
-
-         // default encoding
-         emit open_file_signal (filename, QString (), line);
-       });
-  }
-
-  void main_window::warning_function_not_found (const QString& message)
-  {
-    QMessageBox *msgBox = new QMessageBox (QMessageBox::Critical,
-                                           tr ("Octave Editor"),
-                                           message, QMessageBox::Ok, this);
-    msgBox->setWindowModality (Qt::NonModal);
-    msgBox->setAttribute (Qt::WA_DeleteOnClose);
-    msgBox->show ();
-  }
-
-  void main_window::handle_insert_debugger_pointer_request (const QString& file,
-                                                            int line)
-  {
-    bool cmd_focus = command_window_has_focus ();
-
-    emit insert_debugger_pointer_signal (file, line);
-
-    if (cmd_focus)
-      focus_command_window ();
-  }
-
-  void main_window::handle_delete_debugger_pointer_request (const QString& file,
-                                                            int line)
-  {
-    bool cmd_focus = command_window_has_focus ();
-
-    emit delete_debugger_pointer_signal (file, line);
-
-    if (cmd_focus)
-      focus_command_window ();
-  }
-
-  void main_window::handle_update_breakpoint_marker_request (bool insert,
-                                                             const QString& file,
-                                                             int line,
-                                                             const QString& cond)
-  {
-    bool cmd_focus = command_window_has_focus ();
-
-    emit update_breakpoint_marker_signal (insert, file, line, cond);
-
-    if (cmd_focus)
-      focus_command_window ();
-  }
-
-  void main_window::read_settings ()
-  {
-    gui_settings settings;
-
-    set_window_layout ();
-
-    // restore the list of the last directories
-    QStringList curr_dirs = settings.string_list_value (mw_dir_list);
-    for (int i=0; i < curr_dirs.size (); i++)
-      {
-        m_current_directory_combo_box->addItem (curr_dirs.at (i));
-      }
-
-    emit settings_changed ();
-  }
-
-  void main_window::init_terminal_size ()
-  {
-    emit init_terminal_size_signal ();
-  }
-
-  void main_window::set_window_layout ()
-  {
-    gui_settings settings;
-
-    // For resetting from some inconsistent state, first reset layout
-    // without saving or showing it
-    do_reset_windows (true, false);
-
-    // Restore main window state and geometry from settings file or, in case
-    // of an error (no pref values yet), from the default layout.
-    if (! restoreGeometry (settings.byte_array_value (mw_geometry)))
-      {
-        do_reset_windows (true);
-        return;
-      }
-
-    if (isMaximized())
-      {
-        // If the window state is restored to maximized layout, the
-        // horizontal layout is not preserved. This cann be avoided by
-        // setting the geometry to the max. available geometry. However, on
-        // X11, the available geometry (excluding task bar etc.) is equal to
-        // the total geometry leading to a full screen mode without window
-        // decorations. This in turn can be avoided by explicitly adding
-        // a title bar in the window flags.
-
-        // Get available geometry for current screen and set this
-        // window's geometry to it.
-        QScreen *s = windowHandle ()->screen ();
-        QRect av_geom = s->availableGeometry ();
-        setGeometry (av_geom);  // Set (correct) available geometry
-
-        // Force full title bar
-        setWindowFlags(Qt::WindowTitleHint
-                       | Qt::WindowMinMaxButtonsHint
-                       | Qt::WindowSystemMenuHint
-                       | Qt::WindowCloseButtonHint);
-      }
-
-    if (! restoreState (settings.byte_array_value (mw_state)))
-      {
-        do_reset_windows (true);
-        return;
-      }
-
-    // Restore the geometry of all dock-widgets
-
-    for (auto *widget : dock_widget_list ())
-      {
-        // Leave any widgets that existed before main_window was created
-        // as they were.
-
-        if (widget->adopted ())
-          continue;
-
-        QString name = widget->objectName ();
-
-        if (! name.isEmpty ())
-          {
-            bool floating = false;
-            bool visible = true;
-
-            floating = settings.value
-              (dw_is_floating.settings_key ().arg (name), dw_is_floating.def ()).toBool ();
-            visible = settings.value
-              (dw_is_visible.settings_key ().arg (name), dw_is_visible.def ()).toBool ();
-
-            // If floating, make window from widget.
-            if (floating)
-              {
-                widget->make_window ();
-
-                if (visible)
-                  {
-                    if (settings.value (dw_is_minimized.settings_key ().arg (name),
-                                        dw_is_minimized.def ()).toBool ())
-                      widget->showMinimized ();
-                    else
-                      widget->setVisible (true);
-                  }
-                else
-                  widget->setVisible (false);
-              }
-            else  // not floating
-              {
-                if (! widget->parent ())        // should not be floating but is
-                  widget->make_widget (false);  // no docking, just reparent
-
-                widget->make_widget ();
-                widget->setVisible (visible);   // not floating -> show
-              }
-          }
-      }
-
-    show ();
-  }
-
-  void main_window::write_settings ()
-  {
-    gui_settings settings;
-
-    settings.setValue (mw_geometry.settings_key (), saveGeometry ());
-    settings.setValue (mw_state.settings_key (), saveState ());
-    // write the list of recently used directories
-    QStringList curr_dirs;
-    for (int i=0; i<m_current_directory_combo_box->count (); i++)
-      {
-        curr_dirs.append (m_current_directory_combo_box->itemText (i));
-      }
-    settings.setValue (mw_dir_list.settings_key (), curr_dirs);
-    settings.sync ();
-  }
-
-  void main_window::copyClipboard ()
-  {
-    if (m_current_directory_combo_box->hasFocus ())
-      {
-        QLineEdit *edit = m_current_directory_combo_box->lineEdit ();
-        if (edit && edit->hasSelectedText ())
-          {
-            QClipboard *clipboard = QApplication::clipboard ();
-            clipboard->setText (edit->selectedText ());
-          }
-      }
-    else
-      emit copyClipboard_signal ();
-  }
-
-  void main_window::pasteClipboard ()
-  {
-    if (m_current_directory_combo_box->hasFocus ())
-      {
-        QLineEdit *edit = m_current_directory_combo_box->lineEdit ();
-        QClipboard *clipboard = QApplication::clipboard ();
-        QString str = clipboard->text ();
-        if (edit && str.length () > 0)
-          {
-            edit->insert (str);
-          }
-      }
-    else
-      emit pasteClipboard_signal ();
-  }
-
-  void main_window::selectAll ()
-  {
-    if (m_current_directory_combo_box->hasFocus ())
-      {
-        QLineEdit *edit = m_current_directory_combo_box->lineEdit ();
-        if (edit)
-          {
-            edit->selectAll ();
-          }
-      }
-    else
-      emit selectAll_signal ();
-  }
-
-  void main_window::handle_gui_status_update (const QString& feature,
-                                              const QString& status)
-  {
-    // Put actions that are required for updating a gui features here
-
-    // Profiler on/off
-    if (! feature.compare ("profiler"))
-      {
-        if (! status.compare ("on", Qt::CaseInsensitive))
-          handle_profiler_status_update (true);
-        else if (! status.compare ("off", Qt::CaseInsensitive))
-          handle_profiler_status_update (false);
-      }
-  }
-
-  void main_window::handle_octave_ready ()
-  {
-    // actions after the startup files are executed
-
-    gui_settings settings;
-
-    QDir startup_dir = QDir ();    // current octave dir after startup
-
-    if (settings.bool_value (global_restore_ov_dir))
-      {
-        // restore last dir from previous session
-        QStringList curr_dirs
-          = settings.string_list_value (mw_dir_list);
-        if (curr_dirs.length () > 0)
-          startup_dir = QDir (curr_dirs.at (0));  // last dir prev. session
-      }
-    else if (! settings.string_value (global_ov_startup_dir).isEmpty ())
-      {
-        // do not restore but there is a startup dir configured
-        startup_dir
-          = QDir (settings.string_value (global_ov_startup_dir));
-      }
-
-    update_default_encoding (settings.string_value (ed_default_enc));
-
-    if (! startup_dir.exists ())
-      {
-        // the configured startup dir does not exist, take actual one
-        startup_dir = QDir ();
-      }
-
-    set_current_working_directory (startup_dir.absolutePath ());
-
-    if (m_editor_window)
-      {
-#if defined (HAVE_QSCINTILLA)
-        // Octave ready, determine whether to create an empty script.
-        // This can not be done when the editor is created because all functions
-        // must be known for the lexer's auto completion information
-        m_editor_window->empty_script (true, false);
-        m_editor_window->restore_session ();
-#endif
-      }
-
-    if (m_octave_qobj.experimental_terminal_widget ())
-      {
-        // Set initial prompt.
-
-        // The interpreter_event callback function below emits a
-        // signal.  Because we don't control when that happens, use a
-        // guarded pointer so that the callback can abort if this object
-        // is no longer valid.
-
-        QPointer<main_window> this_mw (this);
-
-        emit interpreter_event
-          ([=] (interpreter& interp)
-          {
-            // INTERPRETER_THREAD
-
-            // We can skip the entire callback function because it does
-            // not make any changes to the interpreter state.
-
-            if (this_mw.isNull ())
-              return;
-
-            interp.PS1 (">> ");
-            std::string prompt = interp.PS1 ();
-
-            std::string decoded_prompt
-              = command_editor::decode_prompt_string (prompt);
-
-            emit update_prompt_signal (QString::fromStdString (decoded_prompt));
-          });
-      }
-
-    m_command_window->init_command_prompt ();
-    focus_command_window ();  // make sure that the command window has focus
-  }
-
-  void main_window::handle_set_path_dialog_request ()
-  {
-    if (m_set_path_dlg)  // m_set_path_dlg is a guarded pointer!
-      return;
-
-    m_set_path_dlg = new set_path_dialog (this);
-
-    m_set_path_dlg->setModal (false);
-    m_set_path_dlg->setAttribute (Qt::WA_DeleteOnClose);
-    m_set_path_dlg->show ();
-
-    // Any interpreter_event signal from a set_path_dialog object is
-    // handled the same as for the main_window object.
-
-    connect (m_set_path_dlg, QOverload<const fcn_callback&>::of (&set_path_dialog::interpreter_event),
-             this, QOverload<const fcn_callback&>::of (&main_window::interpreter_event));
-
-    connect (m_set_path_dlg, QOverload<const meth_callback&>::of (&set_path_dialog::interpreter_event),
-             this, QOverload<const meth_callback&>::of (&main_window::interpreter_event));
-
-    connect (m_set_path_dlg, &set_path_dialog::modify_path_signal,
-             this, &main_window::modify_path);
-
-    interpreter_qobject *interp_qobj = m_octave_qobj.interpreter_qobj ();
-
-    qt_interpreter_events *qt_link = interp_qobj->qt_link ();
-
-    connect (qt_link, &qt_interpreter_events::update_path_dialog_signal,
-             m_set_path_dlg, &set_path_dialog::update_model);
-
-    // Now that all the signal connections are in place for the dialog
-    // we can set the initial value of the path in the model.
-
-    m_set_path_dlg->update_model ();
-  }
-
-  void main_window::find_files (const QString& start_dir)
-  {
-
-    if (! m_find_files_dlg)
-      {
-        m_find_files_dlg = new find_files_dialog (this);
-
-        connect (m_find_files_dlg, &find_files_dialog::finished,
-                 this, &main_window::find_files_finished);
-
-        connect (m_find_files_dlg, &find_files_dialog::dir_selected,
-                 m_file_browser_window, &files_dock_widget::set_current_directory);
-
-        connect (m_find_files_dlg, &find_files_dialog::file_selected,
-                 this, QOverload<const QString&>::of (&main_window::open_file_signal));
-
-        m_find_files_dlg->setWindowModality (Qt::NonModal);
-      }
-
-    if (! m_find_files_dlg->isVisible ())
-      {
-        m_find_files_dlg->show ();
-      }
-
-    m_find_files_dlg->set_search_dir (start_dir);
-
-    m_find_files_dlg->activateWindow ();
-
-  }
-
-  void main_window::set_screen_size (int ht, int wd)
-  {
-    emit interpreter_event
-      ([=] ()
-       {
-         // INTERPRETER THREAD
-
-         command_editor::set_screen_size (ht, wd);
-       });
-  }
-
-  void main_window::clipboard_has_changed ()
-  {
-    if (m_clipboard->text ().isEmpty ())
-      {
-        m_paste_action->setEnabled (false);
-        m_clear_clipboard_action->setEnabled (false);
-      }
-    else
-      {
-        m_paste_action->setEnabled (true);
-        m_clear_clipboard_action->setEnabled (true);
-      }
-  }
-
-  void main_window::clear_clipboard ()
-  {
-    m_clipboard->clear (QClipboard::Clipboard);
-  }
-
-  void main_window::disable_menu_shortcuts (bool disable)
-  {
-    QHash<QMenu *, QStringList>::const_iterator i = m_hash_menu_text.constBegin ();
-
-    while (i != m_hash_menu_text.constEnd ())
-      {
-        i.key ()->setTitle (i.value ().at (disable));
-        ++i;
-      }
-  }
-
-  void main_window::restore_create_file_setting ()
-  {
-    // restore the new files creation setting
-
-    gui_settings settings;
-
-    settings.setValue (ed_create_new_file.settings_key (), false);
-    disconnect (m_editor_window, SIGNAL (file_loaded_signal ()),
-                this, SLOT (restore_create_file_setting ()));
-  }
-
-  void main_window::set_file_encoding (const QString& new_encoding)
-  {
-    m_file_encoding = new_encoding;
-  }
-
-  // The following slot is called after files have been selected in the
-  // open file dialog, possibly with a new selected encoding stored in
-  // m_file_encoding
-  void main_window::request_open_files (const QStringList& open_file_names)
-  {
-    for (int i = 0; i < open_file_names.count (); i++)
-      emit open_file_signal (open_file_names.at (i), m_file_encoding, -1);
-  }
-
-  void main_window::profiler_session ()
-  {
-    emit interpreter_event
-      ([=] (interpreter& interp)
+        // INTERPRETER THREAD
+        F__profiler_enable__ (interp, ovl (false));
+      });
+}
+
+void main_window::handle_profiler_status_update (bool active)
+{
+  m_profiler_start->setEnabled (! active);
+  m_profiler_resume->setEnabled (! active);
+  m_profiler_stop->setEnabled (active);
+
+  led_indicator::led_state state = led_indicator::LED_STATE_INACTIVE;
+  if (active)
+    state = led_indicator::LED_STATE_ACTIVE;
+  m_profiler_status_indicator->set_state (state);
+}
+
+void main_window::profiler_show ()
+{
+  // Do not use a separate interpreter event as in the other
+  // profiler slots since the output of the command "profshow"
+  // would obscure the prompt and we do not need to emimt a signal
+  // for action that is required in the gui after rhe command
+  execute_command_in_terminal ("profshow");
+}
+
+void main_window::closeEvent (QCloseEvent *e)
+{
+  write_settings ();
+
+  if (confirm_shutdown ())
+    {
+      // FIXME: Instead of ignoring the event and posting an
+      // interpreter event, should we just accept the event and
+      // shutdown and clean up the interpreter as part of closing the
+      // GUI?  Going that route might make it easier to close the GUI
+      // without having to stop the interpreter, for example, if the
+      // GUI is started from the interpreter command line.
+
+      e->ignore ();
+
+      if (m_octave_qobj.experimental_terminal_widget ()
+          && ! m_octave_qobj.is_gui_app ())
+        emit close_gui_signal ();
+      else
         {
-          // INTERPRETER THREAD
-          F__profiler_enable__ (interp, ovl (true));
-        });
-  }
-
-  void main_window::profiler_session_resume ()
-  {
-    emit interpreter_event
-      ([=] (interpreter& interp)
-        {
-          // INTERPRETER THREAD
-          F__profiler_enable__ (interp, ovl (true));
-        });
-  }
-
-  void main_window::profiler_stop ()
-  {
-    emit interpreter_event
-      ([=] (interpreter& interp)
-        {
-          // INTERPRETER THREAD
-          F__profiler_enable__ (interp, ovl (false));
-        });
-  }
-
-  void main_window::handle_profiler_status_update (bool active)
-  {
-    m_profiler_start->setEnabled (! active);
-    m_profiler_resume->setEnabled (! active);
-    m_profiler_stop->setEnabled (active);
-
-    led_indicator::led_state state = led_indicator::LED_STATE_INACTIVE;
-    if (active)
-      state = led_indicator::LED_STATE_ACTIVE;
-    m_profiler_status_indicator->set_state (state);
-  }
-
-  void main_window::profiler_show ()
-  {
-    // Do not use a separate interpreter event as in the other
-    // profiler slots since the output of the command "profshow"
-    // would obscure the prompt and we do not need to emimt a signal
-    // for action that is required in the gui after rhe command
-    execute_command_in_terminal ("profshow");
-  }
-
-  void main_window::closeEvent (QCloseEvent *e)
-  {
-    write_settings ();
-
-    if (confirm_shutdown ())
-      {
-        // FIXME: Instead of ignoring the event and posting an
-        // interpreter event, should we just accept the event and
-        // shutdown and clean up the interpreter as part of closing the
-        // GUI?  Going that route might make it easier to close the GUI
-        // without having to stop the interpreter, for example, if the
-        // GUI is started from the interpreter command line.
-
-        e->ignore ();
-
-        if (m_octave_qobj.experimental_terminal_widget ()
-            && ! m_octave_qobj.is_gui_app ())
-          emit close_gui_signal ();
-        else
-          {
-            emit interpreter_event
-              ([] (interpreter& interp)
-               {
-                 // INTERPRETER THREAD
-
-                 interp.quit (0, false, false);
-               });
-          }
-      }
-    else
-      e->ignore ();
-  }
-
-  void main_window::construct_central_widget ()
-  {
-    // Create and set the central widget.  QMainWindow takes ownership of
-    // the widget (pointer) so there is no need to delete the object upon
-    // destroying this main_window.
-
-    QWidget *dummyWidget = new QWidget ();
-    dummyWidget->setObjectName ("CentralDummyWidget");
-    dummyWidget->resize (10, 10);
-    dummyWidget->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed);
-    dummyWidget->hide ();
-    setCentralWidget (dummyWidget);
-  }
+          emit interpreter_event
+            ([] (interpreter& interp)
+             {
+               // INTERPRETER THREAD
+
+               interp.quit (0, false, false);
+             });
+        }
+    }
+  else
+    e->ignore ();
+}
+
+void main_window::construct_central_widget ()
+{
+  // Create and set the central widget.  QMainWindow takes ownership of
+  // the widget (pointer) so there is no need to delete the object upon
+  // destroying this main_window.
+
+  QWidget *dummyWidget = new QWidget ();
+  dummyWidget->setObjectName ("CentralDummyWidget");
+  dummyWidget->resize (10, 10);
+  dummyWidget->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed);
+  dummyWidget->hide ();
+  setCentralWidget (dummyWidget);
+}
 
 // Main subroutine of the constructor
 
-  void main_window::construct ()
-  {
-    setWindowIcon (QIcon (dw_icon_set_names["NONE"]));
-
-    interpreter_qobject *interp_qobj = m_octave_qobj.interpreter_qobj ();
-
-    qt_interpreter_events *qt_link = interp_qobj->qt_link ();
-
-    construct_menu_bar ();
-
-    construct_tool_bar ();
-
-    // FIXME: Is this action intended to be about quitting application
-    // or closing the main window?
-    connect (qApp, &QApplication::aboutToQuit,
-             this, &main_window::prepare_to_exit);
-
-    connect (qApp, &QApplication::focusChanged,
-             this, &main_window::focus_changed);
-
-    // Default argument requires wrapper.
-    connect (this, &main_window::settings_changed,
-             this, [=] () { notice_settings (); });
-
-    // Connections for signals from the interpreter thread where the slot
-    // should be executed by the gui thread
-
-    connect (this, &main_window::warning_function_not_found_signal,
-             this, &main_window::warning_function_not_found);
-
-    setWindowTitle ("Octave");
-
-    setStatusBar (m_status_bar);
-
-    // Signals for removing/renaming files/dirs in the temrinal window
-    connect (qt_link, &qt_interpreter_events::file_remove_signal,
-             this, &main_window::file_remove_proxy);
-
-    connect (this, QOverload<const fcn_callback&>::of (&main_window::interpreter_event),
-             &m_octave_qobj, QOverload<const fcn_callback&>::of (&base_qobject::interpreter_event));
-
-    connect (this, QOverload<const meth_callback&>::of (&main_window::interpreter_event),
-             &m_octave_qobj, QOverload<const meth_callback&>::of (&base_qobject::interpreter_event));
-
-    configure_shortcuts ();
-  }
-
-  void main_window::construct_octave_qt_link ()
-  {
-    interpreter_qobject *interp_qobj = m_octave_qobj.interpreter_qobj ();
-
-    qt_interpreter_events *qt_link = interp_qobj->qt_link ();
-
-    connect (qt_link, &qt_interpreter_events::settings_changed,
-             this, &main_window::notice_settings);
-
-    connect (qt_link, &qt_interpreter_events::apply_new_settings,
-             this, &main_window::request_reload_settings);
-
-    connect (qt_link, &qt_interpreter_events::directory_changed_signal,
-             this, &main_window::update_octave_directory);
-
-    connect (qt_link, &qt_interpreter_events::execute_command_in_terminal_signal,
-             this, &main_window::execute_command_in_terminal);
-
-    connect (qt_link, &qt_interpreter_events::enter_debugger_signal,
-             this, &main_window::handle_enter_debugger);
-
-    connect (qt_link, &qt_interpreter_events::exit_debugger_signal,
-             this, &main_window::handle_exit_debugger);
-
-    connect (qt_link, &qt_interpreter_events::show_preferences_signal,
-             this, [=] () { process_settings_dialog_request (); });
-
-    connect (qt_link, &qt_interpreter_events::insert_debugger_pointer_signal,
-             this, &main_window::handle_insert_debugger_pointer_request);
-
-    connect (qt_link, &qt_interpreter_events::delete_debugger_pointer_signal,
-             this, &main_window::handle_delete_debugger_pointer_request);
-
-    connect (qt_link, &qt_interpreter_events::update_breakpoint_marker_signal,
-             this, &main_window::handle_update_breakpoint_marker_request);
-
-    connect (qt_link, &qt_interpreter_events::gui_status_update_signal,
-             this, &main_window::handle_gui_status_update);
-
-    connect (qt_link, &qt_interpreter_events::update_gui_lexer_signal,
-             this, &main_window::update_gui_lexer_signal);
-  }
-
-  QAction* main_window::add_action (QMenu *menu, const QIcon& icon,
-                                    const QString& text, const char *member,
-                                    const QWidget *receiver)
-  {
-    QAction *a;
-
-    if (receiver)
-      a = menu->addAction (icon, text, receiver, member);
-    else
-      a = menu->addAction (icon, text, this, member);
-
-    addAction (a);  // important for shortcut context
-    a->setShortcutContext (Qt::ApplicationShortcut);
-    return a;
-  }
-
-  QMenu* main_window::m_add_menu (QMenuBar *p, QString name)
-  {
-    QMenu *menu = p->addMenu (name);
-
-    QString base_name = name;  // get a copy
-    // replace intended '&' ("&&") by a temp. string
-    base_name.replace ("&&", "___octave_amp_replacement___");
-    // remove single '&' (shortcut)
-    base_name.remove ("&");
-    // restore intended '&'
-    base_name.replace ("___octave_amp_replacement___", "&&");
-
-    // remember names with and without shortcut
-    m_hash_menu_text[menu] = QStringList ({ name, base_name });
-
-    return menu;
-  }
-
-  void main_window::construct_menu_bar ()
-  {
-    QMenuBar *menu_bar = menuBar ();
-
-    construct_file_menu (menu_bar);
-
-    construct_edit_menu (menu_bar);
-
-    construct_debug_menu (menu_bar);
-
-    construct_tools_menu (menu_bar);
-
-    construct_window_menu (menu_bar);
-
-    construct_help_menu (menu_bar);
-
-    construct_news_menu (menu_bar);
+void main_window::construct ()
+{
+  setWindowIcon (QIcon (dw_icon_set_names["NONE"]));
+
+  interpreter_qobject *interp_qobj = m_octave_qobj.interpreter_qobj ();
+
+  qt_interpreter_events *qt_link = interp_qobj->qt_link ();
+
+  construct_menu_bar ();
+
+  construct_tool_bar ();
+
+  // FIXME: Is this action intended to be about quitting application
+  // or closing the main window?
+  connect (qApp, &QApplication::aboutToQuit,
+           this, &main_window::prepare_to_exit);
+
+  connect (qApp, &QApplication::focusChanged,
+           this, &main_window::focus_changed);
+
+  // Default argument requires wrapper.
+  connect (this, &main_window::settings_changed,
+           this, [=] () { notice_settings (); });
+
+  // Connections for signals from the interpreter thread where the slot
+  // should be executed by the gui thread
+
+  connect (this, &main_window::warning_function_not_found_signal,
+           this, &main_window::warning_function_not_found);
+
+  setWindowTitle ("Octave");
+
+  setStatusBar (m_status_bar);
+
+  // Signals for removing/renaming files/dirs in the temrinal window
+  connect (qt_link, &qt_interpreter_events::file_remove_signal,
+           this, &main_window::file_remove_proxy);
+
+  connect (this, QOverload<const fcn_callback&>::of (&main_window::interpreter_event),
+           &m_octave_qobj, QOverload<const fcn_callback&>::of (&base_qobject::interpreter_event));
+
+  connect (this, QOverload<const meth_callback&>::of (&main_window::interpreter_event),
+           &m_octave_qobj, QOverload<const meth_callback&>::of (&base_qobject::interpreter_event));
+
+  configure_shortcuts ();
+}
+
+void main_window::construct_octave_qt_link ()
+{
+  interpreter_qobject *interp_qobj = m_octave_qobj.interpreter_qobj ();
+
+  qt_interpreter_events *qt_link = interp_qobj->qt_link ();
+
+  connect (qt_link, &qt_interpreter_events::settings_changed,
+           this, &main_window::notice_settings);
+
+  connect (qt_link, &qt_interpreter_events::apply_new_settings,
+           this, &main_window::request_reload_settings);
+
+  connect (qt_link, &qt_interpreter_events::directory_changed_signal,
+           this, &main_window::update_octave_directory);
+
+  connect (qt_link, &qt_interpreter_events::execute_command_in_terminal_signal,
+           this, &main_window::execute_command_in_terminal);
+
+  connect (qt_link, &qt_interpreter_events::enter_debugger_signal,
+           this, &main_window::handle_enter_debugger);
+
+  connect (qt_link, &qt_interpreter_events::exit_debugger_signal,
+           this, &main_window::handle_exit_debugger);
+
+  connect (qt_link, &qt_interpreter_events::show_preferences_signal,
+           this, [=] () { process_settings_dialog_request (); });
+
+  connect (qt_link, &qt_interpreter_events::insert_debugger_pointer_signal,
+           this, &main_window::handle_insert_debugger_pointer_request);
+
+  connect (qt_link, &qt_interpreter_events::delete_debugger_pointer_signal,
+           this, &main_window::handle_delete_debugger_pointer_request);
+
+  connect (qt_link, &qt_interpreter_events::update_breakpoint_marker_signal,
+           this, &main_window::handle_update_breakpoint_marker_request);
+
+  connect (qt_link, &qt_interpreter_events::gui_status_update_signal,
+           this, &main_window::handle_gui_status_update);
+
+  connect (qt_link, &qt_interpreter_events::update_gui_lexer_signal,
+           this, &main_window::update_gui_lexer_signal);
+}
+
+QAction* main_window::add_action (QMenu *menu, const QIcon& icon,
+                                  const QString& text, const char *member,
+                                  const QWidget *receiver)
+{
+  QAction *a;
+
+  if (receiver)
+    a = menu->addAction (icon, text, receiver, member);
+  else
+    a = menu->addAction (icon, text, this, member);
+
+  addAction (a);  // important for shortcut context
+  a->setShortcutContext (Qt::ApplicationShortcut);
+  return a;
+}
+
+QMenu* main_window::m_add_menu (QMenuBar *p, QString name)
+{
+  QMenu *menu = p->addMenu (name);
+
+  QString base_name = name;  // get a copy
+  // replace intended '&' ("&&") by a temp. string
+  base_name.replace ("&&", "___octave_amp_replacement___");
+  // remove single '&' (shortcut)
+  base_name.remove ("&");
+  // restore intended '&'
+  base_name.replace ("___octave_amp_replacement___", "&&");
+
+  // remember names with and without shortcut
+  m_hash_menu_text[menu] = QStringList ({ name, base_name });
+
+  return menu;
+}
+
+void main_window::construct_menu_bar ()
+{
+  QMenuBar *menu_bar = menuBar ();
+
+  construct_file_menu (menu_bar);
+
+  construct_edit_menu (menu_bar);
+
+  construct_debug_menu (menu_bar);
+
+  construct_tools_menu (menu_bar);
+
+  construct_window_menu (menu_bar);
+
+  construct_help_menu (menu_bar);
+
+  construct_news_menu (menu_bar);
 
 #if defined (HAVE_QSCINTILLA)
-    // call the editor to add actions which should also be available in the
-    // editor's menu and tool bar
-    QList<QAction *> shared_actions = {
-      m_new_script_action,
-      m_new_function_action,
-      m_open_action,
-      m_find_files_action,
-      m_undo_action,
-      m_copy_action,
-      m_paste_action,
-      m_select_all_action
-    };
-    m_editor_window->insert_global_actions (shared_actions);
+  // call the editor to add actions which should also be available in the
+  // editor's menu and tool bar
+  QList<QAction *> shared_actions = {
+    m_new_script_action,
+    m_new_function_action,
+    m_open_action,
+    m_find_files_action,
+    m_undo_action,
+    m_copy_action,
+    m_paste_action,
+    m_select_all_action
+  };
+  m_editor_window->insert_global_actions (shared_actions);
 #endif
-  }
-
-  void main_window::construct_file_menu (QMenuBar *p)
-  {
-    QMenu *file_menu = m_add_menu (p, tr ("&File"));
-
-    construct_new_menu (file_menu);
-
-    gui_settings settings;
-
-    m_open_action
-      = add_action (file_menu, settings.icon ("document-open"), tr ("Open..."),
-                    SLOT (request_open_file ()), this);
-    m_open_action->setToolTip (tr ("Open an existing file in editor"));
+}
+
+void main_window::construct_file_menu (QMenuBar *p)
+{
+  QMenu *file_menu = m_add_menu (p, tr ("&File"));
+
+  construct_new_menu (file_menu);
+
+  gui_settings settings;
+
+  m_open_action
+    = add_action (file_menu, settings.icon ("document-open"), tr ("Open..."),
+                  SLOT (request_open_file ()), this);
+  m_open_action->setToolTip (tr ("Open an existing file in editor"));
 
 #if defined (HAVE_QSCINTILLA)
-    file_menu->addMenu (m_editor_window->get_mru_menu ());
+  file_menu->addMenu (m_editor_window->get_mru_menu ());
 #endif
 
-    file_menu->addSeparator ();
-
-    m_load_workspace_action
-      = add_action (file_menu, QIcon (), tr ("Load Workspace..."),
-                    SLOT (handle_load_workspace_request ()), this);
-
-    m_save_workspace_action
-      = add_action (file_menu, QIcon (), tr ("Save Workspace As..."),
-                    SLOT (handle_save_workspace_request ()), this);
-
-    file_menu->addSeparator ();
-
-    m_exit_action
-      = add_action (file_menu, QIcon (), tr ("Exit"),
-                    SLOT (close ()), this);
-    m_exit_action->setMenuRole (QAction::QuitRole);
-
-    // Connect signal related to opening or creating editor files
-    connect (this, SIGNAL (new_file_signal (const QString&)),
-             m_active_editor, SLOT (request_new_file (const QString&)));
-
-    connect (this, SIGNAL (open_file_signal (const QString&)),
-             m_active_editor, SLOT (request_open_file (const QString&)));
-
-    connect (this,
-             SIGNAL (open_file_signal (const QString&, const QString&, int)),
-             m_active_editor,
-             SLOT (request_open_file (const QString&, const QString&, int)));
-  }
-
-  void main_window::construct_new_menu (QMenu *p)
-  {
-    QMenu *new_menu = p->addMenu (tr ("New"));
-
-    gui_settings settings;
-
-    m_new_script_action
-      = add_action (new_menu, settings.icon ("document-new"), tr ("New Script"),
-                    SLOT (request_new_script ()), this);
-
-    m_new_function_action
-      = add_action (new_menu, QIcon (), tr ("New Function..."),
-                    SLOT (request_new_function ()), this);
-
-    m_new_figure_action
-      = add_action (new_menu, QIcon (), tr ("New Figure"),
-                    SLOT (handle_new_figure_request ()), this);
-  }
-
-  void main_window::construct_edit_menu (QMenuBar *p)
-  {
-    QMenu *edit_menu = m_add_menu (p, tr ("&Edit"));
-
-    QKeySequence ctrl_shift = Qt::ControlModifier + Qt::ShiftModifier;
-
-    gui_settings settings;
-
-    m_undo_action
-      = edit_menu->addAction (settings.icon ("edit-undo"), tr ("Undo"));
-    m_undo_action->setShortcutContext (Qt::ApplicationShortcut);
-
-    edit_menu->addSeparator ();
-
-    m_copy_action
-      = edit_menu->addAction (settings.icon ("edit-copy"), tr ("Copy"), this,
-                              &main_window::copyClipboard);
-    m_copy_action->setShortcutContext (Qt::ApplicationShortcut);
-
-    m_paste_action
-      = edit_menu->addAction (settings.icon ("edit-paste"), tr ("Paste"), this,
-                              &main_window::pasteClipboard);
-    m_paste_action->setShortcutContext (Qt::ApplicationShortcut);
-
-    m_select_all_action
-      = edit_menu->addAction (tr ("Select All"), this,
-                              &main_window::selectAll);
-    m_select_all_action->setShortcutContext (Qt::ApplicationShortcut);
-
-    m_clear_clipboard_action
-      = edit_menu->addAction (tr ("Clear Clipboard"), this,
-                              &main_window::clear_clipboard);
-
-    edit_menu->addSeparator ();
-
-    m_find_files_action
-      = edit_menu->addAction (settings.icon ("edit-find"),
-                              tr ("Find Files..."));
-
-    edit_menu->addSeparator ();
-
-    m_clear_command_window_action
-      = edit_menu->addAction (tr ("Clear Command Window"));
-
-    m_clear_command_history_action
-      = edit_menu->addAction (tr ("Clear Command History"));
-
-    m_clear_workspace_action
-      = edit_menu->addAction (tr ("Clear Workspace"));
-
-    edit_menu->addSeparator ();
-
-    m_set_path_action
-      = edit_menu->addAction (tr ("Set Path"));
-
-    m_preferences_action
-      = edit_menu->addAction (settings.icon ("preferences-system"),
-                              tr ("Preferences..."));
-
-    connect (m_find_files_action, &QAction::triggered,
-             this, [=] () { find_files (); });
-
-    connect (m_clear_command_window_action, &QAction::triggered,
-             this, &main_window::handle_clear_command_window_request);
-
-    connect (m_clear_command_history_action, &QAction::triggered,
-             this, &main_window::handle_clear_history_request);
-
-    connect (m_clear_workspace_action, &QAction::triggered,
-             this, &main_window::handle_clear_workspace_request);
-
-    connect (m_clipboard, &QClipboard::dataChanged,
-             this, &main_window::clipboard_has_changed);
-    clipboard_has_changed ();
+  file_menu->addSeparator ();
+
+  m_load_workspace_action
+    = add_action (file_menu, QIcon (), tr ("Load Workspace..."),
+                  SLOT (handle_load_workspace_request ()), this);
+
+  m_save_workspace_action
+    = add_action (file_menu, QIcon (), tr ("Save Workspace As..."),
+                  SLOT (handle_save_workspace_request ()), this);
+
+  file_menu->addSeparator ();
+
+  m_exit_action
+    = add_action (file_menu, QIcon (), tr ("Exit"),
+                  SLOT (close ()), this);
+  m_exit_action->setMenuRole (QAction::QuitRole);
+
+  // Connect signal related to opening or creating editor files
+  connect (this, SIGNAL (new_file_signal (const QString&)),
+           m_active_editor, SLOT (request_new_file (const QString&)));
+
+  connect (this, SIGNAL (open_file_signal (const QString&)),
+           m_active_editor, SLOT (request_open_file (const QString&)));
+
+  connect (this,
+           SIGNAL (open_file_signal (const QString&, const QString&, int)),
+           m_active_editor,
+           SLOT (request_open_file (const QString&, const QString&, int)));
+}
+
+void main_window::construct_new_menu (QMenu *p)
+{
+  QMenu *new_menu = p->addMenu (tr ("New"));
+
+  gui_settings settings;
+
+  m_new_script_action
+    = add_action (new_menu, settings.icon ("document-new"), tr ("New Script"),
+                  SLOT (request_new_script ()), this);
+
+  m_new_function_action
+    = add_action (new_menu, QIcon (), tr ("New Function..."),
+                  SLOT (request_new_function ()), this);
+
+  m_new_figure_action
+    = add_action (new_menu, QIcon (), tr ("New Figure"),
+                  SLOT (handle_new_figure_request ()), this);
+}
+
+void main_window::construct_edit_menu (QMenuBar *p)
+{
+  QMenu *edit_menu = m_add_menu (p, tr ("&Edit"));
+
+  QKeySequence ctrl_shift = Qt::ControlModifier + Qt::ShiftModifier;
+
+  gui_settings settings;
+
+  m_undo_action
+    = edit_menu->addAction (settings.icon ("edit-undo"), tr ("Undo"));
+  m_undo_action->setShortcutContext (Qt::ApplicationShortcut);
+
+  edit_menu->addSeparator ();
+
+  m_copy_action
+    = edit_menu->addAction (settings.icon ("edit-copy"), tr ("Copy"), this,
+                            &main_window::copyClipboard);
+  m_copy_action->setShortcutContext (Qt::ApplicationShortcut);
+
+  m_paste_action
+    = edit_menu->addAction (settings.icon ("edit-paste"), tr ("Paste"), this,
+                            &main_window::pasteClipboard);
+  m_paste_action->setShortcutContext (Qt::ApplicationShortcut);
+
+  m_select_all_action
+    = edit_menu->addAction (tr ("Select All"), this,
+                            &main_window::selectAll);
+  m_select_all_action->setShortcutContext (Qt::ApplicationShortcut);
+
+  m_clear_clipboard_action
+    = edit_menu->addAction (tr ("Clear Clipboard"), this,
+                            &main_window::clear_clipboard);
+
+  edit_menu->addSeparator ();
+
+  m_find_files_action
+    = edit_menu->addAction (settings.icon ("edit-find"),
+                            tr ("Find Files..."));
+
+  edit_menu->addSeparator ();
+
+  m_clear_command_window_action
+    = edit_menu->addAction (tr ("Clear Command Window"));
+
+  m_clear_command_history_action
+    = edit_menu->addAction (tr ("Clear Command History"));
+
+  m_clear_workspace_action
+    = edit_menu->addAction (tr ("Clear Workspace"));
+
+  edit_menu->addSeparator ();
+
+  m_set_path_action
+    = edit_menu->addAction (tr ("Set Path"));
+
+  m_preferences_action
+    = edit_menu->addAction (settings.icon ("preferences-system"),
+                            tr ("Preferences..."));
+
+  connect (m_find_files_action, &QAction::triggered,
+           this, [=] () { find_files (); });
+
+  connect (m_clear_command_window_action, &QAction::triggered,
+           this, &main_window::handle_clear_command_window_request);
+
+  connect (m_clear_command_history_action, &QAction::triggered,
+           this, &main_window::handle_clear_history_request);
+
+  connect (m_clear_workspace_action, &QAction::triggered,
+           this, &main_window::handle_clear_workspace_request);
+
+  connect (m_clipboard, &QClipboard::dataChanged,
+           this, &main_window::clipboard_has_changed);
+  clipboard_has_changed ();
 #if defined (Q_OS_WIN32)
-    // Always enable paste action (unreliable clipboard signals in windows)
-    // FIXME: This has to be removed, when the clipboard signals in windows
-    //        are working again
-    m_paste_action->setEnabled (true);
-    m_clear_clipboard_action->setEnabled (true);
+  // Always enable paste action (unreliable clipboard signals in windows)
+  // FIXME: This has to be removed, when the clipboard signals in windows
+  //        are working again
+  m_paste_action->setEnabled (true);
+  m_clear_clipboard_action->setEnabled (true);
 #endif
 
-    connect (m_preferences_action, &QAction::triggered,
-             this, [=] () { process_settings_dialog_request (); });
-
-    connect (m_set_path_action, &QAction::triggered,
-             this, &main_window::handle_set_path_dialog_request);
-
-  }
-
-  QAction * main_window::construct_debug_menu_item (const char *icon,
-                                                    const QString& item,
-                                                    const char *member)
-  {
-    gui_settings settings;
-
-    QAction *action = add_action (m_debug_menu, settings.icon (QString (icon)),
-                                  item, member);
-
-    action->setEnabled (false);
+  connect (m_preferences_action, &QAction::triggered,
+           this, [=] () { process_settings_dialog_request (); });
+
+  connect (m_set_path_action, &QAction::triggered,
+           this, &main_window::handle_set_path_dialog_request);
+
+}
+
+QAction * main_window::construct_debug_menu_item (const char *icon,
+                                                  const QString& item,
+                                                  const char *member)
+{
+  gui_settings settings;
+
+  QAction *action = add_action (m_debug_menu, settings.icon (QString (icon)),
+                                item, member);
+
+  action->setEnabled (false);
 
 #if defined (HAVE_QSCINTILLA)
-    m_editor_window->debug_menu ()->addAction (action);
-    m_editor_window->toolbar ()->addAction (action);
+  m_editor_window->debug_menu ()->addAction (action);
+  m_editor_window->toolbar ()->addAction (action);
 #endif
 
-    return action;
-  }
-
-  void main_window::construct_debug_menu (QMenuBar *p)
-  {
-    m_debug_menu = m_add_menu (p, tr ("De&bug"));
-
-    m_debug_step_over
-      = construct_debug_menu_item ("db-step", tr ("Step"),
-                                   SLOT (debug_step_over ()));
-
-    m_debug_step_into
-      = construct_debug_menu_item ("db-step-in", tr ("Step In"),
-                                   SLOT (debug_step_into ()));
-
-    m_debug_step_out
-      = construct_debug_menu_item ("db-step-out", tr ("Step Out"),
-                                   SLOT (debug_step_out ()));
-
-    m_debug_continue
-      = construct_debug_menu_item ("db-cont", tr ("Continue"),
-                                   SLOT (debug_continue ()));
-
-    m_debug_menu->addSeparator ();
+  return action;
+}
+
+void main_window::construct_debug_menu (QMenuBar *p)
+{
+  m_debug_menu = m_add_menu (p, tr ("De&bug"));
+
+  m_debug_step_over
+    = construct_debug_menu_item ("db-step", tr ("Step"),
+                                 SLOT (debug_step_over ()));
+
+  m_debug_step_into
+    = construct_debug_menu_item ("db-step-in", tr ("Step In"),
+                                 SLOT (debug_step_into ()));
+
+  m_debug_step_out
+    = construct_debug_menu_item ("db-step-out", tr ("Step Out"),
+                                 SLOT (debug_step_out ()));
+
+  m_debug_continue
+    = construct_debug_menu_item ("db-cont", tr ("Continue"),
+                                 SLOT (debug_continue ()));
+
+  m_debug_menu->addSeparator ();
 #if defined (HAVE_QSCINTILLA)
-    m_editor_window->debug_menu ()->addSeparator ();
+  m_editor_window->debug_menu ()->addSeparator ();
 #endif
 
-    m_debug_quit
-      = construct_debug_menu_item ("db-stop", tr ("Quit Debug Mode"),
-                                   SLOT (debug_quit ()));
-  }
-
-  void main_window::construct_tools_menu (QMenuBar *p)
-  {
-    QMenu *tools_menu = m_add_menu (p, tr ("&Tools"));
-
-    m_profiler_start = add_action (tools_menu, QIcon (),
-          tr ("Start &Profiler Session"), SLOT (profiler_session ()));
-
-    m_profiler_resume = add_action (tools_menu, QIcon (),
-          tr ("&Resume Profiler Session"), SLOT (profiler_session_resume ()));
-
-    m_profiler_stop = add_action (tools_menu, QIcon (),
-          tr ("&Stop Profiler"), SLOT (profiler_stop ()));
-    m_profiler_stop->setEnabled (false);
-
-    m_profiler_show = add_action (tools_menu, QIcon (),
-          tr ("&Show Profile Data"), SLOT (profiler_show ()));
-  }
-
-  void main_window::editor_tabs_changed (bool have_tabs, bool is_octave)
-  {
-    // Set state of actions which depend on the existence of editor tabs
-    m_editor_has_tabs = have_tabs;
-    m_editor_is_octave_file = is_octave;
-    m_debug_step_over->setEnabled (have_tabs && is_octave);
-  }
-
-  QAction * main_window::construct_window_menu_item (QMenu *p,
-                                                     const QString& item,
-                                                     bool checkable,
-                                                     QWidget *widget)
-  {
-    QAction *action = p->addAction (QIcon (), item);
-
-    addAction (action);  // important for shortcut context
-    action->setCheckable (checkable);
-    action->setShortcutContext (Qt::ApplicationShortcut);
-
-    if (widget)  // might be zero for m_editor_window
-      {
-        if (checkable)
-          {
-            // action for visibility of dock widget
-            connect (action, SIGNAL (toggled (bool)),
-                     widget, SLOT (setVisible (bool)));
-
-            connect (widget, SIGNAL (active_changed (bool)),
-                     action, SLOT (setChecked (bool)));
-          }
-        else
-          {
-            // action for focus of dock widget
-            connect (action, SIGNAL (triggered ()),
-                     widget, SLOT (activate ()));
-          }
-      }
-    else
-      {
-        action->setEnabled (false);
-      }
-
-    return action;
-  }
-
-  void main_window::construct_window_menu (QMenuBar *p)
-  {
-    QMenu *window_menu = m_add_menu (p, tr ("&Window"));
-
-    m_show_command_window_action = construct_window_menu_item
-      (window_menu, tr ("Show Command Window"), true, m_command_window);
-
-    m_show_history_action = construct_window_menu_item
-      (window_menu, tr ("Show Command History"), true, m_history_window);
-
-    m_show_file_browser_action = construct_window_menu_item
-      (window_menu, tr ("Show File Browser"), true, m_file_browser_window);
-
-    m_show_workspace_action = construct_window_menu_item
-      (window_menu, tr ("Show Workspace"), true, m_workspace_window);
-
-    m_show_editor_action = construct_window_menu_item
-      (window_menu, tr ("Show Editor"), true, m_editor_window);
-
-    m_show_documentation_action = construct_window_menu_item
-      (window_menu, tr ("Show Documentation"), true, m_doc_browser_window);
-
-    m_show_variable_editor_action = construct_window_menu_item
-      (window_menu, tr ("Show Variable Editor"), true, m_variable_editor_window);
-
-    window_menu->addSeparator ();
-
-    m_command_window_action = construct_window_menu_item
-      (window_menu, tr ("Command Window"), false, m_command_window);
-
-    m_history_action = construct_window_menu_item
-      (window_menu, tr ("Command History"), false, m_history_window);
-
-    m_file_browser_action = construct_window_menu_item
-      (window_menu, tr ("File Browser"), false, m_file_browser_window);
-
-    m_workspace_action = construct_window_menu_item
-      (window_menu, tr ("Workspace"), false, m_workspace_window);
-
-    m_editor_action = construct_window_menu_item
-      (window_menu, tr ("Editor"), false, m_editor_window);
-
-    m_documentation_action = construct_window_menu_item
-      (window_menu, tr ("Documentation"), false, m_doc_browser_window);
-
-    m_variable_editor_action = construct_window_menu_item
-      (window_menu, tr ("Variable Editor"), false, m_variable_editor_window);
-
-    window_menu->addSeparator ();
-
-    m_previous_dock_action = add_action (window_menu, QIcon (),
-                                           tr ("Previous Widget"), SLOT (go_to_previous_widget ()));
-
-    window_menu->addSeparator ();
-
-    m_reset_windows_action = add_action (window_menu, QIcon (),
-                                         tr ("Reset Default Window Layout"), SLOT (reset_windows ()));
-  }
-
-  void main_window::construct_help_menu (QMenuBar *p)
-  {
-    QMenu *help_menu = m_add_menu (p, tr ("&Help"));
-
-    construct_documentation_menu (help_menu);
-
-    help_menu->addSeparator ();
-
-    m_report_bug_action = add_action (help_menu, QIcon (),
-                                      tr ("Report Bug"), SLOT (open_bug_tracker_page ()));
-
-    m_octave_packages_action = add_action (help_menu, QIcon (),
-                                           tr ("Octave Packages"), SLOT (open_octave_packages_page ()));
-
-    m_contribute_action = add_action (help_menu, QIcon (),
-                                      tr ("Contribute"), SLOT (open_contribute_page ()));
-
-    m_developer_action = add_action (help_menu, QIcon (),
-                                     tr ("Donate to Octave"), SLOT (open_donate_page ()));
-
-    help_menu->addSeparator ();
-
-    m_about_octave_action = add_action (help_menu, QIcon (),
-                                        tr ("About Octave"), SLOT (show_about_octave ()));
-  }
-
-  void main_window::construct_documentation_menu (QMenu *p)
-  {
-    QMenu *doc_menu = p->addMenu (tr ("Documentation"));
-
-    m_ondisk_doc_action = add_action (doc_menu, QIcon (),
-                                      tr ("On Disk"), SLOT (activate ()), m_doc_browser_window);
-
-    m_online_doc_action = add_action (doc_menu, QIcon (),
-                                      tr ("Online"), SLOT (open_online_documentation_page ()));
-  }
-
-  void main_window::construct_news_menu (QMenuBar *p)
-  {
-    QMenu *news_menu = m_add_menu (p, tr ("&News"));
-
-    m_release_notes_action
-      = news_menu->addAction (QIcon (), tr ("Release Notes"),
-                              [=] () {
-                                emit show_release_notes_signal ();
-                              });
-    addAction (m_release_notes_action);
-    m_release_notes_action->setShortcutContext (Qt::ApplicationShortcut);
-
-    m_current_news_action
-      = news_menu->addAction (QIcon (), tr ("Community News"),
-                              [=] () {
-                                emit show_community_news_signal (-1);
-                              });
-    addAction (m_current_news_action);
-    m_current_news_action->setShortcutContext (Qt::ApplicationShortcut);
-  }
-
-  void main_window::construct_tool_bar ()
-  {
-    m_main_tool_bar = addToolBar (tr ("Toolbar"));
-    m_main_tool_bar->setStyleSheet (m_main_tool_bar->styleSheet ()
-                                    + global_toolbar_style);
-
-    m_main_tool_bar->setObjectName ("MainToolBar");
-    m_main_tool_bar->addAction (m_new_script_action);
-    m_main_tool_bar->addAction (m_open_action);
-
-    m_main_tool_bar->addSeparator ();
-
-    m_main_tool_bar->addAction (m_copy_action);
-    m_main_tool_bar->addAction (m_paste_action);
-    m_main_tool_bar->addAction (m_undo_action);
-
-    m_main_tool_bar->addSeparator ();
-
-    m_current_directory_combo_box = new QComboBox (this);
-    QFontMetrics fm = m_current_directory_combo_box->fontMetrics ();
-    m_current_directory_combo_box->setFixedWidth (48*fm.averageCharWidth ());
-    m_current_directory_combo_box->setEditable (true);
-    m_current_directory_combo_box->setInsertPolicy (QComboBox::NoInsert);
-    m_current_directory_combo_box->setToolTip (tr ("Enter directory name"));
-    m_current_directory_combo_box->setMaxVisibleItems (current_directory_max_visible);
-    m_current_directory_combo_box->setMaxCount (current_directory_max_count);
-    QSizePolicy sizePol (QSizePolicy::Preferred, QSizePolicy::Preferred);
-    m_current_directory_combo_box->setSizePolicy (sizePol);
-
-    // addWidget takes ownership of the objects so there is no
-    // need to delete these upon destroying this main_window.
-    m_main_tool_bar->addWidget (new QLabel (tr ("Current Directory: ")));
-    m_main_tool_bar->addWidget (m_current_directory_combo_box);
-
-    gui_settings settings;
-
-    QAction *current_dir_up
-      = m_main_tool_bar->addAction (settings.icon ("folder-up", false, "go-up"),
-                                    tr ("One directory up"));
-    QAction *current_dir_search
-      = m_main_tool_bar->addAction (settings.icon ("folder"),
-                                    tr ("Browse directories"));
-
-    connect (m_current_directory_combo_box, SIGNAL (activated (const QString&)),
-             this, SLOT (set_current_working_directory (const QString&)));
-
-    connect (m_current_directory_combo_box->lineEdit (),
-             &QLineEdit::returnPressed,
-             this, &main_window::accept_directory_line_edit);
-
-    connect (current_dir_search, &QAction::triggered,
-             this, &main_window::browse_for_directory);
-
-    connect (current_dir_up, &QAction::triggered,
-             this, &main_window::change_directory_up);
-
-    connect (m_undo_action, &QAction::triggered,
-             this, &main_window::handle_undo_request);
-  }
-
-  void main_window::focus_console_after_command ()
-  {
-    gui_settings settings;
-
-    if (settings.bool_value (cs_focus_cmd))
-      focus_command_window ();
-  }
-
-  void main_window::configure_shortcuts ()
-  {
-    gui_settings settings;
-
-    bool enable
-      = ! ((m_active_dock == m_command_window) && m_prevent_readline_conflicts);
-
-    // file menu
-    settings.set_shortcut (m_open_action, sc_main_file_open_file, enable);
-    settings.set_shortcut (m_new_script_action, sc_main_file_new_file, enable);
-    settings.set_shortcut (m_new_function_action, sc_main_file_new_function, enable);
-    settings.set_shortcut (m_new_figure_action, sc_main_file_new_figure, enable);
-    settings.set_shortcut (m_load_workspace_action, sc_main_file_load_workspace, enable);
-    settings.set_shortcut (m_save_workspace_action, sc_main_file_save_workspace, enable);
-    settings.set_shortcut (m_exit_action, sc_main_file_exit, enable);
-
-    // edit menu
-    settings.set_shortcut (m_copy_action, sc_main_edit_copy, enable);
-    settings.set_shortcut (m_paste_action, sc_main_edit_paste, enable);
-    settings.set_shortcut (m_undo_action, sc_main_edit_undo, enable);
-    settings.set_shortcut (m_select_all_action, sc_main_edit_select_all, enable);
-    settings.set_shortcut (m_clear_clipboard_action, sc_main_edit_clear_clipboard, enable);
-    settings.set_shortcut (m_find_files_action, sc_main_edit_find_in_files, enable);
-    settings.set_shortcut (m_clear_command_history_action, sc_main_edit_clear_history, enable);
-    settings.set_shortcut (m_clear_command_window_action, sc_main_edit_clear_command_window, enable);
-    settings.set_shortcut (m_clear_workspace_action, sc_main_edit_clear_workspace, enable);
-    settings.set_shortcut (m_set_path_action, sc_main_edit_set_path, enable);
-    settings.set_shortcut (m_preferences_action, sc_main_edit_preferences, enable);
-
-    // debug menu
-    settings.set_shortcut (m_debug_step_over, sc_main_debug_step_over, enable);
-    settings.set_shortcut (m_debug_step_into, sc_main_debug_step_into, enable);
-    settings.set_shortcut (m_debug_step_out, sc_main_debug_step_out, enable);
-    settings.set_shortcut (m_debug_continue, sc_main_debug_continue, enable);
-    settings.set_shortcut (m_debug_quit, sc_main_debug_quit, enable);
-
-    // tools menu
-    settings.set_shortcut (m_profiler_start, sc_main_tools_start_profiler, enable);
-    settings.set_shortcut (m_profiler_resume, sc_main_tools_resume_profiler, enable);
-    settings.set_shortcut (m_profiler_stop, sc_main_tools_start_profiler, enable); // same, toggling
-    settings.set_shortcut (m_profiler_show, sc_main_tools_show_profiler, enable);
-
-    // window menu
-    settings.set_shortcut (m_show_command_window_action, sc_main_window_show_command, enable);
-    settings.set_shortcut (m_show_history_action, sc_main_window_show_history, enable);
-    settings.set_shortcut (m_show_workspace_action, sc_main_window_show_workspace, enable);
-    settings.set_shortcut (m_show_file_browser_action, sc_main_window_show_file_browser, enable);
-    settings.set_shortcut (m_show_editor_action, sc_main_window_show_editor, enable);
-    settings.set_shortcut (m_show_documentation_action, sc_main_window_show_doc, enable);
-    settings.set_shortcut (m_show_variable_editor_action, sc_main_window_show_variable_editor, enable);
-    settings.set_shortcut (m_reset_windows_action, sc_main_window_reset, enable);
-    settings.set_shortcut (m_command_window_action, sc_main_window_command, enable);
-    // Switching to the other widgets (including the previous one) is always enabled
-    settings.set_shortcut (m_history_action, sc_main_window_history, true);
-    settings.set_shortcut (m_workspace_action, sc_main_window_workspace, true);
-    settings.set_shortcut (m_file_browser_action, sc_main_window_file_browser, true);
-    settings.set_shortcut (m_editor_action, sc_main_window_editor, true);
-    settings.set_shortcut (m_documentation_action, sc_main_window_doc, true);
-    settings.set_shortcut (m_variable_editor_action, sc_main_window_variable_editor, true);
-    settings.set_shortcut (m_previous_dock_action, sc_main_window_previous_dock, true);
-
-    // help menu
-    settings.set_shortcut (m_ondisk_doc_action, sc_main_help_ondisk_doc, enable);
-    settings.set_shortcut (m_online_doc_action, sc_main_help_online_doc, enable);
-    settings.set_shortcut (m_report_bug_action, sc_main_help_report_bug, enable);
-    settings.set_shortcut (m_octave_packages_action, sc_main_help_packages, enable);
-    settings.set_shortcut (m_contribute_action, sc_main_help_contribute, enable);
-    settings.set_shortcut (m_developer_action, sc_main_help_developer, enable);
-    settings.set_shortcut (m_about_octave_action, sc_main_help_about, enable);
-
-    // news menu
-    settings.set_shortcut (m_release_notes_action, sc_main_news_release_notes, enable);
-    settings.set_shortcut (m_current_news_action, sc_main_news_community_news, enable);
-  }
-
-  QList<octave_dock_widget *> main_window::dock_widget_list ()
-  {
-    QList<octave_dock_widget *> list = QList<octave_dock_widget *> ();
-    list.append (static_cast<octave_dock_widget *> (m_command_window));
-    list.append (static_cast<octave_dock_widget *> (m_history_window));
-    list.append (static_cast<octave_dock_widget *> (m_file_browser_window));
-    list.append (static_cast<octave_dock_widget *> (m_doc_browser_window));
+  m_debug_quit
+    = construct_debug_menu_item ("db-stop", tr ("Quit Debug Mode"),
+                                 SLOT (debug_quit ()));
+}
+
+void main_window::construct_tools_menu (QMenuBar *p)
+{
+  QMenu *tools_menu = m_add_menu (p, tr ("&Tools"));
+
+  m_profiler_start = add_action (tools_menu, QIcon (),
+        tr ("Start &Profiler Session"), SLOT (profiler_session ()));
+
+  m_profiler_resume = add_action (tools_menu, QIcon (),
+        tr ("&Resume Profiler Session"), SLOT (profiler_session_resume ()));
+
+  m_profiler_stop = add_action (tools_menu, QIcon (),
+        tr ("&Stop Profiler"), SLOT (profiler_stop ()));
+  m_profiler_stop->setEnabled (false);
+
+  m_profiler_show = add_action (tools_menu, QIcon (),
+        tr ("&Show Profile Data"), SLOT (profiler_show ()));
+}
+
+void main_window::editor_tabs_changed (bool have_tabs, bool is_octave)
+{
+  // Set state of actions which depend on the existence of editor tabs
+  m_editor_has_tabs = have_tabs;
+  m_editor_is_octave_file = is_octave;
+  m_debug_step_over->setEnabled (have_tabs && is_octave);
+}
+
+QAction * main_window::construct_window_menu_item (QMenu *p,
+                                                   const QString& item,
+                                                   bool checkable,
+                                                   QWidget *widget)
+{
+  QAction *action = p->addAction (QIcon (), item);
+
+  addAction (action);  // important for shortcut context
+  action->setCheckable (checkable);
+  action->setShortcutContext (Qt::ApplicationShortcut);
+
+  if (widget)  // might be zero for m_editor_window
+    {
+      if (checkable)
+        {
+          // action for visibility of dock widget
+          connect (action, SIGNAL (toggled (bool)),
+                   widget, SLOT (setVisible (bool)));
+
+          connect (widget, SIGNAL (active_changed (bool)),
+                   action, SLOT (setChecked (bool)));
+        }
+      else
+        {
+          // action for focus of dock widget
+          connect (action, SIGNAL (triggered ()),
+                   widget, SLOT (activate ()));
+        }
+    }
+  else
+    {
+      action->setEnabled (false);
+    }
+
+  return action;
+}
+
+void main_window::construct_window_menu (QMenuBar *p)
+{
+  QMenu *window_menu = m_add_menu (p, tr ("&Window"));
+
+  m_show_command_window_action = construct_window_menu_item
+    (window_menu, tr ("Show Command Window"), true, m_command_window);
+
+  m_show_history_action = construct_window_menu_item
+    (window_menu, tr ("Show Command History"), true, m_history_window);
+
+  m_show_file_browser_action = construct_window_menu_item
+    (window_menu, tr ("Show File Browser"), true, m_file_browser_window);
+
+  m_show_workspace_action = construct_window_menu_item
+    (window_menu, tr ("Show Workspace"), true, m_workspace_window);
+
+  m_show_editor_action = construct_window_menu_item
+    (window_menu, tr ("Show Editor"), true, m_editor_window);
+
+  m_show_documentation_action = construct_window_menu_item
+    (window_menu, tr ("Show Documentation"), true, m_doc_browser_window);
+
+  m_show_variable_editor_action = construct_window_menu_item
+    (window_menu, tr ("Show Variable Editor"), true, m_variable_editor_window);
+
+  window_menu->addSeparator ();
+
+  m_command_window_action = construct_window_menu_item
+    (window_menu, tr ("Command Window"), false, m_command_window);
+
+  m_history_action = construct_window_menu_item
+    (window_menu, tr ("Command History"), false, m_history_window);
+
+  m_file_browser_action = construct_window_menu_item
+    (window_menu, tr ("File Browser"), false, m_file_browser_window);
+
+  m_workspace_action = construct_window_menu_item
+    (window_menu, tr ("Workspace"), false, m_workspace_window);
+
+  m_editor_action = construct_window_menu_item
+    (window_menu, tr ("Editor"), false, m_editor_window);
+
+  m_documentation_action = construct_window_menu_item
+    (window_menu, tr ("Documentation"), false, m_doc_browser_window);
+
+  m_variable_editor_action = construct_window_menu_item
+    (window_menu, tr ("Variable Editor"), false, m_variable_editor_window);
+
+  window_menu->addSeparator ();
+
+  m_previous_dock_action = add_action (window_menu, QIcon (),
+                                         tr ("Previous Widget"), SLOT (go_to_previous_widget ()));
+
+  window_menu->addSeparator ();
+
+  m_reset_windows_action = add_action (window_menu, QIcon (),
+                                       tr ("Reset Default Window Layout"), SLOT (reset_windows ()));
+}
+
+void main_window::construct_help_menu (QMenuBar *p)
+{
+  QMenu *help_menu = m_add_menu (p, tr ("&Help"));
+
+  construct_documentation_menu (help_menu);
+
+  help_menu->addSeparator ();
+
+  m_report_bug_action = add_action (help_menu, QIcon (),
+                                    tr ("Report Bug"), SLOT (open_bug_tracker_page ()));
+
+  m_octave_packages_action = add_action (help_menu, QIcon (),
+                                         tr ("Octave Packages"), SLOT (open_octave_packages_page ()));
+
+  m_contribute_action = add_action (help_menu, QIcon (),
+                                    tr ("Contribute"), SLOT (open_contribute_page ()));
+
+  m_developer_action = add_action (help_menu, QIcon (),
+                                   tr ("Donate to Octave"), SLOT (open_donate_page ()));
+
+  help_menu->addSeparator ();
+
+  m_about_octave_action = add_action (help_menu, QIcon (),
+                                      tr ("About Octave"), SLOT (show_about_octave ()));
+}
+
+void main_window::construct_documentation_menu (QMenu *p)
+{
+  QMenu *doc_menu = p->addMenu (tr ("Documentation"));
+
+  m_ondisk_doc_action = add_action (doc_menu, QIcon (),
+                                    tr ("On Disk"), SLOT (activate ()), m_doc_browser_window);
+
+  m_online_doc_action = add_action (doc_menu, QIcon (),
+                                    tr ("Online"), SLOT (open_online_documentation_page ()));
+}
+
+void main_window::construct_news_menu (QMenuBar *p)
+{
+  QMenu *news_menu = m_add_menu (p, tr ("&News"));
+
+  m_release_notes_action
+    = news_menu->addAction (QIcon (), tr ("Release Notes"),
+                            [=] () {
+                              emit show_release_notes_signal ();
+                            });
+  addAction (m_release_notes_action);
+  m_release_notes_action->setShortcutContext (Qt::ApplicationShortcut);
+
+  m_current_news_action
+    = news_menu->addAction (QIcon (), tr ("Community News"),
+                            [=] () {
+                              emit show_community_news_signal (-1);
+                            });
+  addAction (m_current_news_action);
+  m_current_news_action->setShortcutContext (Qt::ApplicationShortcut);
+}
+
+void main_window::construct_tool_bar ()
+{
+  m_main_tool_bar = addToolBar (tr ("Toolbar"));
+  m_main_tool_bar->setStyleSheet (m_main_tool_bar->styleSheet ()
+                                  + global_toolbar_style);
+
+  m_main_tool_bar->setObjectName ("MainToolBar");
+  m_main_tool_bar->addAction (m_new_script_action);
+  m_main_tool_bar->addAction (m_open_action);
+
+  m_main_tool_bar->addSeparator ();
+
+  m_main_tool_bar->addAction (m_copy_action);
+  m_main_tool_bar->addAction (m_paste_action);
+  m_main_tool_bar->addAction (m_undo_action);
+
+  m_main_tool_bar->addSeparator ();
+
+  m_current_directory_combo_box = new QComboBox (this);
+  QFontMetrics fm = m_current_directory_combo_box->fontMetrics ();
+  m_current_directory_combo_box->setFixedWidth (48*fm.averageCharWidth ());
+  m_current_directory_combo_box->setEditable (true);
+  m_current_directory_combo_box->setInsertPolicy (QComboBox::NoInsert);
+  m_current_directory_combo_box->setToolTip (tr ("Enter directory name"));
+  m_current_directory_combo_box->setMaxVisibleItems (current_directory_max_visible);
+  m_current_directory_combo_box->setMaxCount (current_directory_max_count);
+  QSizePolicy sizePol (QSizePolicy::Preferred, QSizePolicy::Preferred);
+  m_current_directory_combo_box->setSizePolicy (sizePol);
+
+  // addWidget takes ownership of the objects so there is no
+  // need to delete these upon destroying this main_window.
+  m_main_tool_bar->addWidget (new QLabel (tr ("Current Directory: ")));
+  m_main_tool_bar->addWidget (m_current_directory_combo_box);
+
+  gui_settings settings;
+
+  QAction *current_dir_up
+    = m_main_tool_bar->addAction (settings.icon ("folder-up", false, "go-up"),
+                                  tr ("One directory up"));
+  QAction *current_dir_search
+    = m_main_tool_bar->addAction (settings.icon ("folder"),
+                                  tr ("Browse directories"));
+
+  connect (m_current_directory_combo_box, SIGNAL (activated (const QString&)),
+           this, SLOT (set_current_working_directory (const QString&)));
+
+  connect (m_current_directory_combo_box->lineEdit (),
+           &QLineEdit::returnPressed,
+           this, &main_window::accept_directory_line_edit);
+
+  connect (current_dir_search, &QAction::triggered,
+           this, &main_window::browse_for_directory);
+
+  connect (current_dir_up, &QAction::triggered,
+           this, &main_window::change_directory_up);
+
+  connect (m_undo_action, &QAction::triggered,
+           this, &main_window::handle_undo_request);
+}
+
+void main_window::focus_console_after_command ()
+{
+  gui_settings settings;
+
+  if (settings.bool_value (cs_focus_cmd))
+    focus_command_window ();
+}
+
+void main_window::configure_shortcuts ()
+{
+  gui_settings settings;
+
+  bool enable
+    = ! ((m_active_dock == m_command_window) && m_prevent_readline_conflicts);
+
+  // file menu
+  settings.set_shortcut (m_open_action, sc_main_file_open_file, enable);
+  settings.set_shortcut (m_new_script_action, sc_main_file_new_file, enable);
+  settings.set_shortcut (m_new_function_action, sc_main_file_new_function, enable);
+  settings.set_shortcut (m_new_figure_action, sc_main_file_new_figure, enable);
+  settings.set_shortcut (m_load_workspace_action, sc_main_file_load_workspace, enable);
+  settings.set_shortcut (m_save_workspace_action, sc_main_file_save_workspace, enable);
+  settings.set_shortcut (m_exit_action, sc_main_file_exit, enable);
+
+  // edit menu
+  settings.set_shortcut (m_copy_action, sc_main_edit_copy, enable);
+  settings.set_shortcut (m_paste_action, sc_main_edit_paste, enable);
+  settings.set_shortcut (m_undo_action, sc_main_edit_undo, enable);
+  settings.set_shortcut (m_select_all_action, sc_main_edit_select_all, enable);
+  settings.set_shortcut (m_clear_clipboard_action, sc_main_edit_clear_clipboard, enable);
+  settings.set_shortcut (m_find_files_action, sc_main_edit_find_in_files, enable);
+  settings.set_shortcut (m_clear_command_history_action, sc_main_edit_clear_history, enable);
+  settings.set_shortcut (m_clear_command_window_action, sc_main_edit_clear_command_window, enable);
+  settings.set_shortcut (m_clear_workspace_action, sc_main_edit_clear_workspace, enable);
+  settings.set_shortcut (m_set_path_action, sc_main_edit_set_path, enable);
+  settings.set_shortcut (m_preferences_action, sc_main_edit_preferences, enable);
+
+  // debug menu
+  settings.set_shortcut (m_debug_step_over, sc_main_debug_step_over, enable);
+  settings.set_shortcut (m_debug_step_into, sc_main_debug_step_into, enable);
+  settings.set_shortcut (m_debug_step_out, sc_main_debug_step_out, enable);
+  settings.set_shortcut (m_debug_continue, sc_main_debug_continue, enable);
+  settings.set_shortcut (m_debug_quit, sc_main_debug_quit, enable);
+
+  // tools menu
+  settings.set_shortcut (m_profiler_start, sc_main_tools_start_profiler, enable);
+  settings.set_shortcut (m_profiler_resume, sc_main_tools_resume_profiler, enable);
+  settings.set_shortcut (m_profiler_stop, sc_main_tools_start_profiler, enable); // same, toggling
+  settings.set_shortcut (m_profiler_show, sc_main_tools_show_profiler, enable);
+
+  // window menu
+  settings.set_shortcut (m_show_command_window_action, sc_main_window_show_command, enable);
+  settings.set_shortcut (m_show_history_action, sc_main_window_show_history, enable);
+  settings.set_shortcut (m_show_workspace_action, sc_main_window_show_workspace, enable);
+  settings.set_shortcut (m_show_file_browser_action, sc_main_window_show_file_browser, enable);
+  settings.set_shortcut (m_show_editor_action, sc_main_window_show_editor, enable);
+  settings.set_shortcut (m_show_documentation_action, sc_main_window_show_doc, enable);
+  settings.set_shortcut (m_show_variable_editor_action, sc_main_window_show_variable_editor, enable);
+  settings.set_shortcut (m_reset_windows_action, sc_main_window_reset, enable);
+  settings.set_shortcut (m_command_window_action, sc_main_window_command, enable);
+  // Switching to the other widgets (including the previous one) is always enabled
+  settings.set_shortcut (m_history_action, sc_main_window_history, true);
+  settings.set_shortcut (m_workspace_action, sc_main_window_workspace, true);
+  settings.set_shortcut (m_file_browser_action, sc_main_window_file_browser, true);
+  settings.set_shortcut (m_editor_action, sc_main_window_editor, true);
+  settings.set_shortcut (m_documentation_action, sc_main_window_doc, true);
+  settings.set_shortcut (m_variable_editor_action, sc_main_window_variable_editor, true);
+  settings.set_shortcut (m_previous_dock_action, sc_main_window_previous_dock, true);
+
+  // help menu
+  settings.set_shortcut (m_ondisk_doc_action, sc_main_help_ondisk_doc, enable);
+  settings.set_shortcut (m_online_doc_action, sc_main_help_online_doc, enable);
+  settings.set_shortcut (m_report_bug_action, sc_main_help_report_bug, enable);
+  settings.set_shortcut (m_octave_packages_action, sc_main_help_packages, enable);
+  settings.set_shortcut (m_contribute_action, sc_main_help_contribute, enable);
+  settings.set_shortcut (m_developer_action, sc_main_help_developer, enable);
+  settings.set_shortcut (m_about_octave_action, sc_main_help_about, enable);
+
+  // news menu
+  settings.set_shortcut (m_release_notes_action, sc_main_news_release_notes, enable);
+  settings.set_shortcut (m_current_news_action, sc_main_news_community_news, enable);
+}
+
+QList<octave_dock_widget *> main_window::dock_widget_list ()
+{
+  QList<octave_dock_widget *> list = QList<octave_dock_widget *> ();
+  list.append (static_cast<octave_dock_widget *> (m_command_window));
+  list.append (static_cast<octave_dock_widget *> (m_history_window));
+  list.append (static_cast<octave_dock_widget *> (m_file_browser_window));
+  list.append (static_cast<octave_dock_widget *> (m_doc_browser_window));
 #if defined (HAVE_QSCINTILLA)
-    list.append (static_cast<octave_dock_widget *> (m_editor_window));
+  list.append (static_cast<octave_dock_widget *> (m_editor_window));
 #endif
-    list.append (static_cast<octave_dock_widget *> (m_workspace_window));
-    list.append (static_cast<octave_dock_widget *> (m_variable_editor_window));
-    return list;
-  }
-
-  void main_window::update_default_encoding (const QString& default_encoding)
-  {
-    m_default_encoding = default_encoding;
-    std::string mfile_encoding = m_default_encoding.toStdString ();
-    if (m_default_encoding.startsWith ("SYSTEM", Qt::CaseInsensitive))
-      mfile_encoding = "SYSTEM";
-
-    emit interpreter_event
-      ([=] (interpreter& interp)
-       {
-         // INTERPRETER THREAD
-
-         F__mfile_encoding__ (interp, ovl (mfile_encoding));
-       });
-  }
-
-  void main_window::resize_dock (QDockWidget *dw, int width, int height)
-  {
-    // resizeDockWidget was added to Qt in Qt 5.6
-    if (width >= 0)
-      resizeDocks ({dw}, {width}, Qt::Horizontal);
-    if (height >= 0)
-      resizeDocks ({dw}, {height}, Qt::Vertical);
-  }
-
-  // The default main window size relative to the desktop size
-  void main_window::set_default_geometry ()
-  {
-    int win_x, win_y;
-    get_screen_geometry (win_x, win_y);
-
-    move (0, 0);
-    resize (2*win_x/3, 7*win_y/8);
-  }
-
-  void main_window::reset_windows ()
-  {
-    // Slot for resetting the window layout to the default one
-    hide ();
-    showNormal ();              // Unmaximize
-    do_reset_windows (true, true, true);   // Add all widgets
-
-    // Re-add after giving time: This seems to be a reliable way to
-    // reset the main window's layout
-
-    // JWE says: The following also works for me with 0 delay, so I
-    // think the problem might just be that the event loop needs to run
-    // somewhere in the sequence of resizing and adding widgets.  Maybe
-    // some actions in do_reset_windows should be using signal/slot
-    // connections so that the event loop can do what it needs to do.
-    // But I haven't been able to find the magic sequence.
-
-    QTimer::singleShot (250, this, [=] () { do_reset_windows (true, true, true); });
-  }
-
-  // Create the default layout of the main window. Do not use
-  // restoreState () and restoreGeometry () with default values since
-  // this might lead to problems when the Qt version changes
-  void main_window::do_reset_windows (bool show, bool save, bool force_all)
-  {
-    // Set main window default geometry and store its width for
-    // later resizing the command window
-    set_default_geometry ();
-    int win_x = geometry ().width ();
-
-    // Resize command window (if docked),
-    //the important one in the default layout
-    if (dockWidgetArea (m_command_window) != Qt::NoDockWidgetArea)
-      resize_dock (m_command_window, 7*win_x/8, -1);
-
-    // See Octave bug #53409 and https://bugreports.qt.io/browse/QTBUG-55357
+  list.append (static_cast<octave_dock_widget *> (m_workspace_window));
+  list.append (static_cast<octave_dock_widget *> (m_variable_editor_window));
+  return list;
+}
+
+void main_window::update_default_encoding (const QString& default_encoding)
+{
+  m_default_encoding = default_encoding;
+  std::string mfile_encoding = m_default_encoding.toStdString ();
+  if (m_default_encoding.startsWith ("SYSTEM", Qt::CaseInsensitive))
+    mfile_encoding = "SYSTEM";
+
+  emit interpreter_event
+    ([=] (interpreter& interp)
+     {
+       // INTERPRETER THREAD
+
+       F__mfile_encoding__ (interp, ovl (mfile_encoding));
+     });
+}
+
+void main_window::resize_dock (QDockWidget *dw, int width, int height)
+{
+  // resizeDockWidget was added to Qt in Qt 5.6
+  if (width >= 0)
+    resizeDocks ({dw}, {width}, Qt::Horizontal);
+  if (height >= 0)
+    resizeDocks ({dw}, {height}, Qt::Vertical);
+}
+
+// The default main window size relative to the desktop size
+void main_window::set_default_geometry ()
+{
+  int win_x, win_y;
+  get_screen_geometry (win_x, win_y);
+
+  move (0, 0);
+  resize (2*win_x/3, 7*win_y/8);
+}
+
+void main_window::reset_windows ()
+{
+  // Slot for resetting the window layout to the default one
+  hide ();
+  showNormal ();              // Unmaximize
+  do_reset_windows (true, true, true);   // Add all widgets
+
+  // Re-add after giving time: This seems to be a reliable way to
+  // reset the main window's layout
+
+  // JWE says: The following also works for me with 0 delay, so I
+  // think the problem might just be that the event loop needs to run
+  // somewhere in the sequence of resizing and adding widgets.  Maybe
+  // some actions in do_reset_windows should be using signal/slot
+  // connections so that the event loop can do what it needs to do.
+  // But I haven't been able to find the magic sequence.
+
+  QTimer::singleShot (250, this, [=] () { do_reset_windows (true, true, true); });
+}
+
+// Create the default layout of the main window. Do not use
+// restoreState () and restoreGeometry () with default values since
+// this might lead to problems when the Qt version changes
+void main_window::do_reset_windows (bool show, bool save, bool force_all)
+{
+  // Set main window default geometry and store its width for
+  // later resizing the command window
+  set_default_geometry ();
+  int win_x = geometry ().width ();
+
+  // Resize command window (if docked),
+  //the important one in the default layout
+  if (dockWidgetArea (m_command_window) != Qt::NoDockWidgetArea)
+    resize_dock (m_command_window, 7*win_x/8, -1);
+
+  // See Octave bug #53409 and https://bugreports.qt.io/browse/QTBUG-55357
 #if (QT_VERSION < 0x050601) || (QT_VERSION >= 0x050701)
-    setDockOptions (QMainWindow::AnimatedDocks
-                    | QMainWindow::AllowNestedDocks
-                    | QMainWindow::AllowTabbedDocks);
+  setDockOptions (QMainWindow::AnimatedDocks
+                  | QMainWindow::AllowNestedDocks
+                  | QMainWindow::AllowTabbedDocks);
 #else
-    setDockNestingEnabled (true);
+  setDockNestingEnabled (true);
 #endif
 
-    // Add the dock widgets and show them
-    if (! m_file_browser_window->adopted () || force_all)
-      {
-        // FIXME: Maybe there should be a main_window::add_dock_widget
-        // function that combines both of these actions?
-
-        addDockWidget (Qt::LeftDockWidgetArea, m_file_browser_window);
-        m_file_browser_window->set_adopted (false);
-      }
-
-    if (! m_workspace_window->adopted () || force_all)
-      {
-        addDockWidget (Qt::LeftDockWidgetArea, m_workspace_window);
-        m_workspace_window->set_adopted (false);
-      }
-
-    if (! m_history_window->adopted () || force_all)
-      {
-        addDockWidget (Qt::LeftDockWidgetArea, m_history_window);
-        m_history_window->set_adopted (false);
-      }
-
-    if (! m_command_window->adopted () || force_all)
-      {
-        addDockWidget (Qt::RightDockWidgetArea, m_command_window);
-        m_command_window->set_adopted (false);
-      }
-
-    if (! m_doc_browser_window->adopted () || force_all)
-      {
-        addDockWidget (Qt::RightDockWidgetArea, m_doc_browser_window);
-        tabifyDockWidget (m_command_window, m_doc_browser_window);
-        m_doc_browser_window->set_adopted (false);
-      }
-
-    if (! m_variable_editor_window->adopted () || force_all)
-      {
-        addDockWidget (Qt::RightDockWidgetArea, m_variable_editor_window);
-        tabifyDockWidget (m_command_window, m_variable_editor_window);
-        m_variable_editor_window->set_adopted (false);
-      }
+  // Add the dock widgets and show them
+  if (! m_file_browser_window->adopted () || force_all)
+    {
+      // FIXME: Maybe there should be a main_window::add_dock_widget
+      // function that combines both of these actions?
+
+      addDockWidget (Qt::LeftDockWidgetArea, m_file_browser_window);
+      m_file_browser_window->set_adopted (false);
+    }
+
+  if (! m_workspace_window->adopted () || force_all)
+    {
+      addDockWidget (Qt::LeftDockWidgetArea, m_workspace_window);
+      m_workspace_window->set_adopted (false);
+    }
+
+  if (! m_history_window->adopted () || force_all)
+    {
+      addDockWidget (Qt::LeftDockWidgetArea, m_history_window);
+      m_history_window->set_adopted (false);
+    }
+
+  if (! m_command_window->adopted () || force_all)
+    {
+      addDockWidget (Qt::RightDockWidgetArea, m_command_window);
+      m_command_window->set_adopted (false);
+    }
+
+  if (! m_doc_browser_window->adopted () || force_all)
+    {
+      addDockWidget (Qt::RightDockWidgetArea, m_doc_browser_window);
+      tabifyDockWidget (m_command_window, m_doc_browser_window);
+      m_doc_browser_window->set_adopted (false);
+    }
+
+  if (! m_variable_editor_window->adopted () || force_all)
+    {
+      addDockWidget (Qt::RightDockWidgetArea, m_variable_editor_window);
+      tabifyDockWidget (m_command_window, m_variable_editor_window);
+      m_variable_editor_window->set_adopted (false);
+    }
 
 #if defined (HAVE_QSCINTILLA)
-    addDockWidget (Qt::RightDockWidgetArea, m_editor_window);
-    tabifyDockWidget (m_command_window, m_editor_window);
+  addDockWidget (Qt::RightDockWidgetArea, m_editor_window);
+  tabifyDockWidget (m_command_window, m_editor_window);
 #endif
 
-    // Resize command window, the important one in the default layout
-    resize_dock (m_command_window, 2*win_x/3, -1);
-
-    // Show main wibdow, save state and geometry of main window and
-    // all dock widgets
-    if (show)
-      {
-        // Show all dock widgets
-        for (auto *widget : dock_widget_list ())
-          widget->show ();
-
-        // Show main window and store size and state
-        showNormal ();
-
-        if (save)
-          {
-            gui_settings settings;
-
-            settings.setValue (mw_geometry.settings_key (), saveGeometry ());
-            settings.setValue (mw_state.settings_key (), saveState ());
-          }
-
-        focus_command_window ();
-      }
-  }
+  // Resize command window, the important one in the default layout
+  resize_dock (m_command_window, 2*win_x/3, -1);
+
+  // Show main wibdow, save state and geometry of main window and
+  // all dock widgets
+  if (show)
+    {
+      // Show all dock widgets
+      for (auto *widget : dock_widget_list ())
+        widget->show ();
+
+      // Show main window and store size and state
+      showNormal ();
+
+      if (save)
+        {
+          gui_settings settings;
+
+          settings.setValue (mw_geometry.settings_key (), saveGeometry ());
+          settings.setValue (mw_state.settings_key (), saveState ());
+        }
+
+      focus_command_window ();
+    }
+}
 
 OCTAVE_END_NAMESPACE(octave)
--- a/libgui/src/main-window.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/main-window.h	Thu Feb 02 12:25:51 2023 -0800
@@ -62,385 +62,385 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class interpreter;
+class interpreter;
 
-  class base_qobject;
-  class settings_dialog;
+class base_qobject;
+class settings_dialog;
 
-  //! Represents the main window.
+//! Represents the main window.
 
-  class main_window : public QMainWindow
-  {
-    Q_OBJECT
+class main_window : public QMainWindow
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    typedef std::pair <std::string, std::string> name_pair;
-    typedef std::pair <int, int> int_pair;
+  typedef std::pair <std::string, std::string> name_pair;
+  typedef std::pair <int, int> int_pair;
 
-    main_window (base_qobject& oct_qobj);
+  main_window (base_qobject& oct_qobj);
 
-    ~main_window ();
+  ~main_window ();
 
-    void make_dock_widget_connections (octave_dock_widget *dw);
+  void make_dock_widget_connections (octave_dock_widget *dw);
 
-    bool command_window_has_focus () const;
+  bool command_window_has_focus () const;
 
-    void focus_command_window ();
+  void focus_command_window ();
 
-    bool confirm_shutdown ();
+  bool confirm_shutdown ();
 
-  signals:
+signals:
 
-    // Note: CLOSE_GUI_SIGNAL is currently only used by the new
-    // experimental terminal widget.
-    void close_gui_signal ();
+  // Note: CLOSE_GUI_SIGNAL is currently only used by the new
+  // experimental terminal widget.
+  void close_gui_signal ();
 
-    void active_dock_changed (octave_dock_widget *, octave_dock_widget *);
-    void editor_focus_changed (bool);
+  void active_dock_changed (octave_dock_widget *, octave_dock_widget *);
+  void editor_focus_changed (bool);
 
-    void settings_changed ();
-    void init_terminal_size_signal ();
-    void init_window_menu ();
-    void new_file_signal (const QString&);
-    void open_file_signal (const QString&);
-    void open_file_signal (const QString& file, const QString& enc, int line);
-    void step_into_file_signal ();
+  void settings_changed ();
+  void init_terminal_size_signal ();
+  void init_window_menu ();
+  void new_file_signal (const QString&);
+  void open_file_signal (const QString&);
+  void open_file_signal (const QString& file, const QString& enc, int line);
+  void step_into_file_signal ();
 
-    void show_community_news_signal (int serial);
-    void show_release_notes_signal ();
+  void show_community_news_signal (int serial);
+  void show_release_notes_signal ();
 
-    void update_gui_lexer_signal (bool);
+  void update_gui_lexer_signal (bool);
 
-    void insert_debugger_pointer_signal (const QString& file, int line);
-    void delete_debugger_pointer_signal (const QString& file, int line);
-    void update_breakpoint_marker_signal (bool insert, const QString& file,
-                                          int line, const QString& cond);
+  void insert_debugger_pointer_signal (const QString& file, int line);
+  void delete_debugger_pointer_signal (const QString& file, int line);
+  void update_breakpoint_marker_signal (bool insert, const QString& file,
+                                        int line, const QString& cond);
 
-    void copyClipboard_signal ();
-    void pasteClipboard_signal ();
-    void selectAll_signal ();
-    void undo_signal ();
+  void copyClipboard_signal ();
+  void pasteClipboard_signal ();
+  void selectAll_signal ();
+  void undo_signal ();
 
-    void add_actions_signal (QList <QAction *> action_list);
+  void add_actions_signal (QList <QAction *> action_list);
 
-    void warning_function_not_found_signal (const QString& message);
+  void warning_function_not_found_signal (const QString& message);
 
-    void interpreter_event (const fcn_callback& fcn);
-    void interpreter_event (const meth_callback& meth);
+  void interpreter_event (const fcn_callback& fcn);
+  void interpreter_event (const meth_callback& meth);
 
-    void execute_command_signal (const QString& command);
+  void execute_command_signal (const QString& command);
 
-    void update_prompt_signal (const QString& prompt);
+  void update_prompt_signal (const QString& prompt);
 
-  public slots:
+public slots:
 
-    void focus_changed (QWidget *w_old, QWidget *w_new);
-    void focus_window (const QString& win_name);
-    void request_reload_settings ();
+  void focus_changed (QWidget *w_old, QWidget *w_new);
+  void focus_window (const QString& win_name);
+  void request_reload_settings ();
 
-    void report_status_message (const QString& statusMessage);
-    void handle_save_workspace_request ();
-    void handle_load_workspace_request (const QString& file = QString ());
-    void handle_open_any_request (const QString& file = QString ());
-    void handle_clear_workspace_request ();
-    void handle_clear_command_window_request ();
-    void handle_clear_history_request ();
-    void handle_undo_request ();
-    void modify_path (const QStringList& dir_list, bool rm, bool subdirs);
-    void edit_mfile (const QString&, int);
-    void file_remove_proxy (const QString& o, const QString& n);
-    void open_online_documentation_page ();
-    void open_bug_tracker_page ();
-    void open_octave_packages_page ();
-    void open_contribute_page ();
-    void open_donate_page ();
-    void process_settings_dialog_request (const QString& desired_tab
-                                          = QString ());
-    void show_about_octave ();
-    void notice_settings (bool update_by_worker = false);
-    QPalette getFusionDarkPalette();
-    void prepare_to_exit ();
-    void go_to_previous_widget ();
-    void reset_windows ();
-    void do_reset_windows (bool show = true, bool save = true,
-                           bool force_all = false);
+  void report_status_message (const QString& statusMessage);
+  void handle_save_workspace_request ();
+  void handle_load_workspace_request (const QString& file = QString ());
+  void handle_open_any_request (const QString& file = QString ());
+  void handle_clear_workspace_request ();
+  void handle_clear_command_window_request ();
+  void handle_clear_history_request ();
+  void handle_undo_request ();
+  void modify_path (const QStringList& dir_list, bool rm, bool subdirs);
+  void edit_mfile (const QString&, int);
+  void file_remove_proxy (const QString& o, const QString& n);
+  void open_online_documentation_page ();
+  void open_bug_tracker_page ();
+  void open_octave_packages_page ();
+  void open_contribute_page ();
+  void open_donate_page ();
+  void process_settings_dialog_request (const QString& desired_tab
+                                        = QString ());
+  void show_about_octave ();
+  void notice_settings (bool update_by_worker = false);
+  QPalette getFusionDarkPalette();
+  void prepare_to_exit ();
+  void go_to_previous_widget ();
+  void reset_windows ();
+  void do_reset_windows (bool show = true, bool save = true,
+                         bool force_all = false);
 
-    void update_octave_directory (const QString& dir);
-    void browse_for_directory ();
-    void set_current_working_directory (const QString& dir);
-    void change_directory_up ();
-    void accept_directory_line_edit ();
+  void update_octave_directory (const QString& dir);
+  void browse_for_directory ();
+  void set_current_working_directory (const QString& dir);
+  void change_directory_up ();
+  void accept_directory_line_edit ();
 
-    void execute_command_in_terminal (const QString& dir);
-    void run_file_in_terminal (const QFileInfo& info);
+  void execute_command_in_terminal (const QString& dir);
+  void run_file_in_terminal (const QFileInfo& info);
 
-    void handle_new_figure_request ();
+  void handle_new_figure_request ();
 
-    void handle_enter_debugger ();
-    void handle_exit_debugger ();
-    void debug_continue ();
-    void debug_step_into ();
-    void debug_step_over ();
-    void debug_step_out ();
-    void debug_quit ();
-    void editor_tabs_changed (bool, bool);
+  void handle_enter_debugger ();
+  void handle_exit_debugger ();
+  void debug_continue ();
+  void debug_step_into ();
+  void debug_step_over ();
+  void debug_step_out ();
+  void debug_quit ();
+  void editor_tabs_changed (bool, bool);
 
-    void request_open_file ();
-    void request_new_script (const QString& commands = QString ());
-    void request_new_function (bool triggered = true);
-    void handle_edit_mfile_request (const QString& name, const QString& file,
-                                    const QString& curr_dir, int line);
+  void request_open_file ();
+  void request_new_script (const QString& commands = QString ());
+  void request_new_function (bool triggered = true);
+  void handle_edit_mfile_request (const QString& name, const QString& file,
+                                  const QString& curr_dir, int line);
 
-    void handle_insert_debugger_pointer_request (const QString& file, int line);
-    void handle_delete_debugger_pointer_request (const QString& file, int line);
-    void handle_update_breakpoint_marker_request (bool insert,
-                                                  const QString& file, int line,
-                                                  const QString& cond);
+  void handle_insert_debugger_pointer_request (const QString& file, int line);
+  void handle_delete_debugger_pointer_request (const QString& file, int line);
+  void handle_update_breakpoint_marker_request (bool insert,
+                                                const QString& file, int line,
+                                                const QString& cond);
 
-    void read_settings ();
-    void init_terminal_size ();
-    void set_window_layout ();
-    void write_settings ();
+  void read_settings ();
+  void init_terminal_size ();
+  void set_window_layout ();
+  void write_settings ();
 
-    void copyClipboard ();
-    void pasteClipboard ();
-    void selectAll ();
+  void copyClipboard ();
+  void pasteClipboard ();
+  void selectAll ();
 
-    void handle_gui_status_update (const QString& feature, const QString& status);
+  void handle_gui_status_update (const QString& feature, const QString& status);
 
-    void focus_console_after_command ();
+  void focus_console_after_command ();
 
-    void profiler_session ();
-    void profiler_session_resume ();
-    void profiler_stop ();
-    void handle_profiler_status_update (bool);
-    void profiler_show ();
+  void profiler_session ();
+  void profiler_session_resume ();
+  void profiler_stop ();
+  void handle_profiler_status_update (bool);
+  void profiler_show ();
 
-    void handle_octave_ready ();
+  void handle_octave_ready ();
 
-    void handle_set_path_dialog_request ();
+  void handle_set_path_dialog_request ();
 
-    //! Find files dialog.
-    //!@{
-    void find_files (const QString& startdir = QDir::currentPath ());
-    void find_files_finished (int) { }
-    //!@}
+  //! Find files dialog.
+  //!@{
+  void find_files (const QString& startdir = QDir::currentPath ());
+  void find_files_finished (int) { }
+  //!@}
 
-    void set_screen_size (int ht, int wd);
+  void set_screen_size (int ht, int wd);
 
-    //! Handling the clipboard.
-    //!@{
-    void clipboard_has_changed ();
-    void clear_clipboard ();
-    //!@}
+  //! Handling the clipboard.
+  //!@{
+  void clipboard_has_changed ();
+  void clear_clipboard ();
+  //!@}
 
-    //! Returns a list of dock widgets.
+  //! Returns a list of dock widgets.
 
-    QList<octave_dock_widget *> get_dock_widget_list ()
-    {
-      return dock_widget_list ();
-    }
+  QList<octave_dock_widget *> get_dock_widget_list ()
+  {
+    return dock_widget_list ();
+  }
 
-  private slots:
+private slots:
 
-    void disable_menu_shortcuts (bool disable);
-    void restore_create_file_setting ();
-    void set_file_encoding (const QString& new_encoding);
-    void request_open_files (const QStringList& open_file_names);
+  void disable_menu_shortcuts (bool disable);
+  void restore_create_file_setting ();
+  void set_file_encoding (const QString& new_encoding);
+  void request_open_files (const QStringList& open_file_names);
 
-    void warning_function_not_found (const QString& message);
+  void warning_function_not_found (const QString& message);
 
-  protected:
+protected:
 
-    void closeEvent (QCloseEvent *closeEvent);
+  void closeEvent (QCloseEvent *closeEvent);
 
-  private:
+private:
 
-    void adopt_dock_widgets ();
+  void adopt_dock_widgets ();
 
-    void adopt_terminal_widget ();
-    void adopt_documentation_widget ();
-    void adopt_file_browser_widget ();
-    void adopt_history_widget ();
-    void adopt_workspace_widget ();
-    void adopt_editor_widget ();
-    void adopt_variable_editor_widget ();
+  void adopt_terminal_widget ();
+  void adopt_documentation_widget ();
+  void adopt_file_browser_widget ();
+  void adopt_history_widget ();
+  void adopt_workspace_widget ();
+  void adopt_editor_widget ();
+  void adopt_variable_editor_widget ();
 
-    void construct_central_widget ();
+  void construct_central_widget ();
 
-    void construct ();
+  void construct ();
 
-    void construct_octave_qt_link ();
+  void construct_octave_qt_link ();
 
-    QAction * add_action (QMenu *menu, const QIcon& icon,
-                          const QString& text, const char *member,
-                          const QWidget *receiver = nullptr);
+  QAction * add_action (QMenu *menu, const QIcon& icon,
+                        const QString& text, const char *member,
+                        const QWidget *receiver = nullptr);
 
-    QMenu * m_add_menu (QMenuBar *p, QString text);
-    void construct_menu_bar ();
-    void construct_file_menu (QMenuBar *p);
-    void construct_new_menu (QMenu *p);
-    void construct_edit_menu (QMenuBar *p);
-    QAction * construct_debug_menu_item (const char *icon, const QString& item,
-                                         const char *member);
-    void construct_debug_menu (QMenuBar *p);
-    QAction * construct_window_menu_item (QMenu *p, const QString& item,
-                                          bool checkable, QWidget *);
-    void construct_tools_menu (QMenuBar *p);
-    void construct_window_menu (QMenuBar *p);
-    void construct_help_menu (QMenuBar *p);
-    void construct_documentation_menu (QMenu *p);
+  QMenu * m_add_menu (QMenuBar *p, QString text);
+  void construct_menu_bar ();
+  void construct_file_menu (QMenuBar *p);
+  void construct_new_menu (QMenu *p);
+  void construct_edit_menu (QMenuBar *p);
+  QAction * construct_debug_menu_item (const char *icon, const QString& item,
+                                       const char *member);
+  void construct_debug_menu (QMenuBar *p);
+  QAction * construct_window_menu_item (QMenu *p, const QString& item,
+                                        bool checkable, QWidget *);
+  void construct_tools_menu (QMenuBar *p);
+  void construct_window_menu (QMenuBar *p);
+  void construct_help_menu (QMenuBar *p);
+  void construct_documentation_menu (QMenu *p);
 
-    void construct_news_menu (QMenuBar *p);
+  void construct_news_menu (QMenuBar *p);
 
-    void construct_tool_bar ();
+  void construct_tool_bar ();
 
-    void configure_shortcuts ();
+  void configure_shortcuts ();
 
-    QList<octave_dock_widget *> dock_widget_list ();
+  QList<octave_dock_widget *> dock_widget_list ();
 
-    void update_default_encoding (const QString& default_encoding);
+  void update_default_encoding (const QString& default_encoding);
 
-    void set_default_geometry ();
-    void resize_dock (QDockWidget *dw, int width, int height);
+  void set_default_geometry ();
+  void resize_dock (QDockWidget *dw, int width, int height);
 
-    base_qobject& m_octave_qobj;
+  base_qobject& m_octave_qobj;
 
-    QHash<QMenu *, QStringList> m_hash_menu_text;
+  QHash<QMenu *, QStringList> m_hash_menu_text;
 
-    QString m_default_encoding;
+  QString m_default_encoding;
 
-    QString m_default_style;
-    QPalette m_default_palette;
+  QString m_default_style;
+  QPalette m_default_palette;
 
-    //! Toolbar.
+  //! Toolbar.
 
-    QStatusBar *m_status_bar;
-    led_indicator *m_profiler_status_indicator;
+  QStatusBar *m_status_bar;
+  led_indicator *m_profiler_status_indicator;
 
-    //! Dock widgets.
-    //!@{
-    QPointer<terminal_dock_widget> m_command_window;
-    QPointer<history_dock_widget> m_history_window;
-    QPointer<files_dock_widget> m_file_browser_window;
-    QPointer<documentation_dock_widget> m_doc_browser_window;
-    QPointer<file_editor_interface> m_editor_window;
-    QPointer<workspace_view> m_workspace_window;
-    QPointer<variable_editor> m_variable_editor_window;
-    //!@}
+  //! Dock widgets.
+  //!@{
+  QPointer<terminal_dock_widget> m_command_window;
+  QPointer<history_dock_widget> m_history_window;
+  QPointer<files_dock_widget> m_file_browser_window;
+  QPointer<documentation_dock_widget> m_doc_browser_window;
+  QPointer<file_editor_interface> m_editor_window;
+  QPointer<workspace_view> m_workspace_window;
+  QPointer<variable_editor> m_variable_editor_window;
+  //!@}
 
-    external_editor_interface *m_external_editor;
-    QWidget *m_active_editor;
+  external_editor_interface *m_external_editor;
+  QWidget *m_active_editor;
 
-    octave_dock_widget *m_previous_dock;
-    octave_dock_widget *m_active_dock;
+  octave_dock_widget *m_previous_dock;
+  octave_dock_widget *m_active_dock;
 
-    QToolBar *m_main_tool_bar;
+  QToolBar *m_main_tool_bar;
 
-    QMenu *m_debug_menu;
+  QMenu *m_debug_menu;
 
-    QMenuBar *m_editor_menubar;
+  QMenuBar *m_editor_menubar;
 
-    QAction *m_debug_continue;
-    QAction *m_debug_step_into;
-    QAction *m_debug_step_over;
-    QAction *m_debug_step_out;
-    QAction *m_debug_quit;
+  QAction *m_debug_continue;
+  QAction *m_debug_step_into;
+  QAction *m_debug_step_over;
+  QAction *m_debug_step_out;
+  QAction *m_debug_quit;
 
-    QAction *m_new_script_action;
-    QAction *m_new_function_action;
-    QAction *m_open_action;
-    QAction *m_new_figure_action;
-    QAction *m_load_workspace_action;
-    QAction *m_save_workspace_action;
-    QAction *m_set_path_action;
-    QAction *m_preferences_action;
-    QAction *m_exit_action;
+  QAction *m_new_script_action;
+  QAction *m_new_function_action;
+  QAction *m_open_action;
+  QAction *m_new_figure_action;
+  QAction *m_load_workspace_action;
+  QAction *m_save_workspace_action;
+  QAction *m_set_path_action;
+  QAction *m_preferences_action;
+  QAction *m_exit_action;
 
-    QAction *m_copy_action;
-    QAction *m_paste_action;
-    QAction *m_clear_clipboard_action;
-    QAction *m_undo_action;
-    QAction *m_clear_command_window_action;
-    QAction *m_clear_command_history_action;
-    QAction *m_clear_workspace_action;
-    QAction *m_find_files_action;
-    QAction *m_select_all_action;
+  QAction *m_copy_action;
+  QAction *m_paste_action;
+  QAction *m_clear_clipboard_action;
+  QAction *m_undo_action;
+  QAction *m_clear_command_window_action;
+  QAction *m_clear_command_history_action;
+  QAction *m_clear_workspace_action;
+  QAction *m_find_files_action;
+  QAction *m_select_all_action;
 
-    QAction *m_profiler_start;
-    QAction *m_profiler_resume;
-    QAction *m_profiler_stop;
-    QAction *m_profiler_show;
+  QAction *m_profiler_start;
+  QAction *m_profiler_resume;
+  QAction *m_profiler_stop;
+  QAction *m_profiler_show;
 
-    QAction *m_show_command_window_action;
-    QAction *m_show_history_action;
-    QAction *m_show_workspace_action;
-    QAction *m_show_file_browser_action;
-    QAction *m_show_editor_action;
-    QAction *m_show_documentation_action;
-    QAction *m_show_variable_editor_action;
-    QAction *m_command_window_action;
-    QAction *m_history_action;
-    QAction *m_workspace_action;
-    QAction *m_file_browser_action;
-    QAction *m_editor_action;
-    QAction *m_documentation_action;
-    QAction *m_variable_editor_action;
-    QAction *m_previous_dock_action;
-    QAction *m_reset_windows_action;
+  QAction *m_show_command_window_action;
+  QAction *m_show_history_action;
+  QAction *m_show_workspace_action;
+  QAction *m_show_file_browser_action;
+  QAction *m_show_editor_action;
+  QAction *m_show_documentation_action;
+  QAction *m_show_variable_editor_action;
+  QAction *m_command_window_action;
+  QAction *m_history_action;
+  QAction *m_workspace_action;
+  QAction *m_file_browser_action;
+  QAction *m_editor_action;
+  QAction *m_documentation_action;
+  QAction *m_variable_editor_action;
+  QAction *m_previous_dock_action;
+  QAction *m_reset_windows_action;
 
-    QAction *m_ondisk_doc_action;
-    QAction *m_online_doc_action;
-    QAction *m_report_bug_action;
-    QAction *m_octave_packages_action;
-    QAction *m_contribute_action;
-    QAction *m_developer_action;
-    QAction *m_about_octave_action;
+  QAction *m_ondisk_doc_action;
+  QAction *m_online_doc_action;
+  QAction *m_report_bug_action;
+  QAction *m_octave_packages_action;
+  QAction *m_contribute_action;
+  QAction *m_developer_action;
+  QAction *m_about_octave_action;
 
-    QAction *m_release_notes_action;
-    QAction *m_current_news_action;
+  QAction *m_release_notes_action;
+  QAction *m_current_news_action;
 
-    //! For Toolbars.
-    //!@{
-    QComboBox *m_current_directory_combo_box;
-    static const int current_directory_max_visible = 16;
-    static const int current_directory_max_count = 16;
-    QLineEdit *m_current_directory_line_edit;
-    //!@}
+  //! For Toolbars.
+  //!@{
+  QComboBox *m_current_directory_combo_box;
+  static const int current_directory_max_visible = 16;
+  static const int current_directory_max_count = 16;
+  QLineEdit *m_current_directory_line_edit;
+  //!@}
 
-    //! Settings dialog as guarded pointer (set to 0 when deleted).
+  //! Settings dialog as guarded pointer (set to 0 when deleted).
 
-    QPointer<settings_dialog> m_settings_dlg;
+  QPointer<settings_dialog> m_settings_dlg;
 
-    //! Find files dialog.
+  //! Find files dialog.
 
-    find_files_dialog *m_find_files_dlg;
+  find_files_dialog *m_find_files_dlg;
 
-    //! Set path dialog
-    QPointer<set_path_dialog> m_set_path_dlg;
+  //! Set path dialog
+  QPointer<set_path_dialog> m_set_path_dlg;
 
-    //! Release notes window.
+  //! Release notes window.
 
-    QWidget *m_release_notes_window;
+  QWidget *m_release_notes_window;
 
-    QClipboard *m_clipboard;
+  QClipboard *m_clipboard;
 
-    //! Some class global flags.
-    //!@{
-    bool m_prevent_readline_conflicts;
-    bool m_prevent_readline_conflicts_menu;
-    bool m_suppress_dbg_location;
-    bool m_editor_has_tabs;
-    bool m_editor_is_octave_file;
+  //! Some class global flags.
+  //!@{
+  bool m_prevent_readline_conflicts;
+  bool m_prevent_readline_conflicts_menu;
+  bool m_suppress_dbg_location;
+  bool m_editor_has_tabs;
+  bool m_editor_is_octave_file;
 
-    //! Flag for closing the whole application.
+  //! Flag for closing the whole application.
 
-    bool m_closing;
-    //!@}
+  bool m_closing;
+  //!@}
 
-    QString m_file_encoding;
-  };
+  QString m_file_encoding;
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/src/news-reader.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/news-reader.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -41,106 +41,106 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  void news_reader::process ()
-  {
-    QString html_text;
+void news_reader::process ()
+{
+  QString html_text;
 
-    if (m_connect_to_web)
-      {
-        // Run this part in a separate thread so Octave can continue to
-        // run while we wait for the page to load.  Then emit the signal
-        // to display it when we have the page contents.
+  if (m_connect_to_web)
+    {
+      // Run this part in a separate thread so Octave can continue to
+      // run while we wait for the page to load.  Then emit the signal
+      // to display it when we have the page contents.
 
-        QString url = m_base_url + '/' + m_page;
-        std::ostringstream buf;
-        url_transfer octave_dot_org (url.toStdString (), buf);
+      QString url = m_base_url + '/' + m_page;
+      std::ostringstream buf;
+      url_transfer octave_dot_org (url.toStdString (), buf);
 
-        if (octave_dot_org.is_valid ())
-          {
-            Array<std::string> param;
-            octave_dot_org.http_get (param);
+      if (octave_dot_org.is_valid ())
+        {
+          Array<std::string> param;
+          octave_dot_org.http_get (param);
 
-            if (octave_dot_org.good ())
-              html_text = QString::fromStdString (buf.str ());
-          }
+          if (octave_dot_org.good ())
+            html_text = QString::fromStdString (buf.str ());
+        }
 
-        if (html_text.contains ("this-is-the-gnu-octave-community-news-page"))
-          {
-            if (m_serial >= 0)
-              {
-                gui_settings settings;
+      if (html_text.contains ("this-is-the-gnu-octave-community-news-page"))
+        {
+          if (m_serial >= 0)
+            {
+              gui_settings settings;
 
-                settings.setValue (nr_last_time.settings_key (),
-                                   QDateTime::currentDateTime ());
+              settings.setValue (nr_last_time.settings_key (),
+                                 QDateTime::currentDateTime ());
 
-                settings.sync ();
+              settings.sync ();
 
-                QString tag ("community-news-page-serial=");
+              QString tag ("community-news-page-serial=");
 
-                int b = html_text.indexOf (tag);
+              int b = html_text.indexOf (tag);
 
-                if (b)
-                  {
-                    b += tag.length ();
+              if (b)
+                {
+                  b += tag.length ();
 
-                    int e = html_text.indexOf ("\n", b);
+                  int e = html_text.indexOf ("\n", b);
 
-                    QString tmp = html_text.mid (b, e-b);
+                  QString tmp = html_text.mid (b, e-b);
 
-                    int curr_page_serial = tmp.toInt ();
+                  int curr_page_serial = tmp.toInt ();
 
-                    if (curr_page_serial > m_serial)
-                      {
-                        settings.setValue (nr_last_news.settings_key (), curr_page_serial);
-                        settings.sync ();
-                      }
-                    else
-                      return;
-                  }
-                else
-                  return;
-              }
-          }
-        else
-          html_text = QString
-            (tr ("<html>\n"
-                 "<body>\n"
-                 "<p>\n"
-                 "Octave's community news source seems to be unavailable.\n"
-                 "</p>\n"
-                 "<p>\n"
-                 "For the latest news, please check\n"
-                 "<a href=\"https://octave.org/community-news.html\">https://octave.org/community-news.html</a>\n"
-                 "when you have a connection to the web (link opens in an external browser).\n"
-                 "</p>\n"
-                 "<p>\n"
-                 "<small><em>&mdash; The Octave Developers, ") + OCTAVE_RELEASE_DATE + "</em></small>\n"
-             "</p>\n"
-             "</body>\n"
-             "</html>\n");
-      }
-    else
-      html_text = QString
-        (tr ("<html>\n"
-             "<body>\n"
-             "<p>\n"
-             "Connecting to the web to display the latest Octave Community news has been disabled.\n"
-             "</p>\n"
-             "<p>\n"
-             "For the latest news, please check\n"
-             "<a href=\"https://octave.org/community-news.html\">https://octave.org/community-news.html</a>\n"
-             "when you have a connection to the web (link opens in an external browser)\n"
-             "or enable web connections for news in Octave's network settings dialog.\n"
-             "</p>\n"
-             "<p>\n"
-             "<small><em>&mdash; The Octave Developers, ") + OCTAVE_RELEASE_DATE + "</em></small>\n"
-         "</p>\n"
-         "</body>\n"
-         "</html>\n");
+                  if (curr_page_serial > m_serial)
+                    {
+                      settings.setValue (nr_last_news.settings_key (), curr_page_serial);
+                      settings.sync ();
+                    }
+                  else
+                    return;
+                }
+              else
+                return;
+            }
+        }
+      else
+        html_text = QString
+          (tr ("<html>\n"
+               "<body>\n"
+               "<p>\n"
+               "Octave's community news source seems to be unavailable.\n"
+               "</p>\n"
+               "<p>\n"
+               "For the latest news, please check\n"
+               "<a href=\"https://octave.org/community-news.html\">https://octave.org/community-news.html</a>\n"
+               "when you have a connection to the web (link opens in an external browser).\n"
+               "</p>\n"
+               "<p>\n"
+               "<small><em>&mdash; The Octave Developers, ") + OCTAVE_RELEASE_DATE + "</em></small>\n"
+           "</p>\n"
+           "</body>\n"
+           "</html>\n");
+    }
+  else
+    html_text = QString
+      (tr ("<html>\n"
+           "<body>\n"
+           "<p>\n"
+           "Connecting to the web to display the latest Octave Community news has been disabled.\n"
+           "</p>\n"
+           "<p>\n"
+           "For the latest news, please check\n"
+           "<a href=\"https://octave.org/community-news.html\">https://octave.org/community-news.html</a>\n"
+           "when you have a connection to the web (link opens in an external browser)\n"
+           "or enable web connections for news in Octave's network settings dialog.\n"
+           "</p>\n"
+           "<p>\n"
+           "<small><em>&mdash; The Octave Developers, ") + OCTAVE_RELEASE_DATE + "</em></small>\n"
+       "</p>\n"
+       "</body>\n"
+       "</html>\n");
 
-    emit display_news_signal (html_text);
+  emit display_news_signal (html_text);
 
-    emit finished ();
-  }
+  emit finished ();
+}
 
 OCTAVE_END_NAMESPACE(octave)
--- a/libgui/src/news-reader.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/news-reader.h	Thu Feb 02 12:25:51 2023 -0800
@@ -31,35 +31,35 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class news_reader : public QObject
-  {
-    Q_OBJECT
+class news_reader : public QObject
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    news_reader (const QString& base_url, const QString& page,
-                 int serial = -1, bool connect_to_web = false)
-      : QObject (), m_base_url (base_url),
-        m_page (page), m_serial (serial), m_connect_to_web (connect_to_web)
-    { }
+  news_reader (const QString& base_url, const QString& page,
+               int serial = -1, bool connect_to_web = false)
+    : QObject (), m_base_url (base_url),
+      m_page (page), m_serial (serial), m_connect_to_web (connect_to_web)
+  { }
 
-  signals:
+signals:
 
-    void display_news_signal (const QString& news);
+  void display_news_signal (const QString& news);
 
-    void finished ();
+  void finished ();
 
-  public slots:
+public slots:
 
-    void process ();
+  void process ();
 
-  private:
+private:
 
-    QString m_base_url;
-    QString m_page;
-    int m_serial;
-    bool m_connect_to_web;
-  };
+  QString m_base_url;
+  QString m_page;
+  int m_serial;
+  bool m_connect_to_web;
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/src/octave-dock-widget.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/octave-dock-widget.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -48,780 +48,780 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  label_dock_widget::label_dock_widget (QWidget *p)
-    : QDockWidget (p), m_default_float_button (nullptr),
-      m_default_close_button (nullptr)
-  {
-    QStyle *st = style ();
-    m_icon_size = 0.75*st->pixelMetric (QStyle::PM_SmallIconSize);
+label_dock_widget::label_dock_widget (QWidget *p)
+  : QDockWidget (p), m_default_float_button (nullptr),
+    m_default_close_button (nullptr)
+{
+  QStyle *st = style ();
+  m_icon_size = 0.75*st->pixelMetric (QStyle::PM_SmallIconSize);
 
-    // keep track of the original buttons on the default title bar,
-    // the button further left is considered "float"
-    QList<QAbstractButton *> buttonlist = findChildren<QAbstractButton *> ();
-    if (buttonlist.size () == 2)
-      {
-        if (buttonlist.at (0)->x () < buttonlist.at (1)->x ())
-          {
-            m_default_float_button = buttonlist.at (0);
-            m_default_close_button = buttonlist.at (1);
-          }
-        else
-          {
-            m_default_float_button = buttonlist.at (1);
-            m_default_close_button = buttonlist.at (0);
-          }
-      }
+  // keep track of the original buttons on the default title bar,
+  // the button further left is considered "float"
+  QList<QAbstractButton *> buttonlist = findChildren<QAbstractButton *> ();
+  if (buttonlist.size () == 2)
+    {
+      if (buttonlist.at (0)->x () < buttonlist.at (1)->x ())
+        {
+          m_default_float_button = buttonlist.at (0);
+          m_default_close_button = buttonlist.at (1);
+        }
+      else
+        {
+          m_default_float_button = buttonlist.at (1);
+          m_default_close_button = buttonlist.at (0);
+        }
+    }
 
-    gui_settings settings;
+  gui_settings settings;
 
-    // the custom (extra) title bar of the widget
-    m_title_widget = new QWidget ();
+  // the custom (extra) title bar of the widget
+  m_title_widget = new QWidget ();
 
-    m_dock_action = new QAction
-      (settings.icon ("widget-undock", true), "", this);
-    m_dock_action->setToolTip (tr ("Undock widget"));
-    m_dock_button = new QToolButton (m_title_widget);
-    m_dock_button->setDefaultAction (m_dock_action);
-    m_dock_button->setFocusPolicy (Qt::NoFocus);
-    m_dock_button->setIconSize (QSize (m_icon_size, m_icon_size));
+  m_dock_action = new QAction
+    (settings.icon ("widget-undock", true), "", this);
+  m_dock_action->setToolTip (tr ("Undock widget"));
+  m_dock_button = new QToolButton (m_title_widget);
+  m_dock_button->setDefaultAction (m_dock_action);
+  m_dock_button->setFocusPolicy (Qt::NoFocus);
+  m_dock_button->setIconSize (QSize (m_icon_size, m_icon_size));
 
-    m_close_action = new QAction
-      (settings.icon ("widget-close", true), "", this);
-    m_close_action->setToolTip (tr ("Close widget"));
-    m_close_button = new QToolButton (m_title_widget);
-    m_close_button->setDefaultAction (m_close_action);
-    m_close_button->setFocusPolicy (Qt::NoFocus);
-    m_close_button->setIconSize (QSize (m_icon_size, m_icon_size));
+  m_close_action = new QAction
+    (settings.icon ("widget-close", true), "", this);
+  m_close_action->setToolTip (tr ("Close widget"));
+  m_close_button = new QToolButton (m_title_widget);
+  m_close_button->setDefaultAction (m_close_action);
+  m_close_button->setFocusPolicy (Qt::NoFocus);
+  m_close_button->setIconSize (QSize (m_icon_size, m_icon_size));
 
-    QString css_button = QString ("QToolButton {background: transparent; border: 0px;}");
-    m_dock_button->setStyleSheet (css_button);
-    m_close_button->setStyleSheet (css_button);
+  QString css_button = QString ("QToolButton {background: transparent; border: 0px;}");
+  m_dock_button->setStyleSheet (css_button);
+  m_close_button->setStyleSheet (css_button);
 
-    QHBoxLayout *h_layout = new QHBoxLayout ();
-    h_layout->addStretch (100);
-    h_layout->addWidget (m_dock_button);
-    h_layout->addWidget (m_close_button);
-    h_layout->setSpacing (10);
-    h_layout->setContentsMargins (5, 2, 2, 2);
+  QHBoxLayout *h_layout = new QHBoxLayout ();
+  h_layout->addStretch (100);
+  h_layout->addWidget (m_dock_button);
+  h_layout->addWidget (m_close_button);
+  h_layout->setSpacing (10);
+  h_layout->setContentsMargins (5, 2, 2, 2);
 
-    m_title_widget->setLayout (h_layout);
+  m_title_widget->setLayout (h_layout);
 
-    if (p && (p->objectName () == gui_obj_name_main_window))
-      {
-        // Only connect the when a parent (main window) is given
-        // copy & paste handling
-        connect (p, SIGNAL (copyClipboard_signal ()),
-                 this, SLOT (copyClipboard ()));
-        connect (p, SIGNAL (pasteClipboard_signal ()),
-                 this, SLOT (pasteClipboard ()));
-        connect (p, SIGNAL (selectAll_signal ()),
-                 this, SLOT (selectAll ()));
+  if (p && (p->objectName () == gui_obj_name_main_window))
+    {
+      // Only connect the when a parent (main window) is given
+      // copy & paste handling
+      connect (p, SIGNAL (copyClipboard_signal ()),
+               this, SLOT (copyClipboard ()));
+      connect (p, SIGNAL (pasteClipboard_signal ()),
+               this, SLOT (pasteClipboard ()));
+      connect (p, SIGNAL (selectAll_signal ()),
+               this, SLOT (selectAll ()));
 
-        // undo handling
-        connect (p, SIGNAL (undo_signal ()), this, SLOT (do_undo ()));
-      }
-  }
+      // undo handling
+      connect (p, SIGNAL (undo_signal ()), this, SLOT (do_undo ()));
+    }
+}
 
-  // set the title in the dockwidgets title bar
-  void
-  label_dock_widget::set_title (const QString& title)
-  {
-    QHBoxLayout *h_layout
-      = static_cast<QHBoxLayout *> (m_title_widget->layout ());
-    QLabel *label = new QLabel (title, m_title_widget);
-    label->setStyleSheet ("background-color: transparent;");
-    h_layout->insertWidget (0, label);
-    setTitleBarWidget (m_title_widget);
-    setWindowTitle (title);
-  }
+// set the title in the dockwidgets title bar
+void
+label_dock_widget::set_title (const QString& title)
+{
+  QHBoxLayout *h_layout
+    = static_cast<QHBoxLayout *> (m_title_widget->layout ());
+  QLabel *label = new QLabel (title, m_title_widget);
+  label->setStyleSheet ("background-color: transparent;");
+  h_layout->insertWidget (0, label);
+  setTitleBarWidget (m_title_widget);
+  setWindowTitle (title);
+}
 
-  static QString
-  qdockwidget_css (const QString& close_icon, const QString& close_tooltip,
-                   const QString& float_icon, const QString& float_tooltip,
-                   int icon_size, const QString& titlebar_foreground,
-                   const QString& titlebar_background)
-  {
-    return QString ("QDockWidget\n"
-                    "{\n"
-                    "%6"
-                    "  border: none;\n"
-                    "  titlebar-close-icon: url(%1);\n"
-                    "  titlebar-normal-icon: url(%2);\n"
-                    "}\n"
-                    "\n"
-                    "QDockWidget::close-button, QDockWidget::float-button\n"
-                    "{\n"
-                    "  border: none;\n"
-                    "  icon-size: %3px;\n"
-                    "}\n"
-                    "\n"
-                    "QAbstractButton#qt_dockwidget_closebutton\n"
-                    "{\n"
-                    "  qproperty-toolTip: \"%4\";\n"
-                    "}\n"
-                    "\n"
-                    "QAbstractButton#qt_dockwidget_floatbutton\n"
-                    "{\n"
-                    "  qproperty-toolTip: \"%5\";\n"
-                    "}\n"
-                    "\n"
-                    "QDockWidget::title {\n"
-                    "  text-align: left;\n"
-                    "%7"
-                    "  padding-left: 1px;\n"
-                    "}\n"
-                    "\n"
-                    "QDockWidget::close-button\n"
-                    "{\n"
-                    "  right: %8px;\n"
-                    "  top: 3px;\n"
-                    "}\n"
-                    "\n"
-                    "QDockWidget::float-button\n"
-                    "{\n"
-                    "  right: %9px;\n"
-                    "  top: 3px;\n"
-                    "}\n"
-                    ).arg (close_icon).arg (float_icon).arg (icon_size)
-                     .arg (close_tooltip).arg (float_tooltip)
-                     .arg (titlebar_foreground).arg (titlebar_background)
-                     .arg ((icon_size*2)/3).arg((icon_size*7)/3);
-  }
+static QString
+qdockwidget_css (const QString& close_icon, const QString& close_tooltip,
+                 const QString& float_icon, const QString& float_tooltip,
+                 int icon_size, const QString& titlebar_foreground,
+                 const QString& titlebar_background)
+{
+  return QString ("QDockWidget\n"
+                  "{\n"
+                  "%6"
+                  "  border: none;\n"
+                  "  titlebar-close-icon: url(%1);\n"
+                  "  titlebar-normal-icon: url(%2);\n"
+                  "}\n"
+                  "\n"
+                  "QDockWidget::close-button, QDockWidget::float-button\n"
+                  "{\n"
+                  "  border: none;\n"
+                  "  icon-size: %3px;\n"
+                  "}\n"
+                  "\n"
+                  "QAbstractButton#qt_dockwidget_closebutton\n"
+                  "{\n"
+                  "  qproperty-toolTip: \"%4\";\n"
+                  "}\n"
+                  "\n"
+                  "QAbstractButton#qt_dockwidget_floatbutton\n"
+                  "{\n"
+                  "  qproperty-toolTip: \"%5\";\n"
+                  "}\n"
+                  "\n"
+                  "QDockWidget::title {\n"
+                  "  text-align: left;\n"
+                  "%7"
+                  "  padding-left: 1px;\n"
+                  "}\n"
+                  "\n"
+                  "QDockWidget::close-button\n"
+                  "{\n"
+                  "  right: %8px;\n"
+                  "  top: 3px;\n"
+                  "}\n"
+                  "\n"
+                  "QDockWidget::float-button\n"
+                  "{\n"
+                  "  right: %9px;\n"
+                  "  top: 3px;\n"
+                  "}\n"
+                  ).arg (close_icon).arg (float_icon).arg (icon_size)
+                   .arg (close_tooltip).arg (float_tooltip)
+                   .arg (titlebar_foreground).arg (titlebar_background)
+                   .arg ((icon_size*2)/3).arg((icon_size*7)/3);
+}
 
-  octave_dock_widget::octave_dock_widget (const QString& obj_name, QWidget *p)
-    : label_dock_widget (p), m_main_window (nullptr),  m_adopted (false),
-      m_custom_style (false), m_focus_follows_mouse (false),
-      m_recent_float_geom (), m_recent_dock_geom (),
-      m_waiting_for_mouse_button_release (false)
-  {
-    setObjectName (obj_name);
+octave_dock_widget::octave_dock_widget (const QString& obj_name, QWidget *p)
+  : label_dock_widget (p), m_main_window (nullptr),  m_adopted (false),
+    m_custom_style (false), m_focus_follows_mouse (false),
+    m_recent_float_geom (), m_recent_dock_geom (),
+    m_waiting_for_mouse_button_release (false)
+{
+  setObjectName (obj_name);
 
-    // FIXME: Can we avoid the cast here?
-    m_main_window = dynamic_cast<main_window *> (p);
+  // FIXME: Can we avoid the cast here?
+  m_main_window = dynamic_cast<main_window *> (p);
 
-    m_predecessor_widget = nullptr;
+  m_predecessor_widget = nullptr;
 
-    connect (this, &octave_dock_widget::topLevelChanged,
-             this, &octave_dock_widget::toplevel_change);
-    connect (this, &octave_dock_widget::visibilityChanged,
-             this, &octave_dock_widget::handle_visibility);
+  connect (this, &octave_dock_widget::topLevelChanged,
+           this, &octave_dock_widget::toplevel_change);
+  connect (this, &octave_dock_widget::visibilityChanged,
+           this, &octave_dock_widget::handle_visibility);
 
-    if (m_default_float_button != nullptr)
-      {
-        disconnect (m_default_float_button, 0, 0, 0);
-        connect (m_default_float_button, &QAbstractButton::clicked,
-                 this, &octave_dock_widget::make_window);
-      }
-    connect (this, &octave_dock_widget::queue_make_window,
-             this, &octave_dock_widget::make_window, Qt::QueuedConnection);
-    connect (this, &octave_dock_widget::queue_make_widget,
-             this, [=] () { make_widget (); }, Qt::QueuedConnection);
+  if (m_default_float_button != nullptr)
+    {
+      disconnect (m_default_float_button, 0, 0, 0);
+      connect (m_default_float_button, &QAbstractButton::clicked,
+               this, &octave_dock_widget::make_window);
+    }
+  connect (this, &octave_dock_widget::queue_make_window,
+           this, &octave_dock_widget::make_window, Qt::QueuedConnection);
+  connect (this, &octave_dock_widget::queue_make_widget,
+           this, [=] () { make_widget (); }, Qt::QueuedConnection);
 
-    gui_settings settings;
+  gui_settings settings;
 
-    settings.set_shortcut (m_dock_action, sc_dock_widget_dock);
-    m_dock_action->setShortcutContext (Qt::WidgetWithChildrenShortcut);
-    addAction (m_dock_action);
-    connect (m_dock_action, &QAction::triggered,
-             this, &octave_dock_widget::make_window);
+  settings.set_shortcut (m_dock_action, sc_dock_widget_dock);
+  m_dock_action->setShortcutContext (Qt::WidgetWithChildrenShortcut);
+  addAction (m_dock_action);
+  connect (m_dock_action, &QAction::triggered,
+           this, &octave_dock_widget::make_window);
 
-    settings.set_shortcut (m_close_action, sc_dock_widget_close);
-    m_close_action->setShortcutContext (Qt::WidgetWithChildrenShortcut);
-    addAction (m_close_action);
-    connect (m_close_action, &QAction::triggered,
-             this, &octave_dock_widget::change_visibility);
+  settings.set_shortcut (m_close_action, sc_dock_widget_close);
+  m_close_action->setShortcutContext (Qt::WidgetWithChildrenShortcut);
+  addAction (m_close_action);
+  connect (m_close_action, &QAction::triggered,
+           this, &octave_dock_widget::change_visibility);
 
-    m_close_action->setToolTip (tr ("Hide widget"));
+  m_close_action->setToolTip (tr ("Hide widget"));
 
-    setStyleSheet (qdockwidget_css
-                   (global_icon_paths.at (ICON_THEME_OCTAVE) + "widget-close.png",
-                    QString ("Close widget"),
-                    global_icon_paths.at (ICON_THEME_OCTAVE) + "widget-undock.png",
-                    QString ("Undock widget"), m_icon_size, "", ""));
+  setStyleSheet (qdockwidget_css
+                 (global_icon_paths.at (ICON_THEME_OCTAVE) + "widget-close.png",
+                  QString ("Close widget"),
+                  global_icon_paths.at (ICON_THEME_OCTAVE) + "widget-undock.png",
+                  QString ("Undock widget"), m_icon_size, "", ""));
 
-    if (widget ())
-      widget ()->setToolTip ("");
+  if (widget ())
+    widget ()->setToolTip ("");
 
-    m_icon_color = "";
-    m_title_3d = 50;
+  m_icon_color = "";
+  m_title_3d = 50;
 
-    installEventFilter (this);
+  installEventFilter (this);
 
-    setFocusPolicy (Qt::StrongFocus);
+  setFocusPolicy (Qt::StrongFocus);
 
-    setFeatures (QDockWidget::DockWidgetClosable
-                 | QDockWidget::DockWidgetMovable
-                 | QDockWidget::DockWidgetFloatable);
+  setFeatures (QDockWidget::DockWidgetClosable
+               | QDockWidget::DockWidgetMovable
+               | QDockWidget::DockWidgetFloatable);
 
-    handle_settings ();
-  }
+  handle_settings ();
+}
 
-  void
-  octave_dock_widget::init_window_menu_entry ()
-  {
-    emit active_changed (isVisible ());  // emit once for init of window menu
-  }
+void
+octave_dock_widget::init_window_menu_entry ()
+{
+  emit active_changed (isVisible ());  // emit once for init of window menu
+}
 
-  // make the widget floating
-  void
-  octave_dock_widget::make_window (bool widget_was_dragged)
-  {
-    bool vis = isVisible ();
+// make the widget floating
+void
+octave_dock_widget::make_window (bool widget_was_dragged)
+{
+  bool vis = isVisible ();
 
-    // prevent follow-up calls by clearing state variable
-    m_waiting_for_mouse_button_release = false;
+  // prevent follow-up calls by clearing state variable
+  m_waiting_for_mouse_button_release = false;
 
-    set_focus_predecessor ();  // set focus previously active widget if tabbed
+  set_focus_predecessor ();  // set focus previously active widget if tabbed
 
-    // Before unparenting, get current geometry for restoring if dragged
-    QRect geom = geometry ();
+  // Before unparenting, get current geometry for restoring if dragged
+  QRect geom = geometry ();
 
-    // the widget has to be reparented (parent = 0), preferably
-    // from a non-toplevel widget otherwise may not have full
-    // decorations, e.g., no taskbar icon and always in front
-    if (isFloating ())
-      setFloating (false);
+  // the widget has to be reparented (parent = 0), preferably
+  // from a non-toplevel widget otherwise may not have full
+  // decorations, e.g., no taskbar icon and always in front
+  if (isFloating ())
+    setFloating (false);
 
-    if (m_main_window)
-      {
-        // Before making it a separate (no more parent) floating widget,
-        // remove the dock widget from the main window. This ensures
-        // that tabbed widgets keep their focus when it is re-docked
-        // later
-        m_main_window->removeDockWidget (this);
-      }
+  if (m_main_window)
+    {
+      // Before making it a separate (no more parent) floating widget,
+      // remove the dock widget from the main window. This ensures
+      // that tabbed widgets keep their focus when it is re-docked
+      // later
+      m_main_window->removeDockWidget (this);
+    }
 
-    setParent (0, Qt::CustomizeWindowHint | Qt::WindowTitleHint |
-               Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint | Qt::Window);
+  setParent (0, Qt::CustomizeWindowHint | Qt::WindowTitleHint |
+             Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint | Qt::Window);
 
-    // restore the last geometry when floating only if we have not dragged
-    // the window outside the main window
-    if (! widget_was_dragged)
-      geom = m_recent_float_geom.isNull () ? QRect (50,100,480,480)
-                                           : m_recent_float_geom;
-    setGeometry (geom);
+  // restore the last geometry when floating only if we have not dragged
+  // the window outside the main window
+  if (! widget_was_dragged)
+    geom = m_recent_float_geom.isNull () ? QRect (50,100,480,480)
+                                         : m_recent_float_geom;
+  setGeometry (geom);
 
-    // adjust the (un)dock action
-    disconnect (m_dock_action, 0, this, 0);
-    connect (m_dock_action, &QAction::triggered,
-             this, &octave_dock_widget::make_widget);
+  // adjust the (un)dock action
+  disconnect (m_dock_action, 0, this, 0);
+  connect (m_dock_action, &QAction::triggered,
+           this, &octave_dock_widget::make_widget);
 
-    // adjust the (un)dock icon
-    if (titleBarWidget ())
-      {
-        gui_settings settings;
+  // adjust the (un)dock icon
+  if (titleBarWidget ())
+    {
+      gui_settings settings;
 
-        m_dock_action->setIcon (settings.icon ("widget-dock" + m_icon_color, true));
-        m_dock_action->setToolTip (tr ("Dock widget"));
-      }
-    else
-      {
-        disconnect (m_default_float_button, 0, this, 0);
-        connect (m_default_float_button, &QAbstractButton::clicked,
-                 this, &octave_dock_widget::make_widget);
-      }
+      m_dock_action->setIcon (settings.icon ("widget-dock" + m_icon_color, true));
+      m_dock_action->setToolTip (tr ("Dock widget"));
+    }
+  else
+    {
+      disconnect (m_default_float_button, 0, this, 0);
+      connect (m_default_float_button, &QAbstractButton::clicked,
+               this, &octave_dock_widget::make_widget);
+    }
 
-    raise ();
-    activateWindow ();
+  raise ();
+  activateWindow ();
 
-    if (vis)
-      {
-        show ();
-        setFocus ();
-        set_style (true);
-      }
+  if (vis)
+    {
+      show ();
+      setFocus ();
+      set_style (true);
+    }
 
-    emit topLevelChanged (true);  // Be sure signal is emitted
-  }
+  emit topLevelChanged (true);  // Be sure signal is emitted
+}
 
-  // dock the widget
-  void
-  octave_dock_widget::make_widget (bool)
-  {
-    gui_settings settings;
+// dock the widget
+void
+octave_dock_widget::make_widget (bool)
+{
+  gui_settings settings;
 
-    bool vis = isVisible ();
+  bool vis = isVisible ();
 
-    // Since floating widget has no parent, we have to read it
+  // Since floating widget has no parent, we have to read it
 
-    if (m_main_window)
-      {
-        settings.setValue (mw_state.settings_key (), m_main_window->saveState ());
+  if (m_main_window)
+    {
+      settings.setValue (mw_state.settings_key (), m_main_window->saveState ());
 
-        // Stay window, otherwise will bounce back to window by default
-        // because there is no layout information for this widget in the
-        // saved settings.
-        setParent (m_main_window, Qt::Window);
-        m_main_window->addDockWidget (Qt::BottomDockWidgetArea, this);
-        m_adopted = false;
-        // recover old window states, hide and re-show new added widget
-        m_main_window->restoreState (settings.value (mw_state.settings_key ()).toByteArray ());
-        setFloating (false);
-        // restore size using setGeometry instead of restoreGeometry
-        // following this post:
-        // https://forum.qt.io/topic/79326/qdockwidget-restoregeometry-not-working-correctly-when-qmainwindow-is-maximized/5
-        setGeometry (m_recent_dock_geom);
-      }
+      // Stay window, otherwise will bounce back to window by default
+      // because there is no layout information for this widget in the
+      // saved settings.
+      setParent (m_main_window, Qt::Window);
+      m_main_window->addDockWidget (Qt::BottomDockWidgetArea, this);
+      m_adopted = false;
+      // recover old window states, hide and re-show new added widget
+      m_main_window->restoreState (settings.value (mw_state.settings_key ()).toByteArray ());
+      setFloating (false);
+      // restore size using setGeometry instead of restoreGeometry
+      // following this post:
+      // https://forum.qt.io/topic/79326/qdockwidget-restoregeometry-not-working-correctly-when-qmainwindow-is-maximized/5
+      setGeometry (m_recent_dock_geom);
+    }
 
-    // adjust the (un)dock icon
-    disconnect (m_dock_action, 0, this, 0);
-    connect (m_dock_action, &QAction::triggered,
-             this, &octave_dock_widget::make_window);
-    if (titleBarWidget ())
-      {
-        m_dock_action->setIcon (settings.icon ("widget-undock" + m_icon_color, true));
-        m_dock_action->setToolTip (tr ("Undock widget"));
-      }
-    else
-      {
-        disconnect (m_default_float_button, 0, this, 0);
-        connect (m_default_float_button, &QAbstractButton::clicked,
-                 this, &octave_dock_widget::make_window);
-      }
+  // adjust the (un)dock icon
+  disconnect (m_dock_action, 0, this, 0);
+  connect (m_dock_action, &QAction::triggered,
+           this, &octave_dock_widget::make_window);
+  if (titleBarWidget ())
+    {
+      m_dock_action->setIcon (settings.icon ("widget-undock" + m_icon_color, true));
+      m_dock_action->setToolTip (tr ("Undock widget"));
+    }
+  else
+    {
+      disconnect (m_default_float_button, 0, this, 0);
+      connect (m_default_float_button, &QAbstractButton::clicked,
+               this, &octave_dock_widget::make_window);
+    }
 
-    raise ();
-    QApplication::setActiveWindow (this);
+  raise ();
+  QApplication::setActiveWindow (this);
 
-    if (vis)
-      {
-        show ();
-        setFocus ();
-        set_style (true);
-      }
-  }
+  if (vis)
+    {
+      show ();
+      setFocus ();
+      set_style (true);
+    }
+}
 
-  // dock the widget
-  void
-  octave_dock_widget::default_dock (bool)
-  {
-    setFloating (false);
-  }
+// dock the widget
+void
+octave_dock_widget::default_dock (bool)
+{
+  setFloating (false);
+}
 
-  // set the widget which previously had focus when tabified
-  void
-  octave_dock_widget::set_predecessor_widget (octave_dock_widget *prev_widget)
-  {
-    m_predecessor_widget = prev_widget;
-  }
+// set the widget which previously had focus when tabified
+void
+octave_dock_widget::set_predecessor_widget (octave_dock_widget *prev_widget)
+{
+  m_predecessor_widget = prev_widget;
+}
 
-  void
-  octave_dock_widget::set_main_window (main_window *mw)
-  {
-    m_main_window = mw;
+void
+octave_dock_widget::set_main_window (main_window *mw)
+{
+  m_main_window = mw;
 
-    if (m_main_window)
-      {
-        connect (m_main_window, &main_window::copyClipboard_signal,
-                 this, &octave_dock_widget::copyClipboard);
+  if (m_main_window)
+    {
+      connect (m_main_window, &main_window::copyClipboard_signal,
+               this, &octave_dock_widget::copyClipboard);
 
-        connect (m_main_window, &main_window::pasteClipboard_signal,
-                 this, &octave_dock_widget::pasteClipboard);
+      connect (m_main_window, &main_window::pasteClipboard_signal,
+               this, &octave_dock_widget::pasteClipboard);
 
-        connect (m_main_window, &main_window::selectAll_signal,
-                 this, &octave_dock_widget::selectAll);
+      connect (m_main_window, &main_window::selectAll_signal,
+               this, &octave_dock_widget::selectAll);
 
-        connect (m_main_window, &main_window::undo_signal,
-                 this, &octave_dock_widget::do_undo);
-      }
-  }
+      connect (m_main_window, &main_window::undo_signal,
+               this, &octave_dock_widget::do_undo);
+    }
+}
 
-  // close event
-  void
-  octave_dock_widget::closeEvent (QCloseEvent *e)
-  {
-    emit active_changed (false);
-    set_focus_predecessor ();
-    save_settings ();
+// close event
+void
+octave_dock_widget::closeEvent (QCloseEvent *e)
+{
+  emit active_changed (false);
+  set_focus_predecessor ();
+  save_settings ();
 
-    QDockWidget::closeEvent (e);
-  }
+  QDockWidget::closeEvent (e);
+}
 
-  // get focus widget
-  QWidget *
-  octave_dock_widget::focusWidget ()
-  {
-    QWidget *w = QApplication::focusWidget ();
-    if (w && w->focusProxy ()) w = w->focusProxy ();
-    return w;
-  }
+// get focus widget
+QWidget *
+octave_dock_widget::focusWidget ()
+{
+  QWidget *w = QApplication::focusWidget ();
+  if (w && w->focusProxy ()) w = w->focusProxy ();
+  return w;
+}
 
-  bool
-  octave_dock_widget::event (QEvent *event)
-  {
-    // low-level check of whether docked-widget became a window via
-    // double-click or via drag-and-drop
-    if ( (event->type () == QEvent::MouseButtonDblClick && ! isFloating ())
-         || (event->type () == QEvent::ActivationChange
-             && m_waiting_for_mouse_button_release))
-      {
-        bool retval = QDockWidget::event (event);
-        if (isFloating () && parent () != 0)
-          {
-            m_waiting_for_mouse_button_release = false;
-            emit queue_make_window (event->type () != QEvent::MouseButtonDblClick);
-          }
-        return retval;
-      }
+bool
+octave_dock_widget::event (QEvent *event)
+{
+  // low-level check of whether docked-widget became a window via
+  // double-click or via drag-and-drop
+  if ( (event->type () == QEvent::MouseButtonDblClick && ! isFloating ())
+       || (event->type () == QEvent::ActivationChange
+           && m_waiting_for_mouse_button_release))
+    {
+      bool retval = QDockWidget::event (event);
+      if (isFloating () && parent () != 0)
+        {
+          m_waiting_for_mouse_button_release = false;
+          emit queue_make_window (event->type () != QEvent::MouseButtonDblClick);
+        }
+      return retval;
+    }
 
-    return QDockWidget::event (event);
-  }
+  return QDockWidget::event (event);
+}
 
-  void
-  octave_dock_widget::handle_settings ()
-  {
-    gui_settings settings;
+void
+octave_dock_widget::handle_settings ()
+{
+  gui_settings settings;
 
-    m_focus_follows_mouse = settings.bool_value (dw_focus_follows_mouse);
+  m_focus_follows_mouse = settings.bool_value (dw_focus_follows_mouse);
 
-    m_custom_style
-      = settings.bool_value (dw_title_custom_style);
+  m_custom_style
+    = settings.bool_value (dw_title_custom_style);
 
-    m_title_3d = settings.int_value (dw_title_3d);
+  m_title_3d = settings.int_value (dw_title_3d);
 
-    m_fg_color = settings.color_value (dw_title_fg_color);
+  m_fg_color = settings.color_value (dw_title_fg_color);
 
-    m_fg_color_active = settings.color_value (dw_title_fg_color_active);
+  m_fg_color_active = settings.color_value (dw_title_fg_color_active);
 
-    m_bg_color = settings.color_value (dw_title_bg_color);
+  m_bg_color = settings.color_value (dw_title_bg_color);
 
-    m_bg_color_active = settings.color_value (dw_title_bg_color_active);
+  m_bg_color_active = settings.color_value (dw_title_bg_color_active);
 
-    QColor bcol (m_bg_color);
-    QColor bcola (m_bg_color_active);
+  QColor bcol (m_bg_color);
+  QColor bcola (m_bg_color_active);
 
-    if (! m_custom_style)
-      {
-        bcol = QWidget::palette ().color (m_title_widget->backgroundRole ());
-        bcola = bcol;
-      }
+  if (! m_custom_style)
+    {
+      bcol = QWidget::palette ().color (m_title_widget->backgroundRole ());
+      bcola = bcol;
+    }
 
-    int r, g, b;
-    bcol.getRgb (&r, &g, &b);
-    if (r+g+b < 400)
-      m_icon_color = "-light";
-    else
-      m_icon_color = "";
+  int r, g, b;
+  bcol.getRgb (&r, &g, &b);
+  if (r+g+b < 400)
+    m_icon_color = "-light";
+  else
+    m_icon_color = "";
 
-    bcola.getRgb (&r, &g, &b);
-    if (r+g+b < 400)
-      m_icon_color_active = "-light";
-    else
-      m_icon_color_active = "";
+  bcola.getRgb (&r, &g, &b);
+  if (r+g+b < 400)
+    m_icon_color_active = "-light";
+  else
+    m_icon_color_active = "";
 
-    int x, y, w, h;
-    QGuiApplication::primaryScreen ()->availableGeometry ().getRect (&x, &y, &w, &h);
-    QRect default_floating_size = QRect (x+16, y+32, w/3, h/2);
+  int x, y, w, h;
+  QGuiApplication::primaryScreen ()->availableGeometry ().getRect (&x, &y, &w, &h);
+  QRect default_floating_size = QRect (x+16, y+32, w/3, h/2);
 
-    QRect default_dock_size;
-    if (m_main_window)
-      {
-        // We have a main window, dock size depends on size of main window
-        m_main_window->geometry ().getRect (&x, &y, &w, &h);
-        default_dock_size = QRect (x+16, y+32, w/3, h/3);
-      }
-    else
-      {
-        // No main window, default dock size should never be used
-        default_dock_size = QRect (0, 0, w/10, h/10);
-      }
+  QRect default_dock_size;
+  if (m_main_window)
+    {
+      // We have a main window, dock size depends on size of main window
+      m_main_window->geometry ().getRect (&x, &y, &w, &h);
+      default_dock_size = QRect (x+16, y+32, w/3, h/3);
+    }
+  else
+    {
+      // No main window, default dock size should never be used
+      default_dock_size = QRect (0, 0, w/10, h/10);
+    }
 
-    m_recent_float_geom
-      = settings.value (dw_float_geometry.settings_key ().arg (objectName ()),
-                         default_floating_size).toRect ();
+  m_recent_float_geom
+    = settings.value (dw_float_geometry.settings_key ().arg (objectName ()),
+                       default_floating_size).toRect ();
 
-    adjust_to_screen (m_recent_float_geom, default_floating_size);
+  adjust_to_screen (m_recent_float_geom, default_floating_size);
 
-    // The following is required for ensure smooth transition from old
-    // saveGeomety to new QRect setting (see comment for restoring size
-    // of docked widgets)
-    QVariant dock_geom
-      = settings.value (dw_dock_geometry.settings_key ().arg (objectName ()),
-                        default_dock_size);
-    if (dock_geom.canConvert (QMetaType::QRect))
-      m_recent_dock_geom = dock_geom.toRect ();
-    else
-      m_recent_dock_geom = dw_dock_geometry.def ().toRect ();
+  // The following is required for ensure smooth transition from old
+  // saveGeomety to new QRect setting (see comment for restoring size
+  // of docked widgets)
+  QVariant dock_geom
+    = settings.value (dw_dock_geometry.settings_key ().arg (objectName ()),
+                      default_dock_size);
+  if (dock_geom.canConvert (QMetaType::QRect))
+    m_recent_dock_geom = dock_geom.toRect ();
+  else
+    m_recent_dock_geom = dw_dock_geometry.def ().toRect ();
 
-    notice_settings ();  // call individual handler
+  notice_settings ();  // call individual handler
 
-    set_style (false);
+  set_style (false);
 
-    // Compacter design
-    QToolBar *toolbar = findChild <QToolBar *> ();
-    if (toolbar)
-      toolbar->setStyleSheet (toolbar->styleSheet () + global_toolbar_style);
+  // Compacter design
+  QToolBar *toolbar = findChild <QToolBar *> ();
+  if (toolbar)
+    toolbar->setStyleSheet (toolbar->styleSheet () + global_toolbar_style);
 
-    QMenuBar *menubar = findChild <QMenuBar *> ();
-    if (menubar)
-      menubar->setStyleSheet (menubar->styleSheet () + global_menubar_style);
+  QMenuBar *menubar = findChild <QMenuBar *> ();
+  if (menubar)
+    menubar->setStyleSheet (menubar->styleSheet () + global_menubar_style);
 
-  }
+}
 
-  void
-  octave_dock_widget::handle_active_dock_changed (octave_dock_widget *w_old,
-                                                  octave_dock_widget *w_new)
-  {
-    if (m_custom_style && this == w_old)
-      {
-        set_style (false);
-        update ();
-      }
+void
+octave_dock_widget::handle_active_dock_changed (octave_dock_widget *w_old,
+                                                octave_dock_widget *w_new)
+{
+  if (m_custom_style && this == w_old)
+    {
+      set_style (false);
+      update ();
+    }
 
-    if (m_custom_style && this == w_new)
-      {
-        set_style (true);
-        update ();
-      }
-  }
+  if (m_custom_style && this == w_new)
+    {
+      set_style (true);
+      update ();
+    }
+}
 
-  void
-  octave_dock_widget::save_settings ()
-  {
-    gui_settings settings;
+void
+octave_dock_widget::save_settings ()
+{
+  gui_settings settings;
 
-    // save state of this dock-widget
-    QString name = objectName ();
+  // save state of this dock-widget
+  QString name = objectName ();
 
-    store_geometry ();
+  store_geometry ();
 
-    // conditional needed?
-    if (! m_recent_float_geom.isNull ())
-      settings.setValue (dw_float_geometry.settings_key ().arg (name), m_recent_float_geom);
+  // conditional needed?
+  if (! m_recent_float_geom.isNull ())
+    settings.setValue (dw_float_geometry.settings_key ().arg (name), m_recent_float_geom);
 
-    if (! m_recent_dock_geom.isEmpty ())
-      settings.setValue (dw_dock_geometry.settings_key ().arg (name), m_recent_dock_geom);
-    settings.setValue (dw_is_visible.settings_key ().arg (name), isVisible ()); // store visibility
-    settings.setValue (dw_is_floating.settings_key ().arg (name), isFloating ()); // store floating
-    settings.setValue (dw_is_minimized.settings_key ().arg (name), isMinimized ()); // store minimized
+  if (! m_recent_dock_geom.isEmpty ())
+    settings.setValue (dw_dock_geometry.settings_key ().arg (name), m_recent_dock_geom);
+  settings.setValue (dw_is_visible.settings_key ().arg (name), isVisible ()); // store visibility
+  settings.setValue (dw_is_floating.settings_key ().arg (name), isFloating ()); // store floating
+  settings.setValue (dw_is_minimized.settings_key ().arg (name), isMinimized ()); // store minimized
 
-    settings.sync ();
-  }
+  settings.sync ();
+}
 
-  bool octave_dock_widget::eventFilter (QObject *obj, QEvent *e)
-  {
-    // Ignore double clicks into window decoration elements
-    if (e->type () == QEvent::NonClientAreaMouseButtonDblClick)
-      {
-        e->ignore ();
-        return true;
-      }
+bool octave_dock_widget::eventFilter (QObject *obj, QEvent *e)
+{
+  // Ignore double clicks into window decoration elements
+  if (e->type () == QEvent::NonClientAreaMouseButtonDblClick)
+    {
+      e->ignore ();
+      return true;
+    }
 
-    // Detect mouse enter events if "focus follows mouse" is desired
-    // for widgets docked to the main window (non floating) and activate
-    // the widget currently under the mouse
-    if (m_focus_follows_mouse && ! isFloating () && (e->type () == QEvent::Enter))
-      setFocus ();
+  // Detect mouse enter events if "focus follows mouse" is desired
+  // for widgets docked to the main window (non floating) and activate
+  // the widget currently under the mouse
+  if (m_focus_follows_mouse && ! isFloating () && (e->type () == QEvent::Enter))
+    setFocus ();
 
-    return QDockWidget::eventFilter (obj, e);
-  }
+  return QDockWidget::eventFilter (obj, e);
+}
 
-  void
-  octave_dock_widget::store_geometry ()
-  {
-    if (isFloating ())
-      {
-        if (! parent ())
-          m_recent_float_geom = geometry ();
-      }
-    else
-      {
-        m_recent_dock_geom = geometry ();
-      }
-  }
+void
+octave_dock_widget::store_geometry ()
+{
+  if (isFloating ())
+    {
+      if (! parent ())
+        m_recent_float_geom = geometry ();
+    }
+  else
+    {
+      m_recent_dock_geom = geometry ();
+    }
+}
 
-  void
-  octave_dock_widget::moveEvent (QMoveEvent *event)
-  {
-    store_geometry ();
+void
+octave_dock_widget::moveEvent (QMoveEvent *event)
+{
+  store_geometry ();
 
-    QDockWidget::moveEvent (event);
-  }
+  QDockWidget::moveEvent (event);
+}
 
-  void
-  octave_dock_widget::resizeEvent (QResizeEvent *event)
-  {
-    store_geometry ();
+void
+octave_dock_widget::resizeEvent (QResizeEvent *event)
+{
+  store_geometry ();
 
-    QDockWidget::resizeEvent (event);
-  }
+  QDockWidget::resizeEvent (event);
+}
 
-  // slot for hiding the widget
-  void
-  octave_dock_widget::change_visibility (bool)
-  {
-    setVisible (false);
-    emit active_changed (false);
-  }
+// slot for hiding the widget
+void
+octave_dock_widget::change_visibility (bool)
+{
+  setVisible (false);
+  emit active_changed (false);
+}
 
-  void octave_dock_widget::activate ()
-  {
-    if (! isVisible ())
-      setVisible (true);
+void octave_dock_widget::activate ()
+{
+  if (! isVisible ())
+    setVisible (true);
 
-    setFocus ();
-    activateWindow ();
-    raise ();
-  }
+  setFocus ();
+  activateWindow ();
+  raise ();
+}
 
-  void octave_dock_widget::handle_visibility (bool visible)
-  {
-    if (visible)
-      {
-        emit active_changed (true);
-        if (! isFloating ())
-          setFocus ();
-      }
-  }
+void octave_dock_widget::handle_visibility (bool visible)
+{
+  if (visible)
+    {
+      emit active_changed (true);
+      if (! isFloating ())
+        setFocus ();
+    }
+}
 
-  void
-  octave_dock_widget::toplevel_change (bool toplevel)
-  {
-    QObject *dockobj;
-    const char *docksig;
+void
+octave_dock_widget::toplevel_change (bool toplevel)
+{
+  QObject *dockobj;
+  const char *docksig;
 
-    if (titleBarWidget ())
-      {
-        dockobj = m_dock_action;
-        docksig = SIGNAL (triggered (bool));
-      }
-    else
-      {
-        dockobj = m_default_float_button;
-        docksig = SIGNAL (clicked (bool));
-      }
+  if (titleBarWidget ())
+    {
+      dockobj = m_dock_action;
+      docksig = SIGNAL (triggered (bool));
+    }
+  else
+    {
+      dockobj = m_default_float_button;
+      docksig = SIGNAL (clicked (bool));
+    }
 
-    if (toplevel)
-      {
-        // This is a fallback in case the attempt to create a floated
-        // top-level window fails and the QDockWidget remains a child
-        // of the QMainWindow.
-        connect (dockobj, docksig, this, SLOT (default_dock (bool)));
+  if (toplevel)
+    {
+      // This is a fallback in case the attempt to create a floated
+      // top-level window fails and the QDockWidget remains a child
+      // of the QMainWindow.
+      connect (dockobj, docksig, this, SLOT (default_dock (bool)));
 
-        // Could be dragging window, so must wait until there is a
-        // change in focus.
-        if (parent () != 0)
-          m_waiting_for_mouse_button_release = true;
-      }
-    else
-      {
-        // If a drag-and-drop within the QMainWindow occurred, want to remain a widget.
-        m_waiting_for_mouse_button_release = false;
+      // Could be dragging window, so must wait until there is a
+      // change in focus.
+      if (parent () != 0)
+        m_waiting_for_mouse_button_release = true;
+    }
+  else
+    {
+      // If a drag-and-drop within the QMainWindow occurred, want to remain a widget.
+      m_waiting_for_mouse_button_release = false;
 
-        // Making into a widget immediately will mangle the double-click
-        // status and cause problems on followup button clicks.
-        if (parent () == 0)
-          emit queue_make_widget ();
-      }
-  }
+      // Making into a widget immediately will mangle the double-click
+      // status and cause problems on followup button clicks.
+      if (parent () == 0)
+        emit queue_make_widget ();
+    }
+}
 
-  void
-  octave_dock_widget::set_style (bool active)
-  {
-    QString css_foreground;
-    QString css_background;
-    QString css_button;
-    QString dock_icon;
+void
+octave_dock_widget::set_style (bool active)
+{
+  QString css_foreground;
+  QString css_background;
+  QString css_button;
+  QString dock_icon;
 
-    QString icon_col = m_icon_color;
+  QString icon_col = m_icon_color;
 
-    QString close_tooltip = "Close widget";
-    QString dock_tooltip;
+  QString close_tooltip = "Close widget";
+  QString dock_tooltip;
 
-    if (isFloating ())
-      {
-        dock_icon = "widget-dock";
-        dock_tooltip = "Dock widget";
-      }
-    else
-      {
-        dock_icon = "widget-undock";
-        dock_tooltip = "Undock widget";
-      }
+  if (isFloating ())
+    {
+      dock_icon = "widget-dock";
+      dock_tooltip = "Dock widget";
+    }
+  else
+    {
+      dock_icon = "widget-undock";
+      dock_tooltip = "Undock widget";
+    }
 
 #if defined (Q_OS_MAC)
-    QString alignment = "center";
+  QString alignment = "center";
 #else
-    QString alignment = "center left";
+  QString alignment = "center left";
 #endif
-    if (m_custom_style)
-      {
+  if (m_custom_style)
+    {
 
-        QColor bg_col, fg_col;
+      QColor bg_col, fg_col;
 
-        if (active)
-          {
-            bg_col = m_bg_color_active;
-            fg_col = m_fg_color_active;
-            icon_col = m_icon_color_active;
-          }
-        else
-          {
-            bg_col = m_bg_color;
-            fg_col = m_fg_color;
-            icon_col = m_icon_color;
-          }
+      if (active)
+        {
+          bg_col = m_bg_color_active;
+          fg_col = m_fg_color_active;
+          icon_col = m_icon_color_active;
+        }
+      else
+        {
+          bg_col = m_bg_color;
+          fg_col = m_fg_color;
+          icon_col = m_icon_color;
+        }
 
-        QColor bg_col_top, bg_col_bottom;
-        if (m_title_3d > 0)
-          {
-            bg_col_top = bg_col.lighter (100 + m_title_3d);
-            bg_col_bottom = bg_col.darker (100 + m_title_3d);
-          }
-        else
-          {
-            bg_col_top = bg_col.darker (100 - m_title_3d);
-            bg_col_bottom = bg_col.lighter (100 - m_title_3d);
-          }
+      QColor bg_col_top, bg_col_bottom;
+      if (m_title_3d > 0)
+        {
+          bg_col_top = bg_col.lighter (100 + m_title_3d);
+          bg_col_bottom = bg_col.darker (100 + m_title_3d);
+        }
+      else
+        {
+          bg_col_top = bg_col.darker (100 - m_title_3d);
+          bg_col_bottom = bg_col.lighter (100 - m_title_3d);
+        }
 
-        css_foreground = QString ("  color: %1;\n").arg (fg_col.name ());
+      css_foreground = QString ("  color: %1;\n").arg (fg_col.name ());
 
-        css_background =
-          QString ("  background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,"
-                   " stop: 0 %1, stop: 0.60 %2, stop: 0.95 %2 stop: 1.0 %3);\n").
-          arg (bg_col_top.name ()).
-          arg (bg_col.name ()).
-          arg (bg_col_bottom.name ());
-      }
-    else
-      {
-        css_foreground = "";
-        css_background = "";
-      }
+      css_background =
+        QString ("  background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,"
+                 " stop: 0 %1, stop: 0.60 %2, stop: 0.95 %2 stop: 1.0 %3);\n").
+        arg (bg_col_top.name ()).
+        arg (bg_col.name ()).
+        arg (bg_col_bottom.name ());
+    }
+  else
+    {
+      css_foreground = "";
+      css_background = "";
+    }
 
-    QString full_dock_icon = dock_icon + icon_col;
-    QString full_close_icon = "widget-close" + icon_col;
-    if (titleBarWidget ())
-      {
-        gui_settings settings;
+  QString full_dock_icon = dock_icon + icon_col;
+  QString full_close_icon = "widget-close" + icon_col;
+  if (titleBarWidget ())
+    {
+      gui_settings settings;
 
-        titleBarWidget ()->setStyleSheet (css_foreground + css_background);
-        css_button = QString ("QToolButton {background: transparent; border: 0px;}");
-        m_dock_button->setStyleSheet (css_button);
-        m_close_button->setStyleSheet (css_button);
-        m_dock_action->setIcon (settings.icon (full_dock_icon, true));
-        m_close_action->setIcon (settings.icon (full_close_icon, true));
-      }
-    else
-      {
-        setStyleSheet (qdockwidget_css (global_icon_paths.at (ICON_THEME_OCTAVE) + full_close_icon + ".png",
-                                        close_tooltip,
-                                        global_icon_paths.at (ICON_THEME_OCTAVE) + full_dock_icon + ".png",
-                                        dock_tooltip,
-                                        m_icon_size,
-                                        css_foreground,
-                                        css_background));
-      }
-  }
+      titleBarWidget ()->setStyleSheet (css_foreground + css_background);
+      css_button = QString ("QToolButton {background: transparent; border: 0px;}");
+      m_dock_button->setStyleSheet (css_button);
+      m_close_button->setStyleSheet (css_button);
+      m_dock_action->setIcon (settings.icon (full_dock_icon, true));
+      m_close_action->setIcon (settings.icon (full_close_icon, true));
+    }
+  else
+    {
+      setStyleSheet (qdockwidget_css (global_icon_paths.at (ICON_THEME_OCTAVE) + full_close_icon + ".png",
+                                      close_tooltip,
+                                      global_icon_paths.at (ICON_THEME_OCTAVE) + full_dock_icon + ".png",
+                                      dock_tooltip,
+                                      m_icon_size,
+                                      css_foreground,
+                                      css_background));
+    }
+}
 
-  // set focus to previously active widget in tabbed widget stack
-  void
-  octave_dock_widget::set_focus_predecessor ()
-  {
-    // only != 0 if widget was tabbed
-    if (m_predecessor_widget && m_predecessor_widget->isVisible ())
-      m_predecessor_widget->setFocus ();
+// set focus to previously active widget in tabbed widget stack
+void
+octave_dock_widget::set_focus_predecessor ()
+{
+  // only != 0 if widget was tabbed
+  if (m_predecessor_widget && m_predecessor_widget->isVisible ())
+    m_predecessor_widget->setFocus ();
 
-    m_predecessor_widget = nullptr;
-  }
+  m_predecessor_widget = nullptr;
+}
 
 OCTAVE_END_NAMESPACE(octave)
--- a/libgui/src/octave-dock-widget.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/octave-dock-widget.h	Thu Feb 02 12:25:51 2023 -0800
@@ -35,151 +35,151 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class main_window;
+class main_window;
 
-  // The few decoration items common to both main window and variable editor.
+// The few decoration items common to both main window and variable editor.
 
-  class label_dock_widget : public QDockWidget
-  {
-    Q_OBJECT
+class label_dock_widget : public QDockWidget
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    label_dock_widget (QWidget *p);
+  label_dock_widget (QWidget *p);
 
-    ~label_dock_widget () = default;
+  ~label_dock_widget () = default;
 
-    // set_title() uses the custom title bar while setWindowTitle() uses
-    // the default title bar (with style sheets)
-    void set_title (const QString&);
+  // set_title() uses the custom title bar while setWindowTitle() uses
+  // the default title bar (with style sheets)
+  void set_title (const QString&);
 
-  protected slots:
+protected slots:
 
-    //! Slots to handle copy & paste.
-    //!@{
-    virtual void copyClipboard () { }
-    virtual void pasteClipboard () { }
-    virtual void selectAll () { }
-    //!@}
+  //! Slots to handle copy & paste.
+  //!@{
+  virtual void copyClipboard () { }
+  virtual void pasteClipboard () { }
+  virtual void selectAll () { }
+  //!@}
 
-    //! Slot to handle undo.
+  //! Slot to handle undo.
 
-    virtual void do_undo () { }
+  virtual void do_undo () { }
 
-  protected:
+protected:
 
-    int m_icon_size;
-    QWidget *m_title_widget;
-    QToolButton *m_dock_button;
-    QToolButton *m_close_button;
-    QAction *m_dock_action;
-    QAction *m_close_action;
+  int m_icon_size;
+  QWidget *m_title_widget;
+  QToolButton *m_dock_button;
+  QToolButton *m_close_button;
+  QAction *m_dock_action;
+  QAction *m_close_action;
 
-    QAbstractButton *m_default_float_button;
-    QAbstractButton *m_default_close_button;
-  };
+  QAbstractButton *m_default_float_button;
+  QAbstractButton *m_default_close_button;
+};
 
-  class octave_dock_widget : public label_dock_widget
-  {
-    Q_OBJECT
+class octave_dock_widget : public label_dock_widget
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    octave_dock_widget (const QString& obj_name, QWidget *p);
+  octave_dock_widget (const QString& obj_name, QWidget *p);
 
-    ~octave_dock_widget () = default;
+  ~octave_dock_widget () = default;
 
-    void set_predecessor_widget (octave_dock_widget *prev_widget);
+  void set_predecessor_widget (octave_dock_widget *prev_widget);
 
-    void set_main_window (main_window *mw);
+  void set_main_window (main_window *mw);
 
-    void set_adopted (bool adopted = true) { m_adopted = adopted; }
-    bool adopted () const { return m_adopted; }
+  void set_adopted (bool adopted = true) { m_adopted = adopted; }
+  bool adopted () const { return m_adopted; }
 
-  signals:
+signals:
 
-    //! Custom signal that tells whether a user has clicked away that dock
-    //! widget, i.e. the active dock widget has changed.
+  //! Custom signal that tells whether a user has clicked away that dock
+  //! widget, i.e. the active dock widget has changed.
 
-    void active_changed (bool active);
+  void active_changed (bool active);
 
-    void queue_make_window (bool widget_was_dragged);
+  void queue_make_window (bool widget_was_dragged);
 
-    void queue_make_widget ();
+  void queue_make_widget ();
 
-  protected:
+protected:
 
-    virtual void closeEvent (QCloseEvent *e);
+  virtual void closeEvent (QCloseEvent *e);
 
-    QWidget * focusWidget ();
+  QWidget * focusWidget ();
 
-    bool event (QEvent *event);
+  bool event (QEvent *event);
 
-  public slots:
+public slots:
 
-    virtual void activate ();
+  virtual void activate ();
 
-    virtual void handle_visibility (bool visible);
+  virtual void handle_visibility (bool visible);
 
-    virtual void notice_settings () { }
+  virtual void notice_settings () { }
 
-    virtual void save_settings ();
+  virtual void save_settings ();
 
-    void init_window_menu_entry ();
+  void init_window_menu_entry ();
 
-    void handle_settings ();
+  void handle_settings ();
 
-    void handle_active_dock_changed (octave_dock_widget *, octave_dock_widget *);
+  void handle_active_dock_changed (octave_dock_widget *, octave_dock_widget *);
 
-    void moveEvent (QMoveEvent *event);
+  void moveEvent (QMoveEvent *event);
 
-    void resizeEvent (QResizeEvent *event);
+  void resizeEvent (QResizeEvent *event);
 
-    void make_window (bool widget_was_dragged = false);
+  void make_window (bool widget_was_dragged = false);
 
-    void make_widget (bool not_used = false);
+  void make_widget (bool not_used = false);
 
-    void default_dock (bool not_used = false);
+  void default_dock (bool not_used = false);
 
-  protected slots:
+protected slots:
 
-    virtual void toplevel_change (bool);
+  virtual void toplevel_change (bool);
 
-    //! Event filter for double clicks into the window decoration elements.
+  //! Event filter for double clicks into the window decoration elements.
 
-    bool eventFilter (QObject *obj, QEvent *e);
+  bool eventFilter (QObject *obj, QEvent *e);
 
-  private slots:
+private slots:
 
-    void change_visibility (bool);
+  void change_visibility (bool);
 
-  private:
+private:
 
-    void set_style (bool active);
-    void set_focus_predecessor ();
-    void store_geometry ();
+  void set_style (bool active);
+  void set_focus_predecessor ();
+  void store_geometry ();
 
-  private:
+private:
 
-    //! Stores the parent, since we are reparenting to 0.
+  //! Stores the parent, since we are reparenting to 0.
 
-    main_window *m_main_window;
+  main_window *m_main_window;
 
-    bool m_adopted;
-    bool m_custom_style;
-    bool m_focus_follows_mouse;
-    int m_title_3d;
-    QColor m_bg_color;
-    QColor m_bg_color_active;
-    QColor m_fg_color;
-    QColor m_fg_color_active;
-    QString m_icon_color;
-    QString m_icon_color_active;
-    octave_dock_widget *m_predecessor_widget;
-    QRect m_recent_float_geom;
-    QRect m_recent_dock_geom;
-    bool m_waiting_for_mouse_button_release;
-  };
+  bool m_adopted;
+  bool m_custom_style;
+  bool m_focus_follows_mouse;
+  int m_title_3d;
+  QColor m_bg_color;
+  QColor m_bg_color_active;
+  QColor m_fg_color;
+  QColor m_fg_color_active;
+  QString m_icon_color;
+  QString m_icon_color_active;
+  octave_dock_widget *m_predecessor_widget;
+  QRect m_recent_float_geom;
+  QRect m_recent_dock_geom;
+  bool m_waiting_for_mouse_button_release;
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/src/octave-qobject.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/octave-qobject.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -130,916 +130,916 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  // Disable all Qt messages by default.
+// Disable all Qt messages by default.
 
-  static void
-  message_handler (QtMsgType, const QMessageLogContext&, const QString&)
-  { }
+static void
+message_handler (QtMsgType, const QMessageLogContext&, const QString&)
+{ }
 
-  //! Reimplement QApplication::notify.  Octave's own exceptions are
-  //! caught and rethrown in the interpreter thread.
+//! Reimplement QApplication::notify.  Octave's own exceptions are
+//! caught and rethrown in the interpreter thread.
 
-  bool octave_qapplication::notify (QObject *receiver, QEvent *ev)
-  {
-    try
-      {
-        return QApplication::notify (receiver, ev);
-      }
-    catch (execution_exception& ee)
-      {
-        emit interpreter_event
-          ([=] ()
-           {
-             // INTERPRETER THREAD
-             throw ee;
-           });
-      }
+bool octave_qapplication::notify (QObject *receiver, QEvent *ev)
+{
+  try
+    {
+      return QApplication::notify (receiver, ev);
+    }
+  catch (execution_exception& ee)
+    {
+      emit interpreter_event
+        ([=] ()
+         {
+           // INTERPRETER THREAD
+           throw ee;
+         });
+    }
 
-    return false;
-  }
+  return false;
+}
 
-  // We will create a QApplication object, even if START_GUI is false,
-  // so that we can use Qt widgets for plot windows when running in
-  // command-line mode.  Note that we are creating an
-  // octave_qapplication object but handling it as a QApplication object
-  // because the octave_qapplication should behave identically to a
-  // QApplication object except that it overrides the notify method so
-  // we can handle forward Octave interpreter exceptions from the GUI
-  // thread to the interpreter thread.
+// We will create a QApplication object, even if START_GUI is false,
+// so that we can use Qt widgets for plot windows when running in
+// command-line mode.  Note that we are creating an
+// octave_qapplication object but handling it as a QApplication object
+// because the octave_qapplication should behave identically to a
+// QApplication object except that it overrides the notify method so
+// we can handle forward Octave interpreter exceptions from the GUI
+// thread to the interpreter thread.
 
-  base_qobject::base_qobject (qt_application& app_context, bool gui_app)
-    : QObject (),
-      m_app_context (app_context),
-      m_argc (m_app_context.sys_argc ()),
-      m_argv (m_app_context.sys_argv ()),
-      m_qapplication (new octave_qapplication (m_argc, m_argv)),
-      m_qt_tr (new QTranslator ()),
-      m_gui_tr (new QTranslator ()),
-      m_qsci_tr (new QTranslator ()),
-      m_translators_installed (false),
-      m_qt_interpreter_events (new qt_interpreter_events (*this)),
-      m_interpreter_qobj (new interpreter_qobject (*this)),
-      m_main_thread (new QThread ()),
-      m_gui_app (gui_app),
-      m_interpreter_ready (false),
-      m_workspace_model (new workspace_model ()),
-      m_documentation_widget (),
-      m_file_browser_widget (),
-      m_history_widget (),
-      m_workspace_widget (),
-      m_editor_widget (),
-      m_variable_editor_widget (),
-      m_main_window (nullptr)
-  {
-    std::string show_gui_msgs = sys::env::getenv ("OCTAVE_SHOW_GUI_MESSAGES");
+base_qobject::base_qobject (qt_application& app_context, bool gui_app)
+  : QObject (),
+    m_app_context (app_context),
+    m_argc (m_app_context.sys_argc ()),
+    m_argv (m_app_context.sys_argv ()),
+    m_qapplication (new octave_qapplication (m_argc, m_argv)),
+    m_qt_tr (new QTranslator ()),
+    m_gui_tr (new QTranslator ()),
+    m_qsci_tr (new QTranslator ()),
+    m_translators_installed (false),
+    m_qt_interpreter_events (new qt_interpreter_events (*this)),
+    m_interpreter_qobj (new interpreter_qobject (*this)),
+    m_main_thread (new QThread ()),
+    m_gui_app (gui_app),
+    m_interpreter_ready (false),
+    m_workspace_model (new workspace_model ()),
+    m_documentation_widget (),
+    m_file_browser_widget (),
+    m_history_widget (),
+    m_workspace_widget (),
+    m_editor_widget (),
+    m_variable_editor_widget (),
+    m_main_window (nullptr)
+{
+  std::string show_gui_msgs = sys::env::getenv ("OCTAVE_SHOW_GUI_MESSAGES");
 
-    // Installing our handler suppresses the messages.
+  // Installing our handler suppresses the messages.
 
-    if (show_gui_msgs.empty ())
-      qInstallMessageHandler (message_handler);
+  if (show_gui_msgs.empty ())
+    qInstallMessageHandler (message_handler);
 
-    // Set the codec for all strings (before wizard or any GUI object)
+  // Set the codec for all strings (before wizard or any GUI object)
 #if ! defined (Q_OS_WIN32)
-    QTextCodec::setCodecForLocale (QTextCodec::codecForName ("UTF-8"));
+  QTextCodec::setCodecForLocale (QTextCodec::codecForName ("UTF-8"));
 #endif
 
-    // Register octave_value_list for connecting thread crossing signals.
+  // Register octave_value_list for connecting thread crossing signals.
 
-    qRegisterMetaType<octave_value_list> ("octave_value_list");
+  qRegisterMetaType<octave_value_list> ("octave_value_list");
 
-    // Bug #55940 (Disable App Nap on Mac)
+  // Bug #55940 (Disable App Nap on Mac)
 #if defined (Q_OS_MAC)
-    // Mac App Nap feature causes pause() and sleep() to misbehave.
-    // Disable it for the entire program run.
-    disable_app_nap ();
+  // Mac App Nap feature causes pause() and sleep() to misbehave.
+  // Disable it for the entire program run.
+  disable_app_nap ();
 
-    // Don't let Qt interpret CMD key ("Meta" in Qt terminology) as Ctrl.
-    QCoreApplication::setAttribute (Qt::AA_MacDontSwapCtrlAndMeta, true);
+  // Don't let Qt interpret CMD key ("Meta" in Qt terminology) as Ctrl.
+  QCoreApplication::setAttribute (Qt::AA_MacDontSwapCtrlAndMeta, true);
 #endif
 
-    // Force left-to-right alignment (see bug #46204)
-    m_qapplication->setLayoutDirection (Qt::LeftToRight);
+  // Force left-to-right alignment (see bug #46204)
+  m_qapplication->setLayoutDirection (Qt::LeftToRight);
 
-    // Qt docs recommend using Qt::QueuedConnection when connecting to
-    // the QCoreApplication::exit slot.
-    connect (m_interpreter_qobj, &interpreter_qobject::shutdown_finished,
-             m_qapplication, &octave_qapplication::exit,
-             Qt::QueuedConnection);
+  // Qt docs recommend using Qt::QueuedConnection when connecting to
+  // the QCoreApplication::exit slot.
+  connect (m_interpreter_qobj, &interpreter_qobject::shutdown_finished,
+           m_qapplication, &octave_qapplication::exit,
+           Qt::QueuedConnection);
 
-    connect (m_interpreter_qobj, &interpreter_qobject::ready,
-             this, &base_qobject::interpreter_ready);
+  connect (m_interpreter_qobj, &interpreter_qobject::ready,
+           this, &base_qobject::interpreter_ready);
 
-    connect (m_main_thread, &QThread::finished,
-             m_main_thread, &QThread::deleteLater);
+  connect (m_main_thread, &QThread::finished,
+           m_main_thread, &QThread::deleteLater);
 
-    // Handle any interpreter_event signal from the octave_qapplication
-    // object here.
+  // Handle any interpreter_event signal from the octave_qapplication
+  // object here.
 
-    connect (m_qapplication, QOverload<const fcn_callback&>::of (&octave_qapplication::interpreter_event),
-             this, QOverload<const fcn_callback&>::of (&base_qobject::interpreter_event));
+  connect (m_qapplication, QOverload<const fcn_callback&>::of (&octave_qapplication::interpreter_event),
+           this, QOverload<const fcn_callback&>::of (&base_qobject::interpreter_event));
 
-    connect (m_qapplication, QOverload<const meth_callback&>::of (&octave_qapplication::interpreter_event),
-             this, QOverload<const meth_callback&>::of (&base_qobject::interpreter_event));
+  connect (m_qapplication, QOverload<const meth_callback&>::of (&octave_qapplication::interpreter_event),
+           this, QOverload<const meth_callback&>::of (&base_qobject::interpreter_event));
 
-    if (m_app_context.experimental_terminal_widget ())
-      {
-        connect (qt_link (), &qt_interpreter_events::start_gui_signal,
-                 this, &base_qobject::start_gui);
+  if (m_app_context.experimental_terminal_widget ())
+    {
+      connect (qt_link (), &qt_interpreter_events::start_gui_signal,
+               this, &base_qobject::start_gui);
 
-        connect (qt_link (), &qt_interpreter_events::show_terminal_window_signal,
-                 this, &base_qobject::show_terminal_window);
-      }
+      connect (qt_link (), &qt_interpreter_events::show_terminal_window_signal,
+               this, &base_qobject::show_terminal_window);
+    }
 
-    connect (qt_link (), &qt_interpreter_events::copy_image_to_clipboard_signal,
-             this, &base_qobject::copy_image_to_clipboard);
+  connect (qt_link (), &qt_interpreter_events::copy_image_to_clipboard_signal,
+           this, &base_qobject::copy_image_to_clipboard);
 
-    connect (qt_link (), &qt_interpreter_events::show_documentation_signal,
-             this, &base_qobject::show_documentation_window);
+  connect (qt_link (), &qt_interpreter_events::show_documentation_signal,
+           this, &base_qobject::show_documentation_window);
 
-    connect (qt_link (), &qt_interpreter_events::show_file_browser_signal,
-             this, &base_qobject::show_file_browser_window);
+  connect (qt_link (), &qt_interpreter_events::show_file_browser_signal,
+           this, &base_qobject::show_file_browser_window);
 
-    connect (qt_link (), &qt_interpreter_events::show_command_history_signal,
-             this, &base_qobject::show_command_history_window);
+  connect (qt_link (), &qt_interpreter_events::show_command_history_signal,
+           this, &base_qobject::show_command_history_window);
 
-    connect (qt_link (), &qt_interpreter_events::show_workspace_signal,
-             this, &base_qobject::show_workspace_window);
+  connect (qt_link (), &qt_interpreter_events::show_workspace_signal,
+           this, &base_qobject::show_workspace_window);
 
-    connect (qt_link (), &qt_interpreter_events::edit_variable_signal,
-             this, &base_qobject::show_variable_editor_window);
+  connect (qt_link (), &qt_interpreter_events::edit_variable_signal,
+           this, &base_qobject::show_variable_editor_window);
 
-    connect (qt_link (), &qt_interpreter_events::show_community_news_signal,
-             this, &base_qobject::show_community_news);
+  connect (qt_link (), &qt_interpreter_events::show_community_news_signal,
+           this, &base_qobject::show_community_news);
 
-    connect (qt_link (), &qt_interpreter_events::show_release_notes_signal,
-             this, &base_qobject::show_release_notes);
+  connect (qt_link (), &qt_interpreter_events::show_release_notes_signal,
+           this, &base_qobject::show_release_notes);
 
-    if (m_app_context.experimental_terminal_widget ())
-      {
-        m_qapplication->setQuitOnLastWindowClosed (false);
-      }
-    else
-      {
-        if (gui_app)
-          {
-            m_main_window = new main_window (*this);
+  if (m_app_context.experimental_terminal_widget ())
+    {
+      m_qapplication->setQuitOnLastWindowClosed (false);
+    }
+  else
+    {
+      if (gui_app)
+        {
+          m_main_window = new main_window (*this);
 
-            connect (m_main_window, &main_window::show_community_news_signal,
-                     this, &base_qobject::show_community_news);
+          connect (m_main_window, &main_window::show_community_news_signal,
+                   this, &base_qobject::show_community_news);
 
-            connect (m_main_window, &main_window::show_release_notes_signal,
-                     this, &base_qobject::show_release_notes);
+          connect (m_main_window, &main_window::show_release_notes_signal,
+                   this, &base_qobject::show_release_notes);
 
-            if (m_interpreter_ready)
-              m_main_window->handle_octave_ready ();
-            else
-              connect (m_interpreter_qobj, &interpreter_qobject::ready,
-                       m_main_window, &main_window::handle_octave_ready);
+          if (m_interpreter_ready)
+            m_main_window->handle_octave_ready ();
+          else
+            connect (m_interpreter_qobj, &interpreter_qobject::ready,
+                     m_main_window, &main_window::handle_octave_ready);
 
-            connect (qt_link (), &qt_interpreter_events::focus_window_signal,
-                     m_main_window, &main_window::focus_window);
+          connect (qt_link (), &qt_interpreter_events::focus_window_signal,
+                   m_main_window, &main_window::focus_window);
 
-            m_app_context.gui_running (true);
-          }
-        else
-          {
-            // Get settings file.
-            gui_settings settings;
+          m_app_context.gui_running (true);
+        }
+      else
+        {
+          // Get settings file.
+          gui_settings settings;
 
-            settings.reload ();
+          settings.reload ();
 
-            // After settings.
-            config_translators ();
+          // After settings.
+          config_translators ();
 
-            settings.config_icon_theme ();
+          settings.config_icon_theme ();
 
-            m_qapplication->setQuitOnLastWindowClosed (false);
-          }
-      }
+          m_qapplication->setQuitOnLastWindowClosed (false);
+        }
+    }
 
-    start_main_thread ();
-  }
+  start_main_thread ();
+}
 
-  base_qobject::~base_qobject ()
-  {
-    // Note that we don't delete m_main_thread here.  That is handled by
-    // deleteLater slot that is called when the m_main_thread issues a
-    // finished signal.
+base_qobject::~base_qobject ()
+{
+  // Note that we don't delete m_main_thread here.  That is handled by
+  // deleteLater slot that is called when the m_main_thread issues a
+  // finished signal.
 
-    // FIXME: Why are dock widget settings and/or the main window
-    // configuration not saved correctly if the main window is deleted
-    // after the dock widgets?
+  // FIXME: Why are dock widget settings and/or the main window
+  // configuration not saved correctly if the main window is deleted
+  // after the dock widgets?
 
-    // Calling close will cause settings to be saved.
-    // If m_main_window exists, the widgets are closed by the main window
+  // Calling close will cause settings to be saved.
+  // If m_main_window exists, the widgets are closed by the main window
 
-    if (! m_main_window)
-      {
-        if (m_terminal_widget)
-          m_terminal_widget->close ();
+  if (! m_main_window)
+    {
+      if (m_terminal_widget)
+        m_terminal_widget->close ();
 
-        if (m_documentation_widget)
-          m_documentation_widget->close ();
+      if (m_documentation_widget)
+        m_documentation_widget->close ();
 
-        if (m_file_browser_widget)
-          m_file_browser_widget->close ();
+      if (m_file_browser_widget)
+        m_file_browser_widget->close ();
 
-        if (m_history_widget)
-          m_history_widget->close ();
+      if (m_history_widget)
+        m_history_widget->close ();
 
-        if (m_workspace_widget)
-          m_workspace_widget->close ();
+      if (m_workspace_widget)
+        m_workspace_widget->close ();
 
-        if (m_editor_widget)
-          m_editor_widget->close ();
+      if (m_editor_widget)
+        m_editor_widget->close ();
 
-        if (m_variable_editor_widget)
-          m_variable_editor_widget->close ();
+      if (m_variable_editor_widget)
+        m_variable_editor_widget->close ();
 
-        if (m_community_news)
-          m_community_news->close ();
-      }
-    else
-      {
-        delete m_main_window;
-      }
+      if (m_community_news)
+        m_community_news->close ();
+    }
+  else
+    {
+      delete m_main_window;
+    }
 
-    delete m_terminal_widget;
-    delete m_documentation_widget;
-    delete m_file_browser_widget;
-    delete m_history_widget;
-    delete m_workspace_widget;
-    delete m_editor_widget;
-    delete m_variable_editor_widget;
-    delete m_community_news;
+  delete m_terminal_widget;
+  delete m_documentation_widget;
+  delete m_file_browser_widget;
+  delete m_history_widget;
+  delete m_workspace_widget;
+  delete m_editor_widget;
+  delete m_variable_editor_widget;
+  delete m_community_news;
 
-    delete m_interpreter_qobj;
-    delete m_qsci_tr;
-    delete m_gui_tr;
-    delete m_qt_tr;
-    delete m_qapplication;
-    delete m_workspace_model;
+  delete m_interpreter_qobj;
+  delete m_qsci_tr;
+  delete m_gui_tr;
+  delete m_qt_tr;
+  delete m_qapplication;
+  delete m_workspace_model;
 
-    string_vector::delete_c_str_vec (m_argv);
-  }
+  string_vector::delete_c_str_vec (m_argv);
+}
 
-  void base_qobject::config_translators ()
-  {
-    if (m_translators_installed)
-      return;
+void base_qobject::config_translators ()
+{
+  if (m_translators_installed)
+    return;
 
-    gui_settings settings;
+  gui_settings settings;
 
-    settings.config_translators (m_qt_tr, m_qsci_tr, m_gui_tr);
+  settings.config_translators (m_qt_tr, m_qsci_tr, m_gui_tr);
 
-    m_qapplication->installTranslator (m_qt_tr);
-    m_qapplication->installTranslator (m_gui_tr);
-    m_qapplication->installTranslator (m_qsci_tr);
+  m_qapplication->installTranslator (m_qt_tr);
+  m_qapplication->installTranslator (m_gui_tr);
+  m_qapplication->installTranslator (m_qsci_tr);
 
-    m_translators_installed = true;
-  }
+  m_translators_installed = true;
+}
 
-  void base_qobject::start_main_thread ()
-  {
-    // Note: if using the new experimental terminal widget, we defer
-    // initializing and executing the interpreter until the main event
-    // loop begins executing.
+void base_qobject::start_main_thread ()
+{
+  // Note: if using the new experimental terminal widget, we defer
+  // initializing and executing the interpreter until the main event
+  // loop begins executing.
 
-    // With the old terminal widget, we defer initializing and executing
-    // the interpreter until after the main window and QApplication are
-    // running to prevent race conditions.
+  // With the old terminal widget, we defer initializing and executing
+  // the interpreter until after the main window and QApplication are
+  // running to prevent race conditions.
 
-    QTimer::singleShot (0, m_interpreter_qobj, SLOT (execute ()));
+  QTimer::singleShot (0, m_interpreter_qobj, SLOT (execute ()));
 
-    m_interpreter_qobj->moveToThread (m_main_thread);
+  m_interpreter_qobj->moveToThread (m_main_thread);
 
-    m_main_thread->start ();
-  }
+  m_main_thread->start ();
+}
 
-  int base_qobject::exec ()
-  {
-    int status = m_qapplication->exec ();
+int base_qobject::exec ()
+{
+  int status = m_qapplication->exec ();
 
 #if defined (Q_OS_MAC)
-    // fprintf to stderr is needed by macOS, for poorly-understood reasons.
-    fprintf (stderr, "\n");
+  // fprintf to stderr is needed by macOS, for poorly-understood reasons.
+  fprintf (stderr, "\n");
 #endif
 
-    m_main_thread->quit ();
-    m_main_thread->wait ();
+  m_main_thread->quit ();
+  m_main_thread->wait ();
 
-    return status;
-  }
+  return status;
+}
 
-  // Provided for convenience.  Will be removed once we eliminate the
-  // old terminal widget.
-  bool base_qobject::experimental_terminal_widget () const
-  {
-    return m_app_context.experimental_terminal_widget ();
-  }
+// Provided for convenience.  Will be removed once we eliminate the
+// old terminal widget.
+bool base_qobject::experimental_terminal_widget () const
+{
+  return m_app_context.experimental_terminal_widget ();
+}
 
-  bool base_qobject::gui_running () const
-  {
-    return m_app_context.gui_running ();
-  }
+bool base_qobject::gui_running () const
+{
+  return m_app_context.gui_running ();
+}
 
-  QPointer<terminal_dock_widget>
-  base_qobject::terminal_widget (main_window *mw)
-  {
-    if (m_terminal_widget && mw)
-      {
-        m_terminal_widget->set_main_window (mw);
-        m_terminal_widget->set_adopted (true);
-      }
-    else if (! m_terminal_widget)
-      {
-        bool etw = m_app_context.experimental_terminal_widget ();
+QPointer<terminal_dock_widget>
+base_qobject::terminal_widget (main_window *mw)
+{
+  if (m_terminal_widget && mw)
+    {
+      m_terminal_widget->set_main_window (mw);
+      m_terminal_widget->set_adopted (true);
+    }
+  else if (! m_terminal_widget)
+    {
+      bool etw = m_app_context.experimental_terminal_widget ();
 
-        m_terminal_widget
-          = QPointer<terminal_dock_widget> (new terminal_dock_widget (mw, etw));
+      m_terminal_widget
+        = QPointer<terminal_dock_widget> (new terminal_dock_widget (mw, etw));
 
-        if (etw)
-          {
+      if (etw)
+        {
 #if defined (HAVE_QSCINTILLA)
-            command_widget *cmd_widget
-              = m_terminal_widget->get_command_widget ();
+          command_widget *cmd_widget
+            = m_terminal_widget->get_command_widget ();
 
-            connect (cmd_widget, &command_widget::interpreter_pause,
-                     this, &base_qobject::interpreter_pause);
+          connect (cmd_widget, &command_widget::interpreter_pause,
+                   this, &base_qobject::interpreter_pause);
 
-            connect (cmd_widget, &command_widget::interpreter_resume,
-                     this, &base_qobject::interpreter_resume);
+          connect (cmd_widget, &command_widget::interpreter_resume,
+                   this, &base_qobject::interpreter_resume);
 
-            connect (cmd_widget, &command_widget::interpreter_stop,
-                     this, &base_qobject::interpreter_stop);
+          connect (cmd_widget, &command_widget::interpreter_stop,
+                   this, &base_qobject::interpreter_stop);
 
-            connect (qt_link (), &qt_interpreter_events::interpreter_output_signal,
-                     m_terminal_widget, &terminal_dock_widget::interpreter_output_signal);
+          connect (qt_link (), &qt_interpreter_events::interpreter_output_signal,
+                   m_terminal_widget, &terminal_dock_widget::interpreter_output_signal);
 
-            connect (qt_link (), &qt_interpreter_events::update_prompt_signal,
-                     m_terminal_widget, &terminal_dock_widget::update_prompt_signal);
+          connect (qt_link (), &qt_interpreter_events::update_prompt_signal,
+                   m_terminal_widget, &terminal_dock_widget::update_prompt_signal);
 
-            connect (qt_link (), &qt_interpreter_events::new_command_line_signal,
-                     m_terminal_widget, &terminal_dock_widget::new_command_line_signal);
+          connect (qt_link (), &qt_interpreter_events::new_command_line_signal,
+                   m_terminal_widget, &terminal_dock_widget::new_command_line_signal);
 
-            connect (mw, &main_window::update_prompt_signal,
-                     m_terminal_widget, &terminal_dock_widget::update_prompt_signal);
+          connect (mw, &main_window::update_prompt_signal,
+                   m_terminal_widget, &terminal_dock_widget::update_prompt_signal);
 
-            connect_interpreter_events (cmd_widget);
+          connect_interpreter_events (cmd_widget);
 #endif
-          }
-        else
-          {
-            QTerminal *cmd_widget = m_terminal_widget->get_qterminal ();
+        }
+      else
+        {
+          QTerminal *cmd_widget = m_terminal_widget->get_qterminal ();
 
-            // Connect the interrupt signal (emitted by Ctrl-C)
-            connect (cmd_widget, &QTerminal::interrupt_signal,
-                     this, &base_qobject::interpreter_interrupt);
+          // Connect the interrupt signal (emitted by Ctrl-C)
+          connect (cmd_widget, &QTerminal::interrupt_signal,
+                   this, &base_qobject::interpreter_interrupt);
 
-            connect_interpreter_events (cmd_widget);
-          }
-      }
+          connect_interpreter_events (cmd_widget);
+        }
+    }
 
-    return m_terminal_widget;
-  }
+  return m_terminal_widget;
+}
 
-  QPointer<documentation_dock_widget>
-  base_qobject::documentation_widget (main_window *mw)
-  {
-    if (m_documentation_widget && mw)
-      {
-        m_documentation_widget->set_main_window (mw);
-        m_documentation_widget->set_adopted (true);
-      }
-    else if (! m_documentation_widget)
-      {
-        m_documentation_widget
-          = QPointer<documentation_dock_widget> (new documentation_dock_widget (mw));
+QPointer<documentation_dock_widget>
+base_qobject::documentation_widget (main_window *mw)
+{
+  if (m_documentation_widget && mw)
+    {
+      m_documentation_widget->set_main_window (mw);
+      m_documentation_widget->set_adopted (true);
+    }
+  else if (! m_documentation_widget)
+    {
+      m_documentation_widget
+        = QPointer<documentation_dock_widget> (new documentation_dock_widget (mw));
 
-        connect (qt_link (),
-                 &qt_interpreter_events::register_documentation_signal,
-                 m_documentation_widget,
-                 &documentation_dock_widget::registerDoc);
+      connect (qt_link (),
+               &qt_interpreter_events::register_documentation_signal,
+               m_documentation_widget,
+               &documentation_dock_widget::registerDoc);
 
-        connect (qt_link (),
-                 &qt_interpreter_events::unregister_documentation_signal,
-                 m_documentation_widget,
-                 &documentation_dock_widget::unregisterDoc);
-      }
+      connect (qt_link (),
+               &qt_interpreter_events::unregister_documentation_signal,
+               m_documentation_widget,
+               &documentation_dock_widget::unregisterDoc);
+    }
 
-    return m_documentation_widget;
-  }
+  return m_documentation_widget;
+}
 
-  QPointer<files_dock_widget>
-  base_qobject::file_browser_widget (main_window *mw)
-  {
-    if (m_file_browser_widget)
-      {
-        m_file_browser_widget->set_main_window (mw);
-        m_file_browser_widget->set_adopted (true);
-      }
-    else if (! m_file_browser_widget)
-      m_file_browser_widget
-        = QPointer<files_dock_widget> (new files_dock_widget (mw));
+QPointer<files_dock_widget>
+base_qobject::file_browser_widget (main_window *mw)
+{
+  if (m_file_browser_widget)
+    {
+      m_file_browser_widget->set_main_window (mw);
+      m_file_browser_widget->set_adopted (true);
+    }
+  else if (! m_file_browser_widget)
+    m_file_browser_widget
+      = QPointer<files_dock_widget> (new files_dock_widget (mw));
 
-    connect (qt_link (), &qt_interpreter_events::directory_changed_signal,
-             m_file_browser_widget, &files_dock_widget::update_octave_directory);
+  connect (qt_link (), &qt_interpreter_events::directory_changed_signal,
+           m_file_browser_widget, &files_dock_widget::update_octave_directory);
 
-    return m_file_browser_widget;
-  }
+  return m_file_browser_widget;
+}
 
-  QPointer<history_dock_widget>
-  base_qobject::history_widget (main_window *mw)
-  {
-    if (m_history_widget)
-      {
-        m_history_widget->set_main_window (mw);
-        m_history_widget->set_adopted (true);
-      }
-    else if (! m_history_widget)
-      {
-        m_history_widget
-          = QPointer<history_dock_widget> (new history_dock_widget (mw));
+QPointer<history_dock_widget>
+base_qobject::history_widget (main_window *mw)
+{
+  if (m_history_widget)
+    {
+      m_history_widget->set_main_window (mw);
+      m_history_widget->set_adopted (true);
+    }
+  else if (! m_history_widget)
+    {
+      m_history_widget
+        = QPointer<history_dock_widget> (new history_dock_widget (mw));
 
-        connect (qt_link (), &qt_interpreter_events::set_history_signal,
-                 m_history_widget, &history_dock_widget::set_history);
+      connect (qt_link (), &qt_interpreter_events::set_history_signal,
+               m_history_widget, &history_dock_widget::set_history);
 
-        connect (qt_link (), &qt_interpreter_events::append_history_signal,
-                 m_history_widget, &history_dock_widget::append_history);
+      connect (qt_link (), &qt_interpreter_events::append_history_signal,
+               m_history_widget, &history_dock_widget::append_history);
 
-        connect (qt_link (), &qt_interpreter_events::clear_history_signal,
-                 m_history_widget, &history_dock_widget::clear_history);
+      connect (qt_link (), &qt_interpreter_events::clear_history_signal,
+               m_history_widget, &history_dock_widget::clear_history);
 
-        emit interpreter_event
-          ([=] (interpreter& interp) {
-            // INTERPRETER THREAD
+      emit interpreter_event
+        ([=] (interpreter& interp) {
+          // INTERPRETER THREAD
 
-            event_manager& xevmgr = interp.get_event_manager ();
+          event_manager& xevmgr = interp.get_event_manager ();
 
-            xevmgr.set_history ();
-          });
-      }
+          xevmgr.set_history ();
+        });
+    }
 
-    return m_history_widget;
-  }
+  return m_history_widget;
+}
 
-  QPointer<workspace_view>
-  base_qobject::workspace_widget (main_window *mw)
-  {
-    if (m_workspace_widget)
-      {
-        m_workspace_widget->set_main_window (mw);
-        m_workspace_widget->set_adopted (true);
-      }
-    else if (! m_workspace_widget)
-      {
-        m_workspace_widget
-          = QPointer<workspace_view> (new workspace_view (mw));
+QPointer<workspace_view>
+base_qobject::workspace_widget (main_window *mw)
+{
+  if (m_workspace_widget)
+    {
+      m_workspace_widget->set_main_window (mw);
+      m_workspace_widget->set_adopted (true);
+    }
+  else if (! m_workspace_widget)
+    {
+      m_workspace_widget
+        = QPointer<workspace_view> (new workspace_view (mw));
 
-        m_workspace_widget->setModel (m_workspace_model);
+      m_workspace_widget->setModel (m_workspace_model);
 
-        connect (m_workspace_model, &workspace_model::model_changed,
-                 m_workspace_widget, &workspace_view::handle_model_changed);
+      connect (m_workspace_model, &workspace_model::model_changed,
+               m_workspace_widget, &workspace_view::handle_model_changed);
 
-        connect (qt_link (), &qt_interpreter_events::set_workspace_signal,
-                 m_workspace_model, &workspace_model::set_workspace);
+      connect (qt_link (), &qt_interpreter_events::set_workspace_signal,
+               m_workspace_model, &workspace_model::set_workspace);
 
-        connect (qt_link (), &qt_interpreter_events::clear_workspace_signal,
-                 m_workspace_model, &workspace_model::clear_workspace);
+      connect (qt_link (), &qt_interpreter_events::clear_workspace_signal,
+               m_workspace_model, &workspace_model::clear_workspace);
 
-        connect (m_workspace_widget,
-                 &workspace_view::copy_variable_value_to_clipboard,
-                 [=] (const QString& var_name) {
-                   emit interpreter_event
-                     ([=] (interpreter& interp)
-                      {
-                        // INTERPRETER THREAD
+      connect (m_workspace_widget,
+               &workspace_view::copy_variable_value_to_clipboard,
+               [=] (const QString& var_name) {
+                 emit interpreter_event
+                   ([=] (interpreter& interp)
+                    {
+                      // INTERPRETER THREAD
 
-                        octave_value val = interp.varval (var_name.toStdString ());
+                      octave_value val = interp.varval (var_name.toStdString ());
 
-                        if (val.is_undefined ())
-                          val = 0;
+                      if (val.is_undefined ())
+                        val = 0;
 
-                        std::ostringstream buf;
-                        val.print_raw (buf, true);
+                      std::ostringstream buf;
+                      val.print_raw (buf, true);
 
-                        // FIXME: is the following operation thread safe or should
-                        // it be done with a signal/slot connection?
+                      // FIXME: is the following operation thread safe or should
+                      // it be done with a signal/slot connection?
 
-                        QClipboard *clipboard = QApplication::clipboard ();
-                        clipboard->setText (QString::fromStdString (buf.str ()));
-                      });
-                 });
+                      QClipboard *clipboard = QApplication::clipboard ();
+                      clipboard->setText (QString::fromStdString (buf.str ()));
+                    });
+               });
 
-        connect (m_workspace_widget, &workspace_view::rename_variable_signal,
-                 [=] (const QString& old_name, const QString& new_name) {
-                   emit interpreter_event
-                     ([=] (interpreter& interp) {
-                       // INTERPRETER THREAD
+      connect (m_workspace_widget, &workspace_view::rename_variable_signal,
+               [=] (const QString& old_name, const QString& new_name) {
+                 emit interpreter_event
+                   ([=] (interpreter& interp) {
+                     // INTERPRETER THREAD
 
-                       symbol_scope scope = interp.get_current_scope ();
+                     symbol_scope scope = interp.get_current_scope ();
 
-                       if (scope)
-                         {
-                           scope.rename (old_name.toStdString (),
-                                         new_name.toStdString ());
+                     if (scope)
+                       {
+                         scope.rename (old_name.toStdString (),
+                                       new_name.toStdString ());
 
-                           tree_evaluator& tw = interp.get_evaluator ();
+                         tree_evaluator& tw = interp.get_evaluator ();
 
-                           event_manager& xevmgr = interp.get_event_manager ();
+                         event_manager& xevmgr = interp.get_event_manager ();
 
-                           xevmgr.set_workspace (true, tw.get_symbol_info ());
-                         }
+                         xevmgr.set_workspace (true, tw.get_symbol_info ());
+                       }
 
-                       // FIXME: if this action fails, do we need a way to
-                       // display that info in the GUI?
-                     });
-                 });
+                     // FIXME: if this action fails, do we need a way to
+                     // display that info in the GUI?
+                   });
+               });
 
-        connect (m_workspace_widget, &workspace_view::edit_variable_signal,
-                 [=] (const QString& var_name) {
-                   emit interpreter_event
-                     ([=] (interpreter& interp) {
-                       // INTERPRETER THREAD
+      connect (m_workspace_widget, &workspace_view::edit_variable_signal,
+               [=] (const QString& var_name) {
+                 emit interpreter_event
+                   ([=] (interpreter& interp) {
+                     // INTERPRETER THREAD
 
-                       std::string name = var_name.toStdString ();
-                       octave_value val = interp.varval (name);
+                     std::string name = var_name.toStdString ();
+                     octave_value val = interp.varval (name);
 
-                       event_manager& xevmgr = interp.get_event_manager ();
+                     event_manager& xevmgr = interp.get_event_manager ();
 
-                       xevmgr.edit_variable (name, val);
-                     });
-                 });
+                     xevmgr.edit_variable (name, val);
+                   });
+               });
 
-        emit interpreter_event
-          ([=] (interpreter& interp) {
-            // INTERPRETER THREAD
+      emit interpreter_event
+        ([=] (interpreter& interp) {
+          // INTERPRETER THREAD
 
-            event_manager& xevmgr = interp.get_event_manager ();
+          event_manager& xevmgr = interp.get_event_manager ();
 
-            xevmgr.set_workspace ();
-          });
-      }
+          xevmgr.set_workspace ();
+        });
+    }
 
-    return m_workspace_widget;
-  }
+  return m_workspace_widget;
+}
 
-  QPointer<file_editor_interface>
-  base_qobject::editor_widget (main_window */*mw*/)
-  {
+QPointer<file_editor_interface>
+base_qobject::editor_widget (main_window */*mw*/)
+{
 #if 0
-    if (m_editor_widget && mw)
-      {
-        m_editor_widget->set_main_window (mw);
-        m_editor_widget->set_adopted (true);
-      }
-    else if (! m_editor_widget)
-      m_editor_widget = new file_editor (mw);
+  if (m_editor_widget && mw)
+    {
+      m_editor_widget->set_main_window (mw);
+      m_editor_widget->set_adopted (true);
+    }
+  else if (! m_editor_widget)
+    m_editor_widget = new file_editor (mw);
 #endif
 
-    return m_editor_widget;
-  }
+  return m_editor_widget;
+}
 
-  QPointer<variable_editor>
-  base_qobject::variable_editor_widget (main_window *mw)
-  {
-    if (m_variable_editor_widget && mw)
-      {
-        m_variable_editor_widget->set_main_window (mw);
-        m_variable_editor_widget->set_adopted (true);
-      }
-    else if (! m_variable_editor_widget)
-      {
-        m_variable_editor_widget
-          = QPointer<variable_editor> (new variable_editor (mw));
+QPointer<variable_editor>
+base_qobject::variable_editor_widget (main_window *mw)
+{
+  if (m_variable_editor_widget && mw)
+    {
+      m_variable_editor_widget->set_main_window (mw);
+      m_variable_editor_widget->set_adopted (true);
+    }
+  else if (! m_variable_editor_widget)
+    {
+      m_variable_editor_widget
+        = QPointer<variable_editor> (new variable_editor (mw));
 
-        connect (m_variable_editor_widget, &variable_editor::updated,
-                 this, &base_qobject::handle_variable_editor_update);
+      connect (m_variable_editor_widget, &variable_editor::updated,
+               this, &base_qobject::handle_variable_editor_update);
 
-        connect (m_variable_editor_widget, &variable_editor::command_signal,
-                 this, &base_qobject::execute_command);
+      connect (m_variable_editor_widget, &variable_editor::command_signal,
+               this, &base_qobject::execute_command);
 
-        connect (qt_link (),
-                 &qt_interpreter_events::refresh_variable_editor_signal,
-                 m_variable_editor_widget, &variable_editor::refresh);
+      connect (qt_link (),
+               &qt_interpreter_events::refresh_variable_editor_signal,
+               m_variable_editor_widget, &variable_editor::refresh);
 
-        connect_interpreter_events<variable_editor> (m_variable_editor_widget);
-      }
+      connect_interpreter_events<variable_editor> (m_variable_editor_widget);
+    }
 
-    return m_variable_editor_widget;
-  }
+  return m_variable_editor_widget;
+}
 
-  QPointer<community_news> base_qobject::community_news_widget (int serial)
-  {
-    if (! m_community_news)
-      m_community_news
-        = QPointer<community_news> (new community_news (serial));
+QPointer<community_news> base_qobject::community_news_widget (int serial)
+{
+  if (! m_community_news)
+    m_community_news
+      = QPointer<community_news> (new community_news (serial));
 
-    return m_community_news;
-  }
+  return m_community_news;
+}
 
-  QPointer<release_notes> base_qobject::release_notes_widget ()
-  {
-    if (! m_release_notes)
-      m_release_notes = QPointer<release_notes> (new release_notes ());
+QPointer<release_notes> base_qobject::release_notes_widget ()
+{
+  if (! m_release_notes)
+    m_release_notes = QPointer<release_notes> (new release_notes ());
 
-    return m_release_notes;
-  }
+  return m_release_notes;
+}
 
-  bool base_qobject::confirm_shutdown ()
-  {
-    // Currently, we forward to main_window::confirm_shutdown instead of
-    // just displaying a dialog box here because the main_window also
-    // knows about and is responsible for notifying the editor.
+bool base_qobject::confirm_shutdown ()
+{
+  // Currently, we forward to main_window::confirm_shutdown instead of
+  // just displaying a dialog box here because the main_window also
+  // knows about and is responsible for notifying the editor.
 
-    return m_main_window ? m_main_window->confirm_shutdown () : true;
-  }
+  return m_main_window ? m_main_window->confirm_shutdown () : true;
+}
 
-  void base_qobject::start_gui (bool gui_app)
-  {
-    if (m_app_context.experimental_terminal_widget ())
-      {
-        if (m_main_window)
-          return;
+void base_qobject::start_gui (bool gui_app)
+{
+  if (m_app_context.experimental_terminal_widget ())
+    {
+      if (m_main_window)
+        return;
 
-        m_gui_app = gui_app;
+      m_gui_app = gui_app;
 
-        m_main_window = new main_window (*this);
+      m_main_window = new main_window (*this);
 
-        connect (qt_link (), &qt_interpreter_events::focus_window_signal,
-                 m_main_window, &main_window::focus_window);
+      connect (qt_link (), &qt_interpreter_events::focus_window_signal,
+               m_main_window, &main_window::focus_window);
 
-        connect (qt_link (), &qt_interpreter_events::close_gui_signal,
-                 this, &base_qobject::close_gui);
+      connect (qt_link (), &qt_interpreter_events::close_gui_signal,
+               this, &base_qobject::close_gui);
 
-        connect (m_main_window, &main_window::close_gui_signal,
-                 this, &base_qobject::close_gui);
+      connect (m_main_window, &main_window::close_gui_signal,
+               this, &base_qobject::close_gui);
 
-        connect (m_main_window, &main_window::show_community_news_signal,
-                 this, &base_qobject::show_community_news);
+      connect (m_main_window, &main_window::show_community_news_signal,
+               this, &base_qobject::show_community_news);
 
-        connect (m_main_window, &main_window::show_release_notes_signal,
-                 this, &base_qobject::show_release_notes);
+      connect (m_main_window, &main_window::show_release_notes_signal,
+               this, &base_qobject::show_release_notes);
 
-        if (m_interpreter_ready)
-          m_main_window->handle_octave_ready ();
-        else
-          connect (m_interpreter_qobj, &interpreter_qobject::ready,
-                   m_main_window, &main_window::handle_octave_ready);
+      if (m_interpreter_ready)
+        m_main_window->handle_octave_ready ();
+      else
+        connect (m_interpreter_qobj, &interpreter_qobject::ready,
+                 m_main_window, &main_window::handle_octave_ready);
 
-        if (m_gui_app)
-          m_qapplication->setQuitOnLastWindowClosed (true);
-        else
-          {
-            // FIXME: Save current values of PS1 and PS2 so they can be
-            // restored when we return to the command line?
-          }
+      if (m_gui_app)
+        m_qapplication->setQuitOnLastWindowClosed (true);
+      else
+        {
+          // FIXME: Save current values of PS1 and PS2 so they can be
+          // restored when we return to the command line?
+        }
 
-        m_app_context.gui_running (true);
-      }
-  }
+      m_app_context.gui_running (true);
+    }
+}
 
-  void base_qobject::show_terminal_window ()
-  {
-    terminal_dock_widget *widget
-      = (m_terminal_widget
-         ? m_terminal_widget : terminal_widget ());
+void base_qobject::show_terminal_window ()
+{
+  terminal_dock_widget *widget
+    = (m_terminal_widget
+       ? m_terminal_widget : terminal_widget ());
 
-    if (! widget->isVisible ())
-      {
-        widget->show ();
-        widget->raise ();
-      }
-  }
+  if (! widget->isVisible ())
+    {
+      widget->show ();
+      widget->raise ();
+    }
+}
 
-  void base_qobject::show_documentation_window (const QString& file)
-  {
-    documentation_dock_widget *widget
-      = (m_documentation_widget
-         ? m_documentation_widget : documentation_widget ());
+void base_qobject::show_documentation_window (const QString& file)
+{
+  documentation_dock_widget *widget
+    = (m_documentation_widget
+       ? m_documentation_widget : documentation_widget ());
 
-    widget->showDoc (file);
+  widget->showDoc (file);
 
-    if (! widget->isVisible ())
-      {
-        widget->show ();
-        widget->raise ();
-      }
-  }
+  if (! widget->isVisible ())
+    {
+      widget->show ();
+      widget->raise ();
+    }
+}
 
-  void base_qobject::show_file_browser_window ()
-  {
-    files_dock_widget *widget
-      = m_file_browser_widget ? m_file_browser_widget : file_browser_widget ();
+void base_qobject::show_file_browser_window ()
+{
+  files_dock_widget *widget
+    = m_file_browser_widget ? m_file_browser_widget : file_browser_widget ();
 
-    if (! widget->isVisible ())
-      {
-        widget->show ();
-        widget->raise ();
-      }
-  }
+  if (! widget->isVisible ())
+    {
+      widget->show ();
+      widget->raise ();
+    }
+}
 
-  void base_qobject::show_command_history_window ()
-  {
-    history_dock_widget *widget
-      = m_history_widget ? m_history_widget : history_widget ();
+void base_qobject::show_command_history_window ()
+{
+  history_dock_widget *widget
+    = m_history_widget ? m_history_widget : history_widget ();
 
-    if (! widget->isVisible ())
-      {
-        widget->show ();
-        widget->raise ();
-      }
-  }
+  if (! widget->isVisible ())
+    {
+      widget->show ();
+      widget->raise ();
+    }
+}
 
-  void base_qobject::show_workspace_window ()
-  {
-    workspace_view *widget
-      = m_workspace_widget ? m_workspace_widget : workspace_widget ();
+void base_qobject::show_workspace_window ()
+{
+  workspace_view *widget
+    = m_workspace_widget ? m_workspace_widget : workspace_widget ();
 
-    if (! widget->isVisible ())
-      {
-        widget->show ();
-        widget->raise ();
-      }
-  }
+  if (! widget->isVisible ())
+    {
+      widget->show ();
+      widget->raise ();
+    }
+}
 
-  void base_qobject::show_variable_editor_window (const QString& name,
-                                                  const octave_value& value)
-  {
-    variable_editor *widget
-      = (m_variable_editor_widget
-         ? m_variable_editor_widget : variable_editor_widget ());
+void base_qobject::show_variable_editor_window (const QString& name,
+                                                const octave_value& value)
+{
+  variable_editor *widget
+    = (m_variable_editor_widget
+       ? m_variable_editor_widget : variable_editor_widget ());
 
-    if (! widget->isVisible ())
-      {
-        widget->show ();
-        widget->raise ();
-      }
+  if (! widget->isVisible ())
+    {
+      widget->show ();
+      widget->raise ();
+    }
 
-    // FIXME: Should this be done with a signal/slot connection?
-    widget->edit_variable (name, value);
-  }
+  // FIXME: Should this be done with a signal/slot connection?
+  widget->edit_variable (name, value);
+}
 
-  void base_qobject::handle_variable_editor_update ()
-  {
-    // Called when the variable editor emits the updated signal.  The size
-    // of a variable may have changed, so we refresh the workspace in the
-    // interpreter.  That will eventually cause the workspace view in the
-    // GUI to be updated.
+void base_qobject::handle_variable_editor_update ()
+{
+  // Called when the variable editor emits the updated signal.  The size
+  // of a variable may have changed, so we refresh the workspace in the
+  // interpreter.  That will eventually cause the workspace view in the
+  // GUI to be updated.
 
-    interpreter_event
-      ([] (interpreter& interp)
-       {
-         // INTERPRETER THREAD
+  interpreter_event
+    ([] (interpreter& interp)
+     {
+       // INTERPRETER THREAD
 
-         tree_evaluator& tw = interp.get_evaluator ();
+       tree_evaluator& tw = interp.get_evaluator ();
 
-         event_manager& xevmgr = interp.get_event_manager ();
+       event_manager& xevmgr = interp.get_event_manager ();
 
-         xevmgr.set_workspace (true, tw.get_symbol_info (), false);
-       });
-  }
+       xevmgr.set_workspace (true, tw.get_symbol_info (), false);
+     });
+}
 
-  void base_qobject::show_community_news (int serial)
-  {
-    // Ensure widget exists.
-    community_news_widget (serial);
+void base_qobject::show_community_news (int serial)
+{
+  // Ensure widget exists.
+  community_news_widget (serial);
 
-    m_community_news->display ();
-  }
+  m_community_news->display ();
+}
 
-  void base_qobject::show_release_notes ()
-  {
-    // Ensure widget exists.
-    release_notes_widget ();
+void base_qobject::show_release_notes ()
+{
+  // Ensure widget exists.
+  release_notes_widget ();
 
-    m_release_notes->display ();
-  }
+  m_release_notes->display ();
+}
 
-  void base_qobject::execute_command (const QString& command)
-  {
-    emit interpreter_event
-      ([=] (interpreter& interp)
-      {
-        // INTERPRETER THREAD
+void base_qobject::execute_command (const QString& command)
+{
+  emit interpreter_event
+    ([=] (interpreter& interp)
+    {
+      // INTERPRETER THREAD
 
-        // FIXME: Do we need to do anything special about errors here?
-        // Currently the eval function will just call error() in the
-        // interpreter event loop and throw an execution error.  It will
-        // be caught, so shouldn't crash the interpreter, but the
-        // message may not go anywhere useful depending on how the GUI
-        // is being used or if Octave running server mode.
+      // FIXME: Do we need to do anything special about errors here?
+      // Currently the eval function will just call error() in the
+      // interpreter event loop and throw an execution error.  It will
+      // be caught, so shouldn't crash the interpreter, but the
+      // message may not go anywhere useful depending on how the GUI
+      // is being used or if Octave running server mode.
 
-        interp.eval (command.toStdString (), 0);
-      });
-  }
+      interp.eval (command.toStdString (), 0);
+    });
+}
 
-  void base_qobject::close_gui ()
-  {
-    if (m_app_context.experimental_terminal_widget ())
-      {
-        if (! m_main_window)
-          return;
+void base_qobject::close_gui ()
+{
+  if (m_app_context.experimental_terminal_widget ())
+    {
+      if (! m_main_window)
+        return;
 
-        // FIXME: Restore previous values of PS1 and PS2 if we are
-        // returning to the command line?
+      // FIXME: Restore previous values of PS1 and PS2 if we are
+      // returning to the command line?
 
-        interpreter_event
-          ([=] (interpreter& interp)
-          {
-            // INTERPRETER THREAD
+      interpreter_event
+        ([=] (interpreter& interp)
+        {
+          // INTERPRETER THREAD
 
-            application *app = interp.get_app_context ();
+          application *app = interp.get_app_context ();
 
-            cmdline_options opts = app->options ();
+          cmdline_options opts = app->options ();
 
-            if (opts.gui ())
-              interp.quit (0, false, false);
-          });
+          if (opts.gui ())
+            interp.quit (0, false, false);
+        });
 
-        m_app_context.gui_running (false);
+      m_app_context.gui_running (false);
 
-        if (m_main_window)
-          {
-            m_main_window->deleteLater ();
+      if (m_main_window)
+        {
+          m_main_window->deleteLater ();
 
-            m_main_window = nullptr;
-          }
-      }
-  }
+          m_main_window = nullptr;
+        }
+    }
+}
 
-  void base_qobject::interpreter_ready ()
-  {
-    m_interpreter_ready = true;
-  }
+void base_qobject::interpreter_ready ()
+{
+  m_interpreter_ready = true;
+}
 
-  void base_qobject::interpreter_event (const fcn_callback& fcn)
-  {
-    // The following is a direct function call across threads.  It works
-    // because it is accessing a thread-safe queue of events that
-    // are later executed by the Octave interpreter in the other thread.
+void base_qobject::interpreter_event (const fcn_callback& fcn)
+{
+  // The following is a direct function call across threads.  It works
+  // because it is accessing a thread-safe queue of events that
+  // are later executed by the Octave interpreter in the other thread.
 
-    // See also the comments in interpreter-qobject.h about
-    // interpreter_qobject slots.
+  // See also the comments in interpreter-qobject.h about
+  // interpreter_qobject slots.
 
-    m_interpreter_qobj->interpreter_event (fcn);
-  }
+  m_interpreter_qobj->interpreter_event (fcn);
+}
 
-  void base_qobject::interpreter_event (const meth_callback& meth)
-  {
-    // The following is a direct function call across threads.  It works
-    // because it is accessing a thread-safe queue of events that
-    // are later executed by the Octave interpreter in the other thread.
+void base_qobject::interpreter_event (const meth_callback& meth)
+{
+  // The following is a direct function call across threads.  It works
+  // because it is accessing a thread-safe queue of events that
+  // are later executed by the Octave interpreter in the other thread.
 
-    // See also the comments in interpreter-qobject.h about
-    // interpreter_qobject slots.
+  // See also the comments in interpreter-qobject.h about
+  // interpreter_qobject slots.
 
-    m_interpreter_qobj->interpreter_event (meth);
-  }
+  m_interpreter_qobj->interpreter_event (meth);
+}
 
-  void base_qobject::interpreter_interrupt ()
-  {
-    m_interpreter_qobj->interrupt ();
-  }
+void base_qobject::interpreter_interrupt ()
+{
+  m_interpreter_qobj->interrupt ();
+}
 
-  // FIXME: Should we try to make the pause, stop, and resume actions
-  // work for both the old and new terminal widget?
+// FIXME: Should we try to make the pause, stop, and resume actions
+// work for both the old and new terminal widget?
 
-  void base_qobject::interpreter_pause ()
-  {
-    if (m_app_context.experimental_terminal_widget ())
-      m_interpreter_qobj->pause ();
-  }
+void base_qobject::interpreter_pause ()
+{
+  if (m_app_context.experimental_terminal_widget ())
+    m_interpreter_qobj->pause ();
+}
 
-  void base_qobject::interpreter_stop ()
-  {
-    if (m_app_context.experimental_terminal_widget ())
-      m_interpreter_qobj->stop ();
-  }
+void base_qobject::interpreter_stop ()
+{
+  if (m_app_context.experimental_terminal_widget ())
+    m_interpreter_qobj->stop ();
+}
 
-  void base_qobject::interpreter_resume ()
-  {
-    if (m_app_context.experimental_terminal_widget ())
-      m_interpreter_qobj->resume ();
-  }
+void base_qobject::interpreter_resume ()
+{
+  if (m_app_context.experimental_terminal_widget ())
+    m_interpreter_qobj->resume ();
+}
 
-  void base_qobject::copy_image_to_clipboard (const QString& file,
-                                              bool remove_file)
-  {
-    QClipboard *clipboard = QApplication::clipboard ();
+void base_qobject::copy_image_to_clipboard (const QString& file,
+                                            bool remove_file)
+{
+  QClipboard *clipboard = QApplication::clipboard ();
 
-    QImage img (file);
+  QImage img (file);
 
-    if (img.isNull ())
-      {
-        // Report error?
-        return;
-      }
+  if (img.isNull ())
+    {
+      // Report error?
+      return;
+    }
 
-    clipboard->setImage (img);
+  clipboard->setImage (img);
 
-    if (remove_file)
-      QFile::remove (file);
-  }
+  if (remove_file)
+    QFile::remove (file);
+}
 
 OCTAVE_END_NAMESPACE(octave)
--- a/libgui/src/qt-application.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/qt-application.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -46,60 +46,60 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  qt_application::qt_application (const std::string& organization_name,
-                                  const std::string& application_name,
-                                  const std::string& application_version,
-                                  int argc, char **argv)
-    : application (argc, argv)
-  {
-    if (! organization_name.empty ())
-      QCoreApplication::setOrganizationName
-        (QString::fromStdString (organization_name));
+qt_application::qt_application (const std::string& organization_name,
+                                const std::string& application_name,
+                                const std::string& application_version,
+                                int argc, char **argv)
+  : application (argc, argv)
+{
+  if (! organization_name.empty ())
+    QCoreApplication::setOrganizationName
+      (QString::fromStdString (organization_name));
 
-    if (! application_name.empty ())
-      QCoreApplication::setApplicationName
-        (QString::fromStdString (application_name));
+  if (! application_name.empty ())
+    QCoreApplication::setApplicationName
+      (QString::fromStdString (application_name));
 
-    if (! application_version.empty ())
-      QCoreApplication::setApplicationVersion
-        (QString::fromStdString (application_version));
+  if (! application_version.empty ())
+    QCoreApplication::setApplicationVersion
+      (QString::fromStdString (application_version));
 
-    // FIXME: Is there a better place for this?
-    QSettings::setDefaultFormat (QSettings::IniFormat);
+  // FIXME: Is there a better place for this?
+  QSettings::setDefaultFormat (QSettings::IniFormat);
 
-    // This should probably happen early.
-    sysdep_init ();
-  }
+  // This should probably happen early.
+  sysdep_init ();
+}
 
-  qt_application::qt_application (int argc, char **argv)
-    : application (argc, argv)
-  {
-    // This should probably happen early.
-    sysdep_init ();
-  }
+qt_application::qt_application (int argc, char **argv)
+  : application (argc, argv)
+{
+  // This should probably happen early.
+  sysdep_init ();
+}
 
-  bool qt_application::start_gui_p () const
-  {
-    // Note: this function is not needed if using the experimental
-    // terminal widget, so return a dummy value of false in that case.
+bool qt_application::start_gui_p () const
+{
+  // Note: this function is not needed if using the experimental
+  // terminal widget, so return a dummy value of false in that case.
 
-    return experimental_terminal_widget () ? false : m_options.gui ();
-  }
+  return experimental_terminal_widget () ? false : m_options.gui ();
+}
 
-  int qt_application::execute ()
-  {
-    octave_block_interrupt_signal ();
+int qt_application::execute ()
+{
+  octave_block_interrupt_signal ();
 
-    set_application_id ();
+  set_application_id ();
 
-    // Create and show main window.
+  // Create and show main window.
 
-    // Note: the second argument is ignored if using the new terminal
-    // widget.
+  // Note: the second argument is ignored if using the new terminal
+  // widget.
 
-    base_qobject qt_interface (*this, start_gui_p ());
+  base_qobject qt_interface (*this, start_gui_p ());
 
-    return qt_interface.exec ();
-  }
+  return qt_interface.exec ();
+}
 
 OCTAVE_END_NAMESPACE(octave)
--- a/libgui/src/qt-application.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/qt-application.h	Thu Feb 02 12:25:51 2023 -0800
@@ -32,49 +32,49 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  // Programming Note: This file must not include any Qt headers.  Any
-  // Qt header files required by the qt_application::execute function
-  // must be included only in the corresponding .cc file.
+// Programming Note: This file must not include any Qt headers.  Any
+// Qt header files required by the qt_application::execute function
+// must be included only in the corresponding .cc file.
 
-  //! This class inherits from the pure-virtual base class
-  //! application and provides an implementation of the
-  //! application::execute method that starts an interface to Octave
-  //! that is based on Qt.  It may start a command-line interface that
-  //! allows Qt graphics to be used or it may start an interface that
-  //! provides the full GUI experience.
+//! This class inherits from the pure-virtual base class
+//! application and provides an implementation of the
+//! application::execute method that starts an interface to Octave
+//! that is based on Qt.  It may start a command-line interface that
+//! allows Qt graphics to be used or it may start an interface that
+//! provides the full GUI experience.
 
-  class OCTGUI_API qt_application  : public application
-  {
-  public:
+class OCTGUI_API qt_application  : public application
+{
+public:
 
-    qt_application (const std::string& organization_name,
-                    const std::string& application_name,
-                    const std::string& application_version,
-                    int argc, char **argv);
+  qt_application (const std::string& organization_name,
+                  const std::string& application_name,
+                  const std::string& application_version,
+                  int argc, char **argv);
 
-    qt_application (int argc, char **argv);
+  qt_application (int argc, char **argv);
 
-    // No copying, at least not yet.
+  // No copying, at least not yet.
 
-    qt_application (const qt_application&) = delete;
+  qt_application (const qt_application&) = delete;
 
-    qt_application& operator = (const qt_application&) = delete;
+  qt_application& operator = (const qt_application&) = delete;
 
-    ~qt_application () = default;
+  ~qt_application () = default;
 
-    // Should we start the GUI or fall back to the CLI?
-    bool start_gui_p () const;
+  // Should we start the GUI or fall back to the CLI?
+  bool start_gui_p () const;
 
-    int execute ();
+  int execute ();
 
-    bool gui_running () const { return m_gui_running; }
-    void gui_running (bool arg) { m_gui_running = arg; }
+  bool gui_running () const { return m_gui_running; }
+  void gui_running (bool arg) { m_gui_running = arg; }
 
-  private:
+private:
 
-    // If TRUE, the GUI should be started.
-    bool m_gui_running = false;
-  };
+  // If TRUE, the GUI should be started.
+  bool m_gui_running = false;
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/src/qt-interpreter-events.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/qt-interpreter-events.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -65,690 +65,690 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  static QStringList
-  make_qstring_list (const std::list<std::string>& lst)
-  {
-    QStringList retval;
+static QStringList
+make_qstring_list (const std::list<std::string>& lst)
+{
+  QStringList retval;
 
-    for (const auto& s : lst)
-      retval.append (QString::fromStdString (s));
+  for (const auto& s : lst)
+    retval.append (QString::fromStdString (s));
 
-    return retval;
-  }
+  return retval;
+}
 
-  static QStringList
-  make_filter_list (const event_manager::filter_list& lst)
-  {
-    QStringList retval;
+static QStringList
+make_filter_list (const event_manager::filter_list& lst)
+{
+  QStringList retval;
 
-    // We have pairs of data, first being the list of extensions
-    // exta;exb;extc etc second the name to use as filter name
-    // (optional).  Qt wants a list of filters in the format of
-    // 'FilterName (space separated exts)'.
+  // We have pairs of data, first being the list of extensions
+  // exta;exb;extc etc second the name to use as filter name
+  // (optional).  Qt wants a list of filters in the format of
+  // 'FilterName (space separated exts)'.
 
-    for (const auto& ext_name : lst)
-      {
-        QString ext = QString::fromStdString (ext_name.first);
-        QString name = QString::fromStdString (ext_name.second);
+  for (const auto& ext_name : lst)
+    {
+      QString ext = QString::fromStdString (ext_name.first);
+      QString name = QString::fromStdString (ext_name.second);
 
-        // Strip out extensions from name and replace ';' with spaces in list.
+      // Strip out extensions from name and replace ';' with spaces in list.
 
-        name.replace (QRegExp (R"(\(.*\))"), "");
-        ext.replace (";", " ");
+      name.replace (QRegExp (R"(\(.*\))"), "");
+      ext.replace (";", " ");
 
-        if (name.isEmpty ())
-          {
-            // No name field.  Build one from the extensions.
-            name = ext.toUpper () + " Files";
-          }
+      if (name.isEmpty ())
+        {
+          // No name field.  Build one from the extensions.
+          name = ext.toUpper () + " Files";
+        }
 
-        retval.append (name + " (" + ext + ')');
-      }
+      retval.append (name + " (" + ext + ')');
+    }
 
-    return retval;
-  }
+  return retval;
+}
 
-  qt_interpreter_events::qt_interpreter_events (base_qobject& oct_qobj)
-    : interpreter_events (), m_octave_qobj (oct_qobj),
-      m_uiwidget_creator (), m_result (), m_mutex (),
-      m_waitcondition ()
-  {
-    qRegisterMetaType<QIntList> ("QIntList");
-    qRegisterMetaType<QFloatList> ("QFloatList");
+qt_interpreter_events::qt_interpreter_events (base_qobject& oct_qobj)
+  : interpreter_events (), m_octave_qobj (oct_qobj),
+    m_uiwidget_creator (), m_result (), m_mutex (),
+    m_waitcondition ()
+{
+  qRegisterMetaType<QIntList> ("QIntList");
+  qRegisterMetaType<QFloatList> ("QFloatList");
 
-    qRegisterMetaType<octave_value> ("octave_value");
-    qRegisterMetaType<symbol_info_list> ("symbol_info_list");
+  qRegisterMetaType<octave_value> ("octave_value");
+  qRegisterMetaType<symbol_info_list> ("symbol_info_list");
 
-    qRegisterMetaType<fcn_callback> ("fcn_callback");
-    qRegisterMetaType<meth_callback> ("meth_callback");
+  qRegisterMetaType<fcn_callback> ("fcn_callback");
+  qRegisterMetaType<meth_callback> ("meth_callback");
 
-    connect (this, &qt_interpreter_events::confirm_shutdown_signal,
-             this, &qt_interpreter_events::confirm_shutdown_octave);
+  connect (this, &qt_interpreter_events::confirm_shutdown_signal,
+           this, &qt_interpreter_events::confirm_shutdown_octave);
 
-    connect (this, &qt_interpreter_events::get_named_icon_signal,
-             this, &qt_interpreter_events::get_named_icon_slot);
+  connect (this, &qt_interpreter_events::get_named_icon_signal,
+           this, &qt_interpreter_events::get_named_icon_slot);
 
-    connect (this, &qt_interpreter_events::gui_preference_signal,
-             this, &qt_interpreter_events::gui_preference_slot);
-  }
+  connect (this, &qt_interpreter_events::gui_preference_signal,
+           this, &qt_interpreter_events::gui_preference_slot);
+}
 
-  void qt_interpreter_events::start_gui (bool gui_app)
-  {
-    if (m_octave_qobj.experimental_terminal_widget ())
-      emit start_gui_signal (gui_app);
-  }
+void qt_interpreter_events::start_gui (bool gui_app)
+{
+  if (m_octave_qobj.experimental_terminal_widget ())
+    emit start_gui_signal (gui_app);
+}
 
-  void qt_interpreter_events::close_gui ()
-  {
-    if (m_octave_qobj.experimental_terminal_widget ())
-      emit close_gui_signal ();
-  }
+void qt_interpreter_events::close_gui ()
+{
+  if (m_octave_qobj.experimental_terminal_widget ())
+    emit close_gui_signal ();
+}
 
-  std::list<std::string>
-  qt_interpreter_events::file_dialog (const filter_list& filter,
-                                      const std::string& title,
-                                      const std::string& filename,
-                                      const std::string& dirname,
-                                      const std::string& multimode)
-  {
-    QStringList lst
-      = m_uiwidget_creator.file_dialog (make_filter_list (filter),
-                                        QString::fromStdString (title),
-                                        QString::fromStdString (filename),
-                                        QString::fromStdString (dirname),
-                                        QString::fromStdString (multimode));
+std::list<std::string>
+qt_interpreter_events::file_dialog (const filter_list& filter,
+                                    const std::string& title,
+                                    const std::string& filename,
+                                    const std::string& dirname,
+                                    const std::string& multimode)
+{
+  QStringList lst
+    = m_uiwidget_creator.file_dialog (make_filter_list (filter),
+                                      QString::fromStdString (title),
+                                      QString::fromStdString (filename),
+                                      QString::fromStdString (dirname),
+                                      QString::fromStdString (multimode));
 
-    std::list<std::string> retval;
+  std::list<std::string> retval;
 
-    for (const auto& s : lst)
-      retval.push_back (s.toStdString ());
+  for (const auto& s : lst)
+    retval.push_back (s.toStdString ());
 
-    return retval;
-  }
+  return retval;
+}
 
-  std::list<std::string>
-  qt_interpreter_events::input_dialog (const std::list<std::string>& prompt,
-                                       const std::string& title,
-                                       const std::list<float>& nr,
-                                       const std::list<float>& nc,
-                                       const std::list<std::string>& defaults)
-  {
-    QStringList lst
-      = m_uiwidget_creator.input_dialog (make_qstring_list (prompt),
-                                         QString::fromStdString (title),
-                                         std_list_to_qt_list<float> (nr),
-                                         std_list_to_qt_list<float> (nc),
-                                         make_qstring_list (defaults));
-    std::list<std::string> retval;
+std::list<std::string>
+qt_interpreter_events::input_dialog (const std::list<std::string>& prompt,
+                                     const std::string& title,
+                                     const std::list<float>& nr,
+                                     const std::list<float>& nc,
+                                     const std::list<std::string>& defaults)
+{
+  QStringList lst
+    = m_uiwidget_creator.input_dialog (make_qstring_list (prompt),
+                                       QString::fromStdString (title),
+                                       std_list_to_qt_list<float> (nr),
+                                       std_list_to_qt_list<float> (nc),
+                                       make_qstring_list (defaults));
+  std::list<std::string> retval;
 
-    for (const auto& s : lst)
-      retval.push_back (s.toStdString ());
+  for (const auto& s : lst)
+    retval.push_back (s.toStdString ());
 
-    return retval;
-  }
+  return retval;
+}
 
-  std::pair<std::list<int>, int>
-  qt_interpreter_events::list_dialog (const std::list<std::string>& list,
-                                      const std::string& mode,
-                                      int width, int height,
-                                      const std::list<int>& initial,
-                                      const std::string& name,
-                                      const std::list<std::string>& prompt,
-                                      const std::string& ok_string,
-                                      const std::string& cancel_string)
-  {
-    QPair<QIntList, int> result
-      = m_uiwidget_creator.list_dialog (make_qstring_list (list),
-                                        QString::fromStdString (mode),
-                                        width, height,
-                                        std_list_to_qt_list<int> (initial),
-                                        QString::fromStdString (name),
-                                        make_qstring_list (prompt),
-                                        QString::fromStdString (ok_string),
-                                        QString::fromStdString (cancel_string));
+std::pair<std::list<int>, int>
+qt_interpreter_events::list_dialog (const std::list<std::string>& list,
+                                    const std::string& mode,
+                                    int width, int height,
+                                    const std::list<int>& initial,
+                                    const std::string& name,
+                                    const std::list<std::string>& prompt,
+                                    const std::string& ok_string,
+                                    const std::string& cancel_string)
+{
+  QPair<QIntList, int> result
+    = m_uiwidget_creator.list_dialog (make_qstring_list (list),
+                                      QString::fromStdString (mode),
+                                      width, height,
+                                      std_list_to_qt_list<int> (initial),
+                                      QString::fromStdString (name),
+                                      make_qstring_list (prompt),
+                                      QString::fromStdString (ok_string),
+                                      QString::fromStdString (cancel_string));
 
-    QIntList& lst = result.first;
-    return std::pair<std::list<int>, int> (std::list<int> (lst.begin (),
-                                                           lst.end ()),
-                                           result.second);
-  }
+  QIntList& lst = result.first;
+  return std::pair<std::list<int>, int> (std::list<int> (lst.begin (),
+                                                         lst.end ()),
+                                         result.second);
+}
 
-  std::string
-  qt_interpreter_events::question_dialog (const std::string& msg,
-                                          const std::string& title,
-                                          const std::string& btn1,
-                                          const std::string& btn2,
-                                          const std::string& btn3,
-                                          const std::string& btndef)
-  {
-    QString icon = "quest";
-    QStringList buttons;
-    QStringList role;
+std::string
+qt_interpreter_events::question_dialog (const std::string& msg,
+                                        const std::string& title,
+                                        const std::string& btn1,
+                                        const std::string& btn2,
+                                        const std::string& btn3,
+                                        const std::string& btndef)
+{
+  QString icon = "quest";
+  QStringList buttons;
+  QStringList role;
 
-    // Must use ResetRole which is left-aligned for all OS and WM.
-    role << "ResetRole" << "ResetRole" << "ResetRole";
+  // Must use ResetRole which is left-aligned for all OS and WM.
+  role << "ResetRole" << "ResetRole" << "ResetRole";
 
-    buttons << QString::fromStdString (btn1);
-    if (btn2 == "")
-      role.removeAt (0);
-    else
-      buttons << QString::fromStdString (btn2);
-    buttons << QString::fromStdString (btn3);
+  buttons << QString::fromStdString (btn1);
+  if (btn2 == "")
+    role.removeAt (0);
+  else
+    buttons << QString::fromStdString (btn2);
+  buttons << QString::fromStdString (btn3);
 
-    QString answer
-      = m_uiwidget_creator.message_dialog (QString::fromStdString (msg),
-                                           QString::fromStdString (title),
-                                           icon, buttons,
-                                           QString::fromStdString (btndef),
-                                           role);
+  QString answer
+    = m_uiwidget_creator.message_dialog (QString::fromStdString (msg),
+                                         QString::fromStdString (title),
+                                         icon, buttons,
+                                         QString::fromStdString (btndef),
+                                         role);
 
-    return answer.toStdString ();
-  }
+  return answer.toStdString ();
+}
 
-  void qt_interpreter_events::update_path_dialog ()
-  {
-    emit update_path_dialog_signal ();
-  }
+void qt_interpreter_events::update_path_dialog ()
+{
+  emit update_path_dialog_signal ();
+}
 
-  void qt_interpreter_events::show_preferences ()
-  {
-    emit show_preferences_signal ();
-  }
+void qt_interpreter_events::show_preferences ()
+{
+  emit show_preferences_signal ();
+}
 
-  void qt_interpreter_events::apply_preferences ()
-  {
-    emit apply_new_settings ();
-  }
+void qt_interpreter_events::apply_preferences ()
+{
+  emit apply_new_settings ();
+}
 
-  void qt_interpreter_events::show_terminal_window ()
-  {
-    emit show_terminal_window_signal ();
-  }
+void qt_interpreter_events::show_terminal_window ()
+{
+  emit show_terminal_window_signal ();
+}
 
-  bool qt_interpreter_events::show_documentation (const std::string& file)
-  {
-    emit show_documentation_signal (QString::fromStdString (file));
+bool qt_interpreter_events::show_documentation (const std::string& file)
+{
+  emit show_documentation_signal (QString::fromStdString (file));
 
-    return true;
-  }
+  return true;
+}
 
-  void qt_interpreter_events::show_file_browser ()
-  {
-    emit show_file_browser_signal ();
-  }
+void qt_interpreter_events::show_file_browser ()
+{
+  emit show_file_browser_signal ();
+}
 
-  void qt_interpreter_events::show_command_history ()
-  {
-    emit show_command_history_signal ();
-  }
+void qt_interpreter_events::show_command_history ()
+{
+  emit show_command_history_signal ();
+}
 
-  void qt_interpreter_events::show_workspace ()
-  {
-    emit show_workspace_signal ();
-  }
+void qt_interpreter_events::show_workspace ()
+{
+  emit show_workspace_signal ();
+}
 
-  void qt_interpreter_events::show_community_news (int serial)
-  {
-    emit show_community_news_signal (serial);
-  }
+void qt_interpreter_events::show_community_news (int serial)
+{
+  emit show_community_news_signal (serial);
+}
 
-  void qt_interpreter_events::show_release_notes ()
-  {
-    emit show_release_notes_signal ();
-  }
+void qt_interpreter_events::show_release_notes ()
+{
+  emit show_release_notes_signal ();
+}
 
-  bool qt_interpreter_events::edit_file (const std::string& file)
-  {
-    emit edit_file_signal (QString::fromStdString (file));
+bool qt_interpreter_events::edit_file (const std::string& file)
+{
+  emit edit_file_signal (QString::fromStdString (file));
 
-    return true;
-  }
+  return true;
+}
 
-  void qt_interpreter_events::edit_variable (const std::string& expr,
-                                             const octave_value& val)
-  {
-    emit edit_variable_signal (QString::fromStdString (expr), val);
-  }
+void qt_interpreter_events::edit_variable (const std::string& expr,
+                                           const octave_value& val)
+{
+  emit edit_variable_signal (QString::fromStdString (expr), val);
+}
 
-  bool qt_interpreter_events::confirm_shutdown ()
-  {
-    QMutexLocker autolock (&m_mutex);
+bool qt_interpreter_events::confirm_shutdown ()
+{
+  QMutexLocker autolock (&m_mutex);
 
-    emit confirm_shutdown_signal ();
+  emit confirm_shutdown_signal ();
 
-    // Wait for result.
-    wait ();
+  // Wait for result.
+  wait ();
 
-    return m_result.toBool ();
-  }
+  return m_result.toBool ();
+}
 
-  bool qt_interpreter_events::prompt_new_edit_file (const std::string& file)
-  {
-    gui_settings settings;
+bool qt_interpreter_events::prompt_new_edit_file (const std::string& file)
+{
+  gui_settings settings;
 
-    if (settings.bool_value (ed_create_new_file))
-      return true;
+  if (settings.bool_value (ed_create_new_file))
+    return true;
 
-    std::string abs_fname = sys::env::make_absolute (file);
+  std::string abs_fname = sys::env::make_absolute (file);
 
-    QStringList btn;
-    QStringList role;
-    role << "YesRole" << "RejectRole";
-    btn << tr ("Create") << tr ("Cancel");
+  QStringList btn;
+  QStringList role;
+  role << "YesRole" << "RejectRole";
+  btn << tr ("Create") << tr ("Cancel");
 
-    QString answer = m_uiwidget_creator.message_dialog
-      (tr ("File\n%1\ndoes not exist. Do you want to create it?").
-       arg (QString::fromStdString (abs_fname)),
-       tr ("Octave Editor"), "quest", btn, tr ("Create"), role);
+  QString answer = m_uiwidget_creator.message_dialog
+    (tr ("File\n%1\ndoes not exist. Do you want to create it?").
+     arg (QString::fromStdString (abs_fname)),
+     tr ("Octave Editor"), "quest", btn, tr ("Create"), role);
 
-    return (answer == tr ("Create"));
-  }
+  return (answer == tr ("Create"));
+}
 
-  // Prompt to allow file to be run by setting cwd (or if
-  // addpath_option==true, alternatively setting the path).
+// Prompt to allow file to be run by setting cwd (or if
+// addpath_option==true, alternatively setting the path).
 
-  int
-  qt_interpreter_events::debug_cd_or_addpath_error (const std::string& file,
-                                                    const std::string& dir,
-                                                    bool addpath_option)
-  {
-    int retval = -1;
+int
+qt_interpreter_events::debug_cd_or_addpath_error (const std::string& file,
+                                                  const std::string& dir,
+                                                  bool addpath_option)
+{
+  int retval = -1;
 
-    QString qdir = QString::fromStdString (dir);
-    QString qfile = QString::fromStdString (file);
-    QString msg
-      = (addpath_option
-         ? tr ("The file %1 does not exist in the load path.  To run or debug the function you are editing, you must either change to the directory %2 or add that directory to the load path.").arg (qfile).arg (qdir)
-         : tr ("The file %1 is shadowed by a file with the same name in the load path. To run or debug the function you are editing, change to the directory %2.").arg (qfile).arg (qdir));
+  QString qdir = QString::fromStdString (dir);
+  QString qfile = QString::fromStdString (file);
+  QString msg
+    = (addpath_option
+       ? tr ("The file %1 does not exist in the load path.  To run or debug the function you are editing, you must either change to the directory %2 or add that directory to the load path.").arg (qfile).arg (qdir)
+       : tr ("The file %1 is shadowed by a file with the same name in the load path. To run or debug the function you are editing, change to the directory %2.").arg (qfile).arg (qdir));
 
-    QString title = tr ("Change Directory or Add Directory to Load Path");
+  QString title = tr ("Change Directory or Add Directory to Load Path");
 
-    QString cd_txt = tr ("&Change Directory");
-    QString addpath_txt = tr ("&Add Directory to Load Path");
-    QString cancel_txt = tr ("Cancel");
+  QString cd_txt = tr ("&Change Directory");
+  QString addpath_txt = tr ("&Add Directory to Load Path");
+  QString cancel_txt = tr ("Cancel");
 
-    QStringList btn;
-    QStringList role;
-    btn << cd_txt;
-    role << "YesRole";
-    if (addpath_option)
-      {
-        btn << addpath_txt;
-        role << "AcceptRole";
-      }
-    btn << cancel_txt;
-    role << "RejectRole";
+  QStringList btn;
+  QStringList role;
+  btn << cd_txt;
+  role << "YesRole";
+  if (addpath_option)
+    {
+      btn << addpath_txt;
+      role << "AcceptRole";
+    }
+  btn << cancel_txt;
+  role << "RejectRole";
 
-    QString result
-      = m_uiwidget_creator.message_dialog (msg, title, "quest", btn,
-                                           cancel_txt, role);
+  QString result
+    = m_uiwidget_creator.message_dialog (msg, title, "quest", btn,
+                                         cancel_txt, role);
 
-    if (result == cd_txt)
-      retval = 1;
-    else if (result == addpath_txt)
-      retval = 2;
+  if (result == cd_txt)
+    retval = 1;
+  else if (result == addpath_txt)
+    retval = 2;
 
-    return retval;
-  }
+  return retval;
+}
 
-  uint8NDArray qt_interpreter_events::get_named_icon (const std::string& name)
-  {
-    QMutexLocker autolock (&m_mutex);
+uint8NDArray qt_interpreter_events::get_named_icon (const std::string& name)
+{
+  QMutexLocker autolock (&m_mutex);
 
-    emit get_named_icon_signal (QString::fromStdString (name));
+  emit get_named_icon_signal (QString::fromStdString (name));
 
-    // Wait for result.
-    wait ();
+  // Wait for result.
+  wait ();
 
-    uint8NDArray empty_img;
+  uint8NDArray empty_img;
 
-    QIcon icon = m_result.value<QIcon> ();
+  QIcon icon = m_result.value<QIcon> ();
 
-    if (icon.isNull ())
-      return empty_img;
+  if (icon.isNull ())
+    return empty_img;
 
-    QImage img = icon.pixmap (QSize (32, 32)).toImage ();
+  QImage img = icon.pixmap (QSize (32, 32)).toImage ();
 
-    if (img.format () != QImage::Format_ARGB32_Premultiplied)
-      return empty_img;
+  if (img.format () != QImage::Format_ARGB32_Premultiplied)
+    return empty_img;
 
-    dim_vector dims (img.height (), img.width (), 4);
+  dim_vector dims (img.height (), img.width (), 4);
 
-    uint8NDArray retval (dims, 0);
+  uint8NDArray retval (dims, 0);
 
-    uint8_t *bits = img.bits ();
+  uint8_t *bits = img.bits ();
 
-    for (int i = 0; i < img.height (); i++)
-      {
-        for (int j = 0; j < img.width (); j++)
-          {
-            retval(i, j, 2) = bits[0];
-            retval(i, j, 1) = bits[1];
-            retval(i, j, 0) = bits[2];
-            retval(i, j, 3) = bits[3];
+  for (int i = 0; i < img.height (); i++)
+    {
+      for (int j = 0; j < img.width (); j++)
+        {
+          retval(i, j, 2) = bits[0];
+          retval(i, j, 1) = bits[1];
+          retval(i, j, 0) = bits[2];
+          retval(i, j, 3) = bits[3];
 
-            bits += 4;
-          }
-      }
+          bits += 4;
+        }
+    }
 
-    return retval;
-  }
+  return retval;
+}
 
-  void qt_interpreter_events::get_named_icon_slot (const QString& name)
-  {
-    QMutexLocker autolock (&m_mutex);
+void qt_interpreter_events::get_named_icon_slot (const QString& name)
+{
+  QMutexLocker autolock (&m_mutex);
 
-    gui_settings settings;
+  gui_settings settings;
 
-    m_result = QVariant::fromValue (settings.icon (name));
+  m_result = QVariant::fromValue (settings.icon (name));
 
-    wake_all ();
-  }
+  wake_all ();
+}
 
-  std::string
-  qt_interpreter_events::gui_preference (const std::string& key,
-                                         const std::string& value)
-  {
-    QString pref_value;
+std::string
+qt_interpreter_events::gui_preference (const std::string& key,
+                                       const std::string& value)
+{
+  QString pref_value;
 
-    QMutexLocker autolock (&m_mutex);
+  QMutexLocker autolock (&m_mutex);
 
-    // Emit the signal for changing or getting a preference
-    emit gui_preference_signal (QString::fromStdString (key),
-                                QString::fromStdString (value));
+  // Emit the signal for changing or getting a preference
+  emit gui_preference_signal (QString::fromStdString (key),
+                              QString::fromStdString (value));
 
-    // Wait for response (pref_value).
-    wait ();
+  // Wait for response (pref_value).
+  wait ();
 
-    QString pref = m_result.toString ();
+  QString pref = m_result.toString ();
 
-    return pref.toStdString ();
-  }
+  return pref.toStdString ();
+}
 
-  bool qt_interpreter_events::copy_image_to_clipboard (const std::string& file)
-  {
-    emit copy_image_to_clipboard_signal (QString::fromStdString (file), true);
+bool qt_interpreter_events::copy_image_to_clipboard (const std::string& file)
+{
+  emit copy_image_to_clipboard_signal (QString::fromStdString (file), true);
 
-    return true;
-  }
+  return true;
+}
 
-  void qt_interpreter_events::focus_window (const std::string win_name)
-  {
-    emit focus_window_signal (QString::fromStdString (win_name));
-  }
+void qt_interpreter_events::focus_window (const std::string win_name)
+{
+  emit focus_window_signal (QString::fromStdString (win_name));
+}
 
-  void qt_interpreter_events::execute_command_in_terminal
-  (const std::string& command)
-  {
-    emit execute_command_in_terminal_signal (QString::fromStdString (command));
-  }
+void qt_interpreter_events::execute_command_in_terminal
+(const std::string& command)
+{
+  emit execute_command_in_terminal_signal (QString::fromStdString (command));
+}
 
-  void qt_interpreter_events::register_documentation (const std::string& file)
-  {
-    emit register_documentation_signal (QString::fromStdString (file));
-  }
+void qt_interpreter_events::register_documentation (const std::string& file)
+{
+  emit register_documentation_signal (QString::fromStdString (file));
+}
 
-  void qt_interpreter_events::unregister_documentation (const std::string& file)
-  {
-    emit unregister_documentation_signal (QString::fromStdString (file));
-  }
+void qt_interpreter_events::unregister_documentation (const std::string& file)
+{
+  emit unregister_documentation_signal (QString::fromStdString (file));
+}
 
-  void qt_interpreter_events::interpreter_output (const std::string& msg)
-  {
-    if (m_octave_qobj.experimental_terminal_widget ()
-        && m_octave_qobj.have_terminal_window ())
-      emit interpreter_output_signal (QString::fromStdString (msg));
-    else
-      {
-        // FIXME: is this the correct thing to do?
-        std::cout << msg;
-      }
-  }
+void qt_interpreter_events::interpreter_output (const std::string& msg)
+{
+  if (m_octave_qobj.experimental_terminal_widget ()
+      && m_octave_qobj.have_terminal_window ())
+    emit interpreter_output_signal (QString::fromStdString (msg));
+  else
+    {
+      // FIXME: is this the correct thing to do?
+      std::cout << msg;
+    }
+}
 
-  void qt_interpreter_events::display_exception (const execution_exception& ee,
-                                                 bool beep)
-  {
-    if (m_octave_qobj.experimental_terminal_widget ()
-        && m_octave_qobj.have_terminal_window ())
-      {
-        // Output the exception message
-        std::ostringstream buf;
-        ee.display (buf);
-        emit interpreter_output_signal (QString::fromStdString (buf.str ()));
-        // Create w new command line
-        emit new_command_line_signal ();
-      }
-    else
-      {
-        if (beep)
-          std::cerr << "\a";
+void qt_interpreter_events::display_exception (const execution_exception& ee,
+                                               bool beep)
+{
+  if (m_octave_qobj.experimental_terminal_widget ()
+      && m_octave_qobj.have_terminal_window ())
+    {
+      // Output the exception message
+      std::ostringstream buf;
+      ee.display (buf);
+      emit interpreter_output_signal (QString::fromStdString (buf.str ()));
+      // Create w new command line
+      emit new_command_line_signal ();
+    }
+  else
+    {
+      if (beep)
+        std::cerr << "\a";
 
-        ee.display (std::cerr);
-      }
-  }
+      ee.display (std::cerr);
+    }
+}
 
-  void qt_interpreter_events::gui_status_update (const std::string& feature,
-                                                 const std::string& status)
-  {
-    emit gui_status_update_signal (QString::fromStdString (feature),
-                                   QString::fromStdString (status));
-  }
+void qt_interpreter_events::gui_status_update (const std::string& feature,
+                                               const std::string& status)
+{
+  emit gui_status_update_signal (QString::fromStdString (feature),
+                                 QString::fromStdString (status));
+}
 
-  void qt_interpreter_events::update_gui_lexer ()
-  {
-    emit update_gui_lexer_signal (true);
-  }
+void qt_interpreter_events::update_gui_lexer ()
+{
+  emit update_gui_lexer_signal (true);
+}
 
-  void qt_interpreter_events::directory_changed (const std::string& dir)
-  {
-    emit directory_changed_signal (QString::fromStdString (dir));
-  }
+void qt_interpreter_events::directory_changed (const std::string& dir)
+{
+  emit directory_changed_signal (QString::fromStdString (dir));
+}
 
-  void qt_interpreter_events::file_remove (const std::string& old_name,
-                                           const std::string& new_name)
-  {
-    QMutexLocker autolock (&m_mutex);
+void qt_interpreter_events::file_remove (const std::string& old_name,
+                                         const std::string& new_name)
+{
+  QMutexLocker autolock (&m_mutex);
 
-    // Emit the signal for the editor for closing the file if it is open
-    emit file_remove_signal (QString::fromStdString (old_name),
-                             QString::fromStdString (new_name));
+  // Emit the signal for the editor for closing the file if it is open
+  emit file_remove_signal (QString::fromStdString (old_name),
+                           QString::fromStdString (new_name));
 
-    // Wait for file removal to complete before continuing.
-    wait ();
-  }
+  // Wait for file removal to complete before continuing.
+  wait ();
+}
 
-  void qt_interpreter_events::file_renamed (bool load_new)
-  {
-    emit file_renamed_signal (load_new);
-  }
+void qt_interpreter_events::file_renamed (bool load_new)
+{
+  emit file_renamed_signal (load_new);
+}
 
-  void qt_interpreter_events::set_workspace (bool top_level, bool debug,
-                                             const symbol_info_list& syminfo,
-                                             bool update_variable_editor)
-  {
-    if (! top_level && ! debug)
-      return;
+void qt_interpreter_events::set_workspace (bool top_level, bool debug,
+                                           const symbol_info_list& syminfo,
+                                           bool update_variable_editor)
+{
+  if (! top_level && ! debug)
+    return;
 
-    emit set_workspace_signal (top_level, debug, syminfo);
+  emit set_workspace_signal (top_level, debug, syminfo);
 
-    if (update_variable_editor)
-      emit refresh_variable_editor_signal ();
-  }
+  if (update_variable_editor)
+    emit refresh_variable_editor_signal ();
+}
 
-  void qt_interpreter_events::clear_workspace ()
-  {
-    emit clear_workspace_signal ();
-  }
+void qt_interpreter_events::clear_workspace ()
+{
+  emit clear_workspace_signal ();
+}
 
-  void qt_interpreter_events::update_prompt (const std::string& prompt)
-  {
-    emit update_prompt_signal (QString::fromStdString (prompt));
-  }
+void qt_interpreter_events::update_prompt (const std::string& prompt)
+{
+  emit update_prompt_signal (QString::fromStdString (prompt));
+}
 
-  void qt_interpreter_events::set_history (const string_vector& hist)
-  {
-    QStringList qt_hist;
+void qt_interpreter_events::set_history (const string_vector& hist)
+{
+  QStringList qt_hist;
 
-    for (octave_idx_type i = 0; i < hist.numel (); i++)
-      qt_hist.append (QString::fromStdString (hist[i]));
+  for (octave_idx_type i = 0; i < hist.numel (); i++)
+    qt_hist.append (QString::fromStdString (hist[i]));
 
-    emit set_history_signal (qt_hist);
-  }
+  emit set_history_signal (qt_hist);
+}
 
-  void qt_interpreter_events::append_history (const std::string& hist_entry)
-  {
-    emit append_history_signal (QString::fromStdString (hist_entry));
-  }
+void qt_interpreter_events::append_history (const std::string& hist_entry)
+{
+  emit append_history_signal (QString::fromStdString (hist_entry));
+}
 
-  void qt_interpreter_events::clear_history ()
-  {
-    emit clear_history_signal ();
-  }
+void qt_interpreter_events::clear_history ()
+{
+  emit clear_history_signal ();
+}
 
-  void qt_interpreter_events::pre_input_event ()
-  { }
+void qt_interpreter_events::pre_input_event ()
+{ }
 
-  void qt_interpreter_events::post_input_event ()
-  { }
+void qt_interpreter_events::post_input_event ()
+{ }
 
-  void qt_interpreter_events::enter_debugger_event (const std::string& /*fcn_name*/,
-                                                    const std::string& fcn_file_name,
-                                                    int line)
-  {
-    if (fcn_file_name.empty ())
-      return;
+void qt_interpreter_events::enter_debugger_event (const std::string& /*fcn_name*/,
+                                                  const std::string& fcn_file_name,
+                                                  int line)
+{
+  if (fcn_file_name.empty ())
+    return;
 
-    insert_debugger_pointer (fcn_file_name, line);
+  insert_debugger_pointer (fcn_file_name, line);
 
-    emit enter_debugger_signal ();
-  }
+  emit enter_debugger_signal ();
+}
 
-  void
-  qt_interpreter_events::execute_in_debugger_event (const std::string& file,
-                                                    int line)
-  {
-    delete_debugger_pointer (file, line);
-  }
+void
+qt_interpreter_events::execute_in_debugger_event (const std::string& file,
+                                                  int line)
+{
+  delete_debugger_pointer (file, line);
+}
 
-  void qt_interpreter_events::exit_debugger_event ()
-  {
-    emit exit_debugger_signal ();
-  }
+void qt_interpreter_events::exit_debugger_event ()
+{
+  emit exit_debugger_signal ();
+}
 
-  // Display (if @insert true) or remove the appropriate symbol for a breakpoint
-  // in @file at @line with condition @cond.
-  void qt_interpreter_events::update_breakpoint (bool insert,
-                                                 const std::string& file,
-                                                 int line,
-                                                 const std::string& cond)
-  {
-    emit update_breakpoint_marker_signal (insert, QString::fromStdString (file),
-                                          line, QString::fromStdString (cond));
-  }
+// Display (if @insert true) or remove the appropriate symbol for a breakpoint
+// in @file at @line with condition @cond.
+void qt_interpreter_events::update_breakpoint (bool insert,
+                                               const std::string& file,
+                                               int line,
+                                               const std::string& cond)
+{
+  emit update_breakpoint_marker_signal (insert, QString::fromStdString (file),
+                                        line, QString::fromStdString (cond));
+}
 
-  void
-  qt_interpreter_events::insert_debugger_pointer (const std::string& file,
-                                                  int line)
-  {
-    emit insert_debugger_pointer_signal (QString::fromStdString (file), line);
-  }
+void
+qt_interpreter_events::insert_debugger_pointer (const std::string& file,
+                                                int line)
+{
+  emit insert_debugger_pointer_signal (QString::fromStdString (file), line);
+}
 
-  void
-  qt_interpreter_events::delete_debugger_pointer (const std::string& file,
-                                                  int line)
-  {
-    emit delete_debugger_pointer_signal (QString::fromStdString (file), line);
-  }
+void
+qt_interpreter_events::delete_debugger_pointer (const std::string& file,
+                                                int line)
+{
+  emit delete_debugger_pointer_signal (QString::fromStdString (file), line);
+}
 
-  void
-  qt_interpreter_events::confirm_shutdown_octave ()
-  {
-    QMutexLocker autolock (&m_mutex);
+void
+qt_interpreter_events::confirm_shutdown_octave ()
+{
+  QMutexLocker autolock (&m_mutex);
 
-    m_result = m_octave_qobj.confirm_shutdown ();
+  m_result = m_octave_qobj.confirm_shutdown ();
 
-    wake_all ();
-  }
+  wake_all ();
+}
 
-  // If VALUE is empty, return current value of preference named by KEY.
-  //
-  // If VALUE is not empty, set preference named by KEY to VALUE return
-  // previous value.
-  //
-  // FIXME: should we have separate get and set functions?  With only
-  // one, we don't allow a preference value to be set to the empty
-  // string.
+// If VALUE is empty, return current value of preference named by KEY.
+//
+// If VALUE is not empty, set preference named by KEY to VALUE return
+// previous value.
+//
+// FIXME: should we have separate get and set functions?  With only
+// one, we don't allow a preference value to be set to the empty
+// string.
 
-  void
-  qt_interpreter_events::gui_preference_slot (const QString& key,
-                                              const QString& value)
-  {
-    QMutexLocker autolock (&m_mutex);
+void
+qt_interpreter_events::gui_preference_slot (const QString& key,
+                                            const QString& value)
+{
+  QMutexLocker autolock (&m_mutex);
 
-    gui_settings settings;
+  gui_settings settings;
 
-    // We don't want to apply default value here.
-    QString read_value = settings.value (key).toString ();
+  // We don't want to apply default value here.
+  QString read_value = settings.value (key).toString ();
 
-    // Some preferences need extra handling
-    QString adjusted_value = gui_preference_adjust (key, value);
+  // Some preferences need extra handling
+  QString adjusted_value = gui_preference_adjust (key, value);
 
-    if (! adjusted_value.isEmpty () && (read_value != adjusted_value))
-      {
-        // Change settings only for new, non-empty values
-        settings.setValue (key, QVariant (adjusted_value));
+  if (! adjusted_value.isEmpty () && (read_value != adjusted_value))
+    {
+      // Change settings only for new, non-empty values
+      settings.setValue (key, QVariant (adjusted_value));
 
-        emit settings_changed (true);   // true: changed by worker
-      }
+      emit settings_changed (true);   // true: changed by worker
+    }
 
-    m_result = read_value;
+  m_result = read_value;
 
-    wake_all ();
-  }
+  wake_all ();
+}
 
-  QString
-  qt_interpreter_events::gui_preference_adjust (const QString& key,
-                                                const QString& value)
-  {
-    // Immediately return if no new value is given.
+QString
+qt_interpreter_events::gui_preference_adjust (const QString& key,
+                                              const QString& value)
+{
+  // Immediately return if no new value is given.
 
-    if (value.isEmpty ())
-      return value;
+  if (value.isEmpty ())
+    return value;
 
-    QString adjusted_value = value;
+  QString adjusted_value = value;
 
-    // Not all encodings are available.  Encodings are uppercase and do
-    // not use CPxxx but IBMxxx or WINDOWS-xxx.
+  // Not all encodings are available.  Encodings are uppercase and do
+  // not use CPxxx but IBMxxx or WINDOWS-xxx.
 
-    if (key == ed_default_enc.settings_key ())
-      {
-        adjusted_value = adjusted_value.toUpper ();
+  if (key == ed_default_enc.settings_key ())
+    {
+      adjusted_value = adjusted_value.toUpper ();
 
-        gui_settings settings;
-        QStringList codecs;
-        settings.get_codecs (&codecs);
+      gui_settings settings;
+      QStringList codecs;
+      settings.get_codecs (&codecs);
 
-        QRegExp re ("^CP(\\d+)$");
+      QRegExp re ("^CP(\\d+)$");
 
-        if (adjusted_value == "SYSTEM")
-          adjusted_value =
-            QString ("SYSTEM (") +
-            QString (octave_locale_charset_wrapper ()).toUpper () +
-            QString (")");
-        else if (re.indexIn (adjusted_value) > -1)
-          {
-            if (codecs.contains ("IBM" + re.cap (1)))
-              adjusted_value = "IBM" + re.cap (1);
-            else if (codecs.contains ("WINDOWS-" + re.cap (1)))
-              adjusted_value = "WINDOWS-" + re.cap (1);
-            else
-              adjusted_value.clear ();
-          }
-        else if (! codecs.contains (adjusted_value))
-          adjusted_value.clear ();
-      }
+      if (adjusted_value == "SYSTEM")
+        adjusted_value =
+          QString ("SYSTEM (") +
+          QString (octave_locale_charset_wrapper ()).toUpper () +
+          QString (")");
+      else if (re.indexIn (adjusted_value) > -1)
+        {
+          if (codecs.contains ("IBM" + re.cap (1)))
+            adjusted_value = "IBM" + re.cap (1);
+          else if (codecs.contains ("WINDOWS-" + re.cap (1)))
+            adjusted_value = "WINDOWS-" + re.cap (1);
+          else
+            adjusted_value.clear ();
+        }
+      else if (! codecs.contains (adjusted_value))
+        adjusted_value.clear ();
+    }
 
-    return adjusted_value;
-  }
+  return adjusted_value;
+}
 
 OCTAVE_END_NAMESPACE(octave)
--- a/libgui/src/qt-interpreter-events.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/qt-interpreter-events.h	Thu Feb 02 12:25:51 2023 -0800
@@ -46,284 +46,284 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class base_qobject;
+class base_qobject;
 
-  // The functions in this class are not normally called directly, but
-  // are invoked from the Octave interpreter thead by methods in the
-  // event_manager class.  In most cases, they should only translate
-  // data from the types typically used in the interpreter to whatever
-  // is required by the GUI (for example, std::string to QString) and
-  // emit a Qt signal.
-  //
-  // The use of Qt signals provides a thread-safe way for the Octave
-  // interpreter to notify the GUI of events (directory or workspace has
-  // changed, for example) or to request that the GUI perform actions
-  // (display a dialog, for example).
-  //
-  // By using this class as a wrapper around the Qt signals, we maintain
-  // a separation between the Octave interpreter and any specific GUI
-  // toolkit (no Qt headers are used in the Octave interpreter sources).
+// The functions in this class are not normally called directly, but
+// are invoked from the Octave interpreter thead by methods in the
+// event_manager class.  In most cases, they should only translate
+// data from the types typically used in the interpreter to whatever
+// is required by the GUI (for example, std::string to QString) and
+// emit a Qt signal.
+//
+// The use of Qt signals provides a thread-safe way for the Octave
+// interpreter to notify the GUI of events (directory or workspace has
+// changed, for example) or to request that the GUI perform actions
+// (display a dialog, for example).
+//
+// By using this class as a wrapper around the Qt signals, we maintain
+// a separation between the Octave interpreter and any specific GUI
+// toolkit (no Qt headers are used in the Octave interpreter sources).
 
-  class qt_interpreter_events : public QObject, public interpreter_events
-  {
-    Q_OBJECT
+class qt_interpreter_events : public QObject, public interpreter_events
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    qt_interpreter_events (base_qobject& oct_qobj);
+  qt_interpreter_events (base_qobject& oct_qobj);
 
-    // No copying!
+  // No copying!
 
-    qt_interpreter_events (const qt_interpreter_events&) = delete;
+  qt_interpreter_events (const qt_interpreter_events&) = delete;
 
-    qt_interpreter_events& operator = (const qt_interpreter_events&) = delete;
+  qt_interpreter_events& operator = (const qt_interpreter_events&) = delete;
 
-    ~qt_interpreter_events () = default;
+  ~qt_interpreter_events () = default;
 
-    // Note: these functions currently do nothing with the old terminal
-    // widget.
-    void start_gui (bool gui_app = false);
-    void close_gui ();
+  // Note: these functions currently do nothing with the old terminal
+  // widget.
+  void start_gui (bool gui_app = false);
+  void close_gui ();
 
-    bool have_dialogs () const { return true; }
+  bool have_dialogs () const { return true; }
 
-    std::list<std::string>
-    file_dialog (const filter_list& filter, const std::string& title,
-                 const std::string& filename, const std::string& pathname,
-                 const std::string& multimode);
+  std::list<std::string>
+  file_dialog (const filter_list& filter, const std::string& title,
+               const std::string& filename, const std::string& pathname,
+               const std::string& multimode);
 
-    std::list<std::string>
-    input_dialog (const std::list<std::string>& prompt,
-                  const std::string& title, const std::list<float>& nr,
-                  const std::list<float>& nc,
-                  const std::list<std::string>& defaults);
+  std::list<std::string>
+  input_dialog (const std::list<std::string>& prompt,
+                const std::string& title, const std::list<float>& nr,
+                const std::list<float>& nc,
+                const std::list<std::string>& defaults);
 
-    std::pair<std::list<int>, int>
-    list_dialog (const std::list<std::string>& list,
-                 const std::string& mode, int width, int height,
-                 const std::list<int>& initial_value,
-                 const std::string& name,
-                 const std::list<std::string>& prompt,
-                 const std::string& ok_string,
-                 const std::string& cancel_string);
+  std::pair<std::list<int>, int>
+  list_dialog (const std::list<std::string>& list,
+               const std::string& mode, int width, int height,
+               const std::list<int>& initial_value,
+               const std::string& name,
+               const std::list<std::string>& prompt,
+               const std::string& ok_string,
+               const std::string& cancel_string);
 
-    std::string
-    question_dialog (const std::string& msg, const std::string& title,
-                     const std::string& btn1, const std::string& btn2,
-                     const std::string& btn3, const std::string& btndef);
+  std::string
+  question_dialog (const std::string& msg, const std::string& title,
+                   const std::string& btn1, const std::string& btn2,
+                   const std::string& btn3, const std::string& btndef);
 
-    void update_path_dialog ();
+  void update_path_dialog ();
 
-    void show_preferences ();
+  void show_preferences ();
 
-    void apply_preferences ();
+  void apply_preferences ();
 
-    void show_terminal_window ();
+  void show_terminal_window ();
 
-    bool show_documentation (const std::string& file);
+  bool show_documentation (const std::string& file);
 
-    void show_file_browser ();
+  void show_file_browser ();
 
-    void show_command_history ();
+  void show_command_history ();
 
-    void show_workspace ();
+  void show_workspace ();
 
-    void show_community_news (int serial);
-    void show_release_notes ();
+  void show_community_news (int serial);
+  void show_release_notes ();
 
-    bool edit_file (const std::string& file);
+  bool edit_file (const std::string& file);
 
-    void edit_variable (const std::string& name, const octave_value& val);
+  void edit_variable (const std::string& name, const octave_value& val);
 
-    bool confirm_shutdown ();
+  bool confirm_shutdown ();
 
-    bool prompt_new_edit_file (const std::string& file);
+  bool prompt_new_edit_file (const std::string& file);
 
-    int debug_cd_or_addpath_error (const std::string& file,
-                                   const std::string& dir,
-                                   bool addpath_option);
+  int debug_cd_or_addpath_error (const std::string& file,
+                                 const std::string& dir,
+                                 bool addpath_option);
 
-    uint8NDArray get_named_icon (const std::string& icon_name);
+  uint8NDArray get_named_icon (const std::string& icon_name);
 
-    std::string gui_preference (const std::string& key,
-                                const std::string& value);
+  std::string gui_preference (const std::string& key,
+                              const std::string& value);
 
-    bool copy_image_to_clipboard (const std::string& file);
+  bool copy_image_to_clipboard (const std::string& file);
 
-    void focus_window (const std::string win_name);
+  void focus_window (const std::string win_name);
 
-    void execute_command_in_terminal (const std::string& command);
+  void execute_command_in_terminal (const std::string& command);
 
-    void register_documentation (const std::string& file);
+  void register_documentation (const std::string& file);
 
-    void unregister_documentation (const std::string& file);
+  void unregister_documentation (const std::string& file);
 
-    // Note: this function currently does nothing with the old terminal
-    // widget.
-    void interpreter_output (const std::string& msg);
+  // Note: this function currently does nothing with the old terminal
+  // widget.
+  void interpreter_output (const std::string& msg);
 
-    void display_exception (const execution_exception& ee, bool beep);
+  void display_exception (const execution_exception& ee, bool beep);
 
-    void gui_status_update (const std::string& feature, const std::string& status);
+  void gui_status_update (const std::string& feature, const std::string& status);
 
-    void update_gui_lexer ();
+  void update_gui_lexer ();
 
-    void directory_changed (const std::string& dir);
+  void directory_changed (const std::string& dir);
 
-    void file_remove (const std::string& old_name,
-                      const std::string& new_name);
+  void file_remove (const std::string& old_name,
+                    const std::string& new_name);
 
-    void file_renamed (bool load_new = true);
+  void file_renamed (bool load_new = true);
 
-    void set_workspace (bool top_level, bool debug,
-                        const symbol_info_list& syminfo,
-                        bool update_variable_editor);
+  void set_workspace (bool top_level, bool debug,
+                      const symbol_info_list& syminfo,
+                      bool update_variable_editor);
 
-    void clear_workspace ();
+  void clear_workspace ();
 
-    void update_prompt (const std::string& prompt);
+  void update_prompt (const std::string& prompt);
 
-    void set_history (const string_vector& hist);
+  void set_history (const string_vector& hist);
 
-    void append_history (const std::string& hist_entry);
+  void append_history (const std::string& hist_entry);
 
-    void clear_history ();
+  void clear_history ();
 
-    void pre_input_event ();
+  void pre_input_event ();
 
-    void post_input_event ();
+  void post_input_event ();
 
-    void enter_debugger_event (const std::string& fcn_name,
-                               const std::string& fcn_file_name, int line);
+  void enter_debugger_event (const std::string& fcn_name,
+                             const std::string& fcn_file_name, int line);
 
-    void execute_in_debugger_event (const std::string& file, int line);
+  void execute_in_debugger_event (const std::string& file, int line);
 
-    void exit_debugger_event ();
+  void exit_debugger_event ();
 
-    void update_breakpoint (bool insert, const std::string& file, int line,
-                            const std::string& cond);
+  void update_breakpoint (bool insert, const std::string& file, int line,
+                          const std::string& cond);
 
-    void lock () { m_mutex.lock (); }
+  void lock () { m_mutex.lock (); }
 
-    void wait () { m_waitcondition.wait (&m_mutex); }
+  void wait () { m_waitcondition.wait (&m_mutex); }
 
-    void unlock () { m_mutex.unlock (); }
+  void unlock () { m_mutex.unlock (); }
 
-    void wake_all () { m_waitcondition.wakeAll (); }
+  void wake_all () { m_waitcondition.wakeAll (); }
 
-  public slots:
+public slots:
 
-    void confirm_shutdown_octave ();
+  void confirm_shutdown_octave ();
 
-    void get_named_icon_slot (const QString& name);
+  void get_named_icon_slot (const QString& name);
 
-    void gui_preference_slot (const QString& key, const QString& value);
+  void gui_preference_slot (const QString& key, const QString& value);
 
-  signals:
+signals:
 
-    // Note: these signals are not currently used by the old terminal widget.
-    void start_gui_signal (bool gui_app);
-    void close_gui_signal ();
+  // Note: these signals are not currently used by the old terminal widget.
+  void start_gui_signal (bool gui_app);
+  void close_gui_signal ();
 
-    void copy_image_to_clipboard_signal (const QString& file, bool remove_file);
+  void copy_image_to_clipboard_signal (const QString& file, bool remove_file);
 
-    void focus_window_signal (const QString& win_name);
+  void focus_window_signal (const QString& win_name);
 
-    void edit_file_signal (const QString& file);
+  void edit_file_signal (const QString& file);
 
-    void directory_changed_signal (const QString& dir);
+  void directory_changed_signal (const QString& dir);
 
-    void update_path_dialog_signal ();
+  void update_path_dialog_signal ();
 
-    void file_remove_signal (const QString& old_name, const QString& new_name);
+  void file_remove_signal (const QString& old_name, const QString& new_name);
 
-    void file_renamed_signal (bool load_new);
+  void file_renamed_signal (bool load_new);
 
-    void execute_command_in_terminal_signal (const QString& command);
+  void execute_command_in_terminal_signal (const QString& command);
 
-    void set_workspace_signal (bool top_level, bool debug,
-                               const symbol_info_list& syminfo);
+  void set_workspace_signal (bool top_level, bool debug,
+                             const symbol_info_list& syminfo);
 
-    void clear_workspace_signal ();
+  void clear_workspace_signal ();
 
-    void update_prompt_signal (const QString& prompt);
+  void update_prompt_signal (const QString& prompt);
 
-    void set_history_signal (const QStringList& hist);
+  void set_history_signal (const QStringList& hist);
 
-    void append_history_signal (const QString& hist_entry);
+  void append_history_signal (const QString& hist_entry);
 
-    void clear_history_signal ();
+  void clear_history_signal ();
 
-    void enter_debugger_signal ();
+  void enter_debugger_signal ();
 
-    void exit_debugger_signal ();
+  void exit_debugger_signal ();
 
-    void update_breakpoint_marker_signal (bool insert, const QString& file,
-                                          int line, const QString& cond);
+  void update_breakpoint_marker_signal (bool insert, const QString& file,
+                                        int line, const QString& cond);
 
-    void insert_debugger_pointer_signal (const QString&, int);
+  void insert_debugger_pointer_signal (const QString&, int);
 
-    void delete_debugger_pointer_signal (const QString&, int);
+  void delete_debugger_pointer_signal (const QString&, int);
 
-    void show_preferences_signal ();
+  void show_preferences_signal ();
 
-    void gui_preference_signal (const QString& key, const QString& value);
+  void gui_preference_signal (const QString& key, const QString& value);
 
-    void show_terminal_window_signal ();
+  void show_terminal_window_signal ();
 
-    void show_documentation_signal (const QString& file);
+  void show_documentation_signal (const QString& file);
 
-    void register_documentation_signal (const QString& file);
+  void register_documentation_signal (const QString& file);
 
-    void unregister_documentation_signal (const QString& file);
+  void unregister_documentation_signal (const QString& file);
 
-    void show_file_browser_signal ();
+  void show_file_browser_signal ();
 
-    void show_command_history_signal ();
+  void show_command_history_signal ();
 
-    void show_workspace_signal ();
+  void show_workspace_signal ();
 
-    void show_community_news_signal (int serial);
-    void show_release_notes_signal ();
+  void show_community_news_signal (int serial);
+  void show_release_notes_signal ();
 
-    // Note: the next two signals are currently not used by the old terminal widget.
-    void interpreter_output_signal (const QString& msg);
-    void new_command_line_signal (const QString& msg = QString ());
+  // Note: the next two signals are currently not used by the old terminal widget.
+  void interpreter_output_signal (const QString& msg);
+  void new_command_line_signal (const QString& msg = QString ());
 
-    void gui_status_update_signal (const QString& feature, const QString& status);
+  void gui_status_update_signal (const QString& feature, const QString& status);
 
-    void update_gui_lexer_signal (bool update_apis_only);
+  void update_gui_lexer_signal (bool update_apis_only);
 
-    void edit_variable_signal (const QString& name, const octave_value& val);
+  void edit_variable_signal (const QString& name, const octave_value& val);
 
-    void refresh_variable_editor_signal ();
+  void refresh_variable_editor_signal ();
 
-    void confirm_shutdown_signal ();
+  void confirm_shutdown_signal ();
 
-    void get_named_icon_signal (const QString& name);
+  void get_named_icon_signal (const QString& name);
 
-    void settings_changed (bool);
+  void settings_changed (bool);
 
-    void apply_new_settings ();
+  void apply_new_settings ();
 
-  private:
+private:
 
-    QString gui_preference_adjust (const QString& key, const QString& value);
+  QString gui_preference_adjust (const QString& key, const QString& value);
 
-    void insert_debugger_pointer (const std::string& file, int line);
+  void insert_debugger_pointer (const std::string& file, int line);
 
-    void delete_debugger_pointer (const std::string& file, int line);
+  void delete_debugger_pointer (const std::string& file, int line);
 
-    base_qobject& m_octave_qobj;
+  base_qobject& m_octave_qobj;
 
-    QUIWidgetCreator m_uiwidget_creator;
+  QUIWidgetCreator m_uiwidget_creator;
 
-    QVariant m_result;
+  QVariant m_result;
 
-    QMutex m_mutex;
+  QMutex m_mutex;
 
-    QWaitCondition m_waitcondition;
-  };
+  QWaitCondition m_waitcondition;
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/src/release-notes.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/release-notes.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -47,76 +47,76 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  release_notes::release_notes ()
-    : QWidget (nullptr), m_browser (nullptr)
-  {
+release_notes::release_notes ()
+  : QWidget (nullptr), m_browser (nullptr)
+{
 
-    gui_settings settings;
+  gui_settings settings;
 
-    // The icon
-    QString icon_set = settings.string_value (dw_icon_set);
+  // The icon
+  QString icon_set = settings.string_value (dw_icon_set);
 
-    if (icon_set != "NONE")
-      m_release_notes_icon = dw_icon_set_names[icon_set]
-                             + "ReleaseWidget.png";
-    else
-      m_release_notes_icon = dw_icon_set_names[icon_set];
+  if (icon_set != "NONE")
+    m_release_notes_icon = dw_icon_set_names[icon_set]
+                           + "ReleaseWidget.png";
+  else
+    m_release_notes_icon = dw_icon_set_names[icon_set];
 
-    std::string news_file = config::oct_etc_dir () + "/NEWS";
+  std::string news_file = config::oct_etc_dir () + "/NEWS";
 
-    QString news;
+  QString news;
 
-    QFile *file = new QFile (QString::fromStdString (news_file));
-    if (file->open (QFile::ReadOnly))
-      {
-        QTextStream *stream = new QTextStream (file);
-        news = stream->readAll ();
-        if (! news.isEmpty ())
-          {
-            // Convert '<', '>' which would be interpreted as HTML
-            news.replace ("<", "&lt;");
-            news.replace (">", "&gt;");
-            // Add HTML tags for pre-formatted text
-            news.prepend ("<pre>");
-            news.append ("</pre>");
-          }
-        else
-          news = (tr ("The release notes file '%1' is empty.")
-                  . arg (QString::fromStdString (news_file)));
-      }
-    else
-      news = (tr ("The release notes file '%1' cannot be read.")
-              . arg (QString::fromStdString (news_file)));
+  QFile *file = new QFile (QString::fromStdString (news_file));
+  if (file->open (QFile::ReadOnly))
+    {
+      QTextStream *stream = new QTextStream (file);
+      news = stream->readAll ();
+      if (! news.isEmpty ())
+        {
+          // Convert '<', '>' which would be interpreted as HTML
+          news.replace ("<", "&lt;");
+          news.replace (">", "&gt;");
+          // Add HTML tags for pre-formatted text
+          news.prepend ("<pre>");
+          news.append ("</pre>");
+        }
+      else
+        news = (tr ("The release notes file '%1' is empty.")
+                . arg (QString::fromStdString (news_file)));
+    }
+  else
+    news = (tr ("The release notes file '%1' cannot be read.")
+            . arg (QString::fromStdString (news_file)));
 
-    m_browser = new QTextBrowser (this);
-    m_browser->setText (news);
+  m_browser = new QTextBrowser (this);
+  m_browser->setText (news);
 
-    QVBoxLayout *vlayout = new QVBoxLayout;
-    vlayout->addWidget (m_browser);
+  QVBoxLayout *vlayout = new QVBoxLayout;
+  vlayout->addWidget (m_browser);
 
-    setLayout (vlayout);
-    setWindowTitle (tr ("Octave Release Notes"));
+  setLayout (vlayout);
+  setWindowTitle (tr ("Octave Release Notes"));
 
-    m_browser->document ()->adjustSize ();
+  m_browser->document ()->adjustSize ();
 
-    int win_x, win_y;
-    get_screen_geometry (win_x, win_y);
+  int win_x, win_y;
+  get_screen_geometry (win_x, win_y);
 
-    resize (win_x*2/5, win_y*2/3);
-    move (20, 20);  // move to the top left corner
-  }
+  resize (win_x*2/5, win_y*2/3);
+  move (20, 20);  // move to the top left corner
+}
 
-  void release_notes::display ()
-  {
-    if (! isVisible ())
-      show ();
-    else if (isMinimized ())
-      showNormal ();
+void release_notes::display ()
+{
+  if (! isVisible ())
+    show ();
+  else if (isMinimized ())
+    showNormal ();
 
-    setWindowIcon (QIcon (m_release_notes_icon));
+  setWindowIcon (QIcon (m_release_notes_icon));
 
-    raise ();
-    activateWindow ();
-  }
+  raise ();
+  activateWindow ();
+}
 
 OCTAVE_END_NAMESPACE(octave)
--- a/libgui/src/release-notes.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/release-notes.h	Thu Feb 02 12:25:51 2023 -0800
@@ -33,25 +33,25 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class release_notes : public QWidget
-  {
-    Q_OBJECT
+class release_notes : public QWidget
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    release_notes ();
+  release_notes ();
 
-    ~release_notes () = default;
+  ~release_notes () = default;
 
-  public slots:
+public slots:
 
-    void display ();
+  void display ();
 
-  private:
+private:
 
-    QTextBrowser *m_browser;
-    QString m_release_notes_icon;
-  };
+  QTextBrowser *m_browser;
+  QString m_release_notes_icon;
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/src/set-path-dialog.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/set-path-dialog.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -58,255 +58,255 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  set_path_dialog::set_path_dialog (QWidget *parent)
-    : QDialog (parent)
-  {
-    setWindowTitle (tr ("Set Path"));
+set_path_dialog::set_path_dialog (QWidget *parent)
+  : QDialog (parent)
+{
+  setWindowTitle (tr ("Set Path"));
 
-    set_path_model *model = new set_path_model (this);
+  set_path_model *model = new set_path_model (this);
 
-    m_info_label = new QLabel (tr ("All changes take effect immediately."));
+  m_info_label = new QLabel (tr ("All changes take effect immediately."));
 
-    m_add_folder_button = new QPushButton (tr ("Add Folder..."));
+  m_add_folder_button = new QPushButton (tr ("Add Folder..."));
 
-    QMenu *add_dir_menu = new QMenu ();
-    m_add_folder_button->setMenu (add_dir_menu);
-    add_dir_menu->addAction (tr ("Single Folder"),
-                             this, &set_path_dialog::add_dir);
-    add_dir_menu->addAction (tr ("Folder With Subfolders"),
-                             this, &set_path_dialog::add_dir_subdirs);
+  QMenu *add_dir_menu = new QMenu ();
+  m_add_folder_button->setMenu (add_dir_menu);
+  add_dir_menu->addAction (tr ("Single Folder"),
+                           this, &set_path_dialog::add_dir);
+  add_dir_menu->addAction (tr ("Folder With Subfolders"),
+                           this, &set_path_dialog::add_dir_subdirs);
 
-    m_move_to_top_button = new QPushButton (tr ("Move to Top"));
-    m_move_to_bottom_button = new QPushButton (tr ("Move to Bottom"));
-    m_move_up_button = new QPushButton (tr ("Move Up"));
-    m_move_down_button = new QPushButton (tr ("Move Down"));
-    m_remove_button = new QPushButton (tr ("Remove"));
+  m_move_to_top_button = new QPushButton (tr ("Move to Top"));
+  m_move_to_bottom_button = new QPushButton (tr ("Move to Bottom"));
+  m_move_up_button = new QPushButton (tr ("Move Up"));
+  m_move_down_button = new QPushButton (tr ("Move Down"));
+  m_remove_button = new QPushButton (tr ("Remove"));
 
-    m_reload_button = new QPushButton (tr ("Reload"));
-    m_save_button = new QPushButton (tr ("Save"));
+  m_reload_button = new QPushButton (tr ("Reload"));
+  m_save_button = new QPushButton (tr ("Save"));
 
-    m_revert_button = new QPushButton (tr ("Revert"));
+  m_revert_button = new QPushButton (tr ("Revert"));
 
-    QMenu *revert_menu = new QMenu ();
-    m_revert_button->setMenu (revert_menu);
-    revert_menu->addAction (tr ("Revert Last Change"),
-                            model, &set_path_model::revert_last);
-    revert_menu->addAction (tr ("Revert All Changes"),
-                            model, &set_path_model::revert);
+  QMenu *revert_menu = new QMenu ();
+  m_revert_button->setMenu (revert_menu);
+  revert_menu->addAction (tr ("Revert Last Change"),
+                          model, &set_path_model::revert_last);
+  revert_menu->addAction (tr ("Revert All Changes"),
+                          model, &set_path_model::revert);
 
-    m_save_button->setFocus ();
+  m_save_button->setFocus ();
 
-    connect (m_remove_button, &QPushButton::clicked,
-             this, &set_path_dialog::rm_dir);
+  connect (m_remove_button, &QPushButton::clicked,
+           this, &set_path_dialog::rm_dir);
 
-    connect (m_move_to_top_button, &QPushButton::clicked,
-             this, &set_path_dialog::move_dir_top);
+  connect (m_move_to_top_button, &QPushButton::clicked,
+           this, &set_path_dialog::move_dir_top);
 
-    connect (m_move_to_bottom_button, &QPushButton::clicked,
-             this, &set_path_dialog::move_dir_bottom);
+  connect (m_move_to_bottom_button, &QPushButton::clicked,
+           this, &set_path_dialog::move_dir_bottom);
 
-    connect (m_move_up_button, &QPushButton::clicked,
-             this, &set_path_dialog::move_dir_up);
+  connect (m_move_up_button, &QPushButton::clicked,
+           this, &set_path_dialog::move_dir_up);
 
-    connect (m_move_down_button, &QPushButton::clicked,
-             this, &set_path_dialog::move_dir_down);
+  connect (m_move_down_button, &QPushButton::clicked,
+           this, &set_path_dialog::move_dir_down);
 
-    connect (m_reload_button, &QPushButton::clicked,
-             model, &set_path_model::path_to_model);
+  connect (m_reload_button, &QPushButton::clicked,
+           model, &set_path_model::path_to_model);
 
-    connect (m_save_button, &QPushButton::clicked,
-             model, &set_path_model::save);
+  connect (m_save_button, &QPushButton::clicked,
+           model, &set_path_model::save);
 
-    // Any interpreter_event signal from a set_path_model object is
-    // handled the same as for the parent set_path_dialog object.
+  // Any interpreter_event signal from a set_path_model object is
+  // handled the same as for the parent set_path_dialog object.
 
-    connect (model, QOverload<const fcn_callback&>::of (&set_path_model::interpreter_event),
-             this, QOverload<const fcn_callback&>::of (&set_path_dialog::interpreter_event));
+  connect (model, QOverload<const fcn_callback&>::of (&set_path_model::interpreter_event),
+           this, QOverload<const fcn_callback&>::of (&set_path_dialog::interpreter_event));
 
-    connect (model, QOverload<const meth_callback&>::of (&set_path_model::interpreter_event),
-             this, QOverload<const meth_callback&>::of (&set_path_dialog::interpreter_event));
+  connect (model, QOverload<const meth_callback&>::of (&set_path_model::interpreter_event),
+           this, QOverload<const meth_callback&>::of (&set_path_dialog::interpreter_event));
 
-    m_path_list = new QListView (this);
-    m_path_list->setWordWrap (false);
-    m_path_list->setModel (model);
-    m_path_list->setSelectionBehavior (QAbstractItemView::SelectRows);
-    m_path_list->setSelectionMode (QAbstractItemView::ExtendedSelection);
-    m_path_list->setAlternatingRowColors (true);
-    m_path_list->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+  m_path_list = new QListView (this);
+  m_path_list->setWordWrap (false);
+  m_path_list->setModel (model);
+  m_path_list->setSelectionBehavior (QAbstractItemView::SelectRows);
+  m_path_list->setSelectionMode (QAbstractItemView::ExtendedSelection);
+  m_path_list->setAlternatingRowColors (true);
+  m_path_list->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
 
-    // layout everything
-    QDialogButtonBox *button_box = new QDialogButtonBox (Qt::Horizontal);
-    button_box->addButton (m_save_button, QDialogButtonBox::ActionRole);
-    button_box->addButton (m_reload_button, QDialogButtonBox::ActionRole);
+  // layout everything
+  QDialogButtonBox *button_box = new QDialogButtonBox (Qt::Horizontal);
+  button_box->addButton (m_save_button, QDialogButtonBox::ActionRole);
+  button_box->addButton (m_reload_button, QDialogButtonBox::ActionRole);
 
-    // add dialog close button
-    m_close_button = button_box->addButton (QDialogButtonBox::Close);
-    connect (button_box, &QDialogButtonBox::rejected,
-             this, &set_path_dialog::close);
+  // add dialog close button
+  m_close_button = button_box->addButton (QDialogButtonBox::Close);
+  connect (button_box, &QDialogButtonBox::rejected,
+           this, &set_path_dialog::close);
 
-    button_box->addButton (m_revert_button, QDialogButtonBox::ActionRole);
+  button_box->addButton (m_revert_button, QDialogButtonBox::ActionRole);
 
-    // path edit options
-    QDialogButtonBox *path_edit_layout = new QDialogButtonBox (Qt::Vertical);
-    path_edit_layout->addButton (m_add_folder_button, QDialogButtonBox::ActionRole);
-    path_edit_layout->addButton (m_move_to_top_button, QDialogButtonBox::ActionRole);
-    path_edit_layout->addButton (m_move_up_button, QDialogButtonBox::ActionRole);
-    path_edit_layout->addButton (m_move_down_button, QDialogButtonBox::ActionRole);
-    path_edit_layout->addButton (m_move_to_bottom_button, QDialogButtonBox::ActionRole);
-    path_edit_layout->addButton (m_remove_button, QDialogButtonBox::ActionRole);
+  // path edit options
+  QDialogButtonBox *path_edit_layout = new QDialogButtonBox (Qt::Vertical);
+  path_edit_layout->addButton (m_add_folder_button, QDialogButtonBox::ActionRole);
+  path_edit_layout->addButton (m_move_to_top_button, QDialogButtonBox::ActionRole);
+  path_edit_layout->addButton (m_move_up_button, QDialogButtonBox::ActionRole);
+  path_edit_layout->addButton (m_move_down_button, QDialogButtonBox::ActionRole);
+  path_edit_layout->addButton (m_move_to_bottom_button, QDialogButtonBox::ActionRole);
+  path_edit_layout->addButton (m_remove_button, QDialogButtonBox::ActionRole);
 
-    // main layout
-    QHBoxLayout *main_hboxlayout = new QHBoxLayout;
-    main_hboxlayout->addWidget(path_edit_layout);
-    main_hboxlayout->addWidget(m_path_list);
+  // main layout
+  QHBoxLayout *main_hboxlayout = new QHBoxLayout;
+  main_hboxlayout->addWidget(path_edit_layout);
+  main_hboxlayout->addWidget(m_path_list);
 
-    QGridLayout *main_layout = new QGridLayout;
-    main_layout->addWidget (m_info_label, 0, 0);
-    main_layout->addLayout (main_hboxlayout, 1, 0);
-    main_layout->addWidget (button_box, 2, 0);
+  QGridLayout *main_layout = new QGridLayout;
+  main_layout->addWidget (m_info_label, 0, 0);
+  main_layout->addLayout (main_hboxlayout, 1, 0);
+  main_layout->addWidget (button_box, 2, 0);
 
-    setLayout (main_layout);
+  setLayout (main_layout);
 
-    gui_settings settings;
+  gui_settings settings;
 
-    restoreGeometry (settings.value(pd_geometry.settings_key ()).toByteArray());
-  }
+  restoreGeometry (settings.value(pd_geometry.settings_key ()).toByteArray());
+}
 
-  void set_path_dialog::update_model ()
-  {
-    set_path_model *m = static_cast<set_path_model *> (m_path_list->model ());
-    m->path_to_model ();
-  }
+void set_path_dialog::update_model ()
+{
+  set_path_model *m = static_cast<set_path_model *> (m_path_list->model ());
+  m->path_to_model ();
+}
 
-  void set_path_dialog::add_dir_common (bool subdirs)
-  {
-    QString dir
-      = QFileDialog::getExistingDirectory (this, tr ("Open Directory"),
-                                           "",
-                                           (QFileDialog::ShowDirsOnly
-                                            | QFileDialog::DontResolveSymlinks));
+void set_path_dialog::add_dir_common (bool subdirs)
+{
+  QString dir
+    = QFileDialog::getExistingDirectory (this, tr ("Open Directory"),
+                                         "",
+                                         (QFileDialog::ShowDirsOnly
+                                          | QFileDialog::DontResolveSymlinks));
 
-    if (! dir.isEmpty ())
-      {
-        if (subdirs)
-          {
-            // Use existing method mofifying load path and updating dialog
-            // instead of adding string and updating load path
-            emit modify_path_signal (QStringList (dir), false, true);
-          }
-        else
-          {
-            set_path_model *m
-              = static_cast<set_path_model *> (m_path_list->model ());
-            m->add_dir (dir);
-          }
-      }
-  }
+  if (! dir.isEmpty ())
+    {
+      if (subdirs)
+        {
+          // Use existing method mofifying load path and updating dialog
+          // instead of adding string and updating load path
+          emit modify_path_signal (QStringList (dir), false, true);
+        }
+      else
+        {
+          set_path_model *m
+            = static_cast<set_path_model *> (m_path_list->model ());
+          m->add_dir (dir);
+        }
+    }
+}
 
-  void set_path_dialog::add_dir()
-  {
-    add_dir_common (false);
-  }
+void set_path_dialog::add_dir()
+{
+  add_dir_common (false);
+}
 
-  void set_path_dialog::add_dir_subdirs ()
-  {
-    add_dir_common (true);
-  }
+void set_path_dialog::add_dir_subdirs ()
+{
+  add_dir_common (true);
+}
 
-  void set_path_dialog::rm_dir ()
-  {
-    set_path_model *m = static_cast<set_path_model *> (m_path_list->model ());
-    QItemSelectionModel *selmodel = m_path_list->selectionModel ();
-    QModelIndexList indexlist = selmodel->selectedIndexes();
-    m->rm_dir (indexlist);
+void set_path_dialog::rm_dir ()
+{
+  set_path_model *m = static_cast<set_path_model *> (m_path_list->model ());
+  QItemSelectionModel *selmodel = m_path_list->selectionModel ();
+  QModelIndexList indexlist = selmodel->selectedIndexes();
+  m->rm_dir (indexlist);
 
-    selmodel->clearSelection ();
-  }
+  selmodel->clearSelection ();
+}
 
-  void set_path_dialog::move_dir_up ()
-  {
-    set_path_model *m = static_cast<set_path_model *> (m_path_list->model ());
-    QItemSelectionModel *selmodel = m_path_list->selectionModel ();
-    QModelIndexList indexlist = selmodel->selectedIndexes();
-    m->move_dir_up (indexlist);
+void set_path_dialog::move_dir_up ()
+{
+  set_path_model *m = static_cast<set_path_model *> (m_path_list->model ());
+  QItemSelectionModel *selmodel = m_path_list->selectionModel ();
+  QModelIndexList indexlist = selmodel->selectedIndexes();
+  m->move_dir_up (indexlist);
 
-    // Update selection and view
-    selmodel->clearSelection ();
-    int min_row = m->rowCount () - 1;
-    for (int i = 0; i < indexlist.length (); i++)
-      {
-        int new_row = std::max (indexlist.at (i).row () - 1, 0);
-        min_row = std::min (min_row, new_row);
-        selmodel->select (m->index (new_row), QItemSelectionModel::Select);
-      }
+  // Update selection and view
+  selmodel->clearSelection ();
+  int min_row = m->rowCount () - 1;
+  for (int i = 0; i < indexlist.length (); i++)
+    {
+      int new_row = std::max (indexlist.at (i).row () - 1, 0);
+      min_row = std::min (min_row, new_row);
+      selmodel->select (m->index (new_row), QItemSelectionModel::Select);
+    }
 
-    m_path_list->scrollTo (m->index (min_row));
-  }
+  m_path_list->scrollTo (m->index (min_row));
+}
 
-  void set_path_dialog::move_dir_down ()
-  {
-    set_path_model *m = static_cast<set_path_model *> (m_path_list->model ());
-    QItemSelectionModel *selmodel = m_path_list->selectionModel ();
-    QModelIndexList indexlist = selmodel->selectedIndexes();
-    m->move_dir_down (indexlist);
+void set_path_dialog::move_dir_down ()
+{
+  set_path_model *m = static_cast<set_path_model *> (m_path_list->model ());
+  QItemSelectionModel *selmodel = m_path_list->selectionModel ();
+  QModelIndexList indexlist = selmodel->selectedIndexes();
+  m->move_dir_down (indexlist);
 
-    // Update selection and view
-    selmodel->clearSelection ();
-    int max_row = 0;
-    for (int i = 0; i < indexlist.length (); i++)
-      {
-        int new_row = std::min (indexlist.at (i).row () + 1, m->rowCount () - 1);
-        max_row = std::max (max_row, new_row);
-        selmodel->select (m->index (new_row), QItemSelectionModel::Select);
-      }
+  // Update selection and view
+  selmodel->clearSelection ();
+  int max_row = 0;
+  for (int i = 0; i < indexlist.length (); i++)
+    {
+      int new_row = std::min (indexlist.at (i).row () + 1, m->rowCount () - 1);
+      max_row = std::max (max_row, new_row);
+      selmodel->select (m->index (new_row), QItemSelectionModel::Select);
+    }
 
-    m_path_list->scrollTo (m->index (max_row));
-  }
+  m_path_list->scrollTo (m->index (max_row));
+}
 
-  void set_path_dialog::move_dir_top ()
-  {
-    set_path_model *m = static_cast<set_path_model *> (m_path_list->model ());
-    QItemSelectionModel *selmodel = m_path_list->selectionModel ();
-    QModelIndexList indexlist = selmodel->selectedIndexes();
-    m->move_dir_top (indexlist);
+void set_path_dialog::move_dir_top ()
+{
+  set_path_model *m = static_cast<set_path_model *> (m_path_list->model ());
+  QItemSelectionModel *selmodel = m_path_list->selectionModel ();
+  QModelIndexList indexlist = selmodel->selectedIndexes();
+  m->move_dir_top (indexlist);
 
-    // Update selection and view
-    selmodel->clearSelection ();
-    for (int i = 0; i < indexlist.length (); i++)
-      selmodel->select (m->index (i), QItemSelectionModel::Select);
+  // Update selection and view
+  selmodel->clearSelection ();
+  for (int i = 0; i < indexlist.length (); i++)
+    selmodel->select (m->index (i), QItemSelectionModel::Select);
 
-    m_path_list->scrollTo (m->index (0));
-  }
+  m_path_list->scrollTo (m->index (0));
+}
 
-  void set_path_dialog::move_dir_bottom ()
-  {
-    set_path_model *m = static_cast<set_path_model *> (m_path_list->model ());
-    QItemSelectionModel *selmodel = m_path_list->selectionModel ();
-    QModelIndexList indexlist = selmodel->selectedIndexes();
-    m->move_dir_bottom (indexlist);
+void set_path_dialog::move_dir_bottom ()
+{
+  set_path_model *m = static_cast<set_path_model *> (m_path_list->model ());
+  QItemSelectionModel *selmodel = m_path_list->selectionModel ();
+  QModelIndexList indexlist = selmodel->selectedIndexes();
+  m->move_dir_bottom (indexlist);
 
-    // Update selection and view
-    selmodel->clearSelection ();
-    int row_count = m->rowCount ();
-    for (int i = 0; i < indexlist.length (); i++)
-      selmodel->select (m->index (row_count - 1 - i),
-                        QItemSelectionModel::Select);
+  // Update selection and view
+  selmodel->clearSelection ();
+  int row_count = m->rowCount ();
+  for (int i = 0; i < indexlist.length (); i++)
+    selmodel->select (m->index (row_count - 1 - i),
+                      QItemSelectionModel::Select);
 
-    m_path_list->scrollTo (m->index (row_count - 1));
-  }
+  m_path_list->scrollTo (m->index (row_count - 1));
+}
 
-  void set_path_dialog::save_settings ()
-  {
-    gui_settings settings;
+void set_path_dialog::save_settings ()
+{
+  gui_settings settings;
 
-    settings.setValue (pd_geometry.settings_key (), saveGeometry ());
-  }
+  settings.setValue (pd_geometry.settings_key (), saveGeometry ());
+}
 
-  void set_path_dialog::closeEvent (QCloseEvent *e)
-  {
-    save_settings ();
+void set_path_dialog::closeEvent (QCloseEvent *e)
+{
+  save_settings ();
 
-    QWidget::closeEvent (e);
-  }
+  QWidget::closeEvent (e);
+}
 
 OCTAVE_END_NAMESPACE(octave)
--- a/libgui/src/set-path-dialog.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/set-path-dialog.h	Thu Feb 02 12:25:51 2023 -0800
@@ -41,75 +41,75 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class set_path_dialog : public QDialog
-  {
-    Q_OBJECT
+class set_path_dialog : public QDialog
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    // You must call update_model to fully initialize the path displayed
-    // in the dialog.  That may only be done after the intepreter_event
-    // signal connections are made to the Octave interpreter.
+  // You must call update_model to fully initialize the path displayed
+  // in the dialog.  That may only be done after the intepreter_event
+  // signal connections are made to the Octave interpreter.
 
-    set_path_dialog (QWidget *parent);
+  set_path_dialog (QWidget *parent);
 
-    virtual ~set_path_dialog () = default;
+  virtual ~set_path_dialog () = default;
 
-    void save_settings ();
+  void save_settings ();
 
-  signals:
+signals:
 
-    //! Emitted, when the path has to be modified
+  //! Emitted, when the path has to be modified
 
-    void modify_path_signal (const QStringList& dir_list, bool rm,
-                             bool subdirs);
+  void modify_path_signal (const QStringList& dir_list, bool rm,
+                           bool subdirs);
 
-    void interpreter_event (const fcn_callback& fcn);
-    void interpreter_event (const meth_callback& meth);
+  void interpreter_event (const fcn_callback& fcn);
+  void interpreter_event (const meth_callback& meth);
 
-  public slots:
+public slots:
 
-    void update_model ();
+  void update_model ();
 
-  protected:
+protected:
 
-    void closeEvent (QCloseEvent *e);
+  void closeEvent (QCloseEvent *e);
 
-  private slots:
+private slots:
 
-    void add_dir ();
-    void add_dir_subdirs ();
+  void add_dir ();
+  void add_dir_subdirs ();
 
-    void rm_dir ();
+  void rm_dir ();
 
-    void move_dir_up ();
+  void move_dir_up ();
 
-    void move_dir_down ();
+  void move_dir_down ();
 
-    void move_dir_top ();
+  void move_dir_top ();
 
-    void move_dir_bottom ();
+  void move_dir_bottom ();
 
-  private:
+private:
 
-    void add_dir_common (bool subdirs);
+  void add_dir_common (bool subdirs);
 
-    QLabel *m_info_label;
-    QPushButton *m_reload_button;
-    QPushButton *m_save_button;
-    QPushButton *m_close_button;
-    QPushButton *m_revert_button;
-    QPushButton *m_revert_last_button;
+  QLabel *m_info_label;
+  QPushButton *m_reload_button;
+  QPushButton *m_save_button;
+  QPushButton *m_close_button;
+  QPushButton *m_revert_button;
+  QPushButton *m_revert_last_button;
 
-    QListView *m_path_list;
+  QListView *m_path_list;
 
-    QPushButton *m_add_folder_button;
-    QPushButton *m_move_to_top_button;
-    QPushButton *m_move_to_bottom_button;
-    QPushButton *m_move_up_button;
-    QPushButton *m_move_down_button;
-    QPushButton *m_remove_button;
-  };
+  QPushButton *m_add_folder_button;
+  QPushButton *m_move_to_top_button;
+  QPushButton *m_move_to_bottom_button;
+  QPushButton *m_move_up_button;
+  QPushButton *m_move_down_button;
+  QPushButton *m_remove_button;
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/src/settings-dialog.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/settings-dialog.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -72,1642 +72,1642 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  settings_dialog::settings_dialog (QWidget *p, const QString& desired_tab)
-    : QDialog (p), Ui::settings_dialog ()
-  {
-    setupUi (this);
+settings_dialog::settings_dialog (QWidget *p, const QString& desired_tab)
+  : QDialog (p), Ui::settings_dialog ()
+{
+  setupUi (this);
 
-    gui_settings settings;
+  gui_settings settings;
 
-    // look for available language files and the actual settings
-    QString qm_dir_name = settings.get_gui_translation_dir ();
+  // look for available language files and the actual settings
+  QString qm_dir_name = settings.get_gui_translation_dir ();
 
-    QDir qm_dir (qm_dir_name);
-    QFileInfoList qm_files = qm_dir.entryInfoList (QStringList ("*.qm"),
-                             QDir::Files | QDir::Readable, QDir::Name);
+  QDir qm_dir (qm_dir_name);
+  QFileInfoList qm_files = qm_dir.entryInfoList (QStringList ("*.qm"),
+                           QDir::Files | QDir::Readable, QDir::Name);
 
-    for (int i = 0; i < qm_files.length (); i++)   // insert available languages
-      comboBox_language->addItem (qm_files.at (i).baseName ());
-    // System at beginning
-    comboBox_language->insertItem (0, tr ("System setting"));
-    comboBox_language->insertSeparator (1);    // separator after System
-    QString language = settings.string_value (global_language);
-    if (language == global_language.def ().toString ())
-      language = tr ("System setting");
-    int selected = comboBox_language->findText (language);
-    if (selected >= 0)
-      comboBox_language->setCurrentIndex (selected);
-    else
-      comboBox_language->setCurrentIndex (0);  // System is default
+  for (int i = 0; i < qm_files.length (); i++)   // insert available languages
+    comboBox_language->addItem (qm_files.at (i).baseName ());
+  // System at beginning
+  comboBox_language->insertItem (0, tr ("System setting"));
+  comboBox_language->insertSeparator (1);    // separator after System
+  QString language = settings.string_value (global_language);
+  if (language == global_language.def ().toString ())
+    language = tr ("System setting");
+  int selected = comboBox_language->findText (language);
+  if (selected >= 0)
+    comboBox_language->setCurrentIndex (selected);
+  else
+    comboBox_language->setCurrentIndex (0);  // System is default
 
-    // Global style
-    QStringList styles = QStyleFactory::keys();
-    styles.append (global_extra_styles);
-    combo_styles->addItems (styles);
-    combo_styles->insertItem (0, global_style.def ().toString ());
-    combo_styles->insertSeparator (1);
-    QString current_style = settings.string_value (global_style);
-    if (current_style == global_style.def ().toString ())
-      current_style = global_style.def ().toString ();
-    selected = combo_styles->findText (current_style);
-    if (selected >= 0)
-      combo_styles->setCurrentIndex (selected);
-    else
-      combo_styles->setCurrentIndex (0);
+  // Global style
+  QStringList styles = QStyleFactory::keys();
+  styles.append (global_extra_styles);
+  combo_styles->addItems (styles);
+  combo_styles->insertItem (0, global_style.def ().toString ());
+  combo_styles->insertSeparator (1);
+  QString current_style = settings.string_value (global_style);
+  if (current_style == global_style.def ().toString ())
+    current_style = global_style.def ().toString ();
+  selected = combo_styles->findText (current_style);
+  if (selected >= 0)
+    combo_styles->setCurrentIndex (selected);
+  else
+    combo_styles->setCurrentIndex (0);
 
-    // icon size and theme
-    QButtonGroup *icon_size_group = new QButtonGroup (this);
-    icon_size_group->addButton (icon_size_small);
-    icon_size_group->addButton (icon_size_normal);
-    icon_size_group->addButton (icon_size_large);
-    int icon_size = settings.int_value (global_icon_size);
-    icon_size_normal->setChecked (true);  // the default
-    icon_size_small->setChecked (icon_size < 0);
-    icon_size_large->setChecked (icon_size > 0);
-    combo_box_icon_theme->addItems (global_all_icon_theme_names);
-    int theme = settings.value (global_icon_theme_index.settings_key ()).toInt ();
-    combo_box_icon_theme->setCurrentIndex (theme);
+  // icon size and theme
+  QButtonGroup *icon_size_group = new QButtonGroup (this);
+  icon_size_group->addButton (icon_size_small);
+  icon_size_group->addButton (icon_size_normal);
+  icon_size_group->addButton (icon_size_large);
+  int icon_size = settings.int_value (global_icon_size);
+  icon_size_normal->setChecked (true);  // the default
+  icon_size_small->setChecked (icon_size < 0);
+  icon_size_large->setChecked (icon_size > 0);
+  combo_box_icon_theme->addItems (global_all_icon_theme_names);
+  int theme = settings.value (global_icon_theme_index.settings_key ()).toInt ();
+  combo_box_icon_theme->setCurrentIndex (theme);
 
-    // which icon has to be selected
-    QButtonGroup *icon_group = new QButtonGroup (this);
-    icon_group->addButton (general_icon_octave);
-    icon_group->addButton (general_icon_graphic);
-    icon_group->addButton (general_icon_letter);
-    QString widget_icon_set =
-      settings.string_value (dw_icon_set);
-    general_icon_octave->setChecked (true);  // the default (if invalid set)
-    general_icon_octave->setChecked (widget_icon_set == "NONE");
-    general_icon_graphic->setChecked (widget_icon_set == "GRAPHIC");
-    general_icon_letter->setChecked (widget_icon_set == "LETTER");
+  // which icon has to be selected
+  QButtonGroup *icon_group = new QButtonGroup (this);
+  icon_group->addButton (general_icon_octave);
+  icon_group->addButton (general_icon_graphic);
+  icon_group->addButton (general_icon_letter);
+  QString widget_icon_set =
+    settings.string_value (dw_icon_set);
+  general_icon_octave->setChecked (true);  // the default (if invalid set)
+  general_icon_octave->setChecked (widget_icon_set == "NONE");
+  general_icon_graphic->setChecked (widget_icon_set == "GRAPHIC");
+  general_icon_letter->setChecked (widget_icon_set == "LETTER");
 
-    // custom title bar of dock widget
-    QColor bg_color = settings.color_value (dw_title_bg_color);
-    m_widget_title_bg_color = new color_picker (bg_color);
-    m_widget_title_bg_color->setEnabled (false);
-    layout_widget_bgtitle->addWidget (m_widget_title_bg_color, 0);
+  // custom title bar of dock widget
+  QColor bg_color = settings.color_value (dw_title_bg_color);
+  m_widget_title_bg_color = new color_picker (bg_color);
+  m_widget_title_bg_color->setEnabled (false);
+  layout_widget_bgtitle->addWidget (m_widget_title_bg_color, 0);
 
-    connect (cb_widget_custom_style, &QCheckBox::toggled,
-             m_widget_title_bg_color, &color_picker::setEnabled);
+  connect (cb_widget_custom_style, &QCheckBox::toggled,
+           m_widget_title_bg_color, &color_picker::setEnabled);
 
-    QColor bg_color_active = settings.color_value (dw_title_bg_color_active);
-    m_widget_title_bg_color_active = new color_picker (bg_color_active);
-    m_widget_title_bg_color_active->setEnabled (false);
-    layout_widget_bgtitle_active->addWidget (m_widget_title_bg_color_active, 0);
+  QColor bg_color_active = settings.color_value (dw_title_bg_color_active);
+  m_widget_title_bg_color_active = new color_picker (bg_color_active);
+  m_widget_title_bg_color_active->setEnabled (false);
+  layout_widget_bgtitle_active->addWidget (m_widget_title_bg_color_active, 0);
 
-    connect (cb_widget_custom_style, &QCheckBox::toggled,
-             m_widget_title_bg_color_active, &color_picker::setEnabled);
+  connect (cb_widget_custom_style, &QCheckBox::toggled,
+           m_widget_title_bg_color_active, &color_picker::setEnabled);
 
-    QColor fg_color = settings.color_value (dw_title_fg_color);
-    m_widget_title_fg_color = new color_picker (fg_color);
-    m_widget_title_fg_color->setEnabled (false);
-    layout_widget_fgtitle->addWidget (m_widget_title_fg_color, 0);
+  QColor fg_color = settings.color_value (dw_title_fg_color);
+  m_widget_title_fg_color = new color_picker (fg_color);
+  m_widget_title_fg_color->setEnabled (false);
+  layout_widget_fgtitle->addWidget (m_widget_title_fg_color, 0);
 
-    connect (cb_widget_custom_style, &QCheckBox::toggled,
-             m_widget_title_fg_color, &color_picker::setEnabled);
+  connect (cb_widget_custom_style, &QCheckBox::toggled,
+           m_widget_title_fg_color, &color_picker::setEnabled);
 
-    QColor fg_color_active = settings.color_value (dw_title_fg_color_active);
-    m_widget_title_fg_color_active = new color_picker (fg_color_active);
-    m_widget_title_fg_color_active->setEnabled (false);
-    layout_widget_fgtitle_active->addWidget (m_widget_title_fg_color_active, 0);
+  QColor fg_color_active = settings.color_value (dw_title_fg_color_active);
+  m_widget_title_fg_color_active = new color_picker (fg_color_active);
+  m_widget_title_fg_color_active->setEnabled (false);
+  layout_widget_fgtitle_active->addWidget (m_widget_title_fg_color_active, 0);
 
-    connect (cb_widget_custom_style, &QCheckBox::toggled,
-             m_widget_title_fg_color_active, &color_picker::setEnabled);
+  connect (cb_widget_custom_style, &QCheckBox::toggled,
+           m_widget_title_fg_color_active, &color_picker::setEnabled);
 
-    sb_3d_title->setValue (settings.int_value (dw_title_3d));
-    cb_widget_custom_style->setChecked (settings.bool_value (dw_title_custom_style));
+  sb_3d_title->setValue (settings.int_value (dw_title_3d));
+  cb_widget_custom_style->setChecked (settings.bool_value (dw_title_custom_style));
 
-    // Native file dialogs.
-    // FIXME: This preference can be deprecated / removed if all display
-    //       managers, especially KDE, run those dialogs without hangs or
-    //       delays from the start (bug #54607).
-    cb_use_native_file_dialogs->setChecked (settings.bool_value (global_use_native_dialogs));
+  // Native file dialogs.
+  // FIXME: This preference can be deprecated / removed if all display
+  //       managers, especially KDE, run those dialogs without hangs or
+  //       delays from the start (bug #54607).
+  cb_use_native_file_dialogs->setChecked (settings.bool_value (global_use_native_dialogs));
 
-    // Cursor blinking: consider old terminal related setting if not yet set
-    // FIXME: This pref. can be deprecated / removed if Qt adds support for
-    //       getting the cursor blink preferences from all OS environments
-    if (settings.contains (global_cursor_blinking.settings_key ()))
-      {
-        // Preference exists, read its value
-        cb_cursor_blinking->setChecked (settings.bool_value (global_cursor_blinking));
-      }
-    else
-      {
-        // Pref. does not exist, so take old terminal related pref.
-        cb_cursor_blinking->setChecked (settings.bool_value (cs_cursor_blinking));
-      }
+  // Cursor blinking: consider old terminal related setting if not yet set
+  // FIXME: This pref. can be deprecated / removed if Qt adds support for
+  //       getting the cursor blink preferences from all OS environments
+  if (settings.contains (global_cursor_blinking.settings_key ()))
+    {
+      // Preference exists, read its value
+      cb_cursor_blinking->setChecked (settings.bool_value (global_cursor_blinking));
+    }
+  else
+    {
+      // Pref. does not exist, so take old terminal related pref.
+      cb_cursor_blinking->setChecked (settings.bool_value (cs_cursor_blinking));
+    }
 
-    // focus follows mouse
-    cb_focus_follows_mouse->setChecked (settings.bool_value (dw_focus_follows_mouse));
+  // focus follows mouse
+  cb_focus_follows_mouse->setChecked (settings.bool_value (dw_focus_follows_mouse));
 
-    // prompt on exit
-    cb_prompt_to_exit->setChecked (settings.bool_value (global_prompt_to_exit));
+  // prompt on exit
+  cb_prompt_to_exit->setChecked (settings.bool_value (global_prompt_to_exit));
 
-    // Main status bar
-    cb_status_bar->setChecked (settings.bool_value (global_status_bar));
+  // Main status bar
+  cb_status_bar->setChecked (settings.bool_value (global_status_bar));
 
-    // Octave startup
-    cb_restore_octave_dir->setChecked (settings.bool_value (global_restore_ov_dir));
-    le_octave_dir->setText (settings.string_value (global_ov_startup_dir));
+  // Octave startup
+  cb_restore_octave_dir->setChecked (settings.bool_value (global_restore_ov_dir));
+  le_octave_dir->setText (settings.string_value (global_ov_startup_dir));
 
-    connect (pb_octave_dir, &QPushButton::pressed,
-             this, &settings_dialog::get_octave_dir);
+  connect (pb_octave_dir, &QPushButton::pressed,
+           this, &settings_dialog::get_octave_dir);
 
-    //
-    // editor
-    //
-    useCustomFileEditor->setChecked (settings.bool_value (global_use_custom_editor));
-    customFileEditor->setText (settings.string_value (global_custom_editor));
-    editor_showLineNumbers->setChecked (settings.bool_value (ed_show_line_numbers));
-    editor_linenr_size->setValue (settings.int_value (ed_line_numbers_size));
+  //
+  // editor
+  //
+  useCustomFileEditor->setChecked (settings.bool_value (global_use_custom_editor));
+  customFileEditor->setText (settings.string_value (global_custom_editor));
+  editor_showLineNumbers->setChecked (settings.bool_value (ed_show_line_numbers));
+  editor_linenr_size->setValue (settings.int_value (ed_line_numbers_size));
 
-    settings.combo_encoding (editor_combo_encoding);
+  settings.combo_encoding (editor_combo_encoding);
 
-    editor_highlightCurrentLine->setChecked (settings.bool_value (ed_highlight_current_line));
-    editor_long_line_marker->setChecked (settings.bool_value (ed_long_line_marker));
-    bool long_line =
-      settings.bool_value (ed_long_line_marker_line);
-    editor_long_line_marker_line->setChecked (long_line);
-    bool long_back =
-      settings.bool_value (ed_long_line_marker_background);
-    editor_long_line_marker_background->setChecked (long_back);
-    if (! (long_line || long_back))
-      editor_long_line_marker_line->setChecked (true);
-    editor_long_line_column->setValue (settings.int_value (ed_long_line_column));
-    editor_break_checkbox->setChecked (settings.bool_value (ed_break_lines));
-    editor_break_comments_checkbox->setChecked (settings.bool_value (ed_break_lines_comments));
-    editor_wrap_checkbox->setChecked (settings.bool_value (ed_wrap_lines));
-    cb_edit_status_bar->setChecked (settings.bool_value (ed_show_edit_status_bar));
-    cb_edit_tool_bar->setChecked (settings.bool_value (ed_show_toolbar));
-    cb_code_folding->setChecked (settings.bool_value (ed_code_folding));
-    editor_highlight_all_occurrences->setChecked (settings.bool_value (ed_highlight_all_occurrences));
+  editor_highlightCurrentLine->setChecked (settings.bool_value (ed_highlight_current_line));
+  editor_long_line_marker->setChecked (settings.bool_value (ed_long_line_marker));
+  bool long_line =
+    settings.bool_value (ed_long_line_marker_line);
+  editor_long_line_marker_line->setChecked (long_line);
+  bool long_back =
+    settings.bool_value (ed_long_line_marker_background);
+  editor_long_line_marker_background->setChecked (long_back);
+  if (! (long_line || long_back))
+    editor_long_line_marker_line->setChecked (true);
+  editor_long_line_column->setValue (settings.int_value (ed_long_line_column));
+  editor_break_checkbox->setChecked (settings.bool_value (ed_break_lines));
+  editor_break_comments_checkbox->setChecked (settings.bool_value (ed_break_lines_comments));
+  editor_wrap_checkbox->setChecked (settings.bool_value (ed_wrap_lines));
+  cb_edit_status_bar->setChecked (settings.bool_value (ed_show_edit_status_bar));
+  cb_edit_tool_bar->setChecked (settings.bool_value (ed_show_toolbar));
+  cb_code_folding->setChecked (settings.bool_value (ed_code_folding));
+  editor_highlight_all_occurrences->setChecked (settings.bool_value (ed_highlight_all_occurrences));
 
-    editor_auto_endif->setCurrentIndex (settings.int_value (ed_auto_endif) );
-    editor_codeCompletion->setChecked (settings.bool_value (ed_code_completion));
-    editor_spinbox_ac_threshold->setValue (settings.int_value (ed_code_completion_threshold));
-    editor_checkbox_ac_keywords->setChecked (settings.bool_value (ed_code_completion_keywords));
-    editor_checkbox_ac_builtins->setEnabled (editor_checkbox_ac_keywords->isChecked ());
-    editor_checkbox_ac_functions->setEnabled (editor_checkbox_ac_keywords->isChecked ());
-    editor_checkbox_ac_builtins->setChecked (settings.bool_value (ed_code_completion_octave_builtins));
-    editor_checkbox_ac_functions->setChecked (settings.bool_value (ed_code_completion_octave_functions));
-    editor_checkbox_ac_document->setChecked (settings.bool_value (ed_code_completion_document));
-    editor_checkbox_ac_case->setChecked (settings.bool_value (ed_code_completion_case));
-    editor_checkbox_ac_replace->setChecked (settings.bool_value (ed_code_completion_replace));
-    editor_ws_checkbox->setChecked (settings.bool_value (ed_show_white_space));
-    editor_ws_indent_checkbox->setChecked (settings.bool_value (ed_show_white_space_indent));
-    cb_show_eol->setChecked (settings.bool_value (ed_show_eol_chars));
-    cb_show_hscrollbar->setChecked (settings.bool_value (ed_show_hscroll_bar));
+  editor_auto_endif->setCurrentIndex (settings.int_value (ed_auto_endif) );
+  editor_codeCompletion->setChecked (settings.bool_value (ed_code_completion));
+  editor_spinbox_ac_threshold->setValue (settings.int_value (ed_code_completion_threshold));
+  editor_checkbox_ac_keywords->setChecked (settings.bool_value (ed_code_completion_keywords));
+  editor_checkbox_ac_builtins->setEnabled (editor_checkbox_ac_keywords->isChecked ());
+  editor_checkbox_ac_functions->setEnabled (editor_checkbox_ac_keywords->isChecked ());
+  editor_checkbox_ac_builtins->setChecked (settings.bool_value (ed_code_completion_octave_builtins));
+  editor_checkbox_ac_functions->setChecked (settings.bool_value (ed_code_completion_octave_functions));
+  editor_checkbox_ac_document->setChecked (settings.bool_value (ed_code_completion_document));
+  editor_checkbox_ac_case->setChecked (settings.bool_value (ed_code_completion_case));
+  editor_checkbox_ac_replace->setChecked (settings.bool_value (ed_code_completion_replace));
+  editor_ws_checkbox->setChecked (settings.bool_value (ed_show_white_space));
+  editor_ws_indent_checkbox->setChecked (settings.bool_value (ed_show_white_space_indent));
+  cb_show_eol->setChecked (settings.bool_value (ed_show_eol_chars));
+  cb_show_hscrollbar->setChecked (settings.bool_value (ed_show_hscroll_bar));
 
-    for (int i = 0; i < ed_tab_position_names.length (); i++)
-      editor_combox_tab_pos->insertItem (i,
-              tr (ed_tab_position_names.at (i).toStdString ().data ()));
-    editor_combox_tab_pos->setCurrentIndex
-      (settings.int_value (ed_tab_position));
+  for (int i = 0; i < ed_tab_position_names.length (); i++)
+    editor_combox_tab_pos->insertItem (i,
+            tr (ed_tab_position_names.at (i).toStdString ().data ()));
+  editor_combox_tab_pos->setCurrentIndex
+    (settings.int_value (ed_tab_position));
 
-    editor_cb_tabs_rotated->setChecked (settings.bool_value (ed_tabs_rotated));
-    editor_sb_tabs_max_width->setValue (settings.int_value (ed_tabs_max_width));
+  editor_cb_tabs_rotated->setChecked (settings.bool_value (ed_tabs_rotated));
+  editor_sb_tabs_max_width->setValue (settings.int_value (ed_tabs_max_width));
 
-    int selected_comment_string, selected_uncomment_string;
+  int selected_comment_string, selected_uncomment_string;
 
-    if (settings.contains (ed_comment_str.settings_key ()))   // new version (radio buttons)
-      selected_comment_string = settings.int_value (ed_comment_str);
-    else                                         // old version (combo box)
-      selected_comment_string = settings.value (ed_comment_str_old.settings_key (),                                                 ed_comment_str.def ()).toInt ();
+  if (settings.contains (ed_comment_str.settings_key ()))   // new version (radio buttons)
+    selected_comment_string = settings.int_value (ed_comment_str);
+  else                                         // old version (combo box)
+    selected_comment_string = settings.value (ed_comment_str_old.settings_key (),                                                 ed_comment_str.def ()).toInt ();
 
-    selected_uncomment_string = settings.int_value (ed_uncomment_str);
+  selected_uncomment_string = settings.int_value (ed_uncomment_str);
 
-    for (int i = 0; i < ed_comment_strings_count; i++)
-      {
-        m_rb_comment_strings[i] = new QRadioButton ();
-        m_rb_uncomment_strings[i] = new QCheckBox ();
+  for (int i = 0; i < ed_comment_strings_count; i++)
+    {
+      m_rb_comment_strings[i] = new QRadioButton ();
+      m_rb_uncomment_strings[i] = new QCheckBox ();
 
-        connect (m_rb_comment_strings[i], &QRadioButton::clicked,
-                 m_rb_uncomment_strings[i], &QCheckBox::setChecked);
-        connect (m_rb_comment_strings[i], &QRadioButton::toggled,
-                 m_rb_uncomment_strings[i], &QCheckBox::setDisabled);
+      connect (m_rb_comment_strings[i], &QRadioButton::clicked,
+               m_rb_uncomment_strings[i], &QCheckBox::setChecked);
+      connect (m_rb_comment_strings[i], &QRadioButton::toggled,
+               m_rb_uncomment_strings[i], &QCheckBox::setDisabled);
 
-        m_rb_comment_strings[i]->setText (ed_comment_strings.at(i));
-        m_rb_comment_strings[i]->setChecked (i == selected_comment_string);
-        layout_comment_strings->addWidget (m_rb_comment_strings[i]);
+      m_rb_comment_strings[i]->setText (ed_comment_strings.at(i));
+      m_rb_comment_strings[i]->setChecked (i == selected_comment_string);
+      layout_comment_strings->addWidget (m_rb_comment_strings[i]);
 
-        m_rb_uncomment_strings[i]->setText (ed_comment_strings.at(i));
-        m_rb_uncomment_strings[i]->setAutoExclusive (false);
-        m_rb_uncomment_strings[i]->setChecked ( 1 << i & selected_uncomment_string);
-        layout_uncomment_strings->addWidget (m_rb_uncomment_strings[i]);
-      }
+      m_rb_uncomment_strings[i]->setText (ed_comment_strings.at(i));
+      m_rb_uncomment_strings[i]->setAutoExclusive (false);
+      m_rb_uncomment_strings[i]->setChecked ( 1 << i & selected_uncomment_string);
+      layout_uncomment_strings->addWidget (m_rb_uncomment_strings[i]);
+    }
 
-    combo_eol_mode->setCurrentIndex (settings.int_value (ed_default_eol_mode));
-    editor_auto_ind_checkbox->setChecked (settings.bool_value (ed_auto_indent));
-    editor_tab_ind_checkbox->setChecked (settings.bool_value (ed_tab_indents_line));
-    editor_bs_unind_checkbox->setChecked (settings.bool_value (ed_backspace_unindents_line));
-    editor_ind_guides_checkbox->setChecked (settings.bool_value (ed_show_indent_guides));
-    editor_ind_width_spinbox->setValue (settings.int_value (ed_indent_width));
-    editor_ind_uses_tabs_checkbox->setChecked (settings.bool_value (ed_indent_uses_tabs));
-    editor_tab_width_spinbox->setValue (settings.int_value (ed_tab_width));
-    editor_restoreSession->setChecked (settings.bool_value (ed_restore_session));
-    editor_create_new_file->setChecked (settings.bool_value (ed_create_new_file));
-    editor_reload_changed_files->setChecked (settings.bool_value (ed_always_reload_changed_files));
-    editor_force_newline->setChecked (settings.bool_value (ed_force_newline));
-    editor_remove_trailing_spaces->setChecked (settings.bool_value (ed_rm_trailing_spaces));
-    editor_hiding_closes_files->setChecked (settings.bool_value (ed_hiding_closes_files));
-    editor_show_dbg_file->setChecked (settings.bool_value (ed_show_dbg_file));
+  combo_eol_mode->setCurrentIndex (settings.int_value (ed_default_eol_mode));
+  editor_auto_ind_checkbox->setChecked (settings.bool_value (ed_auto_indent));
+  editor_tab_ind_checkbox->setChecked (settings.bool_value (ed_tab_indents_line));
+  editor_bs_unind_checkbox->setChecked (settings.bool_value (ed_backspace_unindents_line));
+  editor_ind_guides_checkbox->setChecked (settings.bool_value (ed_show_indent_guides));
+  editor_ind_width_spinbox->setValue (settings.int_value (ed_indent_width));
+  editor_ind_uses_tabs_checkbox->setChecked (settings.bool_value (ed_indent_uses_tabs));
+  editor_tab_width_spinbox->setValue (settings.int_value (ed_tab_width));
+  editor_restoreSession->setChecked (settings.bool_value (ed_restore_session));
+  editor_create_new_file->setChecked (settings.bool_value (ed_create_new_file));
+  editor_reload_changed_files->setChecked (settings.bool_value (ed_always_reload_changed_files));
+  editor_force_newline->setChecked (settings.bool_value (ed_force_newline));
+  editor_remove_trailing_spaces->setChecked (settings.bool_value (ed_rm_trailing_spaces));
+  editor_hiding_closes_files->setChecked (settings.bool_value (ed_hiding_closes_files));
+  editor_show_dbg_file->setChecked (settings.bool_value (ed_show_dbg_file));
 
-    // terminal
-    QString default_font = settings.string_value (global_mono_font);
-    terminal_fontName->setCurrentFont (QFont (settings.value (cs_font.settings_key (), default_font).toString ()));
-    terminal_fontSize->setValue (settings.int_value (cs_font_size));
-    terminal_history_buffer->setValue (settings.int_value (cs_hist_buffer));
-    terminal_cursorUseForegroundColor->setChecked (settings.bool_value (cs_cursor_use_fgcol));
-    terminal_focus_command->setChecked (settings.bool_value (cs_focus_cmd));
-    terminal_print_dbg_location->setChecked (settings.bool_value (cs_dbg_location));
+  // terminal
+  QString default_font = settings.string_value (global_mono_font);
+  terminal_fontName->setCurrentFont (QFont (settings.value (cs_font.settings_key (), default_font).toString ()));
+  terminal_fontSize->setValue (settings.int_value (cs_font_size));
+  terminal_history_buffer->setValue (settings.int_value (cs_hist_buffer));
+  terminal_cursorUseForegroundColor->setChecked (settings.bool_value (cs_cursor_use_fgcol));
+  terminal_focus_command->setChecked (settings.bool_value (cs_focus_cmd));
+  terminal_print_dbg_location->setChecked (settings.bool_value (cs_dbg_location));
 
-    QString cursor_type
-      = settings.string_value (cs_cursor);
+  QString cursor_type
+    = settings.string_value (cs_cursor);
 
-    QStringList items;
-    items << QString ("0") << QString ("1") << QString ("2");
-    terminal_cursorType->addItems (items);
-    terminal_cursorType->setItemText (0, tr ("IBeam Cursor"));
-    terminal_cursorType->setItemText (1, tr ("Block Cursor"));
-    terminal_cursorType->setItemText (2, tr ("Underline Cursor"));
+  QStringList items;
+  items << QString ("0") << QString ("1") << QString ("2");
+  terminal_cursorType->addItems (items);
+  terminal_cursorType->setItemText (0, tr ("IBeam Cursor"));
+  terminal_cursorType->setItemText (1, tr ("Block Cursor"));
+  terminal_cursorType->setItemText (2, tr ("Underline Cursor"));
 
-    for (unsigned int i = 0; i < cs_cursor_types.size (); i++)
-      {
-        if (cursor_type.toStdString () == cs_cursor_types[i])
-          {
-            terminal_cursorType->setCurrentIndex (i);
-            break;
-          }
-      }
+  for (unsigned int i = 0; i < cs_cursor_types.size (); i++)
+    {
+      if (cursor_type.toStdString () == cs_cursor_types[i])
+        {
+          terminal_cursorType->setCurrentIndex (i);
+          break;
+        }
+    }
 
-    read_terminal_colors ();
+  read_terminal_colors ();
 
-    // file browser
-    connect (sync_octave_directory, &QCheckBox::toggled,
-             this, &settings_dialog::set_disabled_pref_file_browser_dir);
+  // file browser
+  connect (sync_octave_directory, &QCheckBox::toggled,
+           this, &settings_dialog::set_disabled_pref_file_browser_dir);
 
-    sync_octave_directory->setChecked (settings.bool_value (fb_sync_octdir));
-    cb_restore_file_browser_dir->setChecked (settings.bool_value (fb_restore_last_dir));
-    le_file_browser_dir->setText (settings.value (fb_startup_dir.settings_key ()).toString ());
+  sync_octave_directory->setChecked (settings.bool_value (fb_sync_octdir));
+  cb_restore_file_browser_dir->setChecked (settings.bool_value (fb_restore_last_dir));
+  le_file_browser_dir->setText (settings.value (fb_startup_dir.settings_key ()).toString ());
 
-    connect (pb_file_browser_dir, &QPushButton::pressed,
-             this, &settings_dialog::get_file_browser_dir);
+  connect (pb_file_browser_dir, &QPushButton::pressed,
+           this, &settings_dialog::get_file_browser_dir);
 
-    le_file_browser_extensions->setText (settings.string_value (fb_txt_file_ext));
+  le_file_browser_extensions->setText (settings.string_value (fb_txt_file_ext));
 
-    checkbox_allow_web_connect->setChecked (settings.bool_value (nr_allow_connection));
+  checkbox_allow_web_connect->setChecked (settings.bool_value (nr_allow_connection));
 
-    // Proxy
-    bool use_proxy = settings.bool_value (global_use_proxy);
-    use_proxy_server->setChecked (use_proxy);
-    // Fill combo box and activate current one
-    QString proxy_type_string = settings.string_value (global_proxy_type);
-    proxy_type->addItems (global_proxy_all_types);
-    for (int i = 0; i < global_proxy_all_types.length (); i++)
-      {
-        if (proxy_type->itemText (i) == proxy_type_string)
-          {
-            proxy_type->setCurrentIndex (i);
-            break;
-          }
-      }
-    // Fill all line edits
-    proxy_host_name->setText (settings.string_value (global_proxy_host));
-    proxy_port->setText (settings.string_value (global_proxy_port));
-    proxy_username->setText (settings.string_value (global_proxy_user));
-    proxy_password->setText (settings.string_value (global_proxy_pass));
-    // Connect relevant signals for dis-/enabling some elements
-    connect (proxy_type, QOverload<int>::of (&QComboBox::currentIndexChanged),
-             this, &settings_dialog::proxy_items_update);
-    connect (use_proxy_server, &QCheckBox::toggled,
-             this, &settings_dialog::proxy_items_update);
-    // Check whehter line edits have to be enabled
-    proxy_items_update ();
+  // Proxy
+  bool use_proxy = settings.bool_value (global_use_proxy);
+  use_proxy_server->setChecked (use_proxy);
+  // Fill combo box and activate current one
+  QString proxy_type_string = settings.string_value (global_proxy_type);
+  proxy_type->addItems (global_proxy_all_types);
+  for (int i = 0; i < global_proxy_all_types.length (); i++)
+    {
+      if (proxy_type->itemText (i) == proxy_type_string)
+        {
+          proxy_type->setCurrentIndex (i);
+          break;
+        }
+    }
+  // Fill all line edits
+  proxy_host_name->setText (settings.string_value (global_proxy_host));
+  proxy_port->setText (settings.string_value (global_proxy_port));
+  proxy_username->setText (settings.string_value (global_proxy_user));
+  proxy_password->setText (settings.string_value (global_proxy_pass));
+  // Connect relevant signals for dis-/enabling some elements
+  connect (proxy_type, QOverload<int>::of (&QComboBox::currentIndexChanged),
+           this, &settings_dialog::proxy_items_update);
+  connect (use_proxy_server, &QCheckBox::toggled,
+           this, &settings_dialog::proxy_items_update);
+  // Check whehter line edits have to be enabled
+  proxy_items_update ();
 
-    // Workspace
-    read_workspace_colors ();
+  // Workspace
+  read_workspace_colors ();
 
-    // variable editor
-    varedit_columnWidth->setValue (settings.int_value (ve_column_width));
-    varedit_rowHeight->setValue (settings.int_value (ve_row_height));
+  // variable editor
+  varedit_columnWidth->setValue (settings.int_value (ve_column_width));
+  varedit_rowHeight->setValue (settings.int_value (ve_row_height));
 
-    varedit_font->setCurrentFont (QFont (settings.value (ve_font_name.settings_key (),
-                                                          settings.value (cs_font.settings_key (), default_font)).toString ()));
-    varedit_fontSize->setValue (settings.int_value (ve_font_size));
-    connect (varedit_useTerminalFont, &QCheckBox::toggled,
-             varedit_font, &QFontComboBox::setDisabled);
-    connect (varedit_useTerminalFont, &QCheckBox::toggled,
-             varedit_fontSize, &QSpinBox::setDisabled);
-    varedit_useTerminalFont->setChecked (settings.bool_value (ve_use_terminal_font));
-    varedit_font->setDisabled (varedit_useTerminalFont->isChecked ());
-    varedit_fontSize->setDisabled (varedit_useTerminalFont->isChecked ());
+  varedit_font->setCurrentFont (QFont (settings.value (ve_font_name.settings_key (),
+                                                        settings.value (cs_font.settings_key (), default_font)).toString ()));
+  varedit_fontSize->setValue (settings.int_value (ve_font_size));
+  connect (varedit_useTerminalFont, &QCheckBox::toggled,
+           varedit_font, &QFontComboBox::setDisabled);
+  connect (varedit_useTerminalFont, &QCheckBox::toggled,
+           varedit_fontSize, &QSpinBox::setDisabled);
+  varedit_useTerminalFont->setChecked (settings.bool_value (ve_use_terminal_font));
+  varedit_font->setDisabled (varedit_useTerminalFont->isChecked ());
+  varedit_fontSize->setDisabled (varedit_useTerminalFont->isChecked ());
 
-    varedit_alternate->setChecked (settings.bool_value (ve_alternate_rows));
+  varedit_alternate->setChecked (settings.bool_value (ve_alternate_rows));
 
-    // variable editor colors
-    read_varedit_colors ();
+  // variable editor colors
+  read_varedit_colors ();
 
-    // shortcuts
+  // shortcuts
 
-    cb_prevent_readline_conflicts->setChecked (settings.bool_value (sc_prevent_rl_conflicts));
-    cb_prevent_readline_conflicts_menu->setChecked (settings.bool_value (sc_prevent_rl_conflicts_menu));
+  cb_prevent_readline_conflicts->setChecked (settings.bool_value (sc_prevent_rl_conflicts));
+  cb_prevent_readline_conflicts_menu->setChecked (settings.bool_value (sc_prevent_rl_conflicts_menu));
 
-    // connect the buttons for import/export of the shortcut sets
-    // FIXME: Should there also be a button to discard changes?
+  // connect the buttons for import/export of the shortcut sets
+  // FIXME: Should there also be a button to discard changes?
 
-    connect (btn_import_shortcut_set, &QPushButton::clicked,
-             this, &settings_dialog::import_shortcut_set);
+  connect (btn_import_shortcut_set, &QPushButton::clicked,
+           this, &settings_dialog::import_shortcut_set);
 
-    connect (btn_export_shortcut_set, &QPushButton::clicked,
-             this, &settings_dialog::export_shortcut_set);
+  connect (btn_export_shortcut_set, &QPushButton::clicked,
+           this, &settings_dialog::export_shortcut_set);
 
-    connect (btn_default_shortcut_set, &QPushButton::clicked,
-             this, &settings_dialog::default_shortcut_set);
+  connect (btn_default_shortcut_set, &QPushButton::clicked,
+           this, &settings_dialog::default_shortcut_set);
 
 #if defined (HAVE_QSCINTILLA)
 
-    int mode = settings.int_value (ed_color_mode);
+  int mode = settings.int_value (ed_color_mode);
 
-    QCheckBox *cb_color_mode = new QCheckBox (tr (settings_color_modes.toStdString ().data ()),
-                                              group_box_editor_styles);
-    cb_color_mode->setToolTip (tr (settings_color_modes_tooltip.toStdString ().data ()));
-    cb_color_mode->setChecked (mode > 0);
-    cb_color_mode->setObjectName (ed_color_mode.settings_key ());
+  QCheckBox *cb_color_mode = new QCheckBox (tr (settings_color_modes.toStdString ().data ()),
+                                            group_box_editor_styles);
+  cb_color_mode->setToolTip (tr (settings_color_modes_tooltip.toStdString ().data ()));
+  cb_color_mode->setChecked (mode > 0);
+  cb_color_mode->setObjectName (ed_color_mode.settings_key ());
 
-    QPushButton *pb_reload_default_colors = new QPushButton (tr (settings_reload_styles.toStdString ().data ()));
-    pb_reload_default_colors->setToolTip (tr (settings_reload_styles_tooltip.toStdString ().data ()));
+  QPushButton *pb_reload_default_colors = new QPushButton (tr (settings_reload_styles.toStdString ().data ()));
+  pb_reload_default_colors->setToolTip (tr (settings_reload_styles_tooltip.toStdString ().data ()));
 
-    color_picker *current_line_color
-      = new color_picker
-      (settings.value (ed_highlight_current_line_color.settings_key ()
-                       + settings_color_modes_ext[mode],
-                       ed_highlight_current_line_color.def ()).value<QColor> (),
-       this);
-    current_line_color->setObjectName (ed_highlight_current_line_color.settings_key ());
+  color_picker *current_line_color
+    = new color_picker
+    (settings.value (ed_highlight_current_line_color.settings_key ()
+                     + settings_color_modes_ext[mode],
+                     ed_highlight_current_line_color.def ()).value<QColor> (),
+     this);
+  current_line_color->setObjectName (ed_highlight_current_line_color.settings_key ());
 
-    QLabel *current_line_color_label
-      = new QLabel(tr ("Color of highlighted current line (magenta (255,0,255) for automatic color)"));
+  QLabel *current_line_color_label
+    = new QLabel(tr ("Color of highlighted current line (magenta (255,0,255) for automatic color)"));
 
-    QHBoxLayout *color_mode = new QHBoxLayout ();
-    color_mode->addWidget (cb_color_mode);
-    color_mode->addItem (new QSpacerItem (5, 5, QSizePolicy::Expanding));
-    color_mode->addWidget (pb_reload_default_colors);
+  QHBoxLayout *color_mode = new QHBoxLayout ();
+  color_mode->addWidget (cb_color_mode);
+  color_mode->addItem (new QSpacerItem (5, 5, QSizePolicy::Expanding));
+  color_mode->addWidget (pb_reload_default_colors);
 
-    QHBoxLayout *current_line = new QHBoxLayout ();
-    current_line->addWidget (current_line_color_label);
-    current_line->addWidget (current_line_color);
-    current_line->addItem (new QSpacerItem (5, 5, QSizePolicy::Expanding));
+  QHBoxLayout *current_line = new QHBoxLayout ();
+  current_line->addWidget (current_line_color_label);
+  current_line->addWidget (current_line_color);
+  current_line->addItem (new QSpacerItem (5, 5, QSizePolicy::Expanding));
 
-    editor_styles_layout->addLayout (color_mode);
-    editor_styles_layout->addLayout (current_line);
+  editor_styles_layout->addLayout (color_mode);
+  editor_styles_layout->addLayout (current_line);
 
-    // update colors depending on second theme selection
-    connect (cb_color_mode, &QCheckBox::stateChanged,
-             this, &settings_dialog::update_editor_lexers);
-    connect (pb_reload_default_colors, &QPushButton::clicked,
-             [=] () { update_editor_lexers (settings_reload_default_colors_flag); });
+  // update colors depending on second theme selection
+  connect (cb_color_mode, &QCheckBox::stateChanged,
+           this, &settings_dialog::update_editor_lexers);
+  connect (pb_reload_default_colors, &QPushButton::clicked,
+           [=] () { update_editor_lexers (settings_reload_default_colors_flag); });
 
-    // finally read the lexer colors using the update slot
-    update_editor_lexers ();
+  // finally read the lexer colors using the update slot
+  update_editor_lexers ();
 
 #endif
 
-    // which tab is the desired one?
-    show_tab (desired_tab);
+  // which tab is the desired one?
+  show_tab (desired_tab);
 
-    // connect button box signal
-    connect (button_box, &QDialogButtonBox::clicked,
-             this, &settings_dialog::button_clicked);
+  // connect button box signal
+  connect (button_box, &QDialogButtonBox::clicked,
+           this, &settings_dialog::button_clicked);
 
-    // restore last geometry
-    if (settings.contains (sd_geometry.settings_key ()))
-      restoreGeometry (settings.byte_array_value (sd_geometry));
-    else
-      setGeometry (QRect (10, 50, 1000, 600));
-  }
+  // restore last geometry
+  if (settings.contains (sd_geometry.settings_key ()))
+    restoreGeometry (settings.byte_array_value (sd_geometry));
+  else
+    setGeometry (QRect (10, 50, 1000, 600));
+}
 
-  void settings_dialog::show_tab (const QString& tab)
-  {
-    gui_settings settings;
+void settings_dialog::show_tab (const QString& tab)
+{
+  gui_settings settings;
 
-    if (tab.isEmpty ())
-      tabWidget->setCurrentIndex (settings.int_value (sd_last_tab));
-    else
-      {
-        QHash <QString, QWidget *> tab_hash;
-        tab_hash["editor"] = tab_editor;
-        tab_hash["editor_styles"] = tab_editor;
-        tabWidget->setCurrentIndex (tabWidget->indexOf (tab_hash.value (tab)));
-        if (tab == "editor_styles")
-          tab_editor_scroll_area->ensureWidgetVisible (group_box_editor_styles);
-      }
-  }
+  if (tab.isEmpty ())
+    tabWidget->setCurrentIndex (settings.int_value (sd_last_tab));
+  else
+    {
+      QHash <QString, QWidget *> tab_hash;
+      tab_hash["editor"] = tab_editor;
+      tab_hash["editor_styles"] = tab_editor;
+      tabWidget->setCurrentIndex (tabWidget->indexOf (tab_hash.value (tab)));
+      if (tab == "editor_styles")
+        tab_editor_scroll_area->ensureWidgetVisible (group_box_editor_styles);
+    }
+}
 
-  void settings_dialog::get_octave_dir ()
-  {
-    get_dir (le_octave_dir, tr ("Set Octave Startup Directory"));
-  }
+void settings_dialog::get_octave_dir ()
+{
+  get_dir (le_octave_dir, tr ("Set Octave Startup Directory"));
+}
 
-  void settings_dialog::get_file_browser_dir ()
-  {
-    get_dir (le_file_browser_dir, tr ("Set File Browser Startup Directory"));
-  }
+void settings_dialog::get_file_browser_dir ()
+{
+  get_dir (le_file_browser_dir, tr ("Set File Browser Startup Directory"));
+}
 
-  void settings_dialog::get_dir (QLineEdit *line_edit, const QString& title)
-  {
-    // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
-    int opts = QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks;
+void settings_dialog::get_dir (QLineEdit *line_edit, const QString& title)
+{
+  // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
+  int opts = QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks;
 
-    gui_settings settings;
+  gui_settings settings;
 
-    if (! settings.bool_value (global_use_native_dialogs))
-      opts |= QFileDialog::DontUseNativeDialog;
+  if (! settings.bool_value (global_use_native_dialogs))
+    opts |= QFileDialog::DontUseNativeDialog;
 
-    QString dir = QFileDialog::getExistingDirectory
-      (this, title, line_edit->text (), QFileDialog::Option (opts));
+  QString dir = QFileDialog::getExistingDirectory
+    (this, title, line_edit->text (), QFileDialog::Option (opts));
 
-    line_edit->setText (dir);
-  }
+  line_edit->setText (dir);
+}
 
-  void settings_dialog::button_clicked (QAbstractButton *button)
-  {
-    QDialogButtonBox::ButtonRole button_role = button_box->buttonRole (button);
+void settings_dialog::button_clicked (QAbstractButton *button)
+{
+  QDialogButtonBox::ButtonRole button_role = button_box->buttonRole (button);
 
-    if (button_role == QDialogButtonBox::ApplyRole
-        || button_role == QDialogButtonBox::AcceptRole)
-      {
-        write_changed_settings ();
-        emit apply_new_settings ();
-      }
+  if (button_role == QDialogButtonBox::ApplyRole
+      || button_role == QDialogButtonBox::AcceptRole)
+    {
+      write_changed_settings ();
+      emit apply_new_settings ();
+    }
 
-    if (button_role == QDialogButtonBox::RejectRole
-        || button_role == QDialogButtonBox::AcceptRole)
-      {
-        // save last settings dialog's geometry and close
+  if (button_role == QDialogButtonBox::RejectRole
+      || button_role == QDialogButtonBox::AcceptRole)
+    {
+      // save last settings dialog's geometry and close
 
-        gui_settings settings;
+      gui_settings settings;
 
-        settings.setValue (sd_last_tab.settings_key (), tabWidget->currentIndex ());
-        settings.setValue (sd_geometry.settings_key (), saveGeometry ());
-        settings.sync ();
+      settings.setValue (sd_last_tab.settings_key (), tabWidget->currentIndex ());
+      settings.setValue (sd_geometry.settings_key (), saveGeometry ());
+      settings.sync ();
 
-        close ();
-      }
-  }
+      close ();
+    }
+}
 
-  void settings_dialog::set_disabled_pref_file_browser_dir (bool disable)
-  {
-    cb_restore_file_browser_dir->setDisabled (disable);
+void settings_dialog::set_disabled_pref_file_browser_dir (bool disable)
+{
+  cb_restore_file_browser_dir->setDisabled (disable);
 
-    if (! disable)
-      {
-        le_file_browser_dir->setDisabled (cb_restore_file_browser_dir->isChecked ());
-        pb_file_browser_dir->setDisabled (cb_restore_file_browser_dir->isChecked ());
-      }
-    else
-      {
-        le_file_browser_dir->setDisabled (disable);
-        pb_file_browser_dir->setDisabled (disable);
-      }
-  }
+  if (! disable)
+    {
+      le_file_browser_dir->setDisabled (cb_restore_file_browser_dir->isChecked ());
+      pb_file_browser_dir->setDisabled (cb_restore_file_browser_dir->isChecked ());
+    }
+  else
+    {
+      le_file_browser_dir->setDisabled (disable);
+      pb_file_browser_dir->setDisabled (disable);
+    }
+}
 
-  // slot for updating enabled state of proxy settings
-  void settings_dialog::proxy_items_update ()
-  {
-    bool use_proxy = use_proxy_server->isChecked ();
+// slot for updating enabled state of proxy settings
+void settings_dialog::proxy_items_update ()
+{
+  bool use_proxy = use_proxy_server->isChecked ();
 
-    bool manual = false;
-    for (int i = 0; i < global_proxy_manual_types.length (); i++)
-      {
-        if (proxy_type->currentIndex () == global_proxy_manual_types.at (i))
-          {
-            manual = true;
-            break;
-          }
-      }
+  bool manual = false;
+  for (int i = 0; i < global_proxy_manual_types.length (); i++)
+    {
+      if (proxy_type->currentIndex () == global_proxy_manual_types.at (i))
+        {
+          manual = true;
+          break;
+        }
+    }
 
-    proxy_type->setEnabled (use_proxy);
-    proxy_host_name_label->setEnabled (use_proxy && manual);
-    proxy_host_name->setEnabled (use_proxy && manual);
-    proxy_port_label->setEnabled (use_proxy && manual);
-    proxy_port->setEnabled (use_proxy && manual);
-    proxy_username_label->setEnabled (use_proxy && manual);
-    proxy_username->setEnabled (use_proxy && manual);
-    proxy_password_label->setEnabled (use_proxy && manual);
-    proxy_password->setEnabled (use_proxy && manual);
-  }
+  proxy_type->setEnabled (use_proxy);
+  proxy_host_name_label->setEnabled (use_proxy && manual);
+  proxy_host_name->setEnabled (use_proxy && manual);
+  proxy_port_label->setEnabled (use_proxy && manual);
+  proxy_port->setEnabled (use_proxy && manual);
+  proxy_username_label->setEnabled (use_proxy && manual);
+  proxy_username->setEnabled (use_proxy && manual);
+  proxy_password_label->setEnabled (use_proxy && manual);
+  proxy_password->setEnabled (use_proxy && manual);
+}
 
-  // slots for import/export of shortcut sets
+// slots for import/export of shortcut sets
 
-  // Prompt for file name and import shortcuts from it.  Importing will
-  // change values in tree view but does not apply values to
-  // gui_settings_object so that the user may choose to apply or cancel
-  // the action.
+// Prompt for file name and import shortcuts from it.  Importing will
+// change values in tree view but does not apply values to
+// gui_settings_object so that the user may choose to apply or cancel
+// the action.
 
-  void settings_dialog::import_shortcut_set ()
-  {
-    if (! overwrite_all_shortcuts ())
-      return;
+void settings_dialog::import_shortcut_set ()
+{
+  if (! overwrite_all_shortcuts ())
+    return;
 
-    QString file = get_shortcuts_file_name (OSC_IMPORT);
+  QString file = get_shortcuts_file_name (OSC_IMPORT);
 
-    gui_settings osc_settings (file, QSettings::IniFormat);
+  gui_settings osc_settings (file, QSettings::IniFormat);
 
-    if (osc_settings.status () ==  QSettings::NoError)
-      shortcuts_treewidget->import_shortcuts (osc_settings);
-    else
-      qWarning () << (tr ("Failed to open %1 as Octave shortcut file")
-                      .arg (file));
-  }
+  if (osc_settings.status () ==  QSettings::NoError)
+    shortcuts_treewidget->import_shortcuts (osc_settings);
+  else
+    qWarning () << (tr ("Failed to open %1 as Octave shortcut file")
+                    .arg (file));
+}
 
-  // Prompt for file name and export shortcuts to it.
+// Prompt for file name and export shortcuts to it.
 
-  // FIXME: Should exported settings values come from the gui_settings
-  // object or the tree view?  If modified values in the tree view have
-  // not been applied, should we offer to apply them first?  Offer a
-  // choice to save current application settings or the modified values
-  // in the dialog?
+// FIXME: Should exported settings values come from the gui_settings
+// object or the tree view?  If modified values in the tree view have
+// not been applied, should we offer to apply them first?  Offer a
+// choice to save current application settings or the modified values
+// in the dialog?
 
-  void settings_dialog::export_shortcut_set ()
-  {
-    QString file = get_shortcuts_file_name (OSC_EXPORT);
+void settings_dialog::export_shortcut_set ()
+{
+  QString file = get_shortcuts_file_name (OSC_EXPORT);
 
-    gui_settings osc_settings (file, QSettings::IniFormat);
+  gui_settings osc_settings (file, QSettings::IniFormat);
 
-    if (osc_settings.status () ==  QSettings::NoError)
-      shortcuts_treewidget->export_shortcuts (osc_settings);
-    else
-      qWarning () << (tr ("Failed to open %1 as Octave shortcut file")
-                      .arg (file));
-  }
+  if (osc_settings.status () ==  QSettings::NoError)
+    shortcuts_treewidget->export_shortcuts (osc_settings);
+  else
+    qWarning () << (tr ("Failed to open %1 as Octave shortcut file")
+                    .arg (file));
+}
 
-  // Reset the tree view to default values.  Does not apply values to
-  // gui_settings object so that the user may choose to apply or cancel
-  // the action.
+// Reset the tree view to default values.  Does not apply values to
+// gui_settings object so that the user may choose to apply or cancel
+// the action.
 
-  void settings_dialog::default_shortcut_set ()
-  {
-    if (! overwrite_all_shortcuts ())
-      return;
+void settings_dialog::default_shortcut_set ()
+{
+  if (! overwrite_all_shortcuts ())
+    return;
 
-    shortcuts_treewidget->set_default_shortcuts ();
-  }
+  shortcuts_treewidget->set_default_shortcuts ();
+}
 
-  void settings_dialog::update_editor_lexers (int def)
-  {
+void settings_dialog::update_editor_lexers (int def)
+{
 #if defined (HAVE_QSCINTILLA)
 
-    QCheckBox *cb_color_mode
-      = group_box_editor_styles->findChild <QCheckBox *> (ed_color_mode.settings_key ());
+  QCheckBox *cb_color_mode
+    = group_box_editor_styles->findChild <QCheckBox *> (ed_color_mode.settings_key ());
 
-    int m = 0;
-    if (cb_color_mode && cb_color_mode->isChecked ())
-      m = 1;
+  int m = 0;
+  if (cb_color_mode && cb_color_mode->isChecked ())
+    m = 1;
 
-    color_picker *c_picker = findChild <color_picker *> (ed_highlight_current_line_color.settings_key ());
-    if (c_picker)
-      {
-        gui_settings settings;
+  color_picker *c_picker = findChild <color_picker *> (ed_highlight_current_line_color.settings_key ());
+  if (c_picker)
+    {
+      gui_settings settings;
 
-        if (def != settings_reload_default_colors_flag)
-          {
-            // Get current value from settings or the default
-            c_picker->set_color (settings.color_value (ed_highlight_current_line_color, m));
-          }
-        else
-          {
-            // Get the default value
-            c_picker->set_color (settings.get_color_value (ed_highlight_current_line_color.def (), m));
-          }
-      }
+      if (def != settings_reload_default_colors_flag)
+        {
+          // Get current value from settings or the default
+          c_picker->set_color (settings.color_value (ed_highlight_current_line_color, m));
+        }
+      else
+        {
+          // Get the default value
+          c_picker->set_color (settings.get_color_value (ed_highlight_current_line_color.def (), m));
+        }
+    }
 
-    // editor styles: create lexer, read settings, and
-    // create or update dialog elements
-    QsciLexer *lexer;
+  // editor styles: create lexer, read settings, and
+  // create or update dialog elements
+  QsciLexer *lexer;
 
 #  if defined (HAVE_LEXER_OCTAVE)
-    lexer = new QsciLexerOctave ();
-    update_lexer (lexer, m, def);
-    delete lexer;
+  lexer = new QsciLexerOctave ();
+  update_lexer (lexer, m, def);
+  delete lexer;
 #  elif defined (HAVE_LEXER_MATLAB)
-    lexer = new QsciLexerMatlab ();
-    update_lexer (lexer, m, def);
-    delete lexer;
+  lexer = new QsciLexerMatlab ();
+  update_lexer (lexer, m, def);
+  delete lexer;
 #  endif
 
-    lexer = new QsciLexerCPP ();
-    update_lexer (lexer, m, def);
-    delete lexer;
+  lexer = new QsciLexerCPP ();
+  update_lexer (lexer, m, def);
+  delete lexer;
 
-    lexer = new QsciLexerJava ();
-    update_lexer (lexer, m, def);
-    delete lexer;
+  lexer = new QsciLexerJava ();
+  update_lexer (lexer, m, def);
+  delete lexer;
 
-    lexer = new QsciLexerPerl ();
-    update_lexer (lexer, m, def);
-    delete lexer;
+  lexer = new QsciLexerPerl ();
+  update_lexer (lexer, m, def);
+  delete lexer;
 
-    lexer = new QsciLexerBatch ();
-    update_lexer (lexer, m, def);
-    delete lexer;
+  lexer = new QsciLexerBatch ();
+  update_lexer (lexer, m, def);
+  delete lexer;
 
-    lexer = new QsciLexerDiff ();
-    update_lexer (lexer, m, def);
-    delete lexer;
+  lexer = new QsciLexerDiff ();
+  update_lexer (lexer, m, def);
+  delete lexer;
 
-    lexer = new QsciLexerBash ();
-    update_lexer (lexer, m, def);
-    delete lexer;
+  lexer = new QsciLexerBash ();
+  update_lexer (lexer, m, def);
+  delete lexer;
 
-    lexer = new octave_txt_lexer ();
-    update_lexer (lexer, m, def);
-    delete lexer;
+  lexer = new octave_txt_lexer ();
+  update_lexer (lexer, m, def);
+  delete lexer;
 
 #else
 
-    octave_unused_parameter (def);
+  octave_unused_parameter (def);
 
 #endif
-  }
+}
 
 #if defined (HAVE_QSCINTILLA)
 
-  void settings_dialog::update_lexer (QsciLexer *lexer, int mode, int def)
-  {
-    // Get lexer settings and copy from default settings if not yet
-    // available in normal settings file
-    gui_settings settings;
-    settings.read_lexer_settings (lexer, mode, def);
+void settings_dialog::update_lexer (QsciLexer *lexer, int mode, int def)
+{
+  // Get lexer settings and copy from default settings if not yet
+  // available in normal settings file
+  gui_settings settings;
+  settings.read_lexer_settings (lexer, mode, def);
 
-    // When reloading default styles, the style tabs do already exists.
-    // Otherwise, check if they exist or not.
-    QString lexer_name = lexer->language ();
+  // When reloading default styles, the style tabs do already exists.
+  // Otherwise, check if they exist or not.
+  QString lexer_name = lexer->language ();
 
-    int index = -1;
-    for (int i = 0; i < tabs_editor_lexers->count (); i++)
-      {
-        if (tabs_editor_lexers->tabText (i) == lexer_name)
-          {
-            index = i;
-            break;
-          }
-      }
+  int index = -1;
+  for (int i = 0; i < tabs_editor_lexers->count (); i++)
+    {
+      if (tabs_editor_lexers->tabText (i) == lexer_name)
+        {
+          index = i;
+          break;
+        }
+    }
 
-    if (index == -1)
-      {
-        // This is not an update, call get_lexer_settings for building
-        // the settings tab
-        get_lexer_settings (lexer);
-        return;
-      }
+  if (index == -1)
+    {
+      // This is not an update, call get_lexer_settings for building
+      // the settings tab
+      get_lexer_settings (lexer);
+      return;
+    }
 
-    // Update the styles elements in all styles
-    int styles[ed_max_lexer_styles];  // array for saving valid styles
-    int max_style = settings.get_valid_lexer_styles (lexer, styles);
-    QWidget *tab = tabs_editor_lexers->widget (index);
-    int default_size = 0;
-    QString default_family;
+  // Update the styles elements in all styles
+  int styles[ed_max_lexer_styles];  // array for saving valid styles
+  int max_style = settings.get_valid_lexer_styles (lexer, styles);
+  QWidget *tab = tabs_editor_lexers->widget (index);
+  int default_size = 0;
+  QString default_family;
 
-    for (int i = 0; i < max_style; i++)  // create dialog elements for all styles
-      {
-        QString actual_name = lexer->description (styles[i]);
-        color_picker *bg_color
-          = tab->findChild <color_picker *> (actual_name + "_bg_color");
-        if (bg_color)
-          {
-            // Update
-            if (styles[i] == 0)
-              bg_color->set_color (lexer->defaultPaper ());
-            else
-              {
-                if (lexer->paper (styles[i]) == lexer->defaultPaper ())
-                  bg_color->set_color (settings_color_no_change);
-                else
-                  bg_color->set_color (lexer->paper (styles[i]));
-              }
-          }
+  for (int i = 0; i < max_style; i++)  // create dialog elements for all styles
+    {
+      QString actual_name = lexer->description (styles[i]);
+      color_picker *bg_color
+        = tab->findChild <color_picker *> (actual_name + "_bg_color");
+      if (bg_color)
+        {
+          // Update
+          if (styles[i] == 0)
+            bg_color->set_color (lexer->defaultPaper ());
+          else
+            {
+              if (lexer->paper (styles[i]) == lexer->defaultPaper ())
+                bg_color->set_color (settings_color_no_change);
+              else
+                bg_color->set_color (lexer->paper (styles[i]));
+            }
+        }
 
-        color_picker *color = tab->findChild <color_picker *> (actual_name + "_color");
-        if (color)
-          color->set_color (lexer->color (styles[i]));
+      color_picker *color = tab->findChild <color_picker *> (actual_name + "_color");
+      if (color)
+        color->set_color (lexer->color (styles[i]));
 
-        QFont font = lexer->font (styles[i]);
+      QFont font = lexer->font (styles[i]);
 
-        QCheckBox *cb = tab->findChild <QCheckBox *> (actual_name + "_bold");
-        if (cb)
-          cb->setChecked (font.bold ());
-        cb = tab->findChild <QCheckBox *> (actual_name + "_italic");
-        if (cb)
-          cb->setChecked (font.italic ());
-        cb = tab->findChild <QCheckBox *> (actual_name + "_underline");
-        if (cb)
-          cb->setChecked (font.underline ());
+      QCheckBox *cb = tab->findChild <QCheckBox *> (actual_name + "_bold");
+      if (cb)
+        cb->setChecked (font.bold ());
+      cb = tab->findChild <QCheckBox *> (actual_name + "_italic");
+      if (cb)
+        cb->setChecked (font.italic ());
+      cb = tab->findChild <QCheckBox *> (actual_name + "_underline");
+      if (cb)
+        cb->setChecked (font.underline ());
 
-        QFontComboBox *fcb = tab->findChild <QFontComboBox *> (actual_name + "_font");
-        if (fcb)
-          {
-            if (styles[i] == 0)
-              {
-                default_family = font.family ();
-                fcb->setEditText (default_family);
-              }
-            else
-              {
-                if (font.family () == default_family)
-                  fcb->setEditText (lexer->description (0));
-                else
-                  fcb->setEditText (font.family ());
-              }
-          }
-        QSpinBox *fs = tab->findChild <QSpinBox *> (actual_name + "_size");
-        if (fs)
-          {
-            if (styles[i] == 0)
-              {
-                default_size = font.pointSize ();
-                fs->setValue (default_size);
-              }
-            else
-              fs->setValue (font.pointSize () - default_size);
-          }
-      }
+      QFontComboBox *fcb = tab->findChild <QFontComboBox *> (actual_name + "_font");
+      if (fcb)
+        {
+          if (styles[i] == 0)
+            {
+              default_family = font.family ();
+              fcb->setEditText (default_family);
+            }
+          else
+            {
+              if (font.family () == default_family)
+                fcb->setEditText (lexer->description (0));
+              else
+                fcb->setEditText (font.family ());
+            }
+        }
+      QSpinBox *fs = tab->findChild <QSpinBox *> (actual_name + "_size");
+      if (fs)
+        {
+          if (styles[i] == 0)
+            {
+              default_size = font.pointSize ();
+              fs->setValue (default_size);
+            }
+          else
+            fs->setValue (font.pointSize () - default_size);
+        }
+    }
 
-  }
+}
 
-  void settings_dialog::get_lexer_settings (QsciLexer *lexer)
-  {
-    gui_settings settings;
+void settings_dialog::get_lexer_settings (QsciLexer *lexer)
+{
+  gui_settings settings;
 
-    int styles[ed_max_lexer_styles];  // array for saving valid styles
-    // (enum is not continuous)
-    int max_style = settings.get_valid_lexer_styles (lexer, styles);
-    QGridLayout *style_grid = new QGridLayout ();
-    QVector<QLabel *> description (max_style);
-    QVector<QFontComboBox *> select_font (max_style);
-    QVector<QSpinBox *> font_size (max_style);
-    QVector<QCheckBox *> attrib_font (3 * max_style);
-    QVector<color_picker *> color (max_style);
-    QVector<color_picker *> bg_color (max_style);
-    int default_size = 10;
-    QFont default_font = QFont ();
-    int label_width;
-    QColor default_color = QColor ();
+  int styles[ed_max_lexer_styles];  // array for saving valid styles
+  // (enum is not continuous)
+  int max_style = settings.get_valid_lexer_styles (lexer, styles);
+  QGridLayout *style_grid = new QGridLayout ();
+  QVector<QLabel *> description (max_style);
+  QVector<QFontComboBox *> select_font (max_style);
+  QVector<QSpinBox *> font_size (max_style);
+  QVector<QCheckBox *> attrib_font (3 * max_style);
+  QVector<color_picker *> color (max_style);
+  QVector<color_picker *> bg_color (max_style);
+  int default_size = 10;
+  QFont default_font = QFont ();
+  int label_width;
+  QColor default_color = QColor ();
 
-    for (int i = 0; i < max_style; i++)  // create dialog elements for all styles
-      {
-        QString actual_name = lexer->description (styles[i]);
-        QFont   actual_font = lexer->font (styles[i]);
-        description[i] = new QLabel (actual_name);
-        description[i]->setWordWrap (true);
-        label_width = 24*description[i]->fontMetrics ().averageCharWidth ();
-        description[i]->setMaximumSize (label_width, QWIDGETSIZE_MAX);
-        description[i]->setMinimumSize (label_width, 1);
-        select_font[i] = new QFontComboBox ();
-        select_font[i]->setObjectName (actual_name + "_font");
-        select_font[i]->setMaximumSize (label_width, QWIDGETSIZE_MAX);
-        select_font[i]->setMinimumSize (label_width, 1);
-        font_size[i] = new QSpinBox ();
-        font_size[i]->setObjectName (actual_name + "_size");
-        if (styles[i] == 0) // the default
-          {
-            select_font[i]->setCurrentFont (actual_font);
-            default_font = actual_font;
-            font_size[i]->setRange (6, 24);
-            default_size = actual_font.pointSize ();
-            font_size[i]->setValue (default_size);
-            default_color = lexer->defaultPaper ();
-            bg_color[i] = new color_picker (default_color);
-          }
-        else   // other styles
-          {
-            select_font[i]->setCurrentFont (actual_font);
-            if (actual_font.family () == default_font.family ())
-              select_font[i]->setEditText (lexer->description (0));
-            font_size[i]->setRange (-4, 4);
-            font_size[i]->setValue (actual_font.pointSize ()-default_size);
-            font_size[i]->setToolTip (QObject::tr ("Difference to the default size"));
-            if (lexer->paper (styles[i]) == default_color)
-              bg_color[i] = new color_picker (settings_color_no_change);
-            else
-              bg_color[i] = new color_picker (lexer->paper (styles[i]));
-            bg_color[i]->setToolTip
-              (QObject::tr ("Background color, magenta (255, 0, 255) means default"));
-          }
-        attrib_font[0+3*i] = new QCheckBox (QObject::tr ("b", "short form for bold"));
-        attrib_font[1+3*i] = new QCheckBox (QObject::tr ("i", "short form for italic"));
-        attrib_font[2+3*i] = new QCheckBox (QObject::tr ("u", "short form for underlined"));
-        attrib_font[0+3*i]->setChecked (actual_font.bold ());
-        attrib_font[0+3*i]->setObjectName (actual_name + "_bold");
-        attrib_font[1+3*i]->setChecked (actual_font.italic ());
-        attrib_font[1+3*i]->setObjectName (actual_name + "_italic");
-        attrib_font[2+3*i]->setChecked (actual_font.underline ());
-        attrib_font[2+3*i]->setObjectName (actual_name + "_underline");
-        color[i] = new color_picker (lexer->color (styles[i]));
-        color[i]->setObjectName (actual_name + "_color");
-        bg_color[i]->setObjectName (actual_name + "_bg_color");
-        int column = 1;
-        style_grid->addWidget (description[i], i, column++);
-        style_grid->addWidget (select_font[i], i, column++);
-        style_grid->addWidget (font_size[i], i, column++);
-        style_grid->addWidget (attrib_font[0+3*i], i, column++);
-        style_grid->addWidget (attrib_font[1+3*i], i, column++);
-        style_grid->addWidget (attrib_font[2+3*i], i, column++);
-        style_grid->addWidget (color[i], i, column++);
-        style_grid->addWidget (bg_color[i], i, column++);
-      }
+  for (int i = 0; i < max_style; i++)  // create dialog elements for all styles
+    {
+      QString actual_name = lexer->description (styles[i]);
+      QFont   actual_font = lexer->font (styles[i]);
+      description[i] = new QLabel (actual_name);
+      description[i]->setWordWrap (true);
+      label_width = 24*description[i]->fontMetrics ().averageCharWidth ();
+      description[i]->setMaximumSize (label_width, QWIDGETSIZE_MAX);
+      description[i]->setMinimumSize (label_width, 1);
+      select_font[i] = new QFontComboBox ();
+      select_font[i]->setObjectName (actual_name + "_font");
+      select_font[i]->setMaximumSize (label_width, QWIDGETSIZE_MAX);
+      select_font[i]->setMinimumSize (label_width, 1);
+      font_size[i] = new QSpinBox ();
+      font_size[i]->setObjectName (actual_name + "_size");
+      if (styles[i] == 0) // the default
+        {
+          select_font[i]->setCurrentFont (actual_font);
+          default_font = actual_font;
+          font_size[i]->setRange (6, 24);
+          default_size = actual_font.pointSize ();
+          font_size[i]->setValue (default_size);
+          default_color = lexer->defaultPaper ();
+          bg_color[i] = new color_picker (default_color);
+        }
+      else   // other styles
+        {
+          select_font[i]->setCurrentFont (actual_font);
+          if (actual_font.family () == default_font.family ())
+            select_font[i]->setEditText (lexer->description (0));
+          font_size[i]->setRange (-4, 4);
+          font_size[i]->setValue (actual_font.pointSize ()-default_size);
+          font_size[i]->setToolTip (QObject::tr ("Difference to the default size"));
+          if (lexer->paper (styles[i]) == default_color)
+            bg_color[i] = new color_picker (settings_color_no_change);
+          else
+            bg_color[i] = new color_picker (lexer->paper (styles[i]));
+          bg_color[i]->setToolTip
+            (QObject::tr ("Background color, magenta (255, 0, 255) means default"));
+        }
+      attrib_font[0+3*i] = new QCheckBox (QObject::tr ("b", "short form for bold"));
+      attrib_font[1+3*i] = new QCheckBox (QObject::tr ("i", "short form for italic"));
+      attrib_font[2+3*i] = new QCheckBox (QObject::tr ("u", "short form for underlined"));
+      attrib_font[0+3*i]->setChecked (actual_font.bold ());
+      attrib_font[0+3*i]->setObjectName (actual_name + "_bold");
+      attrib_font[1+3*i]->setChecked (actual_font.italic ());
+      attrib_font[1+3*i]->setObjectName (actual_name + "_italic");
+      attrib_font[2+3*i]->setChecked (actual_font.underline ());
+      attrib_font[2+3*i]->setObjectName (actual_name + "_underline");
+      color[i] = new color_picker (lexer->color (styles[i]));
+      color[i]->setObjectName (actual_name + "_color");
+      bg_color[i]->setObjectName (actual_name + "_bg_color");
+      int column = 1;
+      style_grid->addWidget (description[i], i, column++);
+      style_grid->addWidget (select_font[i], i, column++);
+      style_grid->addWidget (font_size[i], i, column++);
+      style_grid->addWidget (attrib_font[0+3*i], i, column++);
+      style_grid->addWidget (attrib_font[1+3*i], i, column++);
+      style_grid->addWidget (attrib_font[2+3*i], i, column++);
+      style_grid->addWidget (color[i], i, column++);
+      style_grid->addWidget (bg_color[i], i, column++);
+    }
 
-    // place grid with elements into the tab
-    QScrollArea *scroll_area = new QScrollArea ();
-    QWidget *scroll_area_contents = new QWidget ();
-    scroll_area_contents->setObjectName (QString (lexer->language ()) + "_styles");
-    scroll_area_contents->setLayout (style_grid);
-    scroll_area->setWidget (scroll_area_contents);
-    tabs_editor_lexers->addTab (scroll_area, lexer->language ());
+  // place grid with elements into the tab
+  QScrollArea *scroll_area = new QScrollArea ();
+  QWidget *scroll_area_contents = new QWidget ();
+  scroll_area_contents->setObjectName (QString (lexer->language ()) + "_styles");
+  scroll_area_contents->setLayout (style_grid);
+  scroll_area->setWidget (scroll_area_contents);
+  tabs_editor_lexers->addTab (scroll_area, lexer->language ());
 
-    tabs_editor_lexers->setCurrentIndex (settings.int_value (sd_last_editor_styles_tab));
-  }
+  tabs_editor_lexers->setCurrentIndex (settings.int_value (sd_last_editor_styles_tab));
+}
 
-  void settings_dialog::write_lexer_settings (QsciLexer *lexer)
-  {
-    gui_settings settings;
+void settings_dialog::write_lexer_settings (QsciLexer *lexer)
+{
+  gui_settings settings;
 
-    QCheckBox *cb_color_mode
-      = group_box_editor_styles->findChild <QCheckBox *> (ed_color_mode.settings_key ());
-    int mode = 0;
-    if (cb_color_mode && cb_color_mode->isChecked ())
-      mode = 1;
+  QCheckBox *cb_color_mode
+    = group_box_editor_styles->findChild <QCheckBox *> (ed_color_mode.settings_key ());
+  int mode = 0;
+  if (cb_color_mode && cb_color_mode->isChecked ())
+    mode = 1;
 
-    settings.setValue (ed_color_mode.settings_key (), mode);
+  settings.setValue (ed_color_mode.settings_key (), mode);
 
-    QWidget *tab = tabs_editor_lexers->
-      findChild <QWidget *> (QString (lexer->language ()) + "_styles");
-    int styles[ed_max_lexer_styles];  // array for saving valid styles
-    // (enum is not continuous)
+  QWidget *tab = tabs_editor_lexers->
+    findChild <QWidget *> (QString (lexer->language ()) + "_styles");
+  int styles[ed_max_lexer_styles];  // array for saving valid styles
+  // (enum is not continuous)
 
-    int max_style = settings.get_valid_lexer_styles (lexer, styles);
+  int max_style = settings.get_valid_lexer_styles (lexer, styles);
 
-    QFontComboBox *select_font;
-    QSpinBox *font_size;
-    QCheckBox *attrib_font[3];
-    color_picker *color;
-    color_picker *bg_color;
-    int default_size = 10;
+  QFontComboBox *select_font;
+  QSpinBox *font_size;
+  QCheckBox *attrib_font[3];
+  color_picker *color;
+  color_picker *bg_color;
+  int default_size = 10;
 
-    color = findChild <color_picker *> (ed_highlight_current_line_color.settings_key ());
-    if (color)
-      settings.setValue (ed_highlight_current_line_color.settings_key ()
-                          + settings_color_modes_ext[mode], color->color ());
+  color = findChild <color_picker *> (ed_highlight_current_line_color.settings_key ());
+  if (color)
+    settings.setValue (ed_highlight_current_line_color.settings_key ()
+                        + settings_color_modes_ext[mode], color->color ());
 
-    QString default_font_name
-      = settings.string_value (global_mono_font);
-    QFont default_font = QFont (default_font_name, 10, -1, 0);
-    QColor default_color = QColor ();
+  QString default_font_name
+    = settings.string_value (global_mono_font);
+  QFont default_font = QFont (default_font_name, 10, -1, 0);
+  QColor default_color = QColor ();
 
-    for (int i = 0; i < max_style; i++)  // get dialog elements and their contents
-      {
-        QString actual_name = lexer->description (styles[i]);
-        select_font = tab->findChild <QFontComboBox *> (actual_name + "_font");
-        font_size = tab->findChild <QSpinBox *> (actual_name + "_size");
-        attrib_font[0] = tab->findChild <QCheckBox *> (actual_name + "_bold");
-        attrib_font[1] = tab->findChild <QCheckBox *> (actual_name + "_italic");
-        attrib_font[2] = tab->findChild <QCheckBox *> (actual_name + "_underline");
-        color = tab->findChild <color_picker *> (actual_name + "_color");
-        bg_color = tab->findChild <color_picker *> (actual_name + "_bg_color");
-        QFont new_font = default_font;
-        if (select_font)
-          {
-            new_font = select_font->currentFont ();
-            if (styles[i] == 0)
-              default_font = new_font;
-            else if (select_font->currentText () == lexer->description (0))
-              new_font = default_font;
-          }
-        if (font_size)
-          {
-            if (styles[i] == 0)
-              {
-                default_size = font_size->value ();
-                new_font.setPointSize (font_size->value ());
-              }
-            else
-              new_font.setPointSize (font_size->value ()+default_size);
-          }
-        if (attrib_font[0])
-          new_font.setBold (attrib_font[0]->isChecked ());
-        if (attrib_font[1])
-          new_font.setItalic (attrib_font[1]->isChecked ());
-        if (attrib_font[2])
-          new_font.setUnderline (attrib_font[2]->isChecked ());
-        lexer->setFont (new_font, styles[i]);
-        if (styles[i] == 0)
-          lexer->setDefaultFont (new_font);
-        if (color)
-          lexer->setColor (color->color (), styles[i]);
-        if (bg_color)
-          {
-            if (styles[i] == 0)
-              {
-                default_color = bg_color->color ();
+  for (int i = 0; i < max_style; i++)  // get dialog elements and their contents
+    {
+      QString actual_name = lexer->description (styles[i]);
+      select_font = tab->findChild <QFontComboBox *> (actual_name + "_font");
+      font_size = tab->findChild <QSpinBox *> (actual_name + "_size");
+      attrib_font[0] = tab->findChild <QCheckBox *> (actual_name + "_bold");
+      attrib_font[1] = tab->findChild <QCheckBox *> (actual_name + "_italic");
+      attrib_font[2] = tab->findChild <QCheckBox *> (actual_name + "_underline");
+      color = tab->findChild <color_picker *> (actual_name + "_color");
+      bg_color = tab->findChild <color_picker *> (actual_name + "_bg_color");
+      QFont new_font = default_font;
+      if (select_font)
+        {
+          new_font = select_font->currentFont ();
+          if (styles[i] == 0)
+            default_font = new_font;
+          else if (select_font->currentText () == lexer->description (0))
+            new_font = default_font;
+        }
+      if (font_size)
+        {
+          if (styles[i] == 0)
+            {
+              default_size = font_size->value ();
+              new_font.setPointSize (font_size->value ());
+            }
+          else
+            new_font.setPointSize (font_size->value ()+default_size);
+        }
+      if (attrib_font[0])
+        new_font.setBold (attrib_font[0]->isChecked ());
+      if (attrib_font[1])
+        new_font.setItalic (attrib_font[1]->isChecked ());
+      if (attrib_font[2])
+        new_font.setUnderline (attrib_font[2]->isChecked ());
+      lexer->setFont (new_font, styles[i]);
+      if (styles[i] == 0)
+        lexer->setDefaultFont (new_font);
+      if (color)
+        lexer->setColor (color->color (), styles[i]);
+      if (bg_color)
+        {
+          if (styles[i] == 0)
+            {
+              default_color = bg_color->color ();
+              lexer->setPaper (default_color, styles[i]);
+              lexer->setDefaultPaper (default_color);
+            }
+          else
+            {
+              if (bg_color->color () == settings_color_no_change)
                 lexer->setPaper (default_color, styles[i]);
-                lexer->setDefaultPaper (default_color);
-              }
-            else
-              {
-                if (bg_color->color () == settings_color_no_change)
-                  lexer->setPaper (default_color, styles[i]);
-                else
-                  lexer->setPaper (bg_color->color (), styles[i]);
-              }
-          }
-      }
+              else
+                lexer->setPaper (bg_color->color (), styles[i]);
+            }
+        }
+    }
 
-    const std::string group =
-      QString ("Scintilla" + settings_color_modes_ext[mode]).toStdString ();
+  const std::string group =
+    QString ("Scintilla" + settings_color_modes_ext[mode]).toStdString ();
 
-    lexer->writeSettings (settings, group.c_str ());
+  lexer->writeSettings (settings, group.c_str ());
 
-    settings.setValue (sd_last_editor_styles_tab.settings_key (),
-                       tabs_editor_lexers->currentIndex ());
-    settings.sync ();
-  }
+  settings.setValue (sd_last_editor_styles_tab.settings_key (),
+                     tabs_editor_lexers->currentIndex ());
+  settings.sync ();
+}
 
 #endif
 
-  void settings_dialog::write_changed_settings ()
-  {
-    gui_settings settings;
+void settings_dialog::write_changed_settings ()
+{
+  gui_settings settings;
 
-    // the icon set
-    QString widget_icon_set = "NONE";
-    if (general_icon_letter->isChecked ())
-      widget_icon_set = "LETTER";
-    else if (general_icon_graphic->isChecked ())
-      widget_icon_set = "GRAPHIC";
-    settings.setValue (dw_icon_set.settings_key (), widget_icon_set);
+  // the icon set
+  QString widget_icon_set = "NONE";
+  if (general_icon_letter->isChecked ())
+    widget_icon_set = "LETTER";
+  else if (general_icon_graphic->isChecked ())
+    widget_icon_set = "GRAPHIC";
+  settings.setValue (dw_icon_set.settings_key (), widget_icon_set);
 
-    // language
-    QString language = comboBox_language->currentText ();
-    if (language == tr ("System setting"))
-      language = global_language.def ().toString ();
-    settings.setValue (global_language.settings_key (), language);
+  // language
+  QString language = comboBox_language->currentText ();
+  if (language == tr ("System setting"))
+    language = global_language.def ().toString ();
+  settings.setValue (global_language.settings_key (), language);
 
-    // style
-    QString selected_style = combo_styles->currentText ();
-    if (selected_style == global_style.def ().toString ())
-      selected_style = global_style.def ().toString ();
-    settings.setValue (global_style.settings_key (), selected_style);
+  // style
+  QString selected_style = combo_styles->currentText ();
+  if (selected_style == global_style.def ().toString ())
+    selected_style = global_style.def ().toString ();
+  settings.setValue (global_style.settings_key (), selected_style);
 
-    // dock widget title bar
-    settings.setValue (dw_title_custom_style.settings_key (), cb_widget_custom_style->isChecked ());
-    settings.setValue (dw_title_3d.settings_key (), sb_3d_title->value ());
-    settings.setValue (dw_title_bg_color.settings_key (), m_widget_title_bg_color->color ());
-    settings.setValue (dw_title_bg_color_active.settings_key (), m_widget_title_bg_color_active->color ());
-    settings.setValue (dw_title_fg_color.settings_key (), m_widget_title_fg_color->color ());
-    settings.setValue (dw_title_fg_color_active.settings_key (), m_widget_title_fg_color_active->color ());
+  // dock widget title bar
+  settings.setValue (dw_title_custom_style.settings_key (), cb_widget_custom_style->isChecked ());
+  settings.setValue (dw_title_3d.settings_key (), sb_3d_title->value ());
+  settings.setValue (dw_title_bg_color.settings_key (), m_widget_title_bg_color->color ());
+  settings.setValue (dw_title_bg_color_active.settings_key (), m_widget_title_bg_color_active->color ());
+  settings.setValue (dw_title_fg_color.settings_key (), m_widget_title_fg_color->color ());
+  settings.setValue (dw_title_fg_color_active.settings_key (), m_widget_title_fg_color_active->color ());
 
-    // icon size and theme
-    int icon_size = icon_size_large->isChecked () - icon_size_small->isChecked ();
-    settings.setValue (global_icon_size.settings_key (), icon_size);
-    settings.setValue (global_icon_theme_index.settings_key (), combo_box_icon_theme->currentIndex ());
+  // icon size and theme
+  int icon_size = icon_size_large->isChecked () - icon_size_small->isChecked ();
+  settings.setValue (global_icon_size.settings_key (), icon_size);
+  settings.setValue (global_icon_theme_index.settings_key (), combo_box_icon_theme->currentIndex ());
 
-    // native file dialogs
-    settings.setValue (global_use_native_dialogs.settings_key (), cb_use_native_file_dialogs->isChecked ());
+  // native file dialogs
+  settings.setValue (global_use_native_dialogs.settings_key (), cb_use_native_file_dialogs->isChecked ());
 
-    // cursor blinking
-    settings.setValue (global_cursor_blinking.settings_key (), cb_cursor_blinking->isChecked ());
+  // cursor blinking
+  settings.setValue (global_cursor_blinking.settings_key (), cb_cursor_blinking->isChecked ());
 
-    // focus follows mouse
-    settings.setValue (dw_focus_follows_mouse.settings_key (), cb_focus_follows_mouse->isChecked ());
+  // focus follows mouse
+  settings.setValue (dw_focus_follows_mouse.settings_key (), cb_focus_follows_mouse->isChecked ());
 
-    // promp to exit
-    settings.setValue (global_prompt_to_exit.settings_key (), cb_prompt_to_exit->isChecked ());
+  // promp to exit
+  settings.setValue (global_prompt_to_exit.settings_key (), cb_prompt_to_exit->isChecked ());
 
-    // status bar
-    settings.setValue (global_status_bar.settings_key (), cb_status_bar->isChecked ());
+  // status bar
+  settings.setValue (global_status_bar.settings_key (), cb_status_bar->isChecked ());
 
-    // Octave startup
-    settings.setValue (global_restore_ov_dir.settings_key (), cb_restore_octave_dir->isChecked ());
-    settings.setValue (global_ov_startup_dir.settings_key (), le_octave_dir->text ());
+  // Octave startup
+  settings.setValue (global_restore_ov_dir.settings_key (), cb_restore_octave_dir->isChecked ());
+  settings.setValue (global_ov_startup_dir.settings_key (), le_octave_dir->text ());
 
-    //editor
-    settings.setValue (global_use_custom_editor.settings_key (), useCustomFileEditor->isChecked ());
-    settings.setValue (global_custom_editor.settings_key (), customFileEditor->text ());
-    settings.setValue (ed_show_line_numbers.settings_key (), editor_showLineNumbers->isChecked ());
-    settings.setValue (ed_line_numbers_size.settings_key (), editor_linenr_size->value ());
-    settings.setValue (ed_highlight_current_line.settings_key (), editor_highlightCurrentLine->isChecked ());
-    settings.setValue (ed_long_line_marker.settings_key (), editor_long_line_marker->isChecked ());
-    settings.setValue (ed_long_line_marker_line.settings_key (), editor_long_line_marker_line->isChecked ());
-    settings.setValue (ed_long_line_marker_background.settings_key (), editor_long_line_marker_background->isChecked ());
-    settings.setValue (ed_long_line_column.settings_key (), editor_long_line_column->value ());
-    settings.setValue (ed_break_lines.settings_key (), editor_break_checkbox->isChecked ());
-    settings.setValue (ed_break_lines_comments.settings_key (), editor_break_comments_checkbox->isChecked ());
-    settings.setValue (ed_wrap_lines.settings_key (), editor_wrap_checkbox->isChecked ());
-    settings.setValue (ed_code_folding.settings_key (), cb_code_folding->isChecked ());
-    settings.setValue (ed_show_edit_status_bar.settings_key (), cb_edit_status_bar->isChecked ());
-    settings.setValue (ed_show_toolbar.settings_key (), cb_edit_tool_bar->isChecked ());
-    settings.setValue (ed_highlight_all_occurrences.settings_key (), editor_highlight_all_occurrences->isChecked ());
-    settings.setValue (ed_code_completion.settings_key (), editor_codeCompletion->isChecked ());
-    settings.setValue (ed_code_completion_threshold.settings_key (), editor_spinbox_ac_threshold->value ());
-    settings.setValue (ed_code_completion_keywords.settings_key (), editor_checkbox_ac_keywords->isChecked ());
-    settings.setValue (ed_code_completion_octave_builtins.settings_key (), editor_checkbox_ac_builtins->isChecked ());
-    settings.setValue (ed_code_completion_octave_functions.settings_key (), editor_checkbox_ac_functions->isChecked ());
-    settings.setValue (ed_code_completion_document.settings_key (), editor_checkbox_ac_document->isChecked ());
-    settings.setValue (ed_code_completion_case.settings_key (), editor_checkbox_ac_case->isChecked ());
-    settings.setValue (ed_code_completion_replace.settings_key (), editor_checkbox_ac_replace->isChecked ());
-    settings.setValue (ed_auto_endif.settings_key (), editor_auto_endif->currentIndex ());
-    settings.setValue (ed_show_white_space.settings_key (), editor_ws_checkbox->isChecked ());
-    settings.setValue (ed_show_white_space_indent.settings_key (), editor_ws_indent_checkbox->isChecked ());
-    settings.setValue (ed_show_eol_chars.settings_key (), cb_show_eol->isChecked ());
-    settings.setValue (ed_show_hscroll_bar.settings_key (), cb_show_hscrollbar->isChecked ());
-    settings.setValue (ed_default_eol_mode.settings_key (), combo_eol_mode->currentIndex ());
+  //editor
+  settings.setValue (global_use_custom_editor.settings_key (), useCustomFileEditor->isChecked ());
+  settings.setValue (global_custom_editor.settings_key (), customFileEditor->text ());
+  settings.setValue (ed_show_line_numbers.settings_key (), editor_showLineNumbers->isChecked ());
+  settings.setValue (ed_line_numbers_size.settings_key (), editor_linenr_size->value ());
+  settings.setValue (ed_highlight_current_line.settings_key (), editor_highlightCurrentLine->isChecked ());
+  settings.setValue (ed_long_line_marker.settings_key (), editor_long_line_marker->isChecked ());
+  settings.setValue (ed_long_line_marker_line.settings_key (), editor_long_line_marker_line->isChecked ());
+  settings.setValue (ed_long_line_marker_background.settings_key (), editor_long_line_marker_background->isChecked ());
+  settings.setValue (ed_long_line_column.settings_key (), editor_long_line_column->value ());
+  settings.setValue (ed_break_lines.settings_key (), editor_break_checkbox->isChecked ());
+  settings.setValue (ed_break_lines_comments.settings_key (), editor_break_comments_checkbox->isChecked ());
+  settings.setValue (ed_wrap_lines.settings_key (), editor_wrap_checkbox->isChecked ());
+  settings.setValue (ed_code_folding.settings_key (), cb_code_folding->isChecked ());
+  settings.setValue (ed_show_edit_status_bar.settings_key (), cb_edit_status_bar->isChecked ());
+  settings.setValue (ed_show_toolbar.settings_key (), cb_edit_tool_bar->isChecked ());
+  settings.setValue (ed_highlight_all_occurrences.settings_key (), editor_highlight_all_occurrences->isChecked ());
+  settings.setValue (ed_code_completion.settings_key (), editor_codeCompletion->isChecked ());
+  settings.setValue (ed_code_completion_threshold.settings_key (), editor_spinbox_ac_threshold->value ());
+  settings.setValue (ed_code_completion_keywords.settings_key (), editor_checkbox_ac_keywords->isChecked ());
+  settings.setValue (ed_code_completion_octave_builtins.settings_key (), editor_checkbox_ac_builtins->isChecked ());
+  settings.setValue (ed_code_completion_octave_functions.settings_key (), editor_checkbox_ac_functions->isChecked ());
+  settings.setValue (ed_code_completion_document.settings_key (), editor_checkbox_ac_document->isChecked ());
+  settings.setValue (ed_code_completion_case.settings_key (), editor_checkbox_ac_case->isChecked ());
+  settings.setValue (ed_code_completion_replace.settings_key (), editor_checkbox_ac_replace->isChecked ());
+  settings.setValue (ed_auto_endif.settings_key (), editor_auto_endif->currentIndex ());
+  settings.setValue (ed_show_white_space.settings_key (), editor_ws_checkbox->isChecked ());
+  settings.setValue (ed_show_white_space_indent.settings_key (), editor_ws_indent_checkbox->isChecked ());
+  settings.setValue (ed_show_eol_chars.settings_key (), cb_show_eol->isChecked ());
+  settings.setValue (ed_show_hscroll_bar.settings_key (), cb_show_hscrollbar->isChecked ());
+  settings.setValue (ed_default_eol_mode.settings_key (), combo_eol_mode->currentIndex ());
 
-    settings.setValue (ed_tab_position.settings_key (), editor_combox_tab_pos->currentIndex ());
-    settings.setValue (ed_tabs_rotated.settings_key (), editor_cb_tabs_rotated->isChecked ());
-    settings.setValue (ed_tabs_max_width.settings_key (), editor_sb_tabs_max_width->value ());
+  settings.setValue (ed_tab_position.settings_key (), editor_combox_tab_pos->currentIndex ());
+  settings.setValue (ed_tabs_rotated.settings_key (), editor_cb_tabs_rotated->isChecked ());
+  settings.setValue (ed_tabs_max_width.settings_key (), editor_sb_tabs_max_width->value ());
 
-    // Comment strings
-    int rb_uncomment = 0;
-    for (int i = 0; i < ed_comment_strings_count; i++)
-      {
-        if (m_rb_comment_strings[i]->isChecked ())
-          {
-            settings.setValue (ed_comment_str.settings_key (), i);
-            if (i < 3)
-              settings.setValue (ed_comment_str_old.settings_key (), i);
-            else
-              settings.setValue (ed_comment_str_old.settings_key (), ed_comment_str.def ());
-          }
-        if (m_rb_uncomment_strings[i]->isChecked ())
-          rb_uncomment = rb_uncomment + (1 << i);
-      }
-    settings.setValue (ed_uncomment_str.settings_key (), rb_uncomment);
+  // Comment strings
+  int rb_uncomment = 0;
+  for (int i = 0; i < ed_comment_strings_count; i++)
+    {
+      if (m_rb_comment_strings[i]->isChecked ())
+        {
+          settings.setValue (ed_comment_str.settings_key (), i);
+          if (i < 3)
+            settings.setValue (ed_comment_str_old.settings_key (), i);
+          else
+            settings.setValue (ed_comment_str_old.settings_key (), ed_comment_str.def ());
+        }
+      if (m_rb_uncomment_strings[i]->isChecked ())
+        rb_uncomment = rb_uncomment + (1 << i);
+    }
+  settings.setValue (ed_uncomment_str.settings_key (), rb_uncomment);
 
-    settings.setValue (ed_default_enc.settings_key (), editor_combo_encoding->currentText ());
-    settings.setValue (ed_auto_indent.settings_key (), editor_auto_ind_checkbox->isChecked ());
-    settings.setValue (ed_tab_indents_line.settings_key (), editor_tab_ind_checkbox->isChecked ());
-    settings.setValue (ed_backspace_unindents_line.settings_key (), editor_bs_unind_checkbox->isChecked ());
-    settings.setValue (ed_show_indent_guides.settings_key (), editor_ind_guides_checkbox->isChecked ());
-    settings.setValue (ed_indent_width.settings_key (), editor_ind_width_spinbox->value ());
-    settings.setValue (ed_indent_uses_tabs.settings_key (), editor_ind_uses_tabs_checkbox->isChecked ());
-    settings.setValue (ed_tab_width.settings_key (), editor_tab_width_spinbox->value ());
-    settings.setValue (ed_restore_session.settings_key (), editor_restoreSession->isChecked ());
-    settings.setValue (ed_create_new_file.settings_key (), editor_create_new_file->isChecked ());
-    settings.setValue (ed_hiding_closes_files.settings_key (), editor_hiding_closes_files->isChecked ());
-    settings.setValue (ed_always_reload_changed_files.settings_key (), editor_reload_changed_files->isChecked ());
-    settings.setValue (ed_force_newline.settings_key (), editor_force_newline->isChecked ());
-    settings.setValue (ed_rm_trailing_spaces.settings_key (), editor_remove_trailing_spaces->isChecked ());
-    settings.setValue (ed_show_dbg_file.settings_key (), editor_show_dbg_file->isChecked ());
+  settings.setValue (ed_default_enc.settings_key (), editor_combo_encoding->currentText ());
+  settings.setValue (ed_auto_indent.settings_key (), editor_auto_ind_checkbox->isChecked ());
+  settings.setValue (ed_tab_indents_line.settings_key (), editor_tab_ind_checkbox->isChecked ());
+  settings.setValue (ed_backspace_unindents_line.settings_key (), editor_bs_unind_checkbox->isChecked ());
+  settings.setValue (ed_show_indent_guides.settings_key (), editor_ind_guides_checkbox->isChecked ());
+  settings.setValue (ed_indent_width.settings_key (), editor_ind_width_spinbox->value ());
+  settings.setValue (ed_indent_uses_tabs.settings_key (), editor_ind_uses_tabs_checkbox->isChecked ());
+  settings.setValue (ed_tab_width.settings_key (), editor_tab_width_spinbox->value ());
+  settings.setValue (ed_restore_session.settings_key (), editor_restoreSession->isChecked ());
+  settings.setValue (ed_create_new_file.settings_key (), editor_create_new_file->isChecked ());
+  settings.setValue (ed_hiding_closes_files.settings_key (), editor_hiding_closes_files->isChecked ());
+  settings.setValue (ed_always_reload_changed_files.settings_key (), editor_reload_changed_files->isChecked ());
+  settings.setValue (ed_force_newline.settings_key (), editor_force_newline->isChecked ());
+  settings.setValue (ed_rm_trailing_spaces.settings_key (), editor_remove_trailing_spaces->isChecked ());
+  settings.setValue (ed_show_dbg_file.settings_key (), editor_show_dbg_file->isChecked ());
 
-    // file browser
-    settings.setValue (fb_sync_octdir.settings_key (), sync_octave_directory->isChecked ());
-    settings.setValue (fb_restore_last_dir.settings_key (), cb_restore_file_browser_dir->isChecked ());
-    settings.setValue (fb_startup_dir.settings_key (), le_file_browser_dir->text ());
-    settings.setValue (fb_txt_file_ext.settings_key (), le_file_browser_extensions->text ());
+  // file browser
+  settings.setValue (fb_sync_octdir.settings_key (), sync_octave_directory->isChecked ());
+  settings.setValue (fb_restore_last_dir.settings_key (), cb_restore_file_browser_dir->isChecked ());
+  settings.setValue (fb_startup_dir.settings_key (), le_file_browser_dir->text ());
+  settings.setValue (fb_txt_file_ext.settings_key (), le_file_browser_extensions->text ());
 
-    // network
-    settings.setValue (nr_allow_connection.settings_key (), checkbox_allow_web_connect->isChecked ());
-    settings.setValue (global_use_proxy.settings_key (), use_proxy_server->isChecked ());
-    settings.setValue (global_proxy_type.settings_key (), proxy_type->currentText ());
-    settings.setValue (global_proxy_host.settings_key (), proxy_host_name->text ());
-    settings.setValue (global_proxy_port.settings_key (), proxy_port->text ());
-    settings.setValue (global_proxy_user.settings_key (), proxy_username->text ());
-    settings.setValue (global_proxy_pass.settings_key (), proxy_password->text ());
+  // network
+  settings.setValue (nr_allow_connection.settings_key (), checkbox_allow_web_connect->isChecked ());
+  settings.setValue (global_use_proxy.settings_key (), use_proxy_server->isChecked ());
+  settings.setValue (global_proxy_type.settings_key (), proxy_type->currentText ());
+  settings.setValue (global_proxy_host.settings_key (), proxy_host_name->text ());
+  settings.setValue (global_proxy_port.settings_key (), proxy_port->text ());
+  settings.setValue (global_proxy_user.settings_key (), proxy_username->text ());
+  settings.setValue (global_proxy_pass.settings_key (), proxy_password->text ());
 
-    // command window
-    settings.setValue (cs_font_size.settings_key (), terminal_fontSize->value ());
-    settings.setValue (cs_font.settings_key (), terminal_fontName->currentFont ().family ());
-    settings.setValue (cs_cursor_use_fgcol.settings_key (), terminal_cursorUseForegroundColor->isChecked ());
-    settings.setValue (cs_focus_cmd.settings_key (), terminal_focus_command->isChecked ());
-    settings.setValue (cs_dbg_location.settings_key (), terminal_print_dbg_location->isChecked ());
-    settings.setValue (cs_hist_buffer.settings_key (), terminal_history_buffer->value ());
-    write_terminal_colors ();
+  // command window
+  settings.setValue (cs_font_size.settings_key (), terminal_fontSize->value ());
+  settings.setValue (cs_font.settings_key (), terminal_fontName->currentFont ().family ());
+  settings.setValue (cs_cursor_use_fgcol.settings_key (), terminal_cursorUseForegroundColor->isChecked ());
+  settings.setValue (cs_focus_cmd.settings_key (), terminal_focus_command->isChecked ());
+  settings.setValue (cs_dbg_location.settings_key (), terminal_print_dbg_location->isChecked ());
+  settings.setValue (cs_hist_buffer.settings_key (), terminal_history_buffer->value ());
+  write_terminal_colors ();
 
-    // the cursor
-    QString cursor_type;
-    unsigned int cursor_int = terminal_cursorType->currentIndex ();
-    if ((cursor_int > 0) && (cursor_int < cs_cursor_types.size ()))
-      cursor_type = QString (cs_cursor_types[cursor_int].data ());
-    else
-      cursor_type = cs_cursor.def ().toString ();
+  // the cursor
+  QString cursor_type;
+  unsigned int cursor_int = terminal_cursorType->currentIndex ();
+  if ((cursor_int > 0) && (cursor_int < cs_cursor_types.size ()))
+    cursor_type = QString (cs_cursor_types[cursor_int].data ());
+  else
+    cursor_type = cs_cursor.def ().toString ();
 
-    settings.setValue (cs_cursor.settings_key (), cursor_type);
+  settings.setValue (cs_cursor.settings_key (), cursor_type);
 
 #if defined (HAVE_QSCINTILLA)
-    // editor styles: create lexer, get dialog contents, and write settings
-    QsciLexer *lexer;
+  // editor styles: create lexer, get dialog contents, and write settings
+  QsciLexer *lexer;
 
 #if defined (HAVE_LEXER_OCTAVE)
 
-    lexer = new QsciLexerOctave ();
-    write_lexer_settings (lexer);
-    delete lexer;
+  lexer = new QsciLexerOctave ();
+  write_lexer_settings (lexer);
+  delete lexer;
 
 #elif defined (HAVE_LEXER_MATLAB)
 
-    lexer = new QsciLexerMatlab ();
-    write_lexer_settings (lexer);
-    delete lexer;
+  lexer = new QsciLexerMatlab ();
+  write_lexer_settings (lexer);
+  delete lexer;
 
 #endif
 
-    lexer = new QsciLexerCPP ();
-    write_lexer_settings (lexer);
-    delete lexer;
+  lexer = new QsciLexerCPP ();
+  write_lexer_settings (lexer);
+  delete lexer;
 
-    lexer = new QsciLexerJava ();
-    write_lexer_settings (lexer);
-    delete lexer;
+  lexer = new QsciLexerJava ();
+  write_lexer_settings (lexer);
+  delete lexer;
 
-    lexer = new QsciLexerPerl ();
-    write_lexer_settings (lexer);
-    delete lexer;
+  lexer = new QsciLexerPerl ();
+  write_lexer_settings (lexer);
+  delete lexer;
 
-    lexer = new QsciLexerBatch ();
-    write_lexer_settings (lexer);
-    delete lexer;
+  lexer = new QsciLexerBatch ();
+  write_lexer_settings (lexer);
+  delete lexer;
 
-    lexer = new QsciLexerDiff ();
-    write_lexer_settings (lexer);
-    delete lexer;
+  lexer = new QsciLexerDiff ();
+  write_lexer_settings (lexer);
+  delete lexer;
 
-    lexer = new QsciLexerBash ();
-    write_lexer_settings (lexer);
-    delete lexer;
+  lexer = new QsciLexerBash ();
+  write_lexer_settings (lexer);
+  delete lexer;
 
-    lexer = new octave_txt_lexer ();
-    write_lexer_settings (lexer);
-    delete lexer;
+  lexer = new octave_txt_lexer ();
+  write_lexer_settings (lexer);
+  delete lexer;
 
 #endif
 
-    // Workspace
-    write_workspace_colors ();
+  // Workspace
+  write_workspace_colors ();
 
-    // Variable editor
-    settings.setValue (ve_column_width.settings_key (), varedit_columnWidth->value ());
-    settings.setValue (ve_row_height.settings_key (), varedit_rowHeight->value ());
-    settings.setValue (ve_use_terminal_font.settings_key (), varedit_useTerminalFont->isChecked ());
-    settings.setValue (ve_alternate_rows.settings_key (), varedit_alternate->isChecked ());
-    settings.setValue (ve_font_name.settings_key (), varedit_font->currentFont ().family ());
-    settings.setValue (ve_font_size.settings_key (), varedit_fontSize->value ());
-    write_varedit_colors ();
+  // Variable editor
+  settings.setValue (ve_column_width.settings_key (), varedit_columnWidth->value ());
+  settings.setValue (ve_row_height.settings_key (), varedit_rowHeight->value ());
+  settings.setValue (ve_use_terminal_font.settings_key (), varedit_useTerminalFont->isChecked ());
+  settings.setValue (ve_alternate_rows.settings_key (), varedit_alternate->isChecked ());
+  settings.setValue (ve_font_name.settings_key (), varedit_font->currentFont ().family ());
+  settings.setValue (ve_font_size.settings_key (), varedit_fontSize->value ());
+  write_varedit_colors ();
 
-    // shortcuts
+  // shortcuts
 
-    settings.setValue (sc_prevent_rl_conflicts.settings_key (), cb_prevent_readline_conflicts->isChecked ());
-    settings.setValue (sc_prevent_rl_conflicts_menu.settings_key (), cb_prevent_readline_conflicts_menu->isChecked ());
+  settings.setValue (sc_prevent_rl_conflicts.settings_key (), cb_prevent_readline_conflicts->isChecked ());
+  settings.setValue (sc_prevent_rl_conflicts_menu.settings_key (), cb_prevent_readline_conflicts_menu->isChecked ());
 
-    shortcuts_treewidget->write_settings ();
+  shortcuts_treewidget->write_settings ();
 
-    settings.sync ();
-  }
+  settings.sync ();
+}
 
-  void settings_dialog::read_workspace_colors ()
-  {
-    gui_settings settings;
+void settings_dialog::read_workspace_colors ()
+{
+  gui_settings settings;
 
-    // Construct the grid with all color related settings
-    QGridLayout *style_grid = new QGridLayout ();
-    QVector<QLabel *> description (ws_colors_count);
-    QVector<color_picker *> color (ws_colors_count);
+  // Construct the grid with all color related settings
+  QGridLayout *style_grid = new QGridLayout ();
+  QVector<QLabel *> description (ws_colors_count);
+  QVector<color_picker *> color (ws_colors_count);
 
-    int column = 0;
-    const int color_columns = 3;  // place colors in so many columns
-    int row = 0;
-    int mode = settings.int_value (ws_color_mode);
+  int column = 0;
+  const int color_columns = 3;  // place colors in so many columns
+  int row = 0;
+  int mode = settings.int_value (ws_color_mode);
 
-    m_ws_enable_colors = new QCheckBox (tr ("Enable attribute colors"));
-    style_grid->addWidget (m_ws_enable_colors, row++, column, 1, 4);
+  m_ws_enable_colors = new QCheckBox (tr ("Enable attribute colors"));
+  style_grid->addWidget (m_ws_enable_colors, row++, column, 1, 4);
 
-    m_ws_hide_tool_tips = new QCheckBox (tr ("Hide tools tips"));
-    style_grid->addWidget (m_ws_hide_tool_tips, row++, column, 1, 4);
-    connect (m_ws_enable_colors, &QCheckBox::toggled,
-             m_ws_hide_tool_tips, &QCheckBox::setEnabled);
-    m_ws_hide_tool_tips->setChecked
-      (settings.bool_value (ws_hide_tool_tips));
+  m_ws_hide_tool_tips = new QCheckBox (tr ("Hide tools tips"));
+  style_grid->addWidget (m_ws_hide_tool_tips, row++, column, 1, 4);
+  connect (m_ws_enable_colors, &QCheckBox::toggled,
+           m_ws_hide_tool_tips, &QCheckBox::setEnabled);
+  m_ws_hide_tool_tips->setChecked
+    (settings.bool_value (ws_hide_tool_tips));
 
-    QCheckBox *cb_color_mode = new QCheckBox (tr (settings_color_modes.toStdString ().data ()));
-    cb_color_mode->setToolTip (tr (settings_color_modes_tooltip.toStdString ().data ()));
-    cb_color_mode->setChecked (mode == 1);
-    cb_color_mode->setObjectName (ws_color_mode.settings_key ());
-    connect (m_ws_enable_colors, &QCheckBox::toggled,
-             cb_color_mode, &QCheckBox::setEnabled);
-    style_grid->addWidget (cb_color_mode, row, column);
+  QCheckBox *cb_color_mode = new QCheckBox (tr (settings_color_modes.toStdString ().data ()));
+  cb_color_mode->setToolTip (tr (settings_color_modes_tooltip.toStdString ().data ()));
+  cb_color_mode->setChecked (mode == 1);
+  cb_color_mode->setObjectName (ws_color_mode.settings_key ());
+  connect (m_ws_enable_colors, &QCheckBox::toggled,
+           cb_color_mode, &QCheckBox::setEnabled);
+  style_grid->addWidget (cb_color_mode, row, column);
 
-    QPushButton *pb_reload_default_colors = new QPushButton (tr (settings_reload_colors.toStdString ().data ()));
-    pb_reload_default_colors->setToolTip (tr (settings_reload_colors_tooltip.toStdString ().data ()));
-    connect (m_ws_enable_colors, &QCheckBox::toggled,
-             pb_reload_default_colors, &QPushButton::setEnabled);
-    style_grid->addWidget (pb_reload_default_colors, row+1, column++);
+  QPushButton *pb_reload_default_colors = new QPushButton (tr (settings_reload_colors.toStdString ().data ()));
+  pb_reload_default_colors->setToolTip (tr (settings_reload_colors_tooltip.toStdString ().data ()));
+  connect (m_ws_enable_colors, &QCheckBox::toggled,
+           pb_reload_default_colors, &QPushButton::setEnabled);
+  style_grid->addWidget (pb_reload_default_colors, row+1, column++);
 
-    bool colors_enabled = settings.bool_value (ws_enable_colors);
+  bool colors_enabled = settings.bool_value (ws_enable_colors);
 
-    for (int i = 0; i < ws_colors_count; i++)
-      {
-        description[i] = new QLabel ("    "
-          + tr (ws_color_names.at (i).toStdString ().data ()));
-        description[i]->setAlignment (Qt::AlignRight);
-        description[i]->setEnabled (colors_enabled);
-        connect (m_ws_enable_colors, &QCheckBox::toggled,
-                 description[i], &QLabel::setEnabled);
+  for (int i = 0; i < ws_colors_count; i++)
+    {
+      description[i] = new QLabel ("    "
+        + tr (ws_color_names.at (i).toStdString ().data ()));
+      description[i]->setAlignment (Qt::AlignRight);
+      description[i]->setEnabled (colors_enabled);
+      connect (m_ws_enable_colors, &QCheckBox::toggled,
+               description[i], &QLabel::setEnabled);
 
-        QColor setting_color = settings.color_value (ws_colors[i], mode);
-        color[i] = new color_picker (setting_color);
-        color[i]->setObjectName (ws_colors[i].settings_key ());
-        color[i]->setMinimumSize (30, 10);
-        color[i]->setEnabled (colors_enabled);
-        connect (m_ws_enable_colors, &QCheckBox::toggled,
-                 color[i], &color_picker::setEnabled);
+      QColor setting_color = settings.color_value (ws_colors[i], mode);
+      color[i] = new color_picker (setting_color);
+      color[i]->setObjectName (ws_colors[i].settings_key ());
+      color[i]->setMinimumSize (30, 10);
+      color[i]->setEnabled (colors_enabled);
+      connect (m_ws_enable_colors, &QCheckBox::toggled,
+               color[i], &color_picker::setEnabled);
 
-        style_grid->addWidget (description[i], row, 3*column);
-        style_grid->addWidget (color[i], row, 3*column+1);
-        if (++column > color_columns)
-          {
-            style_grid->setColumnStretch (4*column, 10);
-            row++;
-            column = 1;
-          }
-      }
+      style_grid->addWidget (description[i], row, 3*column);
+      style_grid->addWidget (color[i], row, 3*column+1);
+      if (++column > color_columns)
+        {
+          style_grid->setColumnStretch (4*column, 10);
+          row++;
+          column = 1;
+        }
+    }
 
-    // Load enable settings at the end for having signals already connected
-    m_ws_enable_colors->setChecked (colors_enabled);
-    m_ws_hide_tool_tips->setEnabled (colors_enabled);
-    cb_color_mode->setEnabled (colors_enabled);
-    pb_reload_default_colors->setEnabled (colors_enabled);
+  // Load enable settings at the end for having signals already connected
+  m_ws_enable_colors->setChecked (colors_enabled);
+  m_ws_hide_tool_tips->setEnabled (colors_enabled);
+  cb_color_mode->setEnabled (colors_enabled);
+  pb_reload_default_colors->setEnabled (colors_enabled);
 
-    // place grid with elements into the tab
-    workspace_colors_box->setLayout (style_grid);
+  // place grid with elements into the tab
+  workspace_colors_box->setLayout (style_grid);
 
-    // update colors depending on second theme selection or reloading
-    // the dfault values
-    connect (cb_color_mode, &QCheckBox::stateChanged,
-             this, &settings_dialog::update_workspace_colors);
-    connect (pb_reload_default_colors, &QPushButton::clicked,
-             [=] () { update_workspace_colors (settings_reload_default_colors_flag); });
-  }
+  // update colors depending on second theme selection or reloading
+  // the dfault values
+  connect (cb_color_mode, &QCheckBox::stateChanged,
+           this, &settings_dialog::update_workspace_colors);
+  connect (pb_reload_default_colors, &QPushButton::clicked,
+           [=] () { update_workspace_colors (settings_reload_default_colors_flag); });
+}
 
-  void settings_dialog::update_workspace_colors (int def)
-  {
-    QCheckBox *cb_color_mode
-      = workspace_colors_box->findChild <QCheckBox *> (ws_color_mode.settings_key ());
+void settings_dialog::update_workspace_colors (int def)
+{
+  QCheckBox *cb_color_mode
+    = workspace_colors_box->findChild <QCheckBox *> (ws_color_mode.settings_key ());
 
-    int m = 0;
-    if (cb_color_mode && cb_color_mode->isChecked ())
-      m = 1;
+  int m = 0;
+  if (cb_color_mode && cb_color_mode->isChecked ())
+    m = 1;
 
-    gui_settings settings;
+  gui_settings settings;
 
-    color_picker *c_picker;
+  color_picker *c_picker;
 
-    for (unsigned int i = 0; i < ws_colors_count; i++)
-      {
-        c_picker = workspace_colors_box->findChild <color_picker *> (ws_colors[i].settings_key ());
-        if (c_picker)
-          {
-            if (def != settings_reload_default_colors_flag)
-              {
-                // Get current value from settings or the default
-                c_picker->set_color (settings.color_value (ws_colors[i], m));
-              }
-            else
-              {
-                // Get the default value
-                c_picker->set_color (settings.get_color_value (ws_colors[i].def (), m));
-              }
-          }
-      }
-  }
+  for (unsigned int i = 0; i < ws_colors_count; i++)
+    {
+      c_picker = workspace_colors_box->findChild <color_picker *> (ws_colors[i].settings_key ());
+      if (c_picker)
+        {
+          if (def != settings_reload_default_colors_flag)
+            {
+              // Get current value from settings or the default
+              c_picker->set_color (settings.color_value (ws_colors[i], m));
+            }
+          else
+            {
+              // Get the default value
+              c_picker->set_color (settings.get_color_value (ws_colors[i].def (), m));
+            }
+        }
+    }
+}
 
-  void settings_dialog::write_workspace_colors ()
-  {
-    gui_settings settings;
+void settings_dialog::write_workspace_colors ()
+{
+  gui_settings settings;
 
-    settings.setValue (ws_enable_colors.settings_key (), m_ws_enable_colors->isChecked ());
-    settings.setValue (ws_hide_tool_tips.settings_key (), m_ws_hide_tool_tips->isChecked ());
+  settings.setValue (ws_enable_colors.settings_key (), m_ws_enable_colors->isChecked ());
+  settings.setValue (ws_hide_tool_tips.settings_key (), m_ws_hide_tool_tips->isChecked ());
 
-    QCheckBox *cb_color_mode
-      = workspace_colors_box->findChild <QCheckBox *> (ws_color_mode.settings_key ());
+  QCheckBox *cb_color_mode
+    = workspace_colors_box->findChild <QCheckBox *> (ws_color_mode.settings_key ());
 
-    int mode = 0;
-    if (cb_color_mode && cb_color_mode->isChecked ())
-      mode = 1;
+  int mode = 0;
+  if (cb_color_mode && cb_color_mode->isChecked ())
+    mode = 1;
 
-    color_picker *color;
+  color_picker *color;
 
-    for (int i = 0; i < ws_colors_count; i++)
-      {
-        color = workspace_colors_box->findChild <color_picker *> (ws_colors[i].settings_key ());
-        if (color)
-          settings.set_color_value (ws_colors[i], color->color (), mode);
-      }
+  for (int i = 0; i < ws_colors_count; i++)
+    {
+      color = workspace_colors_box->findChild <color_picker *> (ws_colors[i].settings_key ());
+      if (color)
+        settings.set_color_value (ws_colors[i], color->color (), mode);
+    }
 
-    settings.setValue (ws_color_mode.settings_key (), mode);
+  settings.setValue (ws_color_mode.settings_key (), mode);
 
-    settings.sync ();
-  }
+  settings.sync ();
+}
 
-  void settings_dialog::read_terminal_colors ()
-  {
-    gui_settings settings;
+void settings_dialog::read_terminal_colors ()
+{
+  gui_settings settings;
 
-    QGridLayout *style_grid = new QGridLayout ();
-    QVector<QLabel *> description (cs_colors_count);
-    QVector<color_picker *> color (cs_colors_count);
+  QGridLayout *style_grid = new QGridLayout ();
+  QVector<QLabel *> description (cs_colors_count);
+  QVector<color_picker *> color (cs_colors_count);
 
-    int mode = settings.int_value (cs_color_mode);
+  int mode = settings.int_value (cs_color_mode);
 
-    QCheckBox *cb_color_mode = new QCheckBox (tr (settings_color_modes.toStdString ().data ()));
-    cb_color_mode->setToolTip (tr (settings_color_modes_tooltip.toStdString ().data ()));
-    cb_color_mode->setChecked (mode == 1);
-    cb_color_mode->setObjectName (cs_color_mode.settings_key ());
-    style_grid->addWidget (cb_color_mode, 0, 0);
+  QCheckBox *cb_color_mode = new QCheckBox (tr (settings_color_modes.toStdString ().data ()));
+  cb_color_mode->setToolTip (tr (settings_color_modes_tooltip.toStdString ().data ()));
+  cb_color_mode->setChecked (mode == 1);
+  cb_color_mode->setObjectName (cs_color_mode.settings_key ());
+  style_grid->addWidget (cb_color_mode, 0, 0);
 
-    QPushButton *pb_reload_default_colors = new QPushButton (tr (settings_reload_colors.toStdString ().data ()));
-    pb_reload_default_colors->setToolTip (tr (settings_reload_colors_tooltip.toStdString ().data ()));
-    style_grid->addWidget (pb_reload_default_colors, 1, 0);
+  QPushButton *pb_reload_default_colors = new QPushButton (tr (settings_reload_colors.toStdString ().data ()));
+  pb_reload_default_colors->setToolTip (tr (settings_reload_colors_tooltip.toStdString ().data ()));
+  style_grid->addWidget (pb_reload_default_colors, 1, 0);
 
-    int column = 1;               // column 0 is for the color mode checkbox
-    const int color_columns = 2;  // place colors in so many columns
-    int row = 0;
-    for (unsigned int i = 0; i < cs_colors_count; i++)
-      {
-        description[i] = new QLabel ("    "
-            + tr (cs_color_names.at (i).toStdString ().data ()));
-        description[i]->setAlignment (Qt::AlignRight);
-        QColor setting_color = settings.color_value (cs_colors[i], mode);
-        color[i] = new color_picker (setting_color);
-        color[i]->setObjectName (cs_colors[i].settings_key ());
-        color[i]->setMinimumSize (30, 10);
-        style_grid->addWidget (description[i], row, 2*column);
-        style_grid->addWidget (color[i], row, 2*column+1);
-        if (++column > color_columns)
-          {
-            style_grid->setColumnStretch (3*column, 10);
-            row++;
-            column = 1;
-          }
-      }
+  int column = 1;               // column 0 is for the color mode checkbox
+  const int color_columns = 2;  // place colors in so many columns
+  int row = 0;
+  for (unsigned int i = 0; i < cs_colors_count; i++)
+    {
+      description[i] = new QLabel ("    "
+          + tr (cs_color_names.at (i).toStdString ().data ()));
+      description[i]->setAlignment (Qt::AlignRight);
+      QColor setting_color = settings.color_value (cs_colors[i], mode);
+      color[i] = new color_picker (setting_color);
+      color[i]->setObjectName (cs_colors[i].settings_key ());
+      color[i]->setMinimumSize (30, 10);
+      style_grid->addWidget (description[i], row, 2*column);
+      style_grid->addWidget (color[i], row, 2*column+1);
+      if (++column > color_columns)
+        {
+          style_grid->setColumnStretch (3*column, 10);
+          row++;
+          column = 1;
+        }
+    }
 
-    // place grid with elements into the tab
-    terminal_colors_box->setLayout (style_grid);
+  // place grid with elements into the tab
+  terminal_colors_box->setLayout (style_grid);
 
-    // update colors depending on second theme selection
-    connect (cb_color_mode, &QCheckBox::stateChanged,
-             this, &settings_dialog::update_terminal_colors);
-    connect (pb_reload_default_colors, &QPushButton::clicked,
-             [=] () { update_terminal_colors (settings_reload_default_colors_flag); });
-  }
+  // update colors depending on second theme selection
+  connect (cb_color_mode, &QCheckBox::stateChanged,
+           this, &settings_dialog::update_terminal_colors);
+  connect (pb_reload_default_colors, &QPushButton::clicked,
+           [=] () { update_terminal_colors (settings_reload_default_colors_flag); });
+}
 
-  void settings_dialog::update_terminal_colors (int def)
-  {
-    QCheckBox *cb_color_mode
-      = terminal_colors_box->findChild <QCheckBox *> (cs_color_mode.settings_key ());
+void settings_dialog::update_terminal_colors (int def)
+{
+  QCheckBox *cb_color_mode
+    = terminal_colors_box->findChild <QCheckBox *> (cs_color_mode.settings_key ());
 
-    int m = 0;
-    if (cb_color_mode && cb_color_mode->isChecked ())
-      m = 1;
+  int m = 0;
+  if (cb_color_mode && cb_color_mode->isChecked ())
+    m = 1;
 
-    gui_settings settings;
+  gui_settings settings;
 
-    color_picker *c_picker;
+  color_picker *c_picker;
 
-    for (unsigned int i = 0; i < cs_colors_count; i++)
-      {
-        c_picker = terminal_colors_box->findChild <color_picker *> (cs_colors[i].settings_key ());
-        if (c_picker)
-          {
-            if (def != settings_reload_default_colors_flag)
-              {
-                // Get current value from settings or the default
-                c_picker->set_color (settings.color_value (cs_colors[i], m));
-              }
-            else
-              {
-                // Get the default value
-                c_picker->set_color (settings.get_color_value (cs_colors[i].def (), m));
-              }
-          }
-      }
-  }
+  for (unsigned int i = 0; i < cs_colors_count; i++)
+    {
+      c_picker = terminal_colors_box->findChild <color_picker *> (cs_colors[i].settings_key ());
+      if (c_picker)
+        {
+          if (def != settings_reload_default_colors_flag)
+            {
+              // Get current value from settings or the default
+              c_picker->set_color (settings.color_value (cs_colors[i], m));
+            }
+          else
+            {
+              // Get the default value
+              c_picker->set_color (settings.get_color_value (cs_colors[i].def (), m));
+            }
+        }
+    }
+}
 
-  void settings_dialog::write_terminal_colors ()
-  {
-    QCheckBox *cb_color_mode
-      = terminal_colors_box->findChild <QCheckBox *> (cs_color_mode.settings_key ());
+void settings_dialog::write_terminal_colors ()
+{
+  QCheckBox *cb_color_mode
+    = terminal_colors_box->findChild <QCheckBox *> (cs_color_mode.settings_key ());
 
-    int mode = 0;
-    if (cb_color_mode && cb_color_mode->isChecked ())
-      mode = 1;
+  int mode = 0;
+  if (cb_color_mode && cb_color_mode->isChecked ())
+    mode = 1;
 
-    gui_settings settings;
+  gui_settings settings;
 
-    color_picker *color;
+  color_picker *color;
 
-    for (int i = 0; i < cs_color_names.size (); i++)
-      {
-        color = terminal_colors_box->findChild <color_picker *> (cs_colors[i].settings_key ());
-        if (color)
-          settings.set_color_value (cs_colors[i], color->color (), mode);
-      }
+  for (int i = 0; i < cs_color_names.size (); i++)
+    {
+      color = terminal_colors_box->findChild <color_picker *> (cs_colors[i].settings_key ());
+      if (color)
+        settings.set_color_value (cs_colors[i], color->color (), mode);
+    }
 
-    settings.setValue (cs_color_mode.settings_key (), mode);
+  settings.setValue (cs_color_mode.settings_key (), mode);
 
-    settings.sync ();
-  }
+  settings.sync ();
+}
 
-  void settings_dialog::read_varedit_colors ()
-  {
-    gui_settings settings;
+void settings_dialog::read_varedit_colors ()
+{
+  gui_settings settings;
 
-    QGridLayout *style_grid = new QGridLayout ();
-    QVector<QLabel *> description (ve_colors_count);
-    QVector<color_picker *> color (ve_colors_count);
+  QGridLayout *style_grid = new QGridLayout ();
+  QVector<QLabel *> description (ve_colors_count);
+  QVector<color_picker *> color (ve_colors_count);
 
-    int mode = settings.int_value (ve_color_mode);
+  int mode = settings.int_value (ve_color_mode);
 
-    QCheckBox *cb_color_mode = new QCheckBox (tr (settings_color_modes.toStdString ().data ()));
-    cb_color_mode->setToolTip (tr (settings_color_modes_tooltip.toStdString ().data ()));
-    cb_color_mode->setChecked (mode == 1);
-    cb_color_mode->setObjectName (ve_color_mode.settings_key ());
-    style_grid->addWidget (cb_color_mode, 0, 0);
+  QCheckBox *cb_color_mode = new QCheckBox (tr (settings_color_modes.toStdString ().data ()));
+  cb_color_mode->setToolTip (tr (settings_color_modes_tooltip.toStdString ().data ()));
+  cb_color_mode->setChecked (mode == 1);
+  cb_color_mode->setObjectName (ve_color_mode.settings_key ());
+  style_grid->addWidget (cb_color_mode, 0, 0);
 
-    QPushButton *pb_reload_default_colors = new QPushButton (tr (settings_reload_colors.toStdString ().data ()));
-    pb_reload_default_colors->setToolTip (tr (settings_reload_colors_tooltip.toStdString ().data ()));
-    style_grid->addWidget (pb_reload_default_colors, 1, 0);
+  QPushButton *pb_reload_default_colors = new QPushButton (tr (settings_reload_colors.toStdString ().data ()));
+  pb_reload_default_colors->setToolTip (tr (settings_reload_colors_tooltip.toStdString ().data ()));
+  style_grid->addWidget (pb_reload_default_colors, 1, 0);
 
-    int column = 1;
-    int color_columns = 2;
-    int row = 0;
-    for (int i = 0; i < ve_colors_count; i++)
-      {
-        description[i] = new QLabel ("    "
-            + tr (ve_color_names.at (i).toStdString ().data ()));
-        description[i]->setAlignment (Qt::AlignRight);
+  int column = 1;
+  int color_columns = 2;
+  int row = 0;
+  for (int i = 0; i < ve_colors_count; i++)
+    {
+      description[i] = new QLabel ("    "
+          + tr (ve_color_names.at (i).toStdString ().data ()));
+      description[i]->setAlignment (Qt::AlignRight);
 
-        QColor setting_color = settings.color_value (ve_colors[i], mode);
-        color[i] = new color_picker (setting_color);
-        color[i]->setObjectName (ve_colors[i].settings_key ());
-        color[i]->setMinimumSize (30, 10);
-        style_grid->addWidget (description[i], row, 2*column);
-        style_grid->addWidget (color[i], row, 2*column+1);
-        if (++column > color_columns)
-          {
-            style_grid->setColumnStretch (3*column, 10);
-            row++;
-            column = 1;
-          }
-      }
+      QColor setting_color = settings.color_value (ve_colors[i], mode);
+      color[i] = new color_picker (setting_color);
+      color[i]->setObjectName (ve_colors[i].settings_key ());
+      color[i]->setMinimumSize (30, 10);
+      style_grid->addWidget (description[i], row, 2*column);
+      style_grid->addWidget (color[i], row, 2*column+1);
+      if (++column > color_columns)
+        {
+          style_grid->setColumnStretch (3*column, 10);
+          row++;
+          column = 1;
+        }
+    }
 
-    // place grid with elements into the tab
-    varedit_colors_box->setLayout (style_grid);
+  // place grid with elements into the tab
+  varedit_colors_box->setLayout (style_grid);
 
-    // update colors depending on second theme selection
-    connect (cb_color_mode, &QCheckBox::stateChanged,
-             this, &settings_dialog::update_varedit_colors);
-    connect (pb_reload_default_colors, &QPushButton::clicked,
-             [=] () { update_varedit_colors (settings_reload_default_colors_flag); });
-  }
+  // update colors depending on second theme selection
+  connect (cb_color_mode, &QCheckBox::stateChanged,
+           this, &settings_dialog::update_varedit_colors);
+  connect (pb_reload_default_colors, &QPushButton::clicked,
+           [=] () { update_varedit_colors (settings_reload_default_colors_flag); });
+}
 
-  void settings_dialog::update_varedit_colors (int def)
-  {
-    QCheckBox *cb_color_mode
-      = varedit_colors_box->findChild <QCheckBox *> (ve_color_mode.settings_key ());
+void settings_dialog::update_varedit_colors (int def)
+{
+  QCheckBox *cb_color_mode
+    = varedit_colors_box->findChild <QCheckBox *> (ve_color_mode.settings_key ());
 
-    int m = 0;
-    if (cb_color_mode && cb_color_mode->isChecked ())
-      m = 1;
+  int m = 0;
+  if (cb_color_mode && cb_color_mode->isChecked ())
+    m = 1;
 
-    gui_settings settings;
+  gui_settings settings;
 
-    color_picker *c_picker;
+  color_picker *c_picker;
 
-    for (unsigned int i = 0; i < ve_colors_count; i++)
-      {
-        c_picker = varedit_colors_box->findChild <color_picker *> (ve_colors[i].settings_key ());
-        if (c_picker)
-          {
-            if (def != settings_reload_default_colors_flag)
-              {
-                // Get current value from settings or the default
-                c_picker->set_color (settings.color_value (ve_colors[i], m));
-              }
-            else
-              {
-                // Get the default value
-                c_picker->set_color (settings.get_color_value (ve_colors[i].def (), m));
-              }
-          }
-      }
-  }
+  for (unsigned int i = 0; i < ve_colors_count; i++)
+    {
+      c_picker = varedit_colors_box->findChild <color_picker *> (ve_colors[i].settings_key ());
+      if (c_picker)
+        {
+          if (def != settings_reload_default_colors_flag)
+            {
+              // Get current value from settings or the default
+              c_picker->set_color (settings.color_value (ve_colors[i], m));
+            }
+          else
+            {
+              // Get the default value
+              c_picker->set_color (settings.get_color_value (ve_colors[i].def (), m));
+            }
+        }
+    }
+}
 
-  void settings_dialog::write_varedit_colors ()
-  {
-    QCheckBox *cb_color_mode
-      = varedit_colors_box->findChild <QCheckBox *> (ve_color_mode.settings_key ());
+void settings_dialog::write_varedit_colors ()
+{
+  QCheckBox *cb_color_mode
+    = varedit_colors_box->findChild <QCheckBox *> (ve_color_mode.settings_key ());
 
-    int mode = 0;
-    if (cb_color_mode && cb_color_mode->isChecked ())
-      mode = 1;
+  int mode = 0;
+  if (cb_color_mode && cb_color_mode->isChecked ())
+    mode = 1;
 
-    gui_settings settings;
+  gui_settings settings;
 
-    color_picker *color;
+  color_picker *color;
 
-    for (int i = 0; i < ve_colors_count; i++)
-      {
-        color = varedit_colors_box->findChild <color_picker *> (ve_colors[i].settings_key ());
-        if (color)
-          settings.set_color_value (ve_colors[i], color->color (), mode);
-      }
+  for (int i = 0; i < ve_colors_count; i++)
+    {
+      color = varedit_colors_box->findChild <color_picker *> (ve_colors[i].settings_key ());
+      if (color)
+        settings.set_color_value (ve_colors[i], color->color (), mode);
+    }
 
-    settings.setValue (ve_color_mode.settings_key (), mode);
+  settings.setValue (ve_color_mode.settings_key (), mode);
 
-    settings.sync ();
-  }
+  settings.sync ();
+}
 
-  QString settings_dialog::get_shortcuts_file_name (import_export_action action)
-  {
-    QString file;
+QString settings_dialog::get_shortcuts_file_name (import_export_action action)
+{
+  QString file;
 
-    // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
-    int opts = 0;  // No options by default.
+  // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
+  int opts = 0;  // No options by default.
 
-    gui_settings settings;
+  gui_settings settings;
 
-    if (! settings.bool_value (global_use_native_dialogs))
-      opts = QFileDialog::DontUseNativeDialog;
+  if (! settings.bool_value (global_use_native_dialogs))
+    opts = QFileDialog::DontUseNativeDialog;
 
-    if (action == OSC_IMPORT)
-      file = QFileDialog::getOpenFileName
-        (this, tr ("Import shortcuts from file..."), QString (),
-         tr ("Octave Shortcut Files (*.osc);;All Files (*)"),
-         nullptr, QFileDialog::Option (opts));
+  if (action == OSC_IMPORT)
+    file = QFileDialog::getOpenFileName
+      (this, tr ("Import shortcuts from file..."), QString (),
+       tr ("Octave Shortcut Files (*.osc);;All Files (*)"),
+       nullptr, QFileDialog::Option (opts));
 
-    else
-      file = QFileDialog::getSaveFileName
-        (this, tr ("Export shortcuts to file..."), QString (),
-         tr ("Octave Shortcut Files (*.osc);;All Files (*)"),
-         nullptr, QFileDialog::Option (opts));
+  else
+    file = QFileDialog::getSaveFileName
+      (this, tr ("Export shortcuts to file..."), QString (),
+       tr ("Octave Shortcut Files (*.osc);;All Files (*)"),
+       nullptr, QFileDialog::Option (opts));
 
-    return file;
-  }
+  return file;
+}
 
-  // Ask whether to overwrite current shortcuts with settings from an
-  // imported file.  Optionally allow current shortcuts to be saved to a
-  // file.
+// Ask whether to overwrite current shortcuts with settings from an
+// imported file.  Optionally allow current shortcuts to be saved to a
+// file.
 
-  // FIXME: If the tree view contains changes that have not yet been
-  //        saved to the application settings object, should we
-  //
-  //   * allow the user to choose whether to
-  //     - cancel the operation (X)
-  //     - save the modified settings (X)
-  //     - save the current application settings (XX)
-  //
-  //   * unconditionally display an error dialog and cancel the
-  //     export operation
-  //
-  //   (X) - already an option, but not based on whether the tree view
-  //         contains unsaved changes
-  //   (XX) - already possible (cancel operation, cancel settings
-  //          dialog, re-open settings dialog and export changes).
+// FIXME: If the tree view contains changes that have not yet been
+//        saved to the application settings object, should we
+//
+//   * allow the user to choose whether to
+//     - cancel the operation (X)
+//     - save the modified settings (X)
+//     - save the current application settings (XX)
+//
+//   * unconditionally display an error dialog and cancel the
+//     export operation
+//
+//   (X) - already an option, but not based on whether the tree view
+//         contains unsaved changes
+//   (XX) - already possible (cancel operation, cancel settings
+//          dialog, re-open settings dialog and export changes).
 
-  bool settings_dialog::overwrite_all_shortcuts ()
-  {
-    QMessageBox msg_box;
+bool settings_dialog::overwrite_all_shortcuts ()
+{
+  QMessageBox msg_box;
 
-    msg_box.setWindowTitle (tr ("Overwriting Shortcuts"));
-    msg_box.setIcon (QMessageBox::Warning);
-    msg_box.setText (tr ("You are about to overwrite all shortcuts.\n"
-                         "Would you like to save the current shortcut set or cancel the action?"));
-    msg_box.setStandardButtons (QMessageBox::Save | QMessageBox::Cancel);
+  msg_box.setWindowTitle (tr ("Overwriting Shortcuts"));
+  msg_box.setIcon (QMessageBox::Warning);
+  msg_box.setText (tr ("You are about to overwrite all shortcuts.\n"
+                       "Would you like to save the current shortcut set or cancel the action?"));
+  msg_box.setStandardButtons (QMessageBox::Save | QMessageBox::Cancel);
 
-    QPushButton *discard
-      = msg_box.addButton (tr ("Don't save"), QMessageBox::DestructiveRole);
+  QPushButton *discard
+    = msg_box.addButton (tr ("Don't save"), QMessageBox::DestructiveRole);
 
-    msg_box.setDefaultButton (QMessageBox::Save);
+  msg_box.setDefaultButton (QMessageBox::Save);
 
-    int ret = msg_box.exec ();
+  int ret = msg_box.exec ();
 
-    if (msg_box.clickedButton () == discard)
-      return true;
+  if (msg_box.clickedButton () == discard)
+    return true;
 
-    if (ret == QMessageBox::Save)
-      {
-        QString file = get_shortcuts_file_name (OSC_EXPORT);
+  if (ret == QMessageBox::Save)
+    {
+      QString file = get_shortcuts_file_name (OSC_EXPORT);
 
-        gui_settings osc_settings (file, QSettings::IniFormat);
+      gui_settings osc_settings (file, QSettings::IniFormat);
 
-        if (osc_settings.status () ==  QSettings::NoError)
-          {
-            shortcuts_treewidget->export_shortcuts (osc_settings);
-            return true;
-          }
-        else
-          qWarning () << (tr ("Failed to open %1 as Octave shortcut file")
-                          .arg (file));
-      }
+      if (osc_settings.status () ==  QSettings::NoError)
+        {
+          shortcuts_treewidget->export_shortcuts (osc_settings);
+          return true;
+        }
+      else
+        qWarning () << (tr ("Failed to open %1 as Octave shortcut file")
+                        .arg (file));
+    }
 
-    return false;
-  }
+  return false;
+}
 
 OCTAVE_END_NAMESPACE(octave)
--- a/libgui/src/settings-dialog.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/settings-dialog.h	Thu Feb 02 12:25:51 2023 -0800
@@ -39,87 +39,87 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  // Ui::settings_dialog is a generated class.
+// Ui::settings_dialog is a generated class.
 
-  class settings_dialog : public QDialog, private Ui::settings_dialog
-  {
-    Q_OBJECT
+class settings_dialog : public QDialog, private Ui::settings_dialog
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    explicit settings_dialog (QWidget *parent,
-                              const QString& desired_tab = QString ());
+  explicit settings_dialog (QWidget *parent,
+                            const QString& desired_tab = QString ());
 
-    ~settings_dialog () = default;
+  ~settings_dialog () = default;
 
-    void show_tab (const QString&);
+  void show_tab (const QString&);
 
-  signals:
+signals:
 
-    void apply_new_settings ();
+  void apply_new_settings ();
 
-  private slots:
+private slots:
 
-    void get_octave_dir ();
-    void get_file_browser_dir ();
-    void get_dir (QLineEdit *, const QString&);
-    void set_disabled_pref_file_browser_dir (bool disable);
-    void proxy_items_update ();
+  void get_octave_dir ();
+  void get_file_browser_dir ();
+  void get_dir (QLineEdit *, const QString&);
+  void set_disabled_pref_file_browser_dir (bool disable);
+  void proxy_items_update ();
 
-    // slots updating colors depending on theme
-    void update_terminal_colors (int def = 0);
-    void update_workspace_colors (int def = 0);
-    void update_varedit_colors (int def = 0);
-    void update_editor_lexers (int def = 0);
+  // slots updating colors depending on theme
+  void update_terminal_colors (int def = 0);
+  void update_workspace_colors (int def = 0);
+  void update_varedit_colors (int def = 0);
+  void update_editor_lexers (int def = 0);
 
-    // slots for dialog's buttons
-    void button_clicked (QAbstractButton *button);
+  // slots for dialog's buttons
+  void button_clicked (QAbstractButton *button);
 
-    // slots for import/export-buttons of shortcut sets
-    void import_shortcut_set ();
-    void export_shortcut_set ();
-    void default_shortcut_set ();
+  // slots for import/export-buttons of shortcut sets
+  void import_shortcut_set ();
+  void export_shortcut_set ();
+  void default_shortcut_set ();
 
-  private:
+private:
 
-    enum import_export_action
-    {
-      OSC_IMPORT,
-      OSC_EXPORT
-    };
+  enum import_export_action
+  {
+    OSC_IMPORT,
+    OSC_EXPORT
+  };
 
 #if defined (HAVE_QSCINTILLA)
-    void update_lexer (QsciLexer *lexer, int mode, int def = 0);
-    void get_lexer_settings (QsciLexer *lexer);
-    void write_lexer_settings (QsciLexer *lexer);
+  void update_lexer (QsciLexer *lexer, int mode, int def = 0);
+  void get_lexer_settings (QsciLexer *lexer);
+  void write_lexer_settings (QsciLexer *lexer);
 #endif
 
-    void write_changed_settings ();
+  void write_changed_settings ();
 
-    void read_workspace_colors ();
-    void write_workspace_colors ();
+  void read_workspace_colors ();
+  void write_workspace_colors ();
 
-    void read_terminal_colors ();
-    void write_terminal_colors ();
+  void read_terminal_colors ();
+  void write_terminal_colors ();
 
-    void read_varedit_colors ();
-    void write_varedit_colors ();
+  void read_varedit_colors ();
+  void write_varedit_colors ();
 
-    QString get_shortcuts_file_name (import_export_action action);
+  QString get_shortcuts_file_name (import_export_action action);
 
-    bool overwrite_all_shortcuts ();
+  bool overwrite_all_shortcuts ();
 
-    color_picker *m_widget_title_bg_color;
-    color_picker *m_widget_title_bg_color_active;
-    color_picker *m_widget_title_fg_color;
-    color_picker *m_widget_title_fg_color_active;
+  color_picker *m_widget_title_bg_color;
+  color_picker *m_widget_title_bg_color_active;
+  color_picker *m_widget_title_fg_color;
+  color_picker *m_widget_title_fg_color_active;
 
-    QRadioButton *m_rb_comment_strings[ed_comment_strings_count];
-    QCheckBox *m_rb_uncomment_strings[ed_comment_strings_count];
+  QRadioButton *m_rb_comment_strings[ed_comment_strings_count];
+  QCheckBox *m_rb_uncomment_strings[ed_comment_strings_count];
 
-    QCheckBox *m_ws_enable_colors;
-    QCheckBox *m_ws_hide_tool_tips;
-  };
+  QCheckBox *m_ws_enable_colors;
+  QCheckBox *m_ws_hide_tool_tips;
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/src/terminal-dock-widget.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/terminal-dock-widget.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -47,170 +47,170 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  terminal_dock_widget::terminal_dock_widget (QWidget *p,
-                                              bool experimental_terminal_widget)
-    : octave_dock_widget ("TerminalDockWidget", p),
-      m_experimental_terminal_widget (experimental_terminal_widget)
-  {
-    init_control_d_shortcut_behavior ();
+terminal_dock_widget::terminal_dock_widget (QWidget *p,
+                                            bool experimental_terminal_widget)
+  : octave_dock_widget ("TerminalDockWidget", p),
+    m_experimental_terminal_widget (experimental_terminal_widget)
+{
+  init_control_d_shortcut_behavior ();
 
-    // FIXME: we could do this in a better way, but improving it doesn't
-    // matter much if we will eventually be removing the old terminal.
-    if (m_experimental_terminal_widget)
-      {
+  // FIXME: we could do this in a better way, but improving it doesn't
+  // matter much if we will eventually be removing the old terminal.
+  if (m_experimental_terminal_widget)
+    {
 #if defined (HAVE_QSCINTILLA)
-        command_widget *widget = new command_widget (this);
-        console *con = widget->get_console ();
+      command_widget *widget = new command_widget (this);
+      console *con = widget->get_console ();
 
-        connect (this, &terminal_dock_widget::settings_changed,
-                 widget, &command_widget::notice_settings);
+      connect (this, &terminal_dock_widget::settings_changed,
+               widget, &command_widget::notice_settings);
 
-        connect (this, &terminal_dock_widget::update_prompt_signal,
-                 widget, &command_widget::update_prompt);
+      connect (this, &terminal_dock_widget::update_prompt_signal,
+               widget, &command_widget::update_prompt);
 
-        connect (this, &terminal_dock_widget::interpreter_output_signal,
-                 widget, &command_widget::insert_interpreter_output);
+      connect (this, &terminal_dock_widget::interpreter_output_signal,
+               widget, &command_widget::insert_interpreter_output);
 
-        connect (this, &terminal_dock_widget::execute_command_signal,
-                con, &console::execute_command);
+      connect (this, &terminal_dock_widget::execute_command_signal,
+              con, &console::execute_command);
 
-        connect (this, &terminal_dock_widget::new_command_line_signal,
-                con, &console::new_command_line);
+      connect (this, &terminal_dock_widget::new_command_line_signal,
+              con, &console::new_command_line);
 
-        m_terminal = widget;
+      m_terminal = widget;
 #endif
-      }
-    else
-      {
-        QTerminal *widget = QTerminal::create (this);
+    }
+  else
+    {
+      QTerminal *widget = QTerminal::create (this);
 
-        connect (this, &terminal_dock_widget::settings_changed,
-                 widget, &QTerminal::notice_settings);
+      connect (this, &terminal_dock_widget::settings_changed,
+               widget, &QTerminal::notice_settings);
 
-        // Connect the visibility signal to the terminal for
-        // dis-/enabling timers.
-        connect (this, &terminal_dock_widget::visibilityChanged,
-                 widget, &QTerminal::handle_visibility_changed);
+      // Connect the visibility signal to the terminal for
+      // dis-/enabling timers.
+      connect (this, &terminal_dock_widget::visibilityChanged,
+               widget, &QTerminal::handle_visibility_changed);
 
-        connect (widget, QOverload<const fcn_callback&>::of (&QTerminal::interpreter_event),
-                 this, QOverload<const fcn_callback&>::of (&terminal_dock_widget::interpreter_event));
+      connect (widget, QOverload<const fcn_callback&>::of (&QTerminal::interpreter_event),
+               this, QOverload<const fcn_callback&>::of (&terminal_dock_widget::interpreter_event));
 
-        connect (widget, QOverload<const meth_callback&>::of (&QTerminal::interpreter_event),
-                 this, QOverload<const meth_callback&>::of (&terminal_dock_widget::interpreter_event));
+      connect (widget, QOverload<const meth_callback&>::of (&QTerminal::interpreter_event),
+               this, QOverload<const meth_callback&>::of (&terminal_dock_widget::interpreter_event));
 
-        m_terminal = widget;
-      }
+      m_terminal = widget;
+    }
 
-    m_terminal->setObjectName ("OctaveTerminal");
-    m_terminal->setFocusPolicy (Qt::StrongFocus);
+  m_terminal->setObjectName ("OctaveTerminal");
+  m_terminal->setFocusPolicy (Qt::StrongFocus);
 
-    set_title (tr ("Command Window"));
+  set_title (tr ("Command Window"));
 
-    setWidget (m_terminal);
-    setFocusProxy (m_terminal);
+  setWidget (m_terminal);
+  setFocusProxy (m_terminal);
 
-    // Chose a reasonable size at startup in order to avoid truncated
-    // startup messages
+  // Chose a reasonable size at startup in order to avoid truncated
+  // startup messages
 
-    gui_settings settings;
+  gui_settings settings;
 
-    QFont font = QFont ();
-    font.setStyleHint (QFont::TypeWriter);
-    QString default_font = settings.string_value (global_mono_font);
-    font.setFamily
-      (settings.value (cs_font.settings_key (), default_font).toString ());
-    font.setPointSize
-      (settings.int_value (cs_font_size));
+  QFont font = QFont ();
+  font.setStyleHint (QFont::TypeWriter);
+  QString default_font = settings.string_value (global_mono_font);
+  font.setFamily
+    (settings.value (cs_font.settings_key (), default_font).toString ());
+  font.setPointSize
+    (settings.int_value (cs_font_size));
 
-    QFontMetrics metrics(font);
+  QFontMetrics metrics(font);
 
-    int win_x =  metrics.maxWidth()*80;
-    int win_y =  metrics.height()*25;
+  int win_x =  metrics.maxWidth()*80;
+  int win_y =  metrics.height()*25;
 
-    int max_x = QGuiApplication::primaryScreen ()->availableGeometry ().width ();
-    int max_y = QGuiApplication::primaryScreen ()->availableGeometry ().height ();
+  int max_x = QGuiApplication::primaryScreen ()->availableGeometry ().width ();
+  int max_y = QGuiApplication::primaryScreen ()->availableGeometry ().height ();
 
-    if (win_x > max_x)
-      win_x = max_x;
-    if (win_y > max_y)
-      win_y = max_y;
+  if (win_x > max_x)
+    win_x = max_x;
+  if (win_y > max_y)
+    win_y = max_y;
 
-    setGeometry (0, 0, win_x, win_y);
+  setGeometry (0, 0, win_x, win_y);
 
-    if (! p)
-      make_window ();
-  }
+  if (! p)
+    make_window ();
+}
 
-  bool terminal_dock_widget::has_focus () const
-  {
-    QWidget *w = widget ();
-    return w->hasFocus ();
-  }
+bool terminal_dock_widget::has_focus () const
+{
+  QWidget *w = widget ();
+  return w->hasFocus ();
+}
 
-  QTerminal * terminal_dock_widget::get_qterminal ()
-  {
-    return (m_experimental_terminal_widget
-            ? nullptr : dynamic_cast<QTerminal *> (m_terminal));
-  }
+QTerminal * terminal_dock_widget::get_qterminal ()
+{
+  return (m_experimental_terminal_widget
+          ? nullptr : dynamic_cast<QTerminal *> (m_terminal));
+}
 
 #if defined (HAVE_QSCINTILLA)
-  command_widget * terminal_dock_widget::get_command_widget ()
-  {
-    return (m_experimental_terminal_widget
-            ? dynamic_cast<command_widget *> (m_terminal) : nullptr);
-  }
+command_widget * terminal_dock_widget::get_command_widget ()
+{
+  return (m_experimental_terminal_widget
+          ? dynamic_cast<command_widget *> (m_terminal) : nullptr);
+}
 #endif
 
-  void terminal_dock_widget::notice_settings ()
-  {
-    emit settings_changed ();
-  }
+void terminal_dock_widget::notice_settings ()
+{
+  emit settings_changed ();
+}
 
-  void terminal_dock_widget::init_command_prompt ()
-  {
-    if (m_experimental_terminal_widget)
-      {
+void terminal_dock_widget::init_command_prompt ()
+{
+  if (m_experimental_terminal_widget)
+    {
 #if defined (HAVE_QSCINTILLA)
-        command_widget *cmd = get_command_widget ();
-        if (cmd)
-          cmd->init_command_prompt ();
+      command_widget *cmd = get_command_widget ();
+      if (cmd)
+        cmd->init_command_prompt ();
 #endif
-      }
-  }
+    }
+}
 
-  void terminal_dock_widget::init_control_d_shortcut_behavior ()
-  {
-    gui_settings settings;
+void terminal_dock_widget::init_control_d_shortcut_behavior ()
+{
+  gui_settings settings;
 
-    // Reset use of Ctrl-D.  Do this before the call to beginGroup
-    // because sc_main_ctrld.key already begins with the sc_group
-    // prefix.
-    settings.setValue (sc_main_ctrld.settings_key (), false);
+  // Reset use of Ctrl-D.  Do this before the call to beginGroup
+  // because sc_main_ctrld.key already begins with the sc_group
+  // prefix.
+  settings.setValue (sc_main_ctrld.settings_key (), false);
 
-    settings.beginGroup (sc_group);
-    const QStringList shortcut_settings_keys = settings.allKeys ();
-    settings.endGroup ();
+  settings.beginGroup (sc_group);
+  const QStringList shortcut_settings_keys = settings.allKeys ();
+  settings.endGroup ();
 
-    for (const auto& settings_key : shortcut_settings_keys)
-      {
-        // Check whether Ctrl+D is used from main window, i.e. is a
-        // global shortcut.
+  for (const auto& settings_key : shortcut_settings_keys)
+    {
+      // Check whether Ctrl+D is used from main window, i.e. is a
+      // global shortcut.
 
-        QString section = get_shortcut_section (settings_key);
+      QString section = get_shortcut_section (settings_key);
 
-        if (section.startsWith ("main_"))
-          {
-            sc_pref scpref = all_shortcut_preferences::value (settings_key);
+      if (section.startsWith ("main_"))
+        {
+          sc_pref scpref = all_shortcut_preferences::value (settings_key);
 
-            QKeySequence actual = QKeySequence (settings.sc_value (scpref));
+          QKeySequence actual = QKeySequence (settings.sc_value (scpref));
 
-            if (actual == QKeySequence (Qt::ControlModifier+Qt::Key_D))
-              {
-                settings.setValue (sc_main_ctrld.settings_key (), true);
-                break;
-              }
-          }
-     }
-  }
+          if (actual == QKeySequence (Qt::ControlModifier+Qt::Key_D))
+            {
+              settings.setValue (sc_main_ctrld.settings_key (), true);
+              break;
+            }
+        }
+   }
+}
 
 OCTAVE_END_NAMESPACE(octave)
--- a/libgui/src/terminal-dock-widget.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/terminal-dock-widget.h	Thu Feb 02 12:25:51 2023 -0800
@@ -34,66 +34,66 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class command_widget;
+class command_widget;
 
-  class terminal_dock_widget : public octave_dock_widget
-  {
-    Q_OBJECT
+class terminal_dock_widget : public octave_dock_widget
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    terminal_dock_widget (QWidget *parent,
-                          bool experimental_terminal_widget = false);
+  terminal_dock_widget (QWidget *parent,
+                        bool experimental_terminal_widget = false);
 
-    ~terminal_dock_widget () = default;
+  ~terminal_dock_widget () = default;
 
-    bool has_focus () const;
+  bool has_focus () const;
 
-    void init_command_prompt ();
+  void init_command_prompt ();
 
-    void init_control_d_shortcut_behavior ();
+  void init_control_d_shortcut_behavior ();
 
-    // FIXME: The next two functions could be eliminated (or combined)
-    // if we had a common interface for the old and new terminal
-    // widgets.
+  // FIXME: The next two functions could be eliminated (or combined)
+  // if we had a common interface for the old and new terminal
+  // widgets.
 
-    // Only valid if using the old terminal widget.
-    QTerminal * get_qterminal ();
+  // Only valid if using the old terminal widget.
+  QTerminal * get_qterminal ();
 
 #if defined (HAVE_QSCINTILLA)
-    // Only valid if using the new terminal widget.
-    command_widget * get_command_widget ();
+  // Only valid if using the new terminal widget.
+  command_widget * get_command_widget ();
 #endif
 
-  signals:
+signals:
 
-    void settings_changed ();
+  void settings_changed ();
 
-    // Note: the following four signals are
-    // currently only used by the new experimental terminal widget.
+  // Note: the following four signals are
+  // currently only used by the new experimental terminal widget.
 
-    void update_prompt_signal (const QString&);
+  void update_prompt_signal (const QString&);
 
-    void interpreter_output_signal (const QString&);
+  void interpreter_output_signal (const QString&);
 
-    void new_command_line_signal (const QString& = QString ());
+  void new_command_line_signal (const QString& = QString ());
 
-    void execute_command_signal (const QString&);
+  void execute_command_signal (const QString&);
 
-    void interpreter_event (const fcn_callback& fcn);
-    void interpreter_event (const meth_callback& meth);
+  void interpreter_event (const fcn_callback& fcn);
+  void interpreter_event (const meth_callback& meth);
 
-  public slots:
+public slots:
 
-    void notice_settings ();
+  void notice_settings ();
 
-  private:
+private:
 
-    bool m_experimental_terminal_widget;
+  bool m_experimental_terminal_widget;
 
-    // FIXME!!!  Maybe my_term should just be derived from QTerminal?
-    QWidget *m_terminal;
-  };
+  // FIXME!!!  Maybe my_term should just be derived from QTerminal?
+  QWidget *m_terminal;
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/src/variable-editor.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/variable-editor.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -64,1726 +64,1726 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  // Code reuse functions
+// Code reuse functions
 
-  static QSignalMapper *
-  make_plot_mapper (QMenu *menu)
-  {
-    QList<QString> list;
-    list << "plot" << "bar" << "stem" << "stairs" << "area" << "pie" << "hist";
+static QSignalMapper *
+make_plot_mapper (QMenu *menu)
+{
+  QList<QString> list;
+  list << "plot" << "bar" << "stem" << "stairs" << "area" << "pie" << "hist";
 
-    QSignalMapper *plot_mapper = new QSignalMapper (menu);
+  QSignalMapper *plot_mapper = new QSignalMapper (menu);
 
-    for (int i = 0; i < list.size(); ++i)
-      plot_mapper->setMapping
-        (menu->addAction (list.at (i), plot_mapper, SLOT (map ())), list.at (i));
+  for (int i = 0; i < list.size(); ++i)
+    plot_mapper->setMapping
+      (menu->addAction (list.at (i), plot_mapper, SLOT (map ())), list.at (i));
 
-    return plot_mapper;
-  }
+  return plot_mapper;
+}
 
-  // Variable dock widget
+// Variable dock widget
 
-  variable_dock_widget::variable_dock_widget (QWidget *p)
-    : label_dock_widget (p)
+variable_dock_widget::variable_dock_widget (QWidget *p)
+  : label_dock_widget (p)
 // See  Octave bug #53807 and https://bugreports.qt.io/browse/QTBUG-44813
 #if (QT_VERSION >= 0x050302) && (QT_VERSION <= QTBUG_44813_FIX_VERSION)
-      , m_waiting_for_mouse_move (false)
-      , m_waiting_for_mouse_button_release (false)
+    , m_waiting_for_mouse_move (false)
+    , m_waiting_for_mouse_button_release (false)
 #endif
-  {
-    setFocusPolicy (Qt::StrongFocus);
-    setAttribute (Qt::WA_DeleteOnClose);
+{
+  setFocusPolicy (Qt::StrongFocus);
+  setAttribute (Qt::WA_DeleteOnClose);
 
-    connect (m_dock_action, &QAction::triggered,
-             this, &variable_dock_widget::change_floating);
-    connect (m_close_action, &QAction::triggered,
-             this, &variable_dock_widget::change_existence);
-    connect (this, &variable_dock_widget::topLevelChanged,
-             this, &variable_dock_widget::toplevel_change);
+  connect (m_dock_action, &QAction::triggered,
+           this, &variable_dock_widget::change_floating);
+  connect (m_close_action, &QAction::triggered,
+           this, &variable_dock_widget::change_existence);
+  connect (this, &variable_dock_widget::topLevelChanged,
+           this, &variable_dock_widget::toplevel_change);
 
 #define DOCKED_FULLSCREEN_BUTTON_TOOLTIP "Fullscreen undock"
 #define UNDOCKED_FULLSCREEN_BUTTON_TOOLTIP "Fullscreen"
-    // Add a fullscreen button
+  // Add a fullscreen button
 
-    m_fullscreen_action = nullptr;
-    m_full_screen = false;
-    m_prev_floating = false;
-    m_prev_geom = QRect (0, 0, 0, 0);
+  m_fullscreen_action = nullptr;
+  m_full_screen = false;
+  m_prev_floating = false;
+  m_prev_geom = QRect (0, 0, 0, 0);
 
-    QHBoxLayout *h_layout = m_title_widget->findChild<QHBoxLayout *> ();
+  QHBoxLayout *h_layout = m_title_widget->findChild<QHBoxLayout *> ();
 
-    gui_settings settings;
-    m_fullscreen_action
-      = new QAction (settings.icon ("view-fullscreen", false), "", this);
-    m_fullscreen_action->setToolTip (tr (DOCKED_FULLSCREEN_BUTTON_TOOLTIP));
-    QToolButton *fullscreen_button = new QToolButton (m_title_widget);
-    fullscreen_button->setDefaultAction (m_fullscreen_action);
-    fullscreen_button->setFocusPolicy (Qt::NoFocus);
-    fullscreen_button->setIconSize (QSize (m_icon_size, m_icon_size));
-    QString css_button = QString ("QToolButton {background: transparent; border: 0px;}");
-    fullscreen_button->setStyleSheet (css_button);
+  gui_settings settings;
+  m_fullscreen_action
+    = new QAction (settings.icon ("view-fullscreen", false), "", this);
+  m_fullscreen_action->setToolTip (tr (DOCKED_FULLSCREEN_BUTTON_TOOLTIP));
+  QToolButton *fullscreen_button = new QToolButton (m_title_widget);
+  fullscreen_button->setDefaultAction (m_fullscreen_action);
+  fullscreen_button->setFocusPolicy (Qt::NoFocus);
+  fullscreen_button->setIconSize (QSize (m_icon_size, m_icon_size));
+  QString css_button = QString ("QToolButton {background: transparent; border: 0px;}");
+  fullscreen_button->setStyleSheet (css_button);
 
-    connect (m_fullscreen_action, &QAction::triggered,
-             this, &variable_dock_widget::change_fullscreen);
+  connect (m_fullscreen_action, &QAction::triggered,
+           this, &variable_dock_widget::change_fullscreen);
 
-    int index = -1;
-    QToolButton *first = m_title_widget->findChild<QToolButton *> ();
-    if (first != nullptr)
-      index = h_layout->indexOf (first);
-    h_layout->insertWidget (index, fullscreen_button);
+  int index = -1;
+  QToolButton *first = m_title_widget->findChild<QToolButton *> ();
+  if (first != nullptr)
+    index = h_layout->indexOf (first);
+  h_layout->insertWidget (index, fullscreen_button);
 
-    // Custom title bars cause loss of decorations, add a frame
-    m_frame = new QFrame (this);
-    m_frame->setFrameStyle (QFrame::Box | QFrame::Sunken);
-    m_frame->setAttribute (Qt::WA_TransparentForMouseEvents);
-  }
+  // Custom title bars cause loss of decorations, add a frame
+  m_frame = new QFrame (this);
+  m_frame->setFrameStyle (QFrame::Box | QFrame::Sunken);
+  m_frame->setAttribute (Qt::WA_TransparentForMouseEvents);
+}
 
-  // slot for (un)dock action
-  void
-  variable_dock_widget::change_floating (bool)
-  {
-    if (isFloating ())
-      {
-        if (m_full_screen)
-          {
-            setGeometry (m_prev_geom);
-            gui_settings settings;
-            m_fullscreen_action->setIcon (settings.icon ("view-fullscreen", false));
-            m_full_screen = false;
-          }
-        m_fullscreen_action->setToolTip (tr (DOCKED_FULLSCREEN_BUTTON_TOOLTIP));
-      }
-    else
-      m_fullscreen_action->setToolTip (tr (UNDOCKED_FULLSCREEN_BUTTON_TOOLTIP));
+// slot for (un)dock action
+void
+variable_dock_widget::change_floating (bool)
+{
+  if (isFloating ())
+    {
+      if (m_full_screen)
+        {
+          setGeometry (m_prev_geom);
+          gui_settings settings;
+          m_fullscreen_action->setIcon (settings.icon ("view-fullscreen", false));
+          m_full_screen = false;
+        }
+      m_fullscreen_action->setToolTip (tr (DOCKED_FULLSCREEN_BUTTON_TOOLTIP));
+    }
+  else
+    m_fullscreen_action->setToolTip (tr (UNDOCKED_FULLSCREEN_BUTTON_TOOLTIP));
 
-    setFloating (! isFloating ());
-  }
+  setFloating (! isFloating ());
+}
 
-  // slot for hiding the widget
-  void
-  variable_dock_widget::change_existence (bool)
-  {
-    close ();
-  }
+// slot for hiding the widget
+void
+variable_dock_widget::change_existence (bool)
+{
+  close ();
+}
 
-  void
-  variable_dock_widget::toplevel_change (bool toplevel)
-  {
-    if (toplevel)
-      {
-        m_dock_action->setIcon (QIcon (global_icon_paths.at (ICON_THEME_OCTAVE)
-                                       + "widget-dock.png"));
-        m_dock_action->setToolTip (tr ("Dock widget"));
+void
+variable_dock_widget::toplevel_change (bool toplevel)
+{
+  if (toplevel)
+    {
+      m_dock_action->setIcon (QIcon (global_icon_paths.at (ICON_THEME_OCTAVE)
+                                     + "widget-dock.png"));
+      m_dock_action->setToolTip (tr ("Dock widget"));
 
-        setWindowFlags (Qt::Window);
-        setWindowTitle (tr ("Variable Editor: ") + objectName ());
+      setWindowFlags (Qt::Window);
+      setWindowTitle (tr ("Variable Editor: ") + objectName ());
 
-        show ();
-        activateWindow ();
-        setFocus ();
+      show ();
+      activateWindow ();
+      setFocus ();
 
 // See  Octave bug #53807 and https://bugreports.qt.io/browse/QTBUG-44813
 #if (QT_VERSION >= 0x050302) && (QT_VERSION <= QTBUG_44813_FIX_VERSION)
-        m_waiting_for_mouse_move = true;
+      m_waiting_for_mouse_move = true;
 #endif
-      }
-    else
-      {
-        m_dock_action->setIcon (QIcon (global_icon_paths.at (ICON_THEME_OCTAVE)
-                                       + "widget-undock.png"));
-        m_dock_action->setToolTip (tr ("Undock widget"));
+    }
+  else
+    {
+      m_dock_action->setIcon (QIcon (global_icon_paths.at (ICON_THEME_OCTAVE)
+                                     + "widget-undock.png"));
+      m_dock_action->setToolTip (tr ("Undock widget"));
 
-        setFocus ();
+      setFocus ();
 
 // See  Octave bug #53807 and https://bugreports.qt.io/browse/QTBUG-44813
 #if (QT_VERSION >= 0x050302) && (QT_VERSION <= QTBUG_44813_FIX_VERSION)
-        m_waiting_for_mouse_move = false;
-        m_waiting_for_mouse_button_release = false;
+      m_waiting_for_mouse_move = false;
+      m_waiting_for_mouse_button_release = false;
 #endif
-      }
-  }
+    }
+}
 
-  void
-  variable_dock_widget::change_fullscreen ()
-  {
-    gui_settings settings;
+void
+variable_dock_widget::change_fullscreen ()
+{
+  gui_settings settings;
 
-    if (! m_full_screen)
-      {
-        m_prev_floating = isFloating ();
-        m_fullscreen_action->setIcon (settings.icon ("view-restore", false));
-        if (m_prev_floating)
-          m_fullscreen_action->setToolTip (tr ("Restore geometry"));
-        else
-          {
-            m_fullscreen_action->setToolTip (tr ("Redock"));
-            setFloating (true);
-          }
-        m_prev_geom = geometry ();
+  if (! m_full_screen)
+    {
+      m_prev_floating = isFloating ();
+      m_fullscreen_action->setIcon (settings.icon ("view-restore", false));
+      if (m_prev_floating)
+        m_fullscreen_action->setToolTip (tr ("Restore geometry"));
+      else
+        {
+          m_fullscreen_action->setToolTip (tr ("Redock"));
+          setFloating (true);
+        }
+      m_prev_geom = geometry ();
 
-        // showFullscreen() and setWindowState() only work for QWindow objects.
-        QScreen *pscreen = QGuiApplication::primaryScreen ();
-        QRect rect (0, 0, 0, 0);
-        rect = pscreen->availableGeometry ();
-        setGeometry (rect);
+      // showFullscreen() and setWindowState() only work for QWindow objects.
+      QScreen *pscreen = QGuiApplication::primaryScreen ();
+      QRect rect (0, 0, 0, 0);
+      rect = pscreen->availableGeometry ();
+      setGeometry (rect);
 
-        m_full_screen = true;
-      }
-    else
-      {
-        m_fullscreen_action->setIcon (settings.icon ("view-fullscreen", false));
-        setGeometry (m_prev_geom);
-        if (m_prev_floating)
-          m_fullscreen_action->setToolTip (tr (UNDOCKED_FULLSCREEN_BUTTON_TOOLTIP));
-        else
-          {
-            setFloating (false);
-            m_fullscreen_action->setToolTip (tr (DOCKED_FULLSCREEN_BUTTON_TOOLTIP));
-          }
+      m_full_screen = true;
+    }
+  else
+    {
+      m_fullscreen_action->setIcon (settings.icon ("view-fullscreen", false));
+      setGeometry (m_prev_geom);
+      if (m_prev_floating)
+        m_fullscreen_action->setToolTip (tr (UNDOCKED_FULLSCREEN_BUTTON_TOOLTIP));
+      else
+        {
+          setFloating (false);
+          m_fullscreen_action->setToolTip (tr (DOCKED_FULLSCREEN_BUTTON_TOOLTIP));
+        }
 
-        m_full_screen = false;
-      }
+      m_full_screen = false;
+    }
 #undef DOCKED_FULLSCREEN_BUTTON_TOOLTIP
 #undef UNDOCKED_FULLSCREEN_BUTTON_TOOLTIP
-  }
+}
 
-  void
-  variable_dock_widget::closeEvent (QCloseEvent *e)
-  {
-    QDockWidget::closeEvent (e);
-  }
+void
+variable_dock_widget::closeEvent (QCloseEvent *e)
+{
+  QDockWidget::closeEvent (e);
+}
 
-  void
-  variable_dock_widget::handle_focus_change (QWidget *old, QWidget *now)
-  {
-    octave_unused_parameter (now);
+void
+variable_dock_widget::handle_focus_change (QWidget *old, QWidget *now)
+{
+  octave_unused_parameter (now);
 
-    // This is a proxied test
-    if (hasFocus ())
-      {
-        if (old == this)
-          return;
+  // This is a proxied test
+  if (hasFocus ())
+    {
+      if (old == this)
+        return;
 
-        if (titleBarWidget () != nullptr)
-          {
-            QLabel *label = titleBarWidget ()->findChild<QLabel *> ();
-            if (label != nullptr)
-              {
-                label->setBackgroundRole (QPalette::Highlight);
-                label->setStyleSheet ("background-color: palette(highlight); color: palette(highlightedText);");
-              }
-          }
+      if (titleBarWidget () != nullptr)
+        {
+          QLabel *label = titleBarWidget ()->findChild<QLabel *> ();
+          if (label != nullptr)
+            {
+              label->setBackgroundRole (QPalette::Highlight);
+              label->setStyleSheet ("background-color: palette(highlight); color: palette(highlightedText);");
+            }
+        }
 
-        emit variable_focused_signal (objectName ());
-      }
-    else if (old == focusWidget())
-      {
-        if (titleBarWidget () != nullptr)
-          {
-            QLabel *label = titleBarWidget ()->findChild<QLabel *> ();
-            if (label != nullptr)
-              {
-                label->setBackgroundRole (QPalette::NoRole);
-                label->setStyleSheet (";");
-              }
-          }
-      }
-  }
+      emit variable_focused_signal (objectName ());
+    }
+  else if (old == focusWidget())
+    {
+      if (titleBarWidget () != nullptr)
+        {
+          QLabel *label = titleBarWidget ()->findChild<QLabel *> ();
+          if (label != nullptr)
+            {
+              label->setBackgroundRole (QPalette::NoRole);
+              label->setStyleSheet (";");
+            }
+        }
+    }
+}
 
-  void variable_dock_widget::resizeEvent (QResizeEvent *)
-  {
-    if (m_frame)
-      m_frame->resize (size ());
-  }
+void variable_dock_widget::resizeEvent (QResizeEvent *)
+{
+  if (m_frame)
+    m_frame->resize (size ());
+}
 
 // See  Octave bug #53807 and https://bugreports.qt.io/browse/QTBUG-44813
 #if (QT_VERSION >= 0x050302) && (QT_VERSION <= QTBUG_44813_FIX_VERSION)
 
-  bool
-  variable_dock_widget::event (QEvent *event)
-  {
-    // low-level check of whether docked-widget became a window via
-    // via drag-and-drop
-    if (event->type () == QEvent::MouseButtonPress)
-      {
-        m_waiting_for_mouse_move = false;
-        m_waiting_for_mouse_button_release = false;
-      }
-    if (event->type () == QEvent::MouseMove && m_waiting_for_mouse_move)
-      {
-        m_waiting_for_mouse_move = false;
-        m_waiting_for_mouse_button_release = true;
-      }
-    if (event->type () == QEvent::MouseButtonRelease
-        && m_waiting_for_mouse_button_release)
-      {
-        m_waiting_for_mouse_button_release = false;
-        bool retval = QDockWidget::event (event);
-        if (isFloating ())
-          emit queue_unfloat_float ();
-        return retval;
-      }
+bool
+variable_dock_widget::event (QEvent *event)
+{
+  // low-level check of whether docked-widget became a window via
+  // via drag-and-drop
+  if (event->type () == QEvent::MouseButtonPress)
+    {
+      m_waiting_for_mouse_move = false;
+      m_waiting_for_mouse_button_release = false;
+    }
+  if (event->type () == QEvent::MouseMove && m_waiting_for_mouse_move)
+    {
+      m_waiting_for_mouse_move = false;
+      m_waiting_for_mouse_button_release = true;
+    }
+  if (event->type () == QEvent::MouseButtonRelease
+      && m_waiting_for_mouse_button_release)
+    {
+      m_waiting_for_mouse_button_release = false;
+      bool retval = QDockWidget::event (event);
+      if (isFloating ())
+        emit queue_unfloat_float ();
+      return retval;
+    }
 
-    return QDockWidget::event (event);
-  }
+  return QDockWidget::event (event);
+}
 
-  void
-  variable_dock_widget::unfloat_float ()
-  {
-    hide ();
-    setFloating (false);
-    // Avoid a Ubunty Unity issue by queuing this rather than direct.
-    emit queue_float ();
-    m_waiting_for_mouse_move = false;
-    m_waiting_for_mouse_button_release = false;
-  }
+void
+variable_dock_widget::unfloat_float ()
+{
+  hide ();
+  setFloating (false);
+  // Avoid a Ubunty Unity issue by queuing this rather than direct.
+  emit queue_float ();
+  m_waiting_for_mouse_move = false;
+  m_waiting_for_mouse_button_release = false;
+}
 
-  void
-  variable_dock_widget::refloat ()
-  {
-    setFloating (true);
-    m_waiting_for_mouse_move = false;
-    m_waiting_for_mouse_button_release = false;
-    show ();
-    activateWindow ();
-    setFocus ();
-  }
+void
+variable_dock_widget::refloat ()
+{
+  setFloating (true);
+  m_waiting_for_mouse_move = false;
+  m_waiting_for_mouse_button_release = false;
+  show ();
+  activateWindow ();
+  setFocus ();
+}
 
 #else
 
-  void
-  variable_dock_widget::unfloat_float ()
-  { }
+void
+variable_dock_widget::unfloat_float ()
+{ }
 
-  void
-  variable_dock_widget::refloat ()
-  { }
+void
+variable_dock_widget::refloat ()
+{ }
 
 #endif
 
-  // Variable editor stack
+// Variable editor stack
 
-  variable_editor_stack::variable_editor_stack (QWidget *p)
-    : QStackedWidget (p), m_edit_view (new variable_editor_view (this))
-  {
-    setFocusPolicy (Qt::StrongFocus);
+variable_editor_stack::variable_editor_stack (QWidget *p)
+  : QStackedWidget (p), m_edit_view (new variable_editor_view (this))
+{
+  setFocusPolicy (Qt::StrongFocus);
 
-    m_disp_view = make_disp_view (this);
+  m_disp_view = make_disp_view (this);
 
-    addWidget (m_edit_view);
-    addWidget (m_disp_view);
-  }
+  addWidget (m_edit_view);
+  addWidget (m_disp_view);
+}
 
-  QTextEdit *
-  variable_editor_stack::make_disp_view (QWidget *parent)
-  {
-    QTextEdit *viewer = new QTextEdit (parent);
+QTextEdit *
+variable_editor_stack::make_disp_view (QWidget *parent)
+{
+  QTextEdit *viewer = new QTextEdit (parent);
 
-    viewer->setLineWrapMode (QTextEdit::NoWrap);
-    viewer->setReadOnly (true);
+  viewer->setLineWrapMode (QTextEdit::NoWrap);
+  viewer->setReadOnly (true);
 
-    return viewer;
-  }
+  return viewer;
+}
 
-  void
-  variable_editor_stack::set_editable (bool editable)
-  {
-    // The QTableView is for editable data models
-    // and the QTextEdit is for non-editable models.
+void
+variable_editor_stack::set_editable (bool editable)
+{
+  // The QTableView is for editable data models
+  // and the QTextEdit is for non-editable models.
 
-    if (editable)
-      {
-        if (m_edit_view != nullptr)
-          {
-            setCurrentWidget (m_edit_view);
-            setFocusProxy (m_edit_view);
-            m_edit_view->setFocusPolicy (Qt::StrongFocus);
-          }
+  if (editable)
+    {
+      if (m_edit_view != nullptr)
+        {
+          setCurrentWidget (m_edit_view);
+          setFocusProxy (m_edit_view);
+          m_edit_view->setFocusPolicy (Qt::StrongFocus);
+        }
 
-        if (m_disp_view != nullptr)
-          m_disp_view->setFocusPolicy (Qt::NoFocus);
-      }
-    else
-      {
-        if (m_disp_view != nullptr)
-          {
-            setCurrentWidget (m_disp_view);
-            setFocusProxy (m_disp_view);
+      if (m_disp_view != nullptr)
+        m_disp_view->setFocusPolicy (Qt::NoFocus);
+    }
+  else
+    {
+      if (m_disp_view != nullptr)
+        {
+          setCurrentWidget (m_disp_view);
+          setFocusProxy (m_disp_view);
 
-            QAbstractTableModel *model = findChild<QAbstractTableModel *> ();
-            if (model != nullptr)
-              m_disp_view->setPlainText (model->data (QModelIndex ()).toString ());
-            else
-              m_disp_view->setPlainText ("");
-          }
+          QAbstractTableModel *model = findChild<QAbstractTableModel *> ();
+          if (model != nullptr)
+            m_disp_view->setPlainText (model->data (QModelIndex ()).toString ());
+          else
+            m_disp_view->setPlainText ("");
+        }
 
-        if (m_edit_view != nullptr)
-          m_edit_view->setFocusPolicy (Qt::NoFocus);
-      }
-  }
+      if (m_edit_view != nullptr)
+        m_edit_view->setFocusPolicy (Qt::NoFocus);
+    }
+}
 
-  void
-  variable_editor_stack::levelUp ()
-  {
-    if (! hasFocus ())
-      return;
+void
+variable_editor_stack::levelUp ()
+{
+  if (! hasFocus ())
+    return;
 
-    QString name = objectName ();
+  QString name = objectName ();
 
-    // FIXME: Is there a better way?
+  // FIXME: Is there a better way?
 
-    if (name.endsWith (')') || name.endsWith ('}'))
-      {
-        name.remove ( QRegExp ("[({][^({]*[)}]$)") );
-        emit edit_variable_signal (name, octave_value ());
-      }
-  }
+  if (name.endsWith (')') || name.endsWith ('}'))
+    {
+      name.remove ( QRegExp ("[({][^({]*[)}]$)") );
+      emit edit_variable_signal (name, octave_value ());
+    }
+}
 
-  // Slot for saving a variable into a file
-  void
-  variable_editor_stack::save (const QString& format)
-  {
-    if (! hasFocus ())
-      return;
+// Slot for saving a variable into a file
+void
+variable_editor_stack::save (const QString& format)
+{
+  if (! hasFocus ())
+    return;
 
-    // Check whether a format for saving the variable is given
-    QString format_string;
-    if (! format.isEmpty ())
-      {
-        format_string = "-" + format;
-        do_save (format_string, format_string);
-        return;
-      }
+  // Check whether a format for saving the variable is given
+  QString format_string;
+  if (! format.isEmpty ())
+    {
+      format_string = "-" + format;
+      do_save (format_string, format_string);
+      return;
+    }
 
-    // The interpreter_event callback function below emits a signal.
-    // Because we don't control when that happens, use a guarded pointer
-    // so that the callback can abort if this object is no longer valid.
+  // The interpreter_event callback function below emits a signal.
+  // Because we don't control when that happens, use a guarded pointer
+  // so that the callback can abort if this object is no longer valid.
 
-    QPointer<variable_editor_stack> this_ves (this);
+  QPointer<variable_editor_stack> this_ves (this);
 
-    // No format given, test save default options
-    emit interpreter_event
-      ([=] (interpreter& interp)
-        {
-          // INTERPRETER THREAD
+  // No format given, test save default options
+  emit interpreter_event
+    ([=] (interpreter& interp)
+      {
+        // INTERPRETER THREAD
 
-          // We can skip the entire callback function because it does
-          // not make any changes to the interpreter state.
+        // We can skip the entire callback function because it does
+        // not make any changes to the interpreter state.
 
-          if (this_ves.isNull ())
-            return;
+        if (this_ves.isNull ())
+          return;
 
-          octave_value_list argout
-            = Fsave_default_options (interp, octave_value_list (), 1);
-          QString save_opts = QString::fromStdString (argout(0).string_value ());
+        octave_value_list argout
+          = Fsave_default_options (interp, octave_value_list (), 1);
+        QString save_opts = QString::fromStdString (argout(0).string_value ());
 
-          connect (this, &variable_editor_stack::do_save_signal,
-                   this, &variable_editor_stack::do_save);
+        connect (this, &variable_editor_stack::do_save_signal,
+                 this, &variable_editor_stack::do_save);
 
-          emit do_save_signal (format_string, save_opts);
-        });
-  }
+        emit do_save_signal (format_string, save_opts);
+      });
+}
 
-  // Perform saving the variable after desired format is determined
-  void
-  variable_editor_stack::do_save (const QString& format, const QString& save_opts)
-  {
-    QString file_ext = "txt";
-    for (int i = 0; i < ve_save_formats_ext.length ()/2; i++)
-      {
-        if (save_opts.contains (ve_save_formats_ext.at (2*i), Qt::CaseInsensitive))
-          {
-            file_ext = ve_save_formats_ext.at (2*i + 1);
-            break;
-          }
-      }
+// Perform saving the variable after desired format is determined
+void
+variable_editor_stack::do_save (const QString& format, const QString& save_opts)
+{
+  QString file_ext = "txt";
+  for (int i = 0; i < ve_save_formats_ext.length ()/2; i++)
+    {
+      if (save_opts.contains (ve_save_formats_ext.at (2*i), Qt::CaseInsensitive))
+        {
+          file_ext = ve_save_formats_ext.at (2*i + 1);
+          break;
+        }
+    }
 
-    // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
-    int opts = 0;  // No options by default.
+  // FIXME: Remove, if for all common KDE versions (bug #54607) is resolved.
+  int opts = 0;  // No options by default.
 
-    gui_settings settings;
+  gui_settings settings;
 
-    if (! settings.bool_value (global_use_native_dialogs))
-      opts = QFileDialog::DontUseNativeDialog;
+  if (! settings.bool_value (global_use_native_dialogs))
+    opts = QFileDialog::DontUseNativeDialog;
 
-    QString name = objectName ();
-    QString file
-      = QFileDialog::getSaveFileName (this,
-                                      tr ("Save Variable %1 As").arg (name),
-                                      QString ("./%1.%2").arg (name).arg (file_ext),
-                                      0, 0, QFileDialog::Option (opts));
+  QString name = objectName ();
+  QString file
+    = QFileDialog::getSaveFileName (this,
+                                    tr ("Save Variable %1 As").arg (name),
+                                    QString ("./%1.%2").arg (name).arg (file_ext),
+                                    0, 0, QFileDialog::Option (opts));
 
-    if (file.isEmpty ())
-      return; // No file selected: Just return
+  if (file.isEmpty ())
+    return; // No file selected: Just return
 
-    // Let the interpreter thread do the saving
-    emit interpreter_event
-      ([=] (interpreter& interp)
-        {
-          // INTERPRETER THREAD
+  // Let the interpreter thread do the saving
+  emit interpreter_event
+    ([=] (interpreter& interp)
+      {
+        // INTERPRETER THREAD
 
-          octave_value_list ovl;
-          std::list<octave_value> str_list
-                              = {octave_value (file.toStdString ()),
-                                 octave_value (name.toStdString ())};
-          if (! format.isEmpty ())
-            str_list.push_front (octave_value (format.toStdString ()));
+        octave_value_list ovl;
+        std::list<octave_value> str_list
+                            = {octave_value (file.toStdString ()),
+                               octave_value (name.toStdString ())};
+        if (! format.isEmpty ())
+          str_list.push_front (octave_value (format.toStdString ()));
 
-          Fsave (interp, octave_value_list (str_list));
-        });
-  }
+        Fsave (interp, octave_value_list (str_list));
+      });
+}
 
-  // Custom editable variable table view
+// Custom editable variable table view
 
 variable_editor_view::variable_editor_view (QWidget *p)
-    : QTableView (p), m_var_model (nullptr)
-  {
-    setWordWrap (false);
-    setContextMenuPolicy (Qt::CustomContextMenu);
-    setSelectionMode (QAbstractItemView::ContiguousSelection);
+  : QTableView (p), m_var_model (nullptr)
+{
+  setWordWrap (false);
+  setContextMenuPolicy (Qt::CustomContextMenu);
+  setSelectionMode (QAbstractItemView::ContiguousSelection);
 
-    horizontalHeader ()->setContextMenuPolicy (Qt::CustomContextMenu);
-    verticalHeader ()->setContextMenuPolicy (Qt::CustomContextMenu);
+  horizontalHeader ()->setContextMenuPolicy (Qt::CustomContextMenu);
+  verticalHeader ()->setContextMenuPolicy (Qt::CustomContextMenu);
 
-    setHorizontalScrollMode (QAbstractItemView::ScrollPerPixel);
-    setVerticalScrollMode (QAbstractItemView::ScrollPerPixel);
+  setHorizontalScrollMode (QAbstractItemView::ScrollPerPixel);
+  setVerticalScrollMode (QAbstractItemView::ScrollPerPixel);
 
-    verticalHeader ()->setSectionResizeMode (QHeaderView::Interactive);
-  }
+  verticalHeader ()->setSectionResizeMode (QHeaderView::Interactive);
+}
 
-  void
-  variable_editor_view::setModel (QAbstractItemModel *model)
-  {
-    QTableView::setModel (model);
+void
+variable_editor_view::setModel (QAbstractItemModel *model)
+{
+  QTableView::setModel (model);
 
-    horizontalHeader ()->setSectionResizeMode (QHeaderView::Interactive);
+  horizontalHeader ()->setSectionResizeMode (QHeaderView::Interactive);
 
-    m_var_model = parent ()->findChild<variable_editor_model *> ();
+  m_var_model = parent ()->findChild<variable_editor_model *> ();
 
-    if (m_var_model != nullptr && m_var_model->column_width () > 0)
-      {
-        // col_width is in characters.  The font should be a fixed-width
-        // font, so any character will do.  If not, you lose!
+  if (m_var_model != nullptr && m_var_model->column_width () > 0)
+    {
+      // col_width is in characters.  The font should be a fixed-width
+      // font, so any character will do.  If not, you lose!
 
-        QFontMetrics fm (font ());
-        int w = (m_var_model->column_width ()
-                 * qt_fontmetrics_horizontal_advance (fm, '0'));
-        horizontalHeader ()->setDefaultSectionSize (w);
-      }
-  }
+      QFontMetrics fm (font ());
+      int w = (m_var_model->column_width ()
+               * qt_fontmetrics_horizontal_advance (fm, '0'));
+      horizontalHeader ()->setDefaultSectionSize (w);
+    }
+}
 
-  QList<int>
-  variable_editor_view::range_selected ()
-  {
-    QItemSelectionModel *sel = selectionModel ();
+QList<int>
+variable_editor_view::range_selected ()
+{
+  QItemSelectionModel *sel = selectionModel ();
 
-    // Return early if nothing selected.
-    if (! sel->hasSelection ())
-      return QList<int> ();
+  // Return early if nothing selected.
+  if (! sel->hasSelection ())
+    return QList<int> ();
 
-    QList<QModelIndex> indices = sel->selectedIndexes ();
+  QList<QModelIndex> indices = sel->selectedIndexes ();
 
-    // FIXME: Shouldn't this be keyed to octave_idx_type?
+  // FIXME: Shouldn't this be keyed to octave_idx_type?
 
-    int32_t from_row = std::numeric_limits<int32_t>::max ();
-    int32_t to_row = 0;
-    int32_t from_col = std::numeric_limits<int32_t>::max ();
-    int32_t to_col = 0;
+  int32_t from_row = std::numeric_limits<int32_t>::max ();
+  int32_t to_row = 0;
+  int32_t from_col = std::numeric_limits<int32_t>::max ();
+  int32_t to_col = 0;
 
-    for (const auto& idx : indices)
-      {
-        from_row = std::min (from_row, idx.row ());
-        to_row = std::max (to_row, idx.row ());
-        from_col = std::min (from_col, idx.column ());
-        to_col = std::max (to_col, idx.column ());
-      }
+  for (const auto& idx : indices)
+    {
+      from_row = std::min (from_row, idx.row ());
+      to_row = std::max (to_row, idx.row ());
+      from_col = std::min (from_col, idx.column ());
+      to_col = std::max (to_col, idx.column ());
+    }
 
-    QVector<int> vect;
-    vect << from_row + 1 << to_row + 1 << from_col + 1 << to_col + 1;
-    QList<int> range = QList<int>::fromVector(vect);
+  QVector<int> vect;
+  vect << from_row + 1 << to_row + 1 << from_col + 1 << to_col + 1;
+  QList<int> range = QList<int>::fromVector(vect);
 
-    return range;
-  }
+  return range;
+}
 
-  void
-  variable_editor_view::selected_command_requested (const QString& cmd)
-  {
-    if (! hasFocus ())
-      return;
+void
+variable_editor_view::selected_command_requested (const QString& cmd)
+{
+  if (! hasFocus ())
+    return;
 
-    QList<int> range = range_selected ();
-    if (range.isEmpty ())
-      {
-        // Nothing selected, apply print command to all data
-        range << 1 << m_var_model->data_rows ()
-              << 1 << m_var_model->data_columns ();
-      }
+  QList<int> range = range_selected ();
+  if (range.isEmpty ())
+    {
+      // Nothing selected, apply print command to all data
+      range << 1 << m_var_model->data_rows ()
+            << 1 << m_var_model->data_columns ();
+    }
 
-    int s1 = m_var_model->data_rows ();
-    int s2 = m_var_model->data_columns ();
-    if (s1 < range.at (0) || s2 < range.at (2))
-      return; // Selected range does not contain data
+  int s1 = m_var_model->data_rows ();
+  int s2 = m_var_model->data_columns ();
+  if (s1 < range.at (0) || s2 < range.at (2))
+    return; // Selected range does not contain data
 
-    s1 = std::min (s1, range.at (1));
-    s2 = std::min (s2, range.at (3));
+  s1 = std::min (s1, range.at (1));
+  s2 = std::min (s2, range.at (3));
 
-    // Variable with desired range as string
-    QString variable = QString ("%1(%2:%3,%4:%5)")
-                                .arg (objectName ())
-                                .arg (range.at (0)).arg (s1)
-                                .arg (range.at (2)).arg (s2);
+  // Variable with desired range as string
+  QString variable = QString ("%1(%2:%3,%4:%5)")
+                              .arg (objectName ())
+                              .arg (range.at (0)).arg (s1)
+                              .arg (range.at (2)).arg (s2);
 
-    // Desired command as string
-    QString command;
-    if (cmd == "create")
-      command = QString ("unnamed = %1;").arg (variable);
-    else
-      command = QString ("figure (); %1 (%2); title ('%2');")
-                          .arg (cmd).arg (variable);
+  // Desired command as string
+  QString command;
+  if (cmd == "create")
+    command = QString ("unnamed = %1;").arg (variable);
+  else
+    command = QString ("figure (); %1 (%2); title ('%2');")
+                        .arg (cmd).arg (variable);
 
-    emit command_signal (command);
-  }
+  emit command_signal (command);
+}
 
-  void
-  variable_editor_view::add_edit_actions (QMenu *menu,
-                                          const QString& qualifier_string)
-  {
-    gui_settings settings;
+void
+variable_editor_view::add_edit_actions (QMenu *menu,
+                                        const QString& qualifier_string)
+{
+  gui_settings settings;
 
-    menu->addAction (settings.icon ("edit-cut"),
-                     tr ("Cut") + qualifier_string,
-                     this, &variable_editor_view::cutClipboard);
+  menu->addAction (settings.icon ("edit-cut"),
+                   tr ("Cut") + qualifier_string,
+                   this, &variable_editor_view::cutClipboard);
 
-    menu->addAction (settings.icon ("edit-copy"),
-                     tr ("Copy") + qualifier_string,
-                     this, &variable_editor_view::copyClipboard);
+  menu->addAction (settings.icon ("edit-copy"),
+                   tr ("Copy") + qualifier_string,
+                   this, &variable_editor_view::copyClipboard);
 
-    menu->addAction (settings.icon ("edit-paste"),
-                     tr ("Paste"),
-                     this, &variable_editor_view::pasteClipboard);
+  menu->addAction (settings.icon ("edit-paste"),
+                   tr ("Paste"),
+                   this, &variable_editor_view::pasteClipboard);
 
-    menu->addSeparator ();
+  menu->addSeparator ();
 
-    menu->addAction (settings.icon ("edit-delete"),
-                     tr ("Clear") + qualifier_string,
-                     this, &variable_editor_view::clearContent);
+  menu->addAction (settings.icon ("edit-delete"),
+                   tr ("Clear") + qualifier_string,
+                   this, &variable_editor_view::clearContent);
 
-    menu->addAction (settings.icon ("edit-delete"),
-                     tr ("Delete") + qualifier_string,
-                     this, &variable_editor_view::delete_selected);
+  menu->addAction (settings.icon ("edit-delete"),
+                   tr ("Delete") + qualifier_string,
+                   this, &variable_editor_view::delete_selected);
 
-    menu->addAction (settings.icon ("document-new"),
-                     tr ("Variable from Selection"),
-                     this, &variable_editor_view::createVariable);
-  }
+  menu->addAction (settings.icon ("document-new"),
+                   tr ("Variable from Selection"),
+                   this, &variable_editor_view::createVariable);
+}
 
-  void
-  variable_editor_view::createContextMenu (const QPoint& qpos)
-  {
-    QModelIndex index = indexAt (qpos);
+void
+variable_editor_view::createContextMenu (const QPoint& qpos)
+{
+  QModelIndex index = indexAt (qpos);
 
-    if (index.isValid ())
-      {
-        QMenu *menu = new QMenu (this);
+  if (index.isValid ())
+    {
+      QMenu *menu = new QMenu (this);
 
-        add_edit_actions (menu, tr (""));
+      add_edit_actions (menu, tr (""));
 
-        // FIXME: addAction for sort?
-        // FIXME: Add icon for transpose.
+      // FIXME: addAction for sort?
+      // FIXME: Add icon for transpose.
 
-        menu->addAction (tr ("Transpose"),
-                         this, &variable_editor_view::transposeContent);
+      menu->addAction (tr ("Transpose"),
+                       this, &variable_editor_view::transposeContent);
 
-        QItemSelectionModel *sel = selectionModel ();
+      QItemSelectionModel *sel = selectionModel ();
 
-        QList<QModelIndex> indices = sel->selectedIndexes ();
+      QList<QModelIndex> indices = sel->selectedIndexes ();
 
-        if (! indices.isEmpty ())
-          {
-            menu->addSeparator ();
+      if (! indices.isEmpty ())
+        {
+          menu->addSeparator ();
 
-            QSignalMapper *plot_mapper = make_plot_mapper (menu);
+          QSignalMapper *plot_mapper = make_plot_mapper (menu);
 
-            connect (plot_mapper, SIGNAL (mapped (const QString&)),
-                     this, SLOT (selected_command_requested (const QString&)));
-          }
+          connect (plot_mapper, SIGNAL (mapped (const QString&)),
+                   this, SLOT (selected_command_requested (const QString&)));
+        }
 
-        menu->exec (mapToGlobal (qpos));
-      }
-  }
+      menu->exec (mapToGlobal (qpos));
+    }
+}
 
-  void
-  variable_editor_view::createColumnMenu (const QPoint& pt)
-  {
-    int index = horizontalHeader ()->logicalIndexAt (pt);
+void
+variable_editor_view::createColumnMenu (const QPoint& pt)
+{
+  int index = horizontalHeader ()->logicalIndexAt (pt);
 
-    if (index < 0 || index > model ()->columnCount ())
-      return;
+  if (index < 0 || index > model ()->columnCount ())
+    return;
 
-    QList<int> coords = range_selected ();
+  QList<int> coords = range_selected ();
 
-    bool nothingSelected = coords.isEmpty ();
+  bool nothingSelected = coords.isEmpty ();
 
-    bool whole_columns_selected
-      =  (nothingSelected
-          ? false
-          : (coords[0] == 1 && coords[1] == model ()->rowCount ()));
+  bool whole_columns_selected
+    =  (nothingSelected
+        ? false
+        : (coords[0] == 1 && coords[1] == model ()->rowCount ()));
 
-    bool current_column_selected
-      = nothingSelected ? false : (coords[2] <= index+1 && coords[3] > index);
+  bool current_column_selected
+    = nothingSelected ? false : (coords[2] <= index+1 && coords[3] > index);
 
-    int column_selection_count
-      = nothingSelected ? 0 : (coords[3] - coords[2] + 1);
+  int column_selection_count
+    = nothingSelected ? 0 : (coords[3] - coords[2] + 1);
 
-    if (! whole_columns_selected || ! current_column_selected)
-      {
-        selectColumn (index);
-        column_selection_count = 1;
-      }
+  if (! whole_columns_selected || ! current_column_selected)
+    {
+      selectColumn (index);
+      column_selection_count = 1;
+    }
 
-    QString column_string
-      = column_selection_count > 1 ? tr (" columns") : tr (" column");
+  QString column_string
+    = column_selection_count > 1 ? tr (" columns") : tr (" column");
 
-    QMenu *menu = new QMenu (this);
+  QMenu *menu = new QMenu (this);
 
-    add_edit_actions (menu, column_string);
+  add_edit_actions (menu, column_string);
 
-    menu->addSeparator ();
+  menu->addSeparator ();
 
-    QSignalMapper *plot_mapper = make_plot_mapper (menu);
+  QSignalMapper *plot_mapper = make_plot_mapper (menu);
 
-    connect (plot_mapper, SIGNAL (mapped (const QString&)),
-             this, SLOT (selected_command_requested (const QString&)));
+  connect (plot_mapper, SIGNAL (mapped (const QString&)),
+           this, SLOT (selected_command_requested (const QString&)));
 
-    QPoint menupos = pt;
-    menupos.setY (horizontalHeader ()->height ());
+  QPoint menupos = pt;
+  menupos.setY (horizontalHeader ()->height ());
 
-    menu->exec (mapToGlobal (menupos));
-  }
+  menu->exec (mapToGlobal (menupos));
+}
 
-  void
-  variable_editor_view::createRowMenu (const QPoint& pt)
-  {
-    int index = verticalHeader ()->logicalIndexAt (pt);
+void
+variable_editor_view::createRowMenu (const QPoint& pt)
+{
+  int index = verticalHeader ()->logicalIndexAt (pt);
 
-    if (index < 0 || index > model ()->columnCount ())
-      return;
+  if (index < 0 || index > model ()->columnCount ())
+    return;
 
-    QList<int> coords = range_selected ();
+  QList<int> coords = range_selected ();
 
-    bool nothingSelected = coords.isEmpty ();
+  bool nothingSelected = coords.isEmpty ();
 
-    bool whole_rows_selected
-      = (nothingSelected
-         ? false
-         : (coords[2] == 1 && coords[3] == model ()->columnCount ()));
+  bool whole_rows_selected
+    = (nothingSelected
+       ? false
+       : (coords[2] == 1 && coords[3] == model ()->columnCount ()));
 
-    bool current_row_selected
-      = (nothingSelected ? false : (coords[0] <= index+1 && coords[1] > index));
+  bool current_row_selected
+    = (nothingSelected ? false : (coords[0] <= index+1 && coords[1] > index));
 
-    int rowselection_count = nothingSelected ? 0 : (coords[3] - coords[2] + 1);
+  int rowselection_count = nothingSelected ? 0 : (coords[3] - coords[2] + 1);
 
-    if (! whole_rows_selected || ! current_row_selected)
-      {
-        selectRow (index);
-        rowselection_count = 1;
-      }
+  if (! whole_rows_selected || ! current_row_selected)
+    {
+      selectRow (index);
+      rowselection_count = 1;
+    }
 
-    QString row_string = rowselection_count > 1 ? tr (" rows") : tr (" row");
+  QString row_string = rowselection_count > 1 ? tr (" rows") : tr (" row");
 
-    QMenu *menu = new QMenu (this);
+  QMenu *menu = new QMenu (this);
 
-    add_edit_actions (menu, row_string);
+  add_edit_actions (menu, row_string);
 
-    menu->addSeparator ();
+  menu->addSeparator ();
 
-    QSignalMapper *plot_mapper = make_plot_mapper (menu);
+  QSignalMapper *plot_mapper = make_plot_mapper (menu);
 
-    connect (plot_mapper, SIGNAL (mapped (const QString&)),
-             this, SLOT (selected_command_requested (const QString&)));
+  connect (plot_mapper, SIGNAL (mapped (const QString&)),
+           this, SLOT (selected_command_requested (const QString&)));
 
-    QPoint menupos = pt;
-    menupos.setX (verticalHeader ()->width ());
+  QPoint menupos = pt;
+  menupos.setX (verticalHeader ()->width ());
 
-    // FIXME: What was the intent here?
-    // setY (verticalHeader ()->sectionPosition (index+1) +
-    //       verticalHeader ()->sectionSize (index));
+  // FIXME: What was the intent here?
+  // setY (verticalHeader ()->sectionPosition (index+1) +
+  //       verticalHeader ()->sectionSize (index));
 
-    menu->exec (mapToGlobal (menupos));
-  }
+  menu->exec (mapToGlobal (menupos));
+}
 
-  void
-  variable_editor_view::createVariable ()
-  {
-    // FIXME: Create unnamed1..n if exist ('unnamed', 'var') is true.
+void
+variable_editor_view::createVariable ()
+{
+  // FIXME: Create unnamed1..n if exist ('unnamed', 'var') is true.
 
-    selected_command_requested ("create");
-  }
+  selected_command_requested ("create");
+}
 
-  void
-  variable_editor_view::transposeContent ()
-  {
-    if (! hasFocus ())
-      return;
+void
+variable_editor_view::transposeContent ()
+{
+  if (! hasFocus ())
+    return;
 
-    emit command_signal (QString ("%1 = %1';").arg (objectName ()));
-  }
+  emit command_signal (QString ("%1 = %1';").arg (objectName ()));
+}
 
-  void
-  variable_editor_view::delete_selected ()
-  {
-    if (! hasFocus ())
-      return;
+void
+variable_editor_view::delete_selected ()
+{
+  if (! hasFocus ())
+    return;
 
-    QAbstractItemModel *mod = model ();
-    QList<int> coords = range_selected ();
+  QAbstractItemModel *mod = model ();
+  QList<int> coords = range_selected ();
 
-    if (coords.isEmpty ())
-      return;
+  if (coords.isEmpty ())
+    return;
 
-    bool whole_columns_selected
-      = coords[0] == 1 && coords[1] == mod->rowCount ();
+  bool whole_columns_selected
+    = coords[0] == 1 && coords[1] == mod->rowCount ();
 
-    bool whole_rows_selected
-      = coords[2] == 1 && coords[3] == mod->columnCount ();
+  bool whole_rows_selected
+    = coords[2] == 1 && coords[3] == mod->columnCount ();
 
-    // Must be deleting whole columns or whole rows, and not the whole thing.
+  // Must be deleting whole columns or whole rows, and not the whole thing.
 
-    if (whole_columns_selected == whole_rows_selected)
-      return;
+  if (whole_columns_selected == whole_rows_selected)
+    return;
 
-    if (whole_rows_selected)
-      mod->removeRows (coords[0], coords[1] - coords[0]);
+  if (whole_rows_selected)
+    mod->removeRows (coords[0], coords[1] - coords[0]);
 
-    if (whole_columns_selected)
-      mod->removeColumns (coords[2], coords[3] - coords[2]);
-  }
+  if (whole_columns_selected)
+    mod->removeColumns (coords[2], coords[3] - coords[2]);
+}
 
-  void
-  variable_editor_view::clearContent ()
-  {
-    if (! hasFocus ())
-      return;
+void
+variable_editor_view::clearContent ()
+{
+  if (! hasFocus ())
+    return;
 
-    if (m_var_model == nullptr)
-      return;
+  if (m_var_model == nullptr)
+    return;
 
-    QItemSelectionModel *sel = selectionModel ();
-    QList<QModelIndex> indices = sel->selectedIndexes ();
+  QItemSelectionModel *sel = selectionModel ();
+  QList<QModelIndex> indices = sel->selectedIndexes ();
 
-    // FIXME: Use [] for empty cells?
+  // FIXME: Use [] for empty cells?
 
-    for (const auto& idx : indices)
-      m_var_model->clear_content (idx);
-  }
+  for (const auto& idx : indices)
+    m_var_model->clear_content (idx);
+}
 
-  void
-  variable_editor_view::cutClipboard ()
-  {
-    copyClipboard ();
+void
+variable_editor_view::cutClipboard ()
+{
+  copyClipboard ();
 
-    clearContent ();
-  }
+  clearContent ();
+}
 
-  void
-  variable_editor_view::copyClipboard ()
-  {
-    if (! hasFocus ())
-      return;
+void
+variable_editor_view::copyClipboard ()
+{
+  if (! hasFocus ())
+    return;
 
-    QItemSelectionModel *sel = selectionModel ();
-    QList<QModelIndex> indices = sel->selectedIndexes ();
-    std::sort (indices.begin (), indices.end ());
+  QItemSelectionModel *sel = selectionModel ();
+  QList<QModelIndex> indices = sel->selectedIndexes ();
+  std::sort (indices.begin (), indices.end ());
 
-    if (indices.isEmpty ())
-      return;
+  if (indices.isEmpty ())
+    return;
 
-    // Convert selected items into TSV format and copy that.
-    // Spreadsheet tools should understand that.
+  // Convert selected items into TSV format and copy that.
+  // Spreadsheet tools should understand that.
 
-    QAbstractItemModel *mod = model ();
-    QModelIndex previous = indices.first ();
-    QString copy = mod->data (previous).toString ();
-    indices.removeFirst ();
-    for (auto idx : indices)
-      {
-        copy.push_back (previous.row () != idx.row () ? '\n' : '\t');
-        copy.append (mod->data (idx).toString ());
-        previous = idx;
-      }
+  QAbstractItemModel *mod = model ();
+  QModelIndex previous = indices.first ();
+  QString copy = mod->data (previous).toString ();
+  indices.removeFirst ();
+  for (auto idx : indices)
+    {
+      copy.push_back (previous.row () != idx.row () ? '\n' : '\t');
+      copy.append (mod->data (idx).toString ());
+      previous = idx;
+    }
 
-    QClipboard *clipboard = QApplication::clipboard ();
-    clipboard->setText (copy);
-  }
+  QClipboard *clipboard = QApplication::clipboard ();
+  clipboard->setText (copy);
+}
 
-  void
-  variable_editor_view::pasteClipboard ()
-  {
-    if (! hasFocus ())
-      return;
+void
+variable_editor_view::pasteClipboard ()
+{
+  if (! hasFocus ())
+    return;
 
-    QAbstractItemModel *mod = model ();
-    QItemSelectionModel *sel = selectionModel ();
-    QList<QModelIndex> indices = sel->selectedIndexes ();
+  QAbstractItemModel *mod = model ();
+  QItemSelectionModel *sel = selectionModel ();
+  QList<QModelIndex> indices = sel->selectedIndexes ();
 
-    QClipboard *clipboard = QApplication::clipboard ();
-    QString text = clipboard->text ();
+  QClipboard *clipboard = QApplication::clipboard ();
+  QString text = clipboard->text ();
 
-    QPoint start, end;
+  QPoint start, end;
 
-    QPoint tabsize = QPoint (mod->rowCount (), mod->columnCount ());
+  QPoint tabsize = QPoint (mod->rowCount (), mod->columnCount ());
 
-    if (indices.isEmpty ())
-      {
-        start = QPoint (0, 0);
-        end = tabsize;
-      }
-    else if (indices.size () == 1)
-      {
-        start = QPoint (indices[0].row (), indices[0].column ());
-        end = tabsize;
-      }
-    else
-      {
-        end = QPoint (0, 0);
-        start = tabsize;
+  if (indices.isEmpty ())
+    {
+      start = QPoint (0, 0);
+      end = tabsize;
+    }
+  else if (indices.size () == 1)
+    {
+      start = QPoint (indices[0].row (), indices[0].column ());
+      end = tabsize;
+    }
+  else
+    {
+      end = QPoint (0, 0);
+      start = tabsize;
 
-        for (int i = 0; i < indices.size (); i++)
-          {
-            if (indices[i].column () < start.y ())
-              start.setY (indices[i].column ());
+      for (int i = 0; i < indices.size (); i++)
+        {
+          if (indices[i].column () < start.y ())
+            start.setY (indices[i].column ());
 
-            if (indices[i].column () > end.y ())
-              end.setY (indices[i].column ());
+          if (indices[i].column () > end.y ())
+            end.setY (indices[i].column ());
 
-            if (indices[i].row () < start.x ())
-              start.setX (indices[i].column ());
+          if (indices[i].row () < start.x ())
+            start.setX (indices[i].column ());
 
-            if (indices[i].row () > end.x ())
-              end.setX (indices[i].column ());
-          }
-      }
+          if (indices[i].row () > end.x ())
+            end.setX (indices[i].column ());
+        }
+    }
 
-    int rownum = 0;
-    int colnum = 0;
+  int rownum = 0;
+  int colnum = 0;
 
-    QStringList rows = text.split ('\n');
-    for (const auto& row : rows)
-      {
-        if (rownum > end.x () - start.x ())
-          continue;
+  QStringList rows = text.split ('\n');
+  for (const auto& row : rows)
+    {
+      if (rownum > end.x () - start.x ())
+        continue;
 
-        QStringList cols = row.split ('\t');
-        if (cols.isEmpty ())
-          continue;
+      QStringList cols = row.split ('\t');
+      if (cols.isEmpty ())
+        continue;
 
-        for (const auto& col : cols)
-          {
-            if (col.isEmpty ())
-              continue;
-            if (colnum > end.y () - start.y () )
-              continue;
+      for (const auto& col : cols)
+        {
+          if (col.isEmpty ())
+            continue;
+          if (colnum > end.y () - start.y () )
+            continue;
 
-            mod->setData (mod->index (rownum + start.x (),
-                                      colnum + start.y ()),
-                          QVariant (col));
+          mod->setData (mod->index (rownum + start.x (),
+                                    colnum + start.y ()),
+                        QVariant (col));
 
-            colnum++;
-          }
+          colnum++;
+        }
 
-        colnum = 0;
-        rownum++;
-      }
-  }
+      colnum = 0;
+      rownum++;
+    }
+}
 
-  void
-  variable_editor_view::handle_horizontal_scroll_action (int action)
-  {
-    if (action == QAbstractSlider::SliderSingleStepAdd
-        || action == QAbstractSlider::SliderPageStepAdd
-        || action == QAbstractSlider::SliderToMaximum
-        || action == QAbstractSlider::SliderMove)
-      {
-        if (m_var_model != nullptr)
-          {
-            QScrollBar *sb = horizontalScrollBar ();
+void
+variable_editor_view::handle_horizontal_scroll_action (int action)
+{
+  if (action == QAbstractSlider::SliderSingleStepAdd
+      || action == QAbstractSlider::SliderPageStepAdd
+      || action == QAbstractSlider::SliderToMaximum
+      || action == QAbstractSlider::SliderMove)
+    {
+      if (m_var_model != nullptr)
+        {
+          QScrollBar *sb = horizontalScrollBar ();
 
-            if (sb && sb->value () == sb->maximum ())
-              {
-                int new_cols = m_var_model->display_columns () + 16;
+          if (sb && sb->value () == sb->maximum ())
+            {
+              int new_cols = m_var_model->display_columns () + 16;
 
-                m_var_model->maybe_resize_columns (new_cols);
-              }
-          }
-      }
-  }
+              m_var_model->maybe_resize_columns (new_cols);
+            }
+        }
+    }
+}
 
-  void
-  variable_editor_view::handle_vertical_scroll_action (int action)
-  {
-    if (action == QAbstractSlider::SliderSingleStepAdd
-        || action == QAbstractSlider::SliderPageStepAdd
-        || action == QAbstractSlider::SliderToMaximum
-        || action == QAbstractSlider::SliderMove)
-      {
-        if (m_var_model != nullptr)
-          {
-            QScrollBar *sb = verticalScrollBar ();
+void
+variable_editor_view::handle_vertical_scroll_action (int action)
+{
+  if (action == QAbstractSlider::SliderSingleStepAdd
+      || action == QAbstractSlider::SliderPageStepAdd
+      || action == QAbstractSlider::SliderToMaximum
+      || action == QAbstractSlider::SliderMove)
+    {
+      if (m_var_model != nullptr)
+        {
+          QScrollBar *sb = verticalScrollBar ();
 
-            if (sb && sb->value () == sb->maximum ())
-              {
-                int new_rows = m_var_model->display_rows () + 16;
+          if (sb && sb->value () == sb->maximum ())
+            {
+              int new_rows = m_var_model->display_rows () + 16;
 
-                m_var_model->maybe_resize_rows (new_rows);
-              }
-          }
-      }
-  }
+              m_var_model->maybe_resize_rows (new_rows);
+            }
+        }
+    }
+}
 
-  // Gadgets for focus restoration
+// Gadgets for focus restoration
 
-  HoverToolButton::HoverToolButton (QWidget *parent)
-    : QToolButton (parent)
-  {
-    installEventFilter (this);
-  }
+HoverToolButton::HoverToolButton (QWidget *parent)
+  : QToolButton (parent)
+{
+  installEventFilter (this);
+}
 
-  bool HoverToolButton::eventFilter (QObject *obj, QEvent *ev)
-  {
-    if (ev->type () == QEvent::HoverEnter)
-      emit hovered_signal ();
-    else if (ev->type () == QEvent::MouseButtonPress)
-      emit popup_shown_signal ();
+bool HoverToolButton::eventFilter (QObject *obj, QEvent *ev)
+{
+  if (ev->type () == QEvent::HoverEnter)
+    emit hovered_signal ();
+  else if (ev->type () == QEvent::MouseButtonPress)
+    emit popup_shown_signal ();
 
-    return QToolButton::eventFilter (obj, ev);
-  }
+  return QToolButton::eventFilter (obj, ev);
+}
 
-  ReturnFocusToolButton::ReturnFocusToolButton (QWidget *parent)
-    : HoverToolButton (parent)
-  {
-    installEventFilter (this);
-  }
+ReturnFocusToolButton::ReturnFocusToolButton (QWidget *parent)
+  : HoverToolButton (parent)
+{
+  installEventFilter (this);
+}
 
-  bool ReturnFocusToolButton::eventFilter (QObject *obj, QEvent *ev)
-  {
+bool ReturnFocusToolButton::eventFilter (QObject *obj, QEvent *ev)
+{
 
-    if (ev->type () == QEvent::MouseButtonRelease && isDown ())
-      {
-        emit about_to_activate ();
+  if (ev->type () == QEvent::MouseButtonRelease && isDown ())
+    {
+      emit about_to_activate ();
 
-        setDown (false);
-        QAction *action = defaultAction ();
-        if (action != nullptr)
-          action->activate (QAction::Trigger);
+      setDown (false);
+      QAction *action = defaultAction ();
+      if (action != nullptr)
+        action->activate (QAction::Trigger);
 
-        return true;
-      }
+      return true;
+    }
 
-    return HoverToolButton::eventFilter (obj, ev);
-  }
+  return HoverToolButton::eventFilter (obj, ev);
+}
 
-  ReturnFocusMenu::ReturnFocusMenu (QWidget *parent)
-    : QMenu (parent)
-  {
-    installEventFilter (this);
-  }
+ReturnFocusMenu::ReturnFocusMenu (QWidget *parent)
+  : QMenu (parent)
+{
+  installEventFilter (this);
+}
 
-  bool ReturnFocusMenu::eventFilter (QObject *obj, QEvent *ev)
-  {
-    if (ev->type () == QEvent::MouseButtonRelease && underMouse ())
-      {
-        emit about_to_activate ();
-      }
+bool ReturnFocusMenu::eventFilter (QObject *obj, QEvent *ev)
+{
+  if (ev->type () == QEvent::MouseButtonRelease && underMouse ())
+    {
+      emit about_to_activate ();
+    }
 
-    return QMenu::eventFilter (obj, ev);
-  }
+  return QMenu::eventFilter (obj, ev);
+}
 
-  // Variable editor.
+// Variable editor.
 
-  variable_editor::variable_editor (QWidget *p)
-    : octave_dock_widget ("VariableEditor", p),
-      m_main (new dw_main_window ()),
-      m_tool_bar (new QToolBar (m_main)),
-      m_default_width (30),
-      m_default_height (100),
-      m_add_font_height (0),
-      m_use_terminal_font (true),
-      m_alternate_rows (true),
-      m_stylesheet (""),
-      m_font (),
-      m_sel_font (),
-      m_table_colors (),
-      m_current_focus_vname (""),
-      m_hovered_focus_vname (""),
-      m_plot_mapper (nullptr),
-      m_focus_widget (nullptr),
-      m_focus_widget_vdw (nullptr)
-  {
-    set_title (tr ("Variable Editor"));
-    setStatusTip (tr ("Edit variables."));
-    setAttribute (Qt::WA_AlwaysShowToolTips);
+variable_editor::variable_editor (QWidget *p)
+  : octave_dock_widget ("VariableEditor", p),
+    m_main (new dw_main_window ()),
+    m_tool_bar (new QToolBar (m_main)),
+    m_default_width (30),
+    m_default_height (100),
+    m_add_font_height (0),
+    m_use_terminal_font (true),
+    m_alternate_rows (true),
+    m_stylesheet (""),
+    m_font (),
+    m_sel_font (),
+    m_table_colors (),
+    m_current_focus_vname (""),
+    m_hovered_focus_vname (""),
+    m_plot_mapper (nullptr),
+    m_focus_widget (nullptr),
+    m_focus_widget_vdw (nullptr)
+{
+  set_title (tr ("Variable Editor"));
+  setStatusTip (tr ("Edit variables."));
+  setAttribute (Qt::WA_AlwaysShowToolTips);
 
-    m_main->setParent (this);
+  m_main->setParent (this);
 // See Octave bug #53409 and https://bugreports.qt.io/browse/QTBUG-55357
 #if (QT_VERSION < 0x050601) || (QT_VERSION >= 0x050701)
-    m_main->setDockOptions (QMainWindow::AnimatedDocks |
-                            QMainWindow::AllowNestedDocks |
-                            QMainWindow::VerticalTabs);
+  m_main->setDockOptions (QMainWindow::AnimatedDocks |
+                          QMainWindow::AllowNestedDocks |
+                          QMainWindow::VerticalTabs);
 #else
-    m_main->setDockNestingEnabled (true);
+  m_main->setDockNestingEnabled (true);
 #endif
 
-    // Tool Bar.
+  // Tool Bar.
 
-    construct_tool_bar ();
-    m_main->addToolBar (m_tool_bar);
+  construct_tool_bar ();
+  m_main->addToolBar (m_tool_bar);
 
-    // Colors.
+  // Colors.
 
-    for (int i = 0; i < ve_colors_count; i++)
-      m_table_colors.append (QColor (Qt::white));
+  for (int i = 0; i < ve_colors_count; i++)
+    m_table_colors.append (QColor (Qt::white));
 
-    // Use an MDI area that is shrunk to nothing as the central widget.
-    // Future feature might be to switch to MDI mode in which the dock
-    // area is shrunk to nothing and the widgets live in the MDI window.
+  // Use an MDI area that is shrunk to nothing as the central widget.
+  // Future feature might be to switch to MDI mode in which the dock
+  // area is shrunk to nothing and the widgets live in the MDI window.
 
-    QMdiArea *central_mdiarea = new QMdiArea (m_main);
-    central_mdiarea->setMinimumSize (QSize (0, 0));
-    central_mdiarea->setMaximumSize (QSize (0, 0));
-    central_mdiarea->resize (QSize (0, 0));
-    m_main->setCentralWidget (central_mdiarea);
+  QMdiArea *central_mdiarea = new QMdiArea (m_main);
+  central_mdiarea->setMinimumSize (QSize (0, 0));
+  central_mdiarea->setMaximumSize (QSize (0, 0));
+  central_mdiarea->resize (QSize (0, 0));
+  m_main->setCentralWidget (central_mdiarea);
 
-    setWidget (m_main);
+  setWidget (m_main);
 
-    if (! p)
-      make_window ();
-  }
+  if (! p)
+    make_window ();
+}
 
-  void variable_editor::focusInEvent (QFocusEvent *ev)
-  {
-    octave_dock_widget::focusInEvent (ev);
+void variable_editor::focusInEvent (QFocusEvent *ev)
+{
+  octave_dock_widget::focusInEvent (ev);
 
-    // set focus to the current variable or most recent if still valid
-    if (m_focus_widget != nullptr)
-      {
-        // Activating a floating window causes problems.
-        if (! m_focus_widget_vdw->isFloating ())
+  // set focus to the current variable or most recent if still valid
+  if (m_focus_widget != nullptr)
+    {
+      // Activating a floating window causes problems.
+      if (! m_focus_widget_vdw->isFloating ())
+        activateWindow ();
+      m_focus_widget->setFocus ();
+    }
+  else
+    {
+      QWidget *fw = m_main->focusWidget ();
+      if (fw != nullptr)
+        {
           activateWindow ();
-        m_focus_widget->setFocus ();
-      }
-    else
-      {
-        QWidget *fw = m_main->focusWidget ();
-        if (fw != nullptr)
-          {
-            activateWindow ();
-            fw->setFocus ();
-          }
-        else
-          {
-            QDockWidget *any_qdw = m_main->findChild<QDockWidget *> ();
-            if (any_qdw != nullptr)
-              {
-                activateWindow ();
-                any_qdw->setFocus ();
-              }
-            else
-              setFocus();
-          }
-      }
-  }
+          fw->setFocus ();
+        }
+      else
+        {
+          QDockWidget *any_qdw = m_main->findChild<QDockWidget *> ();
+          if (any_qdw != nullptr)
+            {
+              activateWindow ();
+              any_qdw->setFocus ();
+            }
+          else
+            setFocus();
+        }
+    }
+}
 
-  variable_editor::~variable_editor ()
-  {
-    // FIXME: Maybe toolbar actions could be handled with signals and
-    // slots so that deleting the toolbar here would disconnect all
-    // toolbar actions and any other slots that might try to access the
-    // toolbar would work properly (I'm looking at you,
-    // handle_focus_change).
+variable_editor::~variable_editor ()
+{
+  // FIXME: Maybe toolbar actions could be handled with signals and
+  // slots so that deleting the toolbar here would disconnect all
+  // toolbar actions and any other slots that might try to access the
+  // toolbar would work properly (I'm looking at you,
+  // handle_focus_change).
 
-    delete m_tool_bar;
-    m_tool_bar = nullptr;
-  }
+  delete m_tool_bar;
+  m_tool_bar = nullptr;
+}
 
-  void
-  variable_editor::edit_variable (const QString& name, const octave_value& val)
-  {
-    if (m_stylesheet.isEmpty ())
-      notice_settings ();
+void
+variable_editor::edit_variable (const QString& name, const octave_value& val)
+{
+  if (m_stylesheet.isEmpty ())
+    notice_settings ();
 
-    QDockWidget *existing_qdw = m_main->findChild<QDockWidget *> (name);
-    if (existing_qdw)
-      {
-        // Already open.
+  QDockWidget *existing_qdw = m_main->findChild<QDockWidget *> (name);
+  if (existing_qdw)
+    {
+      // Already open.
 
-        // Put current focused variable out of focus
-        if (m_main->focusWidget () != nullptr)
-          {
-            QFocusEvent event (QEvent::FocusOut, Qt::OtherFocusReason);
-            QApplication::sendEvent (m_main->focusWidget (), &event);
-          }
+      // Put current focused variable out of focus
+      if (m_main->focusWidget () != nullptr)
+        {
+          QFocusEvent event (QEvent::FocusOut, Qt::OtherFocusReason);
+          QApplication::sendEvent (m_main->focusWidget (), &event);
+        }
 
-        // Put existing variable in focus and raise
-        m_main->parentWidget ()->show ();
-        existing_qdw->show ();
-        existing_qdw->raise ();
-        existing_qdw->activateWindow ();
-        tab_to_front ();
-        existing_qdw->setFocus ();
+      // Put existing variable in focus and raise
+      m_main->parentWidget ()->show ();
+      existing_qdw->show ();
+      existing_qdw->raise ();
+      existing_qdw->activateWindow ();
+      tab_to_front ();
+      existing_qdw->setFocus ();
 
-        return;
-      }
+      return;
+    }
 
-    variable_dock_widget *page = new variable_dock_widget (this);
+  variable_dock_widget *page = new variable_dock_widget (this);
 
-    page->setObjectName (name);
-    m_main->addDockWidget (Qt::LeftDockWidgetArea, page);
+  page->setObjectName (name);
+  m_main->addDockWidget (Qt::LeftDockWidgetArea, page);
 
-    // The old-style signal/slot connection appears to be needed here to
-    // prevent a crash when closing a variable_dock_widget object.
-    connect (qApp, SIGNAL (focusChanged (QWidget *, QWidget *)),
-             page, SLOT (handle_focus_change (QWidget *, QWidget *)));
+  // The old-style signal/slot connection appears to be needed here to
+  // prevent a crash when closing a variable_dock_widget object.
+  connect (qApp, SIGNAL (focusChanged (QWidget *, QWidget *)),
+           page, SLOT (handle_focus_change (QWidget *, QWidget *)));
 
-    connect (this, &variable_editor::visibilityChanged,
-             page, &variable_dock_widget::setVisible);
+  connect (this, &variable_editor::visibilityChanged,
+           page, &variable_dock_widget::setVisible);
 
-    // Notify the variable editor for page actions.
-    connect (page, &variable_dock_widget::destroyed,
-             this, &variable_editor::variable_destroyed);
-    connect (page, &variable_dock_widget::variable_focused_signal,
-             this, &variable_editor::variable_focused);
+  // Notify the variable editor for page actions.
+  connect (page, &variable_dock_widget::destroyed,
+           this, &variable_editor::variable_destroyed);
+  connect (page, &variable_dock_widget::variable_focused_signal,
+           this, &variable_editor::variable_focused);
 
-    // See  Octave bug #53807 and https://bugreports.qt.io/browse/QTBUG-44813
+  // See  Octave bug #53807 and https://bugreports.qt.io/browse/QTBUG-44813
 #if (QT_VERSION >= 0x050302) && (QT_VERSION <= QTBUG_44813_FIX_VERSION)
-    connect (page, SIGNAL (queue_unfloat_float ()),
-             page, SLOT (unfloat_float ()), Qt::QueuedConnection);
-    connect (page, SIGNAL (queue_float ()),
-             page, SLOT (refloat ()), Qt::QueuedConnection);
+  connect (page, SIGNAL (queue_unfloat_float ()),
+           page, SLOT (unfloat_float ()), Qt::QueuedConnection);
+  connect (page, SIGNAL (queue_float ()),
+           page, SLOT (refloat ()), Qt::QueuedConnection);
 #endif
 
-    variable_editor_stack *stack = new variable_editor_stack (page);
+  variable_editor_stack *stack = new variable_editor_stack (page);
 
-    stack->setObjectName (name);
-    page->setWidget (stack);
-    page->setFocusProxy (stack);
+  stack->setObjectName (name);
+  page->setWidget (stack);
+  page->setFocusProxy (stack);
 
-    // Any interpreter_event signal from a variable_editor_stack object is
-    // handled the same as for the parent variable_editor object.
-    connect (stack, QOverload<const fcn_callback&>::of (&variable_editor_stack::interpreter_event),
-             this, QOverload<const fcn_callback&>::of (&variable_editor::interpreter_event));
+  // Any interpreter_event signal from a variable_editor_stack object is
+  // handled the same as for the parent variable_editor object.
+  connect (stack, QOverload<const fcn_callback&>::of (&variable_editor_stack::interpreter_event),
+           this, QOverload<const fcn_callback&>::of (&variable_editor::interpreter_event));
 
-    connect (stack, QOverload<const meth_callback&>::of (&variable_editor_stack::interpreter_event),
-             this, QOverload<const meth_callback&>::of (&variable_editor::interpreter_event));
+  connect (stack, QOverload<const meth_callback&>::of (&variable_editor_stack::interpreter_event),
+           this, QOverload<const meth_callback&>::of (&variable_editor::interpreter_event));
 
-    connect (stack, &variable_editor_stack::edit_variable_signal,
-             this, &variable_editor::edit_variable);
-    connect (this, &variable_editor::level_up_signal,
-             stack, &variable_editor_stack::levelUp);
-    connect (this, &variable_editor::save_signal,
-             stack, [=] () { stack->save (); });
+  connect (stack, &variable_editor_stack::edit_variable_signal,
+           this, &variable_editor::edit_variable);
+  connect (this, &variable_editor::level_up_signal,
+           stack, &variable_editor_stack::levelUp);
+  connect (this, &variable_editor::save_signal,
+           stack, [=] () { stack->save (); });
 
-    variable_editor_view *edit_view = stack->edit_view ();
+  variable_editor_view *edit_view = stack->edit_view ();
 
-    edit_view->setObjectName (name);
-    edit_view->setFont (m_font);
-    edit_view->setStyleSheet (m_stylesheet);
-    edit_view->setAlternatingRowColors (m_alternate_rows);
-    edit_view->verticalHeader ()->setDefaultSectionSize (m_default_height
-                                                         + m_add_font_height);
+  edit_view->setObjectName (name);
+  edit_view->setFont (m_font);
+  edit_view->setStyleSheet (m_stylesheet);
+  edit_view->setAlternatingRowColors (m_alternate_rows);
+  edit_view->verticalHeader ()->setDefaultSectionSize (m_default_height
+                                                       + m_add_font_height);
 
-    connect (m_plot_mapper, SIGNAL (mapped (const QString&)),
-             edit_view, SLOT (selected_command_requested (const QString&)));
-    connect (m_save_mapper, SIGNAL (mapped (const QString&)),
-             stack, SLOT (save (const QString&)));
+  connect (m_plot_mapper, SIGNAL (mapped (const QString&)),
+           edit_view, SLOT (selected_command_requested (const QString&)));
+  connect (m_save_mapper, SIGNAL (mapped (const QString&)),
+           stack, SLOT (save (const QString&)));
 
-    connect (edit_view, &variable_editor_view::command_signal,
-             this, &variable_editor::command_signal);
-    connect (this, &variable_editor::delete_selected_signal,
-             edit_view, &variable_editor_view::delete_selected);
-    connect (this, &variable_editor::clear_content_signal,
-             edit_view, &variable_editor_view::clearContent);
-    connect (this, &variable_editor::copy_clipboard_signal,
-             edit_view, &variable_editor_view::copyClipboard);
-    connect (this, &variable_editor::paste_clipboard_signal,
-             edit_view, &variable_editor_view::pasteClipboard);
-    connect (edit_view->horizontalHeader (),
-             &QHeaderView::customContextMenuRequested,
-             edit_view, &variable_editor_view::createColumnMenu);
-    connect (edit_view->verticalHeader (),
-             &QHeaderView::customContextMenuRequested,
-             edit_view, &variable_editor_view::createRowMenu);
-    connect (edit_view, &variable_editor_view::customContextMenuRequested,
-             edit_view, &variable_editor_view::createContextMenu);
-    connect (edit_view->horizontalScrollBar (), &QScrollBar::actionTriggered,
-             edit_view, &variable_editor_view::handle_horizontal_scroll_action);
-    connect (edit_view->verticalScrollBar (), &QScrollBar::actionTriggered,
-             edit_view, &variable_editor_view::handle_vertical_scroll_action);
+  connect (edit_view, &variable_editor_view::command_signal,
+           this, &variable_editor::command_signal);
+  connect (this, &variable_editor::delete_selected_signal,
+           edit_view, &variable_editor_view::delete_selected);
+  connect (this, &variable_editor::clear_content_signal,
+           edit_view, &variable_editor_view::clearContent);
+  connect (this, &variable_editor::copy_clipboard_signal,
+           edit_view, &variable_editor_view::copyClipboard);
+  connect (this, &variable_editor::paste_clipboard_signal,
+           edit_view, &variable_editor_view::pasteClipboard);
+  connect (edit_view->horizontalHeader (),
+           &QHeaderView::customContextMenuRequested,
+           edit_view, &variable_editor_view::createColumnMenu);
+  connect (edit_view->verticalHeader (),
+           &QHeaderView::customContextMenuRequested,
+           edit_view, &variable_editor_view::createRowMenu);
+  connect (edit_view, &variable_editor_view::customContextMenuRequested,
+           edit_view, &variable_editor_view::createContextMenu);
+  connect (edit_view->horizontalScrollBar (), &QScrollBar::actionTriggered,
+           edit_view, &variable_editor_view::handle_horizontal_scroll_action);
+  connect (edit_view->verticalScrollBar (), &QScrollBar::actionTriggered,
+           edit_view, &variable_editor_view::handle_vertical_scroll_action);
 
-    variable_editor_model *model =
-      new variable_editor_model (name, val, stack);
+  variable_editor_model *model =
+    new variable_editor_model (name, val, stack);
 
-    connect (model, &variable_editor_model::edit_variable_signal,
-             this, &variable_editor::edit_variable);
-    connect (model, &variable_editor_model::dataChanged,
-             this, &variable_editor::callUpdate);
-    connect (this, &variable_editor::refresh_signal,
-             model, &variable_editor_model::update_data_cache);
-    connect (model, &variable_editor_model::set_editable_signal,
-             stack, &variable_editor_stack::set_editable);
+  connect (model, &variable_editor_model::edit_variable_signal,
+           this, &variable_editor::edit_variable);
+  connect (model, &variable_editor_model::dataChanged,
+           this, &variable_editor::callUpdate);
+  connect (this, &variable_editor::refresh_signal,
+           model, &variable_editor_model::update_data_cache);
+  connect (model, &variable_editor_model::set_editable_signal,
+           stack, &variable_editor_stack::set_editable);
 
-    edit_view->setModel (model);
-    connect (edit_view, &variable_editor_view::doubleClicked,
-             model, &variable_editor_model::double_click);
+  edit_view->setModel (model);
+  connect (edit_view, &variable_editor_view::doubleClicked,
+           model, &variable_editor_model::double_click);
 
-    // Any interpreter_event signal from a variable_editor_model object is
-    // handled the same as for the parent variable_editor object.
+  // Any interpreter_event signal from a variable_editor_model object is
+  // handled the same as for the parent variable_editor object.
 
-    connect (model, QOverload<const fcn_callback&>::of (&variable_editor_model::interpreter_event),
-             this, QOverload<const fcn_callback&>::of (&variable_editor::interpreter_event));
+  connect (model, QOverload<const fcn_callback&>::of (&variable_editor_model::interpreter_event),
+           this, QOverload<const fcn_callback&>::of (&variable_editor::interpreter_event));
 
-    connect (model, QOverload<const meth_callback&>::of (&variable_editor_model::interpreter_event),
-             this, QOverload<const meth_callback&>::of (&variable_editor::interpreter_event));
+  connect (model, QOverload<const meth_callback&>::of (&variable_editor_model::interpreter_event),
+           this, QOverload<const meth_callback&>::of (&variable_editor::interpreter_event));
 
-    // Must supply a title for a QLabel to be created.  Calling set_title()
-    // more than once will add more QLabels.  Could change octave_dock_widget
-    // to always supply a QLabel (initially empty) and then simply update its
-    // contents.
-    page->set_title (name);
-    if (page->titleBarWidget () != nullptr)
-      {
-        QLabel *existing_ql = page->titleBarWidget ()->findChild<QLabel *> ();
+  // Must supply a title for a QLabel to be created.  Calling set_title()
+  // more than once will add more QLabels.  Could change octave_dock_widget
+  // to always supply a QLabel (initially empty) and then simply update its
+  // contents.
+  page->set_title (name);
+  if (page->titleBarWidget () != nullptr)
+    {
+      QLabel *existing_ql = page->titleBarWidget ()->findChild<QLabel *> ();
 
-        // FIXME: What was the intent here?  update_label_signal does
-        // not seem to exist now.
-        connect (model, SIGNAL (description_changed (const QString&)),
-                 existing_ql, SLOT (setText (const QString&)));
-        existing_ql->setMargin (2);
-      }
+      // FIXME: What was the intent here?  update_label_signal does
+      // not seem to exist now.
+      connect (model, SIGNAL (description_changed (const QString&)),
+               existing_ql, SLOT (setText (const QString&)));
+      existing_ql->setMargin (2);
+    }
 
-    model->update_data (val);
+  model->update_data (val);
 
-    if (m_tool_bar)
-      {
-        QList<QTableView *> viewlist = findChildren<QTableView *> ();
-        if (viewlist.size () == 1 && m_tool_bar)
-          m_tool_bar->setEnabled (true);
-      }
+  if (m_tool_bar)
+    {
+      QList<QTableView *> viewlist = findChildren<QTableView *> ();
+      if (viewlist.size () == 1 && m_tool_bar)
+        m_tool_bar->setEnabled (true);
+    }
 
-    show ();
-    page->show ();
-    page->raise ();
-    page->activateWindow ();
-    tab_to_front ();
-    page->setFocus ();
-  }
+  show ();
+  page->show ();
+  page->raise ();
+  page->activateWindow ();
+  tab_to_front ();
+  page->setFocus ();
+}
 
-  void
-  variable_editor::tab_to_front ()
-  {
-    QWidget *parent = parentWidget ();
+void
+variable_editor::tab_to_front ()
+{
+  QWidget *parent = parentWidget ();
 
-    if (parent)
-      {
-        QList<QTabBar *> barlist = parent->findChildren<QTabBar *> ();
+  if (parent)
+    {
+      QList<QTabBar *> barlist = parent->findChildren<QTabBar *> ();
 
-        QVariant this_value (reinterpret_cast<quintptr> (this));
+      QVariant this_value (reinterpret_cast<quintptr> (this));
 
-        for (auto *tbar : barlist)
-          {
-            for (int i = 0; i < tbar->count (); i++)
-              {
-                if (tbar->tabData (i) == this_value)
-                  {
-                    tbar->setCurrentIndex (i);
-                    return;
-                  }
-              }
-          }
-      }
-  }
+      for (auto *tbar : barlist)
+        {
+          for (int i = 0; i < tbar->count (); i++)
+            {
+              if (tbar->tabData (i) == this_value)
+                {
+                  tbar->setCurrentIndex (i);
+                  return;
+                }
+            }
+        }
+    }
+}
 
-  void
-  variable_editor::refresh ()
-  {
-    emit refresh_signal ();
-  }
+void
+variable_editor::refresh ()
+{
+  emit refresh_signal ();
+}
 
-  void
-  variable_editor::callUpdate (const QModelIndex&, const QModelIndex&)
-  {
-    emit updated ();
-  }
+void
+variable_editor::callUpdate (const QModelIndex&, const QModelIndex&)
+{
+  emit updated ();
+}
 
-  void
-  variable_editor::notice_settings ()
-  {
-    gui_settings settings;
+void
+variable_editor::notice_settings ()
+{
+  gui_settings settings;
 
-    m_main->notice_settings (); // update settings in parent main win
+  m_main->notice_settings (); // update settings in parent main win
 
-    m_default_width = settings.int_value (ve_column_width);
+  m_default_width = settings.int_value (ve_column_width);
 
-    m_default_height = settings.int_value (ve_row_height);
+  m_default_height = settings.int_value (ve_row_height);
 
-    m_alternate_rows = settings.bool_value (ve_alternate_rows);
+  m_alternate_rows = settings.bool_value (ve_alternate_rows);
 
-    m_use_terminal_font = settings.bool_value (ve_use_terminal_font);
+  m_use_terminal_font = settings.bool_value (ve_use_terminal_font);
 
-    QString font_name;
-    int font_size;
-    QString default_font = settings.string_value (global_mono_font);
+  QString font_name;
+  int font_size;
+  QString default_font = settings.string_value (global_mono_font);
 
-    if (m_use_terminal_font)
-      {
-        font_name = settings.value (cs_font.settings_key (), default_font).toString ();
-        font_size = settings.int_value (cs_font_size);
-      }
-    else
-      {
-        font_name = settings.value (ve_font_name.settings_key (), default_font).toString ();
-        font_size = settings.int_value (ve_font_size);
-      }
+  if (m_use_terminal_font)
+    {
+      font_name = settings.value (cs_font.settings_key (), default_font).toString ();
+      font_size = settings.int_value (cs_font_size);
+    }
+  else
+    {
+      font_name = settings.value (ve_font_name.settings_key (), default_font).toString ();
+      font_size = settings.int_value (ve_font_size);
+    }
 
-    m_font = QFont (font_name, font_size);
+  m_font = QFont (font_name, font_size);
 
-    QFontMetrics fm (m_font);
+  QFontMetrics fm (m_font);
 
-    m_add_font_height = fm.height ();
+  m_add_font_height = fm.height ();
 
-    int mode = settings.int_value (ve_color_mode);
+  int mode = settings.int_value (ve_color_mode);
 
-    for (int i = 0; i < ve_colors_count; i++)
-      {
-        QColor setting_color = settings.color_value (ve_colors[i], mode);
-        m_table_colors.replace (i, setting_color);
-      }
+  for (int i = 0; i < ve_colors_count; i++)
+    {
+      QColor setting_color = settings.color_value (ve_colors[i], mode);
+      m_table_colors.replace (i, setting_color);
+    }
 
-    update_colors ();
+  update_colors ();
 
-    // Icon size in the toolbar.
+  // Icon size in the toolbar.
 
-    if (m_tool_bar)
-      {
-        int size_idx = settings.int_value (global_icon_size);
-        size_idx = (size_idx > 0) - (size_idx < 0) + 1;  // Make valid index from 0 to 2
+  if (m_tool_bar)
+    {
+      int size_idx = settings.int_value (global_icon_size);
+      size_idx = (size_idx > 0) - (size_idx < 0) + 1;  // Make valid index from 0 to 2
 
-        QStyle *st = style ();
-        int icon_size = st->pixelMetric (global_icon_sizes[size_idx]);
-        m_tool_bar->setIconSize (QSize (icon_size, icon_size));
-      }
+      QStyle *st = style ();
+      int icon_size = st->pixelMetric (global_icon_sizes[size_idx]);
+      m_tool_bar->setIconSize (QSize (icon_size, icon_size));
+    }
 
-    // Shortcuts (same as file editor)
-    settings.set_shortcut (m_save_action, sc_edit_file_save);
-  }
+  // Shortcuts (same as file editor)
+  settings.set_shortcut (m_save_action, sc_edit_file_save);
+}
 
-  void
-  variable_editor::closeEvent (QCloseEvent *e)
-  {
-    emit finished ();
+void
+variable_editor::closeEvent (QCloseEvent *e)
+{
+  emit finished ();
 
-    octave_dock_widget::closeEvent (e);
-  }
+  octave_dock_widget::closeEvent (e);
+}
 
-  void
-  variable_editor::variable_destroyed (QObject *obj)
-  {
-    // Invalidate the focus-restoring widget pointer if currently active.
-    if (m_focus_widget_vdw == obj)
-      {
-        m_focus_widget = nullptr;
-        m_focus_widget_vdw = nullptr;
-      }
+void
+variable_editor::variable_destroyed (QObject *obj)
+{
+  // Invalidate the focus-restoring widget pointer if currently active.
+  if (m_focus_widget_vdw == obj)
+    {
+      m_focus_widget = nullptr;
+      m_focus_widget_vdw = nullptr;
+    }
 
-    if (m_tool_bar)
-      {
-        // If no variable pages remain, deactivate the tool bar.
-        QList<variable_dock_widget *> vdwlist = findChildren<variable_dock_widget *> ();
-        if (vdwlist.isEmpty ())
-          m_tool_bar->setEnabled (false);
-      }
+  if (m_tool_bar)
+    {
+      // If no variable pages remain, deactivate the tool bar.
+      QList<variable_dock_widget *> vdwlist = findChildren<variable_dock_widget *> ();
+      if (vdwlist.isEmpty ())
+        m_tool_bar->setEnabled (false);
+    }
 
-    QFocusEvent ev (QEvent::FocusIn);
-    focusInEvent (&ev);
-  }
+  QFocusEvent ev (QEvent::FocusIn);
+  focusInEvent (&ev);
+}
 
-  void
-  variable_editor::variable_focused (const QString& name)
-  {
-    m_current_focus_vname = name;
+void
+variable_editor::variable_focused (const QString& name)
+{
+  m_current_focus_vname = name;
 
-    // focusWidget() appears lost in transition to/from main window
-    // so keep a record of the widget.
+  // focusWidget() appears lost in transition to/from main window
+  // so keep a record of the widget.
 
-    QWidget *current = QApplication::focusWidget ();
-    m_focus_widget = nullptr;
-    m_focus_widget_vdw = nullptr;
-    if (current != nullptr)
-      {
-        QList<variable_dock_widget *> vdwlist = findChildren<variable_dock_widget *> ();
-        for (int i = 0; i < vdwlist.size (); i++)
-          {
-            variable_dock_widget *vdw = vdwlist.at (i);
-            if (vdw->isAncestorOf (current))
-              {
-                m_focus_widget = current;
-                m_focus_widget_vdw = vdw;
-                break;
-              }
-          }
-      }
-  }
+  QWidget *current = QApplication::focusWidget ();
+  m_focus_widget = nullptr;
+  m_focus_widget_vdw = nullptr;
+  if (current != nullptr)
+    {
+      QList<variable_dock_widget *> vdwlist = findChildren<variable_dock_widget *> ();
+      for (int i = 0; i < vdwlist.size (); i++)
+        {
+          variable_dock_widget *vdw = vdwlist.at (i);
+          if (vdw->isAncestorOf (current))
+            {
+              m_focus_widget = current;
+              m_focus_widget_vdw = vdw;
+              break;
+            }
+        }
+    }
+}
 
-  void
-  variable_editor::record_hovered_focus_variable ()
-  {
-    m_hovered_focus_vname = m_current_focus_vname;
-  }
+void
+variable_editor::record_hovered_focus_variable ()
+{
+  m_hovered_focus_vname = m_current_focus_vname;
+}
 
-  void
-  variable_editor::restore_hovered_focus_variable ()
-  {
-    variable_dock_widget *tofocus = findChild<variable_dock_widget *> (m_hovered_focus_vname);
-    if (tofocus != nullptr)
-      {
-        // Note that this may be platform and window system dependent.
-        // On a particular Linux system, activateWindow() alone didn't
-        // immediately set the active window and there was a race
-        // between the window focus and action signal.  Setting the
-        // active window via the QApplication route did work.
-        QApplication::setActiveWindow(tofocus->window());
-        tofocus->activateWindow ();
-        tofocus->setFocus (Qt::OtherFocusReason);
-      }
-  }
+void
+variable_editor::restore_hovered_focus_variable ()
+{
+  variable_dock_widget *tofocus = findChild<variable_dock_widget *> (m_hovered_focus_vname);
+  if (tofocus != nullptr)
+    {
+      // Note that this may be platform and window system dependent.
+      // On a particular Linux system, activateWindow() alone didn't
+      // immediately set the active window and there was a race
+      // between the window focus and action signal.  Setting the
+      // active window via the QApplication route did work.
+      QApplication::setActiveWindow(tofocus->window());
+      tofocus->activateWindow ();
+      tofocus->setFocus (Qt::OtherFocusReason);
+    }
+}
 
-  void
-  variable_editor::save ()
-  {
-    emit save_signal ();
-  }
+void
+variable_editor::save ()
+{
+  emit save_signal ();
+}
 
-  void
-  variable_editor::cutClipboard ()
-  {
-    copyClipboard ();
+void
+variable_editor::cutClipboard ()
+{
+  copyClipboard ();
 
-    emit clear_content_signal ();
-  }
+  emit clear_content_signal ();
+}
 
-  void
-  variable_editor::copyClipboard ()
-  {
-    emit copy_clipboard_signal ();
-  }
+void
+variable_editor::copyClipboard ()
+{
+  emit copy_clipboard_signal ();
+}
 
-  void
-  variable_editor::pasteClipboard ()
-  {
-    emit paste_clipboard_signal ();
+void
+variable_editor::pasteClipboard ()
+{
+  emit paste_clipboard_signal ();
 
-    emit updated ();
-  }
+  emit updated ();
+}
 
-  void
-  variable_editor::levelUp ()
-  {
-    emit level_up_signal ();
-  }
+void
+variable_editor::levelUp ()
+{
+  emit level_up_signal ();
+}
 
-  // Also updates the font.
+// Also updates the font.
 
-  void variable_editor::update_colors ()
-  {
-    m_stylesheet = "";
+void variable_editor::update_colors ()
+{
+  m_stylesheet = "";
 
-    if (m_table_colors.length () > 0)
-      m_stylesheet += "QTableView::item{ color: "
-                      + m_table_colors[0].name () +" }";
+  if (m_table_colors.length () > 0)
+    m_stylesheet += "QTableView::item{ color: "
+                    + m_table_colors[0].name () +" }";
 
-    if (m_table_colors.length () > 1)
-      m_stylesheet += "QTableView::item{ background-color: "
-                      + m_table_colors[1].name () +" }";
+  if (m_table_colors.length () > 1)
+    m_stylesheet += "QTableView::item{ background-color: "
+                    + m_table_colors[1].name () +" }";
 
-    if (m_table_colors.length () > 2)
-      m_stylesheet += "QTableView::item{ selection-color: "
-                      + m_table_colors[2].name () +" }";
+  if (m_table_colors.length () > 2)
+    m_stylesheet += "QTableView::item{ selection-color: "
+                    + m_table_colors[2].name () +" }";
 
-    if (m_table_colors.length () > 3)
-      m_stylesheet += "QTableView::item:selected{ background-color: "
-                      + m_table_colors[3].name () +" }";
+  if (m_table_colors.length () > 3)
+    m_stylesheet += "QTableView::item:selected{ background-color: "
+                    + m_table_colors[3].name () +" }";
 
-    if (m_table_colors.length () > 4 && m_alternate_rows)
-      {
-        m_stylesheet += "QTableView::item:alternate{ background-color: "
-                        + m_table_colors[4].name () +" }";
+  if (m_table_colors.length () > 4 && m_alternate_rows)
+    {
+      m_stylesheet += "QTableView::item:alternate{ background-color: "
+                      + m_table_colors[4].name () +" }";
 
-        m_stylesheet += "QTableView::item:alternate:selected{ background-color: "
-                        + m_table_colors[3].name () +" }";
-      }
+      m_stylesheet += "QTableView::item:alternate:selected{ background-color: "
+                      + m_table_colors[3].name () +" }";
+    }
 
-    QList<QTableView *> viewlist = findChildren<QTableView *> ();
-    for (int i = 0; i < viewlist.size (); i++)
-      {
-        QTableView *view = viewlist.at (i);
+  QList<QTableView *> viewlist = findChildren<QTableView *> ();
+  for (int i = 0; i < viewlist.size (); i++)
+    {
+      QTableView *view = viewlist.at (i);
 
-        if (! view)
-          continue;
+      if (! view)
+        continue;
 
-        view->setAlternatingRowColors (m_alternate_rows);
-        view->setStyleSheet (m_stylesheet);
-        view->setFont (m_font);
-      }
+      view->setAlternatingRowColors (m_alternate_rows);
+      view->setStyleSheet (m_stylesheet);
+      view->setFont (m_font);
+    }
 
-  }
+}
 
-  QAction *
-  variable_editor::add_tool_bar_button (const QIcon& icon,
-                                        const QString& text,
-                                        const QObject *receiver,
-                                        const char *member)
-  {
-    QAction *action = new QAction (icon, text, this);
-    connect(action, SIGNAL (triggered ()), receiver, member);
-    QToolButton *button = new ReturnFocusToolButton (m_tool_bar);
-    button->setDefaultAction (action);
-    button->setText (text);
-    button->setToolTip (text);
-    button->setIcon (icon);
-    m_tool_bar->addWidget (button);
+QAction *
+variable_editor::add_tool_bar_button (const QIcon& icon,
+                                      const QString& text,
+                                      const QObject *receiver,
+                                      const char *member)
+{
+  QAction *action = new QAction (icon, text, this);
+  connect(action, SIGNAL (triggered ()), receiver, member);
+  QToolButton *button = new ReturnFocusToolButton (m_tool_bar);
+  button->setDefaultAction (action);
+  button->setText (text);
+  button->setToolTip (text);
+  button->setIcon (icon);
+  m_tool_bar->addWidget (button);
 
-    return action;
-  }
+  return action;
+}
 
-  void
-  variable_editor::construct_tool_bar ()
-  {
-    m_tool_bar->setAllowedAreas (Qt::TopToolBarArea);
+void
+variable_editor::construct_tool_bar ()
+{
+  m_tool_bar->setAllowedAreas (Qt::TopToolBarArea);
 
-    m_tool_bar->setObjectName ("VariableEditorToolBar");
+  m_tool_bar->setObjectName ("VariableEditorToolBar");
 
-    m_tool_bar->setWindowTitle (tr ("Variable Editor Toolbar"));
+  m_tool_bar->setWindowTitle (tr ("Variable Editor Toolbar"));
 
-    gui_settings settings;
+  gui_settings settings;
 
-    m_save_action = add_tool_bar_button (settings.icon ("document-save"),
-                                         tr ("Save"), this, SLOT (save ()));
-    addAction (m_save_action);
-    m_save_action->setShortcutContext (Qt::WidgetWithChildrenShortcut);
-    m_save_action->setStatusTip(tr("Save variable to a file"));
+  m_save_action = add_tool_bar_button (settings.icon ("document-save"),
+                                       tr ("Save"), this, SLOT (save ()));
+  addAction (m_save_action);
+  m_save_action->setShortcutContext (Qt::WidgetWithChildrenShortcut);
+  m_save_action->setStatusTip(tr("Save variable to a file"));
 
-    QAction *action = new QAction (settings.icon ("document-save-as"),
-                                   tr ("Save in format ..."), m_tool_bar);
+  QAction *action = new QAction (settings.icon ("document-save-as"),
+                                 tr ("Save in format ..."), m_tool_bar);
 
-    QToolButton *save_tool_button = new HoverToolButton (m_tool_bar);
-    save_tool_button->setDefaultAction (action);
+  QToolButton *save_tool_button = new HoverToolButton (m_tool_bar);
+  save_tool_button->setDefaultAction (action);
 
-    save_tool_button->setText (tr ("Save in format ..."));
-    save_tool_button->setToolTip (tr("Save variable to a file in different format"));
-    save_tool_button->setIcon (settings.icon ("document-save-as"));
-    save_tool_button->setPopupMode (QToolButton::InstantPopup);
+  save_tool_button->setText (tr ("Save in format ..."));
+  save_tool_button->setToolTip (tr("Save variable to a file in different format"));
+  save_tool_button->setIcon (settings.icon ("document-save-as"));
+  save_tool_button->setPopupMode (QToolButton::InstantPopup);
 
-    QMenu *save_menu = new ReturnFocusMenu (save_tool_button);
-    save_menu->setTitle (tr ("Save in format ..."));
-    save_menu->setSeparatorsCollapsible (false);
+  QMenu *save_menu = new ReturnFocusMenu (save_tool_button);
+  save_menu->setTitle (tr ("Save in format ..."));
+  save_menu->setSeparatorsCollapsible (false);
 
-    m_save_mapper = new QSignalMapper (save_menu);
-    for (int i = 0; i < ve_save_formats.length (); i++)
-      m_save_mapper->setMapping
-        (save_menu->addAction (ve_save_formats.at (i),
-                               m_save_mapper, SLOT (map ())),
-                               ve_save_formats.at (i));
+  m_save_mapper = new QSignalMapper (save_menu);
+  for (int i = 0; i < ve_save_formats.length (); i++)
+    m_save_mapper->setMapping
+      (save_menu->addAction (ve_save_formats.at (i),
+                             m_save_mapper, SLOT (map ())),
+                             ve_save_formats.at (i));
 
-    save_tool_button->setMenu (save_menu);
-    m_tool_bar->addWidget (save_tool_button);
+  save_tool_button->setMenu (save_menu);
+  m_tool_bar->addWidget (save_tool_button);
 
-    m_tool_bar->addSeparator ();
+  m_tool_bar->addSeparator ();
 
-    action = add_tool_bar_button (settings.icon ("edit-cut"), tr ("Cut"),
-                                  this, SLOT (cutClipboard ()));
-    action->setStatusTip(tr("Cut data to clipboard"));
+  action = add_tool_bar_button (settings.icon ("edit-cut"), tr ("Cut"),
+                                this, SLOT (cutClipboard ()));
+  action->setStatusTip(tr("Cut data to clipboard"));
 
-    action = add_tool_bar_button (settings.icon ("edit-copy"), tr ("Copy"),
-                                  this, SLOT (copyClipboard ()));
-    action->setStatusTip(tr("Copy data to clipboard"));
+  action = add_tool_bar_button (settings.icon ("edit-copy"), tr ("Copy"),
+                                this, SLOT (copyClipboard ()));
+  action->setStatusTip(tr("Copy data to clipboard"));
 
-    action = add_tool_bar_button (settings.icon ("edit-paste"), tr ("Paste"),
-                                  this, SLOT (pasteClipboard ()));
-    action->setStatusTip(tr("Paste clipboard into variable data"));
+  action = add_tool_bar_button (settings.icon ("edit-paste"), tr ("Paste"),
+                                this, SLOT (pasteClipboard ()));
+  action->setStatusTip(tr("Paste clipboard into variable data"));
 
-    m_tool_bar->addSeparator ();
+  m_tool_bar->addSeparator ();
 
-    // FIXME: Add a print item?
-    // QAction *print_action; /icons/fileprint.png
-    // m_tool_bar->addSeparator ();
+  // FIXME: Add a print item?
+  // QAction *print_action; /icons/fileprint.png
+  // m_tool_bar->addSeparator ();
 
-    action = new QAction (settings.icon ("plot-xy-curve"), tr ("Plot"),
-                          m_tool_bar);
-    action->setToolTip (tr ("Plot Selected Data"));
-    QToolButton *plot_tool_button = new HoverToolButton (m_tool_bar);
-    plot_tool_button->setDefaultAction (action);
+  action = new QAction (settings.icon ("plot-xy-curve"), tr ("Plot"),
+                        m_tool_bar);
+  action->setToolTip (tr ("Plot Selected Data"));
+  QToolButton *plot_tool_button = new HoverToolButton (m_tool_bar);
+  plot_tool_button->setDefaultAction (action);
 
-    plot_tool_button->setText (tr ("Plot"));
-    plot_tool_button->setToolTip (tr ("Plot selected data"));
-    plot_tool_button->setIcon (settings.icon ("plot-xy-curve"));
+  plot_tool_button->setText (tr ("Plot"));
+  plot_tool_button->setToolTip (tr ("Plot selected data"));
+  plot_tool_button->setIcon (settings.icon ("plot-xy-curve"));
 
-    plot_tool_button->setPopupMode (QToolButton::InstantPopup);
+  plot_tool_button->setPopupMode (QToolButton::InstantPopup);
 
-    QMenu *plot_menu = new ReturnFocusMenu (plot_tool_button);
-    plot_menu->setTitle (tr ("Plot"));
-    plot_menu->setSeparatorsCollapsible (false);
+  QMenu *plot_menu = new ReturnFocusMenu (plot_tool_button);
+  plot_menu->setTitle (tr ("Plot"));
+  plot_menu->setSeparatorsCollapsible (false);
 
-    m_plot_mapper = make_plot_mapper (plot_menu);
+  m_plot_mapper = make_plot_mapper (plot_menu);
 
-    plot_tool_button->setMenu (plot_menu);
+  plot_tool_button->setMenu (plot_menu);
 
-    m_tool_bar->addWidget (plot_tool_button);
+  m_tool_bar->addWidget (plot_tool_button);
 
-    m_tool_bar->addSeparator ();
+  m_tool_bar->addSeparator ();
 
-    action = add_tool_bar_button (settings.icon ("go-up"), tr ("Up"), this,
-                                  SLOT (levelUp ()));
-    action->setStatusTip(tr("Go one level up in variable hierarchy"));
+  action = add_tool_bar_button (settings.icon ("go-up"), tr ("Up"), this,
+                                SLOT (levelUp ()));
+  action->setStatusTip(tr("Go one level up in variable hierarchy"));
 
-    // The QToolButton mouse-clicks change active window, so connect all
-    // HoverToolButton and ReturnFocusToolButton objects to the mechanism
-    // that restores active window and focus before acting.
-    QList<HoverToolButton *> hbuttonlist
-      = m_tool_bar->findChildren<HoverToolButton *> (""
-                                                     , Qt::FindDirectChildrenOnly
-                                                    );
-    for (int i = 0; i < hbuttonlist.size (); i++)
-      {
-        connect (hbuttonlist.at (i), &HoverToolButton::hovered_signal,
-                 this, &variable_editor::record_hovered_focus_variable);
-        connect (hbuttonlist.at (i), &HoverToolButton::popup_shown_signal,
-                 this, &variable_editor::restore_hovered_focus_variable);
-      }
+  // The QToolButton mouse-clicks change active window, so connect all
+  // HoverToolButton and ReturnFocusToolButton objects to the mechanism
+  // that restores active window and focus before acting.
+  QList<HoverToolButton *> hbuttonlist
+    = m_tool_bar->findChildren<HoverToolButton *> (""
+                                                   , Qt::FindDirectChildrenOnly
+                                                  );
+  for (int i = 0; i < hbuttonlist.size (); i++)
+    {
+      connect (hbuttonlist.at (i), &HoverToolButton::hovered_signal,
+               this, &variable_editor::record_hovered_focus_variable);
+      connect (hbuttonlist.at (i), &HoverToolButton::popup_shown_signal,
+               this, &variable_editor::restore_hovered_focus_variable);
+    }
 
-    QList<ReturnFocusToolButton *> rfbuttonlist
-      = m_tool_bar->findChildren<ReturnFocusToolButton *> (""
-                                                           , Qt::FindDirectChildrenOnly
-                                                          );
-    for (int i = 0; i < rfbuttonlist.size (); i++)
-      {
-        connect (rfbuttonlist.at (i), &ReturnFocusToolButton::about_to_activate,
-                 this, &variable_editor::restore_hovered_focus_variable);
-      }
+  QList<ReturnFocusToolButton *> rfbuttonlist
+    = m_tool_bar->findChildren<ReturnFocusToolButton *> (""
+                                                         , Qt::FindDirectChildrenOnly
+                                                        );
+  for (int i = 0; i < rfbuttonlist.size (); i++)
+    {
+      connect (rfbuttonlist.at (i), &ReturnFocusToolButton::about_to_activate,
+               this, &variable_editor::restore_hovered_focus_variable);
+    }
 
-    // Same for QMenu
-    QList<ReturnFocusMenu *> menulist
-      = m_tool_bar->findChildren<ReturnFocusMenu *> ();
-    for (int i = 0; i < menulist.size (); i++)
-      {
-        connect (menulist.at (i), &ReturnFocusMenu::about_to_activate,
-                 this, &variable_editor::restore_hovered_focus_variable);
-      }
+  // Same for QMenu
+  QList<ReturnFocusMenu *> menulist
+    = m_tool_bar->findChildren<ReturnFocusMenu *> ();
+  for (int i = 0; i < menulist.size (); i++)
+    {
+      connect (menulist.at (i), &ReturnFocusMenu::about_to_activate,
+               this, &variable_editor::restore_hovered_focus_variable);
+    }
 
-    m_tool_bar->setAttribute(Qt::WA_ShowWithoutActivating);
-    m_tool_bar->setFocusPolicy (Qt::NoFocus);
+  m_tool_bar->setAttribute(Qt::WA_ShowWithoutActivating);
+  m_tool_bar->setFocusPolicy (Qt::NoFocus);
 
-    // Disabled when no tab is present.
+  // Disabled when no tab is present.
 
-    m_tool_bar->setEnabled (false);
-  }
+  m_tool_bar->setEnabled (false);
+}
 
 OCTAVE_END_NAMESPACE(octave)
--- a/libgui/src/variable-editor.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/variable-editor.h	Thu Feb 02 12:25:51 2023 -0800
@@ -44,369 +44,369 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class variable_editor_model;
-  class variable_editor_view;
+class variable_editor_model;
+class variable_editor_view;
 
-  // The individual variable subwindow class
+// The individual variable subwindow class
 
-  class variable_dock_widget : public label_dock_widget
-  {
-    Q_OBJECT
+class variable_dock_widget : public label_dock_widget
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    variable_dock_widget (QWidget *p);
+  variable_dock_widget (QWidget *p);
 
-    ~variable_dock_widget () = default;
+  ~variable_dock_widget () = default;
 
-  signals:
+signals:
 
-    void variable_focused_signal (const QString& name);
+  void variable_focused_signal (const QString& name);
 
-  protected:
+protected:
 
-    virtual void closeEvent (QCloseEvent *e);
+  virtual void closeEvent (QCloseEvent *e);
 
-    void resizeEvent (QResizeEvent *event);
+  void resizeEvent (QResizeEvent *event);
 
-  public slots:
+public slots:
 
-    void handle_focus_change (QWidget *old, QWidget *now);
+  void handle_focus_change (QWidget *old, QWidget *now);
 
-  private slots:
+private slots:
 
-    void change_floating (bool);
+  void change_floating (bool);
 
-    void change_existence (bool);
+  void change_existence (bool);
 
-    void toplevel_change (bool);
+  void toplevel_change (bool);
 
-    void change_fullscreen ();
+  void change_fullscreen ();
 
-  protected:
+protected:
 
-    QFrame *m_frame;
+  QFrame *m_frame;
 
-    QAction *m_fullscreen_action;
+  QAction *m_fullscreen_action;
 
-    bool m_full_screen;
+  bool m_full_screen;
 
-    bool m_prev_floating;
+  bool m_prev_floating;
 
-    QRect m_prev_geom;
+  QRect m_prev_geom;
 
 // See Octave bug #53807 and https://bugreports.qt.io/browse/QTBUG-44813
 #define QTBUG_44813_FIX_VERSION 0x999999
-  signals:
+signals:
 
-    void queue_unfloat_float ();
+  void queue_unfloat_float ();
 
-    void queue_float ();
+  void queue_float ();
 
-  protected slots:
+protected slots:
 
-    void unfloat_float ();
+  void unfloat_float ();
 
-    void refloat ();
+  void refloat ();
 
 #if (QT_VERSION >= 0x050302) && (QT_VERSION <= QTBUG_44813_FIX_VERSION)
-  protected:
+protected:
 
-    bool event (QEvent *event);
+  bool event (QEvent *event);
 
-  private:
+private:
 
-    bool m_waiting_for_mouse_move;
+  bool m_waiting_for_mouse_move;
 
-    bool m_waiting_for_mouse_button_release;
+  bool m_waiting_for_mouse_button_release;
 #endif
-  };
+};
 
-  class variable_editor_stack : public QStackedWidget
-  {
-    Q_OBJECT
+class variable_editor_stack : public QStackedWidget
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    variable_editor_stack (QWidget *p);
+  variable_editor_stack (QWidget *p);
 
-    ~variable_editor_stack () = default;
+  ~variable_editor_stack () = default;
 
-    variable_editor_view * edit_view () {return m_edit_view;};
+  variable_editor_view * edit_view () {return m_edit_view;};
 
-    QTextEdit * disp_view () {return m_disp_view;};
+  QTextEdit * disp_view () {return m_disp_view;};
 
-  signals:
+signals:
 
-    void edit_variable_signal (const QString& name, const octave_value& val);
+  void edit_variable_signal (const QString& name, const octave_value& val);
 
-    void do_save_signal (const QString& format, const QString& save_opts);
+  void do_save_signal (const QString& format, const QString& save_opts);
 
-    void interpreter_event (const fcn_callback& fcn);
-    void interpreter_event (const meth_callback& meth);
+  void interpreter_event (const fcn_callback& fcn);
+  void interpreter_event (const meth_callback& meth);
 
-  public slots:
+public slots:
 
-    void set_editable (bool editable);
+  void set_editable (bool editable);
 
-    void levelUp ();
+  void levelUp ();
 
-    void save (const QString& format = QString ());
+  void save (const QString& format = QString ());
 
-    void do_save (const QString& format, const QString& save_opts);
+  void do_save (const QString& format, const QString& save_opts);
 
-  private:
+private:
 
-    QTextEdit * make_disp_view (QWidget *parent);
+  QTextEdit * make_disp_view (QWidget *parent);
 
-    variable_editor_view *m_edit_view;
+  variable_editor_view *m_edit_view;
 
-    QTextEdit *m_disp_view;
-  };
+  QTextEdit *m_disp_view;
+};
 
-  class variable_editor_view : public QTableView
-  {
-    Q_OBJECT
+class variable_editor_view : public QTableView
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    variable_editor_view (QWidget *p);
+  variable_editor_view (QWidget *p);
 
-    ~variable_editor_view () = default;
+  ~variable_editor_view () = default;
 
-    void setModel (QAbstractItemModel *model);
+  void setModel (QAbstractItemModel *model);
 
-  signals:
+signals:
 
-    void command_signal (const QString& cmd);
+  void command_signal (const QString& cmd);
 
-    void add_edit_actions_signal (QMenu *menu, const QString& qualifier_string);
+  void add_edit_actions_signal (QMenu *menu, const QString& qualifier_string);
 
-  public slots:
+public slots:
 
-    void createVariable ();
+  void createVariable ();
 
-    void transposeContent ();
+  void transposeContent ();
 
-    QList<int> range_selected ();
+  QList<int> range_selected ();
 
-    void delete_selected ();
+  void delete_selected ();
 
-    void clearContent ();
+  void clearContent ();
 
-    void cutClipboard ();
+  void cutClipboard ();
 
-    void copyClipboard ();
+  void copyClipboard ();
 
-    void pasteClipboard ();
+  void pasteClipboard ();
 
-    void handle_horizontal_scroll_action (int action);
+  void handle_horizontal_scroll_action (int action);
 
-    void handle_vertical_scroll_action (int action);
+  void handle_vertical_scroll_action (int action);
 
-    void createContextMenu (const QPoint& pt);
+  void createContextMenu (const QPoint& pt);
 
-    void createColumnMenu (const QPoint& pt);
+  void createColumnMenu (const QPoint& pt);
 
-    void createRowMenu (const QPoint& pt);
+  void createRowMenu (const QPoint& pt);
 
-    void selected_command_requested (const QString& cmd);
+  void selected_command_requested (const QString& cmd);
 
-  private:
+private:
 
-    void add_edit_actions (QMenu *menu, const QString& qualifier_string);
+  void add_edit_actions (QMenu *menu, const QString& qualifier_string);
 
-    variable_editor_model *m_var_model;
-  };
+  variable_editor_model *m_var_model;
+};
 
-  // Gadgets to keep track of and restore what variable window was in focus
-  // just prior to selecting something on the menu bar.
+// Gadgets to keep track of and restore what variable window was in focus
+// just prior to selecting something on the menu bar.
 
-  class HoverToolButton : public QToolButton
-  {
-    Q_OBJECT
+class HoverToolButton : public QToolButton
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    HoverToolButton (QWidget *parent = nullptr);
+  HoverToolButton (QWidget *parent = nullptr);
 
-    ~HoverToolButton () = default;
+  ~HoverToolButton () = default;
 
-  signals:
+signals:
 
-    void hovered_signal ();
+  void hovered_signal ();
 
-    void popup_shown_signal ();
+  void popup_shown_signal ();
 
-  protected:
+protected:
 
-    bool eventFilter (QObject *obj, QEvent *ev);
-  };
+  bool eventFilter (QObject *obj, QEvent *ev);
+};
 
-  class ReturnFocusToolButton : public HoverToolButton
-  {
-    Q_OBJECT
+class ReturnFocusToolButton : public HoverToolButton
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    ReturnFocusToolButton (QWidget *parent = nullptr);
+  ReturnFocusToolButton (QWidget *parent = nullptr);
 
-    ~ReturnFocusToolButton () = default;
+  ~ReturnFocusToolButton () = default;
 
-  signals:
+signals:
 
-    void about_to_activate ();
+  void about_to_activate ();
 
-  protected:
+protected:
 
-    bool eventFilter (QObject *obj, QEvent *ev);
-  };
+  bool eventFilter (QObject *obj, QEvent *ev);
+};
 
-  class ReturnFocusMenu : public QMenu
-  {
-    Q_OBJECT
+class ReturnFocusMenu : public QMenu
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    ReturnFocusMenu (QWidget *parent = nullptr);
+  ReturnFocusMenu (QWidget *parent = nullptr);
 
-    ~ReturnFocusMenu () = default;
+  ~ReturnFocusMenu () = default;
 
-  signals:
+signals:
 
-    void about_to_activate ();
+  void about_to_activate ();
 
-  protected:
+protected:
 
-    bool eventFilter (QObject *obj, QEvent *ev);
-  };
+  bool eventFilter (QObject *obj, QEvent *ev);
+};
 
-  // The variable editor class
+// The variable editor class
 
-  class variable_editor : public octave_dock_widget
-  {
-    Q_OBJECT
+class variable_editor : public octave_dock_widget
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    variable_editor (QWidget *parent);
+  variable_editor (QWidget *parent);
 
-    ~variable_editor ();
+  ~variable_editor ();
 
-    // No copying!
+  // No copying!
 
-    variable_editor (const variable_editor&) = delete;
+  variable_editor (const variable_editor&) = delete;
 
-    variable_editor& operator = (const variable_editor&) = delete;
+  variable_editor& operator = (const variable_editor&) = delete;
 
-    void refresh ();
+  void refresh ();
 
-    void tab_to_front ();
+  void tab_to_front ();
 
-  signals:
+signals:
 
-    void updated ();
+  void updated ();
 
-    void finished ();
+  void finished ();
 
-    void command_signal (const QString& cmd);
+  void command_signal (const QString& cmd);
 
-    void refresh_signal ();
+  void refresh_signal ();
 
-    void clear_content_signal ();
+  void clear_content_signal ();
 
-    void copy_clipboard_signal ();
+  void copy_clipboard_signal ();
 
-    void paste_clipboard_signal ();
+  void paste_clipboard_signal ();
 
-    void level_up_signal ();
+  void level_up_signal ();
 
-    void save_signal ();
+  void save_signal ();
 
-    void delete_selected_signal ();
+  void delete_selected_signal ();
 
-    void interpreter_event (const fcn_callback& fcn);
-    void interpreter_event (const meth_callback& meth);
+  void interpreter_event (const fcn_callback& fcn);
+  void interpreter_event (const meth_callback& meth);
 
-  public slots:
+public slots:
 
-    void callUpdate (const QModelIndex&, const QModelIndex&);
+  void callUpdate (const QModelIndex&, const QModelIndex&);
 
-    void notice_settings ();
+  void notice_settings ();
 
-    void edit_variable (const QString& name, const octave_value& val);
+  void edit_variable (const QString& name, const octave_value& val);
 
-    void variable_destroyed (QObject *obj);
+  void variable_destroyed (QObject *obj);
 
-    void variable_focused (const QString& name);
+  void variable_focused (const QString& name);
 
-    void record_hovered_focus_variable ();
+  void record_hovered_focus_variable ();
 
-    void restore_hovered_focus_variable ();
+  void restore_hovered_focus_variable ();
 
-  protected slots:
+protected slots:
 
-    void closeEvent (QCloseEvent *);
+  void closeEvent (QCloseEvent *);
 
-    void save ();
+  void save ();
 
-    void cutClipboard ();
+  void cutClipboard ();
 
-    void copyClipboard ();
+  void copyClipboard ();
 
-    void pasteClipboard ();
+  void pasteClipboard ();
 
-    void levelUp ();
+  void levelUp ();
 
-  protected:
+protected:
 
-    void focusInEvent (QFocusEvent *ev);
+  void focusInEvent (QFocusEvent *ev);
 
-  private:
+private:
 
-    dw_main_window *m_main;
+  dw_main_window *m_main;
 
-    QToolBar *m_tool_bar;
-    QAction *m_save_action;
+  QToolBar *m_tool_bar;
+  QAction *m_save_action;
 
-    int m_default_width;
+  int m_default_width;
 
-    int m_default_height;
+  int m_default_height;
 
-    int m_add_font_height;
+  int m_add_font_height;
 
-    bool m_use_terminal_font;
+  bool m_use_terminal_font;
 
-    bool m_alternate_rows;
+  bool m_alternate_rows;
 
-    QString m_stylesheet;
+  QString m_stylesheet;
 
-    QFont m_font;
+  QFont m_font;
 
-    // If use_terminal_font is true then this will be different since
-    // "font" will contain the terminal font.
-    QFont m_sel_font;
+  // If use_terminal_font is true then this will be different since
+  // "font" will contain the terminal font.
+  QFont m_sel_font;
 
-    QList<QColor> m_table_colors;
+  QList<QColor> m_table_colors;
 
-    void update_colors ();
+  void update_colors ();
 
-    QAction * add_tool_bar_button (const QIcon& icon, const QString& text,
-                                   const QObject *receiver, const char *member);
+  QAction * add_tool_bar_button (const QIcon& icon, const QString& text,
+                                 const QObject *receiver, const char *member);
 
-    void construct_tool_bar ();
+  void construct_tool_bar ();
 
-    QString m_current_focus_vname;
+  QString m_current_focus_vname;
 
-    QString m_hovered_focus_vname;
+  QString m_hovered_focus_vname;
 
-    QSignalMapper *m_plot_mapper;
-    QSignalMapper *m_save_mapper;
+  QSignalMapper *m_plot_mapper;
+  QSignalMapper *m_save_mapper;
 
-    QWidget *m_focus_widget;
+  QWidget *m_focus_widget;
 
-    variable_dock_widget *m_focus_widget_vdw;
-  };
+  variable_dock_widget *m_focus_widget_vdw;
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/src/welcome-wizard.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/welcome-wizard.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -44,338 +44,338 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  static QLabel *
-  make_octave_logo (QWidget *p = nullptr, int height = 100)
-  {
-    QLabel *logo = new QLabel (p);
-    QPixmap logo_pixmap (dw_icon_set_names["NONE"]);
-    logo->setPixmap (logo_pixmap.scaledToHeight (height));
-    return logo;
-  };
+static QLabel *
+make_octave_logo (QWidget *p = nullptr, int height = 100)
+{
+  QLabel *logo = new QLabel (p);
+  QPixmap logo_pixmap (dw_icon_set_names["NONE"]);
+  logo->setPixmap (logo_pixmap.scaledToHeight (height));
+  return logo;
+};
 
-  welcome_wizard::welcome_wizard (QWidget *p)
-    : QDialog (p), m_page_ctor_list (), m_page_list_iterator (),
-      m_current_page (initial_page::create (this)),
-      m_allow_web_connect_state (false),
-      m_max_height (0), m_max_width (0)
-  {
-    m_page_ctor_list.push_back (initial_page::create);
-    m_page_ctor_list.push_back (setup_community_news::create);
-    m_page_ctor_list.push_back (final_page::create);
+welcome_wizard::welcome_wizard (QWidget *p)
+  : QDialog (p), m_page_ctor_list (), m_page_list_iterator (),
+    m_current_page (initial_page::create (this)),
+    m_allow_web_connect_state (false),
+    m_max_height (0), m_max_width (0)
+{
+  m_page_ctor_list.push_back (initial_page::create);
+  m_page_ctor_list.push_back (setup_community_news::create);
+  m_page_ctor_list.push_back (final_page::create);
 
-    m_page_list_iterator = m_page_ctor_list.begin ();
+  m_page_list_iterator = m_page_ctor_list.begin ();
 
-    setWindowTitle (tr ("Welcome to GNU Octave"));
+  setWindowTitle (tr ("Welcome to GNU Octave"));
 
-    setEnabled (true);
+  setEnabled (true);
 
-    setSizePolicy (QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
+  setSizePolicy (QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
 
-    // Create all pages for pre-setting the minimal required size for all pages
-    show_page ();
-    adjust_size ();
-    next_page ();
-    adjust_size ();
-    next_page ();
-    adjust_size ();
-    // now go back to the first page
-    previous_page ();
-    previous_page ();
+  // Create all pages for pre-setting the minimal required size for all pages
+  show_page ();
+  adjust_size ();
+  next_page ();
+  adjust_size ();
+  next_page ();
+  adjust_size ();
+  // now go back to the first page
+  previous_page ();
+  previous_page ();
 
-    // Set the size determined above
-    resize (m_max_width, m_max_height);
+  // Set the size determined above
+  resize (m_max_width, m_max_height);
 
 #if defined (OCTAVE_USE_WINDOWS_API)
-    // HACK to forceshow of dialog if started minimized
-    ShowWindow (reinterpret_cast<HWND> (winId ()), SW_SHOWNORMAL);
+  // HACK to forceshow of dialog if started minimized
+  ShowWindow (reinterpret_cast<HWND> (winId ()), SW_SHOWNORMAL);
 #endif
-  }
+}
 
-  void welcome_wizard::adjust_size ()
-  {
-    // Get adjusted size for the current page
-    adjustSize ();
-    QSize sz = size ();
+void welcome_wizard::adjust_size ()
+{
+  // Get adjusted size for the current page
+  adjustSize ();
+  QSize sz = size ();
 
-    // Update the max. size of the three pages if required
+  // Update the max. size of the three pages if required
 
-    if (sz.height () > m_max_height)
-      m_max_height = sz.height ();
+  if (sz.height () > m_max_height)
+    m_max_height = sz.height ();
 
-    if (sz.width () > m_max_width)
-      m_max_width = sz.width ();
-  }
+  if (sz.width () > m_max_width)
+    m_max_width = sz.width ();
+}
 
-  void welcome_wizard::handle_web_connect_option (int state)
-  {
-    m_allow_web_connect_state = state == Qt::Checked;
-  }
+void welcome_wizard::handle_web_connect_option (int state)
+{
+  m_allow_web_connect_state = state == Qt::Checked;
+}
 
-  void welcome_wizard::show_page ()
-  {
-    delete m_current_page;
-    delete layout ();
+void welcome_wizard::show_page ()
+{
+  delete m_current_page;
+  delete layout ();
 
-    m_current_page = (*m_page_list_iterator) (this);
+  m_current_page = (*m_page_list_iterator) (this);
 
-    QVBoxLayout *new_layout = new QVBoxLayout ();
-    setLayout (new_layout);
+  QVBoxLayout *new_layout = new QVBoxLayout ();
+  setLayout (new_layout);
 
-    new_layout->addWidget (m_current_page);
-  }
+  new_layout->addWidget (m_current_page);
+}
 
-  void welcome_wizard::previous_page ()
-  {
-    --m_page_list_iterator;
+void welcome_wizard::previous_page ()
+{
+  --m_page_list_iterator;
 
-    show_page ();
-  }
+  show_page ();
+}
 
-  void welcome_wizard::next_page ()
-  {
-    ++m_page_list_iterator;
+void welcome_wizard::next_page ()
+{
+  ++m_page_list_iterator;
 
-    show_page ();
-  }
+  show_page ();
+}
 
-  void welcome_wizard::accept ()
-  {
-    // Create default settings file.
+void welcome_wizard::accept ()
+{
+  // Create default settings file.
 
-    gui_settings settings;
+  gui_settings settings;
 
-    settings.setValue (nr_allow_connection.settings_key (), m_allow_web_connect_state);
+  settings.setValue (nr_allow_connection.settings_key (), m_allow_web_connect_state);
 
-    settings.sync ();
+  settings.sync ();
 
-    QDialog::accept ();
-  }
+  QDialog::accept ();
+}
 
-  initial_page::initial_page (welcome_wizard *wizard)
-    : QWidget (wizard),
-      m_title (new QLabel (tr ("Welcome to Octave!"), this)),
-      m_message (new QLabel (this)),
-      m_logo (make_octave_logo (this)),
-      m_next (new QPushButton (tr ("Next"), this)),
-      m_cancel (new QPushButton (tr ("Cancel"), this))
-  {
-    QFont ft;
-    ft.setPointSize (20);
-    m_title->setFont (ft);
+initial_page::initial_page (welcome_wizard *wizard)
+  : QWidget (wizard),
+    m_title (new QLabel (tr ("Welcome to Octave!"), this)),
+    m_message (new QLabel (this)),
+    m_logo (make_octave_logo (this)),
+    m_next (new QPushButton (tr ("Next"), this)),
+    m_cancel (new QPushButton (tr ("Cancel"), this))
+{
+  QFont ft;
+  ft.setPointSize (20);
+  m_title->setFont (ft);
 
-    gui_settings settings;
+  gui_settings settings;
 
-    m_message->setText
-      (tr ("<html><body>\n"
-           "<p>You seem to be using the Octave graphical interface for the first time on this computer.\n"
-           "Click 'Next' to create a configuration file and launch Octave.</p>\n"
-           "<p>The configuration file is stored in<br>%1.</p>\n"
-           "</body></html>").
-       arg (settings.file_name ()));
-    m_message->setWordWrap (true);
-    m_message->setMinimumWidth (400);
+  m_message->setText
+    (tr ("<html><body>\n"
+         "<p>You seem to be using the Octave graphical interface for the first time on this computer.\n"
+         "Click 'Next' to create a configuration file and launch Octave.</p>\n"
+         "<p>The configuration file is stored in<br>%1.</p>\n"
+         "</body></html>").
+     arg (settings.file_name ()));
+  m_message->setWordWrap (true);
+  m_message->setMinimumWidth (400);
 
-    QVBoxLayout *message_layout = new QVBoxLayout;
+  QVBoxLayout *message_layout = new QVBoxLayout;
 
-    message_layout->addWidget (m_title);
-    message_layout->addWidget (m_message);
+  message_layout->addWidget (m_title);
+  message_layout->addWidget (m_message);
 
-    QHBoxLayout *message_and_logo = new QHBoxLayout;
+  QHBoxLayout *message_and_logo = new QHBoxLayout;
 
-    message_and_logo->addLayout (message_layout);
-    message_and_logo->addStretch (10);
-    message_and_logo->addWidget (m_logo, 0, Qt::AlignTop);
+  message_and_logo->addLayout (message_layout);
+  message_and_logo->addStretch (10);
+  message_and_logo->addWidget (m_logo, 0, Qt::AlignTop);
 
-    QHBoxLayout *button_bar = new QHBoxLayout;
+  QHBoxLayout *button_bar = new QHBoxLayout;
 
-    button_bar->addStretch (10);
-    button_bar->addWidget (m_next);
-    button_bar->addWidget (m_cancel);
+  button_bar->addStretch (10);
+  button_bar->addWidget (m_next);
+  button_bar->addWidget (m_cancel);
 
-    QVBoxLayout *page_layout = new QVBoxLayout (this);
-    setLayout (page_layout);
+  QVBoxLayout *page_layout = new QVBoxLayout (this);
+  setLayout (page_layout);
 
-    page_layout->addLayout (message_and_logo);
-    page_layout->addStretch (10);
-    page_layout->addSpacing (20);
-    page_layout->addLayout (button_bar);
+  page_layout->addLayout (message_and_logo);
+  page_layout->addStretch (10);
+  page_layout->addSpacing (20);
+  page_layout->addLayout (button_bar);
 
-    setSizePolicy (QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
+  setSizePolicy (QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
 
-    m_next->setDefault (true);
-    m_next->setFocus ();
+  m_next->setDefault (true);
+  m_next->setFocus ();
 
-    connect (m_next, &QPushButton::clicked, wizard, &welcome_wizard::next_page);
-    connect (m_cancel, &QPushButton::clicked, wizard, &welcome_wizard::reject);
-  }
+  connect (m_next, &QPushButton::clicked, wizard, &welcome_wizard::next_page);
+  connect (m_cancel, &QPushButton::clicked, wizard, &welcome_wizard::reject);
+}
 
-  setup_community_news::setup_community_news (welcome_wizard *wizard)
-    : QWidget (wizard),
-      m_title (new QLabel (tr ("Community News"), this)),
-      m_message (new QLabel (this)),
-      m_checkbox (new QCheckBox (this)),
-      m_checkbox_message (new QLabel (this)),
-      m_logo (make_octave_logo (this)),
-      m_previous (new QPushButton (tr ("Previous"), this)),
-      m_next (new QPushButton (tr ("Next"), this)),
-      m_cancel (new QPushButton (tr ("Cancel"), this))
-  {
-    QFont ft;
-    ft.setPointSize (20);
-    m_title->setFont (ft);
+setup_community_news::setup_community_news (welcome_wizard *wizard)
+  : QWidget (wizard),
+    m_title (new QLabel (tr ("Community News"), this)),
+    m_message (new QLabel (this)),
+    m_checkbox (new QCheckBox (this)),
+    m_checkbox_message (new QLabel (this)),
+    m_logo (make_octave_logo (this)),
+    m_previous (new QPushButton (tr ("Previous"), this)),
+    m_next (new QPushButton (tr ("Next"), this)),
+    m_cancel (new QPushButton (tr ("Cancel"), this))
+{
+  QFont ft;
+  ft.setPointSize (20);
+  m_title->setFont (ft);
 
-    m_message->setText
-      (tr ("<html><body>\n"
-           "<p>When Octave starts, it will optionally check the Octave web site for current news and information about the Octave community.\n"
-           "The check will happen at most once each day and news will only be displayed if there is something new since the last time you viewed the news.</p>\n"
-           "<p>You may also view the news by selecting the \"Community News\" item in the \"Help\" menu, or by visiting\n"
-           "<a href=\"https://octave.org/community-news.html\">https://octave.org/community-news.html</a>.</p>\n"
-           "</body></html>"));
-    m_message->setWordWrap (true);
-    m_message->setMinimumWidth (400);
-    m_message->setOpenExternalLinks (true);
+  m_message->setText
+    (tr ("<html><body>\n"
+         "<p>When Octave starts, it will optionally check the Octave web site for current news and information about the Octave community.\n"
+         "The check will happen at most once each day and news will only be displayed if there is something new since the last time you viewed the news.</p>\n"
+         "<p>You may also view the news by selecting the \"Community News\" item in the \"Help\" menu, or by visiting\n"
+         "<a href=\"https://octave.org/community-news.html\">https://octave.org/community-news.html</a>.</p>\n"
+         "</body></html>"));
+  m_message->setWordWrap (true);
+  m_message->setMinimumWidth (400);
+  m_message->setOpenExternalLinks (true);
 
-    QVBoxLayout *message_layout = new QVBoxLayout;
+  QVBoxLayout *message_layout = new QVBoxLayout;
 
-    message_layout->addWidget (m_title);
-    message_layout->addWidget (m_message);
+  message_layout->addWidget (m_title);
+  message_layout->addWidget (m_message);
 
-    QHBoxLayout *message_and_logo = new QHBoxLayout;
+  QHBoxLayout *message_and_logo = new QHBoxLayout;
 
-    message_and_logo->addLayout (message_layout);
-    message_and_logo->addStretch (10);
-    message_and_logo->addWidget (m_logo, 0, Qt::AlignTop);
+  message_and_logo->addLayout (message_layout);
+  message_and_logo->addStretch (10);
+  message_and_logo->addWidget (m_logo, 0, Qt::AlignTop);
 
-    QHBoxLayout *checkbox_layout = new QHBoxLayout;
+  QHBoxLayout *checkbox_layout = new QHBoxLayout;
 
-    bool allow_connection = nr_allow_connection.def ().toBool ();
-    if (allow_connection)
-      m_checkbox->setCheckState (Qt::Checked);
-    else
-      m_checkbox->setCheckState (Qt::Unchecked);
+  bool allow_connection = nr_allow_connection.def ().toBool ();
+  if (allow_connection)
+    m_checkbox->setCheckState (Qt::Checked);
+  else
+    m_checkbox->setCheckState (Qt::Unchecked);
 
-    m_checkbox_message->setText
-      (tr ("<html><head>\n"
-           "</head><body>\n"
-           "<p>Allow Octave to connect to the Octave web site when it starts to display current news and information about the Octave community.</p>\n"
-           "</body></html>"));
-    m_checkbox_message->setWordWrap (true);
-    m_checkbox_message->setOpenExternalLinks (true);
-    m_checkbox_message->setMinimumWidth (500);
+  m_checkbox_message->setText
+    (tr ("<html><head>\n"
+         "</head><body>\n"
+         "<p>Allow Octave to connect to the Octave web site when it starts to display current news and information about the Octave community.</p>\n"
+         "</body></html>"));
+  m_checkbox_message->setWordWrap (true);
+  m_checkbox_message->setOpenExternalLinks (true);
+  m_checkbox_message->setMinimumWidth (500);
 
-    checkbox_layout->addWidget (m_checkbox, 0, Qt::AlignTop);
-    checkbox_layout->addSpacing (20);
-    checkbox_layout->addWidget (m_checkbox_message, 0, Qt::AlignTop);
-    checkbox_layout->addStretch (10);
+  checkbox_layout->addWidget (m_checkbox, 0, Qt::AlignTop);
+  checkbox_layout->addSpacing (20);
+  checkbox_layout->addWidget (m_checkbox_message, 0, Qt::AlignTop);
+  checkbox_layout->addStretch (10);
 
-    QVBoxLayout *message_logo_and_checkbox = new QVBoxLayout;
+  QVBoxLayout *message_logo_and_checkbox = new QVBoxLayout;
 
-    message_logo_and_checkbox->addLayout (message_and_logo);
-    message_logo_and_checkbox->addSpacing (20);
-    message_logo_and_checkbox->addLayout (checkbox_layout);
+  message_logo_and_checkbox->addLayout (message_and_logo);
+  message_logo_and_checkbox->addSpacing (20);
+  message_logo_and_checkbox->addLayout (checkbox_layout);
 
-    QHBoxLayout *button_bar = new QHBoxLayout;
+  QHBoxLayout *button_bar = new QHBoxLayout;
 
-    button_bar->addStretch (10);
-    button_bar->addWidget (m_previous);
-    button_bar->addWidget (m_next);
-    button_bar->addWidget (m_cancel);
+  button_bar->addStretch (10);
+  button_bar->addWidget (m_previous);
+  button_bar->addWidget (m_next);
+  button_bar->addWidget (m_cancel);
 
-    QVBoxLayout *page_layout = new QVBoxLayout (this);
-    setLayout (page_layout);
+  QVBoxLayout *page_layout = new QVBoxLayout (this);
+  setLayout (page_layout);
 
-    page_layout->addLayout (message_logo_and_checkbox);
-    page_layout->addStretch (10);
-    page_layout->addSpacing (20);
-    page_layout->addLayout (button_bar);
+  page_layout->addLayout (message_logo_and_checkbox);
+  page_layout->addStretch (10);
+  page_layout->addSpacing (20);
+  page_layout->addLayout (button_bar);
 
-    setSizePolicy (QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
+  setSizePolicy (QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
 
-    m_next->setDefault (true);
-    m_next->setFocus ();
+  m_next->setDefault (true);
+  m_next->setFocus ();
 
-    connect (m_checkbox, &QCheckBox::stateChanged,
-             wizard, &welcome_wizard::handle_web_connect_option);
+  connect (m_checkbox, &QCheckBox::stateChanged,
+           wizard, &welcome_wizard::handle_web_connect_option);
 
-    connect (m_previous, &QPushButton::clicked, wizard, &welcome_wizard::previous_page);
-    connect (m_next, &QPushButton::clicked, wizard, &welcome_wizard::next_page);
-    connect (m_cancel, &QPushButton::clicked, wizard, &welcome_wizard::reject);
-  }
+  connect (m_previous, &QPushButton::clicked, wizard, &welcome_wizard::previous_page);
+  connect (m_next, &QPushButton::clicked, wizard, &welcome_wizard::next_page);
+  connect (m_cancel, &QPushButton::clicked, wizard, &welcome_wizard::reject);
+}
 
-  final_page::final_page (welcome_wizard *wizard)
-    : QWidget (wizard),
-      m_title (new QLabel (tr ("Enjoy!"), this)),
-      m_message (new QLabel (this)),
-      m_logo (make_octave_logo (this)),
-      m_links (new QLabel (this)),
-      m_previous (new QPushButton (tr ("Previous"), this)),
-      m_finish (new QPushButton (tr ("Finish"), this)),
-      m_cancel (new QPushButton (tr ("Cancel"), this))
-  {
-    QFont ft;
-    ft.setPointSize (20);
-    m_title->setFont (ft);
+final_page::final_page (welcome_wizard *wizard)
+  : QWidget (wizard),
+    m_title (new QLabel (tr ("Enjoy!"), this)),
+    m_message (new QLabel (this)),
+    m_logo (make_octave_logo (this)),
+    m_links (new QLabel (this)),
+    m_previous (new QPushButton (tr ("Previous"), this)),
+    m_finish (new QPushButton (tr ("Finish"), this)),
+    m_cancel (new QPushButton (tr ("Cancel"), this))
+{
+  QFont ft;
+  ft.setPointSize (20);
+  m_title->setFont (ft);
 
-    m_message->setText
-      (tr ("<html><body>\n"
-           "<p>We hope you find Octave to be a useful tool.</p>\n"
-           "<p>If you encounter problems, there are a number of ways to get help, including commercial support options, a mailing list, a wiki, and other community-based support channels.\n"
-           "You can find more information about each of these by visiting <a href=\"https://octave.org/support.html\">https://octave.org/support.html</a> (opens in external browser).</p>\n"
-           "</body></html>"));
-    m_message->setWordWrap (true);
-    m_message->setMinimumWidth (400);
-    m_message->setOpenExternalLinks (true);
+  m_message->setText
+    (tr ("<html><body>\n"
+         "<p>We hope you find Octave to be a useful tool.</p>\n"
+         "<p>If you encounter problems, there are a number of ways to get help, including commercial support options, a mailing list, a wiki, and other community-based support channels.\n"
+         "You can find more information about each of these by visiting <a href=\"https://octave.org/support.html\">https://octave.org/support.html</a> (opens in external browser).</p>\n"
+         "</body></html>"));
+  m_message->setWordWrap (true);
+  m_message->setMinimumWidth (400);
+  m_message->setOpenExternalLinks (true);
 
-    QVBoxLayout *message_layout = new QVBoxLayout;
+  QVBoxLayout *message_layout = new QVBoxLayout;
 
-    message_layout->addWidget (m_title);
-    message_layout->addWidget (m_message);
+  message_layout->addWidget (m_title);
+  message_layout->addWidget (m_message);
 
-    QHBoxLayout *message_and_logo = new QHBoxLayout;
+  QHBoxLayout *message_and_logo = new QHBoxLayout;
 
-    message_and_logo->addLayout (message_layout);
-    message_and_logo->addStretch (10);
-    message_and_logo->addWidget (m_logo, 0, Qt::AlignTop);
+  message_and_logo->addLayout (message_layout);
+  message_and_logo->addStretch (10);
+  message_and_logo->addWidget (m_logo, 0, Qt::AlignTop);
 
-    m_links->setText
-      (tr ("<html><head>\n"
-           "</head><body>\n"
-           "<p>For more information about Octave:</p>\n"
-           "<ul>\n"
-           "<li>Visit <a href=\"https://octave.org\">https://octave.org</a> (opens in external browser)</li>\n"
-           "<li>Get the documentation online as <a href=\"https://www.gnu.org/software/octave/doc/interpreter/index.html\">html</a>- or <a href=\"https://www.gnu.org/software/octave/octave.pdf\">pdf</a>-document (opens in external browser)</li>\n"
-           "<li>Open the documentation browser of the Octave GUI with the help menu</li>\n"
-           "</ul>\n"
-           "</body></html>"));
-    m_links->setWordWrap (true);
-    m_links->setOpenExternalLinks (true);
+  m_links->setText
+    (tr ("<html><head>\n"
+         "</head><body>\n"
+         "<p>For more information about Octave:</p>\n"
+         "<ul>\n"
+         "<li>Visit <a href=\"https://octave.org\">https://octave.org</a> (opens in external browser)</li>\n"
+         "<li>Get the documentation online as <a href=\"https://www.gnu.org/software/octave/doc/interpreter/index.html\">html</a>- or <a href=\"https://www.gnu.org/software/octave/octave.pdf\">pdf</a>-document (opens in external browser)</li>\n"
+         "<li>Open the documentation browser of the Octave GUI with the help menu</li>\n"
+         "</ul>\n"
+         "</body></html>"));
+  m_links->setWordWrap (true);
+  m_links->setOpenExternalLinks (true);
 
-    QHBoxLayout *button_bar = new QHBoxLayout;
+  QHBoxLayout *button_bar = new QHBoxLayout;
 
-    button_bar->addStretch (10);
-    button_bar->addWidget (m_previous);
-    button_bar->addWidget (m_finish);
-    button_bar->addWidget (m_cancel);
+  button_bar->addStretch (10);
+  button_bar->addWidget (m_previous);
+  button_bar->addWidget (m_finish);
+  button_bar->addWidget (m_cancel);
 
-    QVBoxLayout *page_layout = new QVBoxLayout (this);
-    setLayout (page_layout);
+  QVBoxLayout *page_layout = new QVBoxLayout (this);
+  setLayout (page_layout);
 
-    page_layout->addLayout (message_and_logo);
-    page_layout->addSpacing (20);
-    page_layout->addWidget (m_links);
-    page_layout->addStretch (10);
-    page_layout->addSpacing (20);
-    page_layout->addLayout (button_bar);
+  page_layout->addLayout (message_and_logo);
+  page_layout->addSpacing (20);
+  page_layout->addWidget (m_links);
+  page_layout->addStretch (10);
+  page_layout->addSpacing (20);
+  page_layout->addLayout (button_bar);
 
-    setSizePolicy (QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
+  setSizePolicy (QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
 
-    m_finish->setDefault (true);
-    m_finish->setFocus ();
+  m_finish->setDefault (true);
+  m_finish->setFocus ();
 
-    connect (m_previous, &QPushButton::clicked,
-             wizard, &welcome_wizard::previous_page);
-    connect (m_finish, &QPushButton::clicked, wizard, &welcome_wizard::accept);
-    connect (m_cancel, &QPushButton::clicked, wizard, &welcome_wizard::reject);
-  }
+  connect (m_previous, &QPushButton::clicked,
+           wizard, &welcome_wizard::previous_page);
+  connect (m_finish, &QPushButton::clicked, wizard, &welcome_wizard::accept);
+  connect (m_cancel, &QPushButton::clicked, wizard, &welcome_wizard::reject);
+}
 
 OCTAVE_END_NAMESPACE(octave)
--- a/libgui/src/welcome-wizard.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/welcome-wizard.h	Thu Feb 02 12:25:51 2023 -0800
@@ -32,119 +32,119 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class welcome_wizard : public QDialog
-  {
-    Q_OBJECT
+class welcome_wizard : public QDialog
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    typedef QWidget *(*page_creator_fptr) (welcome_wizard *);
+  typedef QWidget *(*page_creator_fptr) (welcome_wizard *);
 
-    welcome_wizard (QWidget *parent = nullptr);
+  welcome_wizard (QWidget *parent = nullptr);
 
-    ~welcome_wizard () = default;
+  ~welcome_wizard () = default;
 
-    void adjust_size ();
+  void adjust_size ();
 
-  private:
+private:
 
-    QList<page_creator_fptr> m_page_ctor_list;
-    QList<page_creator_fptr>::iterator m_page_list_iterator;
-    QWidget *m_current_page;
-    bool m_allow_web_connect_state;
-    int m_max_height;
-    int m_max_width;
+  QList<page_creator_fptr> m_page_ctor_list;
+  QList<page_creator_fptr>::iterator m_page_list_iterator;
+  QWidget *m_current_page;
+  bool m_allow_web_connect_state;
+  int m_max_height;
+  int m_max_width;
 
-  public slots:
+public slots:
 
-    void handle_web_connect_option (int state);
+  void handle_web_connect_option (int state);
 
-    void show_page ();
-    void previous_page ();
-    void next_page ();
+  void show_page ();
+  void previous_page ();
+  void next_page ();
 
-    void accept ();
-  };
+  void accept ();
+};
 
-  class initial_page : public QWidget
-  {
-    Q_OBJECT
+class initial_page : public QWidget
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    initial_page (welcome_wizard *wizard);
+  initial_page (welcome_wizard *wizard);
 
-    ~initial_page () = default;
+  ~initial_page () = default;
 
-    static QWidget *
-    create (welcome_wizard *wizard)
-    {
-      return new initial_page (wizard);
-    }
+  static QWidget *
+  create (welcome_wizard *wizard)
+  {
+    return new initial_page (wizard);
+  }
 
-  private:
+private:
 
-    QLabel *m_title;
-    QLabel *m_message;
-    QLabel *m_logo;
-    QPushButton *m_next;
-    QPushButton *m_cancel;
-  };
+  QLabel *m_title;
+  QLabel *m_message;
+  QLabel *m_logo;
+  QPushButton *m_next;
+  QPushButton *m_cancel;
+};
 
-  class setup_community_news : public QWidget
-  {
-    Q_OBJECT
+class setup_community_news : public QWidget
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    setup_community_news (welcome_wizard *wizard);
+  setup_community_news (welcome_wizard *wizard);
 
-    ~setup_community_news () = default;
+  ~setup_community_news () = default;
 
-    static QWidget *
-    create (welcome_wizard *wizard)
-    {
-      return new setup_community_news (wizard);
-    }
+  static QWidget *
+  create (welcome_wizard *wizard)
+  {
+    return new setup_community_news (wizard);
+  }
 
-  private:
+private:
 
-    QLabel *m_title;
-    QLabel *m_message;
-    QCheckBox *m_checkbox;
-    QLabel *m_checkbox_message;
-    QLabel *m_logo;
-    QPushButton *m_previous;
-    QPushButton *m_next;
-    QPushButton *m_cancel;
-  };
+  QLabel *m_title;
+  QLabel *m_message;
+  QCheckBox *m_checkbox;
+  QLabel *m_checkbox_message;
+  QLabel *m_logo;
+  QPushButton *m_previous;
+  QPushButton *m_next;
+  QPushButton *m_cancel;
+};
 
-  class final_page : public QWidget
-  {
-    Q_OBJECT
+class final_page : public QWidget
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    final_page (welcome_wizard *wizard);
+  final_page (welcome_wizard *wizard);
 
-    ~final_page () = default;
+  ~final_page () = default;
 
-    static QWidget *
-    create (welcome_wizard *wizard)
-    {
-      return new final_page (wizard);
-    }
+  static QWidget *
+  create (welcome_wizard *wizard)
+  {
+    return new final_page (wizard);
+  }
 
-  private:
+private:
 
-    QLabel *m_title;
-    QLabel *m_message;
-    QLabel *m_logo;
-    QLabel *m_links;
-    QPushButton *m_previous;
-    QPushButton *m_finish;
-    QPushButton *m_cancel;
-  };
+  QLabel *m_title;
+  QLabel *m_message;
+  QLabel *m_logo;
+  QLabel *m_links;
+  QPushButton *m_previous;
+  QPushButton *m_finish;
+  QPushButton *m_cancel;
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/src/workspace-model.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/workspace-model.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -41,249 +41,249 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  workspace_model::workspace_model (QObject *p)
-    : QAbstractTableModel (p)
-  {
-    // The header names. Use tr () again when accessing them since
-    // the translator si not yet initialized when this ctor is called
-    m_columnNames.append (tr ("Name"));
-    m_columnNames.append (tr ("Class"));
-    m_columnNames.append (tr ("Dimension"));
-    m_columnNames.append (tr ("Value"));
-    m_columnNames.append (tr ("Attribute"));
+workspace_model::workspace_model (QObject *p)
+  : QAbstractTableModel (p)
+{
+  // The header names. Use tr () again when accessing them since
+  // the translator si not yet initialized when this ctor is called
+  m_columnNames.append (tr ("Name"));
+  m_columnNames.append (tr ("Class"));
+  m_columnNames.append (tr ("Dimension"));
+  m_columnNames.append (tr ("Value"));
+  m_columnNames.append (tr ("Attribute"));
 
-    // Initialize the background and foreground colors of special
-    // classes in the workspace view.  The structure is
-    // m_storage_class_colors(1,2,...,colors):        background colors
-    // m_storage_class_colors(colors+1,...,2*colors): foreground colors
-    for (unsigned int i = 0; i < 2*ws_colors_count; i++)
-      m_storage_class_colors.append (QColor (Qt::white));
+  // Initialize the background and foreground colors of special
+  // classes in the workspace view.  The structure is
+  // m_storage_class_colors(1,2,...,colors):        background colors
+  // m_storage_class_colors(colors+1,...,2*colors): foreground colors
+  for (unsigned int i = 0; i < 2*ws_colors_count; i++)
+    m_storage_class_colors.append (QColor (Qt::white));
 
-  }
+}
 
-  int
-  workspace_model::rowCount (const QModelIndex&) const
-  {
-    return m_symbols.size ();
-  }
+int
+workspace_model::rowCount (const QModelIndex&) const
+{
+  return m_symbols.size ();
+}
 
-  int
-  workspace_model::columnCount (const QModelIndex&) const
-  {
-    return m_columnNames.size ();
-  }
+int
+workspace_model::columnCount (const QModelIndex&) const
+{
+  return m_columnNames.size ();
+}
 
-  Qt::ItemFlags
-  workspace_model::flags (const QModelIndex& idx) const
-  {
-    Qt::ItemFlags retval = Qt::NoItemFlags;
+Qt::ItemFlags
+workspace_model::flags (const QModelIndex& idx) const
+{
+  Qt::ItemFlags retval = Qt::NoItemFlags;
 
-    if (idx.isValid ())
-      {
-        retval |= Qt::ItemIsEnabled;
+  if (idx.isValid ())
+    {
+      retval |= Qt::ItemIsEnabled;
 
-        if (m_top_level && idx.column () == 0)
-          retval |= Qt::ItemIsSelectable;
-      }
+      if (m_top_level && idx.column () == 0)
+        retval |= Qt::ItemIsSelectable;
+    }
 
-    return retval;
-  }
+  return retval;
+}
 
-  QVariant
-  workspace_model::headerData (int section, Qt::Orientation orientation,
-                               int role) const
-  {
-    if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
-      return tr (m_columnNames[section].toStdString ().data ());
-    else
-      return QVariant ();
-  }
+QVariant
+workspace_model::headerData (int section, Qt::Orientation orientation,
+                             int role) const
+{
+  if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
+    return tr (m_columnNames[section].toStdString ().data ());
+  else
+    return QVariant ();
+}
 
-  QVariant
-  workspace_model::data (const QModelIndex& idx, int role) const
-  {
-    QVariant retval;
+QVariant
+workspace_model::data (const QModelIndex& idx, int role) const
+{
+  QVariant retval;
 
-    if (idx.isValid ())
-      {
-        if ((role == Qt::BackgroundRole || role == Qt::ForegroundRole)
-            && m_enable_colors)
-          {
-            int actual_class
-              = ws_class_chars.indexOf (m_scopes[idx.row ()].toLatin1 ());
-            if (actual_class >= 0)
-              {
-                // Valid class: Get background (normal indexes) or foreground
-                // color (indexes with offset)
-                if (role == Qt::ForegroundRole)
-                  actual_class += ws_colors_count;
+  if (idx.isValid ())
+    {
+      if ((role == Qt::BackgroundRole || role == Qt::ForegroundRole)
+          && m_enable_colors)
+        {
+          int actual_class
+            = ws_class_chars.indexOf (m_scopes[idx.row ()].toLatin1 ());
+          if (actual_class >= 0)
+            {
+              // Valid class: Get background (normal indexes) or foreground
+              // color (indexes with offset)
+              if (role == Qt::ForegroundRole)
+                actual_class += ws_colors_count;
 
-                return QVariant (m_storage_class_colors.at (actual_class));
-              }
-            else
-              return retval;
-          }
+              return QVariant (m_storage_class_colors.at (actual_class));
+            }
+          else
+            return retval;
+        }
 
-        if (role == Qt::DisplayRole
-            || (idx.column () == 0 && role == Qt::EditRole)
-            || (idx.column () == 0 && role == Qt::ToolTipRole))
-          {
-            switch (idx.column ())
-              {
-              case 0:
-                if (role == Qt::ToolTipRole)
-                  retval
-                    = QVariant (tr ("Right click to copy, rename, or display"));
-                else
-                  retval = QVariant (m_symbols[idx.row ()]);
-                break;
+      if (role == Qt::DisplayRole
+          || (idx.column () == 0 && role == Qt::EditRole)
+          || (idx.column () == 0 && role == Qt::ToolTipRole))
+        {
+          switch (idx.column ())
+            {
+            case 0:
+              if (role == Qt::ToolTipRole)
+                retval
+                  = QVariant (tr ("Right click to copy, rename, or display"));
+              else
+                retval = QVariant (m_symbols[idx.row ()]);
+              break;
 
-              case 1:
-                retval = QVariant (m_class_names[idx.row ()]);
-                break;
+            case 1:
+              retval = QVariant (m_class_names[idx.row ()]);
+              break;
 
-              case 2:
-                retval = QVariant (m_dimensions[idx.row ()]);
-                break;
+            case 2:
+              retval = QVariant (m_dimensions[idx.row ()]);
+              break;
 
-              case 3:
-                retval = QVariant (m_values[idx.row ()]);
-                break;
+            case 3:
+              retval = QVariant (m_values[idx.row ()]);
+              break;
 
-              case 4:
-                {
-                  QString sclass;
+            case 4:
+              {
+                QString sclass;
 
-                  int actual_class
-                    = ws_class_chars.indexOf (m_scopes[idx.row ()].toLatin1 ());
+                int actual_class
+                  = ws_class_chars.indexOf (m_scopes[idx.row ()].toLatin1 ());
 
-                  if (actual_class >= 0)
-                    sclass = ws_color_names.at (actual_class);
+                if (actual_class >= 0)
+                  sclass = ws_color_names.at (actual_class);
 
-                  if (m_complex_flags[idx.row ()])
-                    {
-                      if (sclass.isEmpty ())
-                        sclass = tr ("complex");
-                      else
-                        sclass += ", " + tr ("complex");
-                    }
+                if (m_complex_flags[idx.row ()])
+                  {
+                    if (sclass.isEmpty ())
+                      sclass = tr ("complex");
+                    else
+                      sclass += ", " + tr ("complex");
+                  }
 
-                  retval = QVariant (sclass);
-                }
-                break;
+                retval = QVariant (sclass);
               }
-          }
-      }
+              break;
+            }
+        }
+    }
 
-    return retval;
-  }
+  return retval;
+}
 
-  void
-  workspace_model::set_workspace (bool top_level, bool /* debug */,
-                                  const symbol_info_list& syminfo)
-  {
-    clear_data ();
+void
+workspace_model::set_workspace (bool top_level, bool /* debug */,
+                                const symbol_info_list& syminfo)
+{
+  clear_data ();
 
-    m_top_level = top_level;
-    m_syminfo_list = syminfo;
+  m_top_level = top_level;
+  m_syminfo_list = syminfo;
 
-    update_table ();
-  }
+  update_table ();
+}
 
-  void
-  workspace_model::clear_workspace ()
-  {
-    clear_data ();
-    update_table ();
-  }
+void
+workspace_model::clear_workspace ()
+{
+  clear_data ();
+  update_table ();
+}
 
-  void
-  workspace_model::notice_settings ()
-  {
-    gui_settings settings;
+void
+workspace_model::notice_settings ()
+{
+  gui_settings settings;
 
-    m_enable_colors = settings.bool_value (ws_enable_colors);
+  m_enable_colors = settings.bool_value (ws_enable_colors);
 
-    int mode = settings.int_value (ws_color_mode);
+  int mode = settings.int_value (ws_color_mode);
 
-    for (int i = 0; i < ws_colors_count; i++)
-      {
-        QColor setting_color = settings.color_value (ws_colors[i], mode);
+  for (int i = 0; i < ws_colors_count; i++)
+    {
+      QColor setting_color = settings.color_value (ws_colors[i], mode);
 
-        QPalette p (setting_color);
-        m_storage_class_colors.replace (i, setting_color);
+      QPalette p (setting_color);
+      m_storage_class_colors.replace (i, setting_color);
 
-        QColor fg_color = p.color (QPalette::WindowText);
-        m_storage_class_colors.replace (i + ws_colors_count, fg_color);
+      QColor fg_color = p.color (QPalette::WindowText);
+      m_storage_class_colors.replace (i + ws_colors_count, fg_color);
 
-      }
-  }
+    }
+}
 
-  void
-  workspace_model::show_symbol_tooltip (const QPoint& pos,
-                                        const QString& symbol)
-  {
-    int symbol_idx = m_symbols.indexOf (symbol);
+void
+workspace_model::show_symbol_tooltip (const QPoint& pos,
+                                      const QString& symbol)
+{
+  int symbol_idx = m_symbols.indexOf (symbol);
 
-    if (symbol_idx > -1)
-      QToolTip::showText (pos, symbol + " = " + m_values.at (symbol_idx));
-    else
-      QToolTip::hideText ();
-  }
+  if (symbol_idx > -1)
+    QToolTip::showText (pos, symbol + " = " + m_values.at (symbol_idx));
+  else
+    QToolTip::hideText ();
+}
 
-  void
-  workspace_model::clear_data ()
-  {
-    m_top_level = false;
-    m_syminfo_list = symbol_info_list ();
-    m_scopes = QString ();
-    m_symbols = QStringList ();
-    m_class_names = QStringList ();
-    m_dimensions = QStringList ();
-    m_values = QStringList ();
-    m_complex_flags = QIntList ();
-  }
+void
+workspace_model::clear_data ()
+{
+  m_top_level = false;
+  m_syminfo_list = symbol_info_list ();
+  m_scopes = QString ();
+  m_symbols = QStringList ();
+  m_class_names = QStringList ();
+  m_dimensions = QStringList ();
+  m_values = QStringList ();
+  m_complex_flags = QIntList ();
+}
 
-  void
-  workspace_model::update_table ()
-  {
-    beginResetModel ();
+void
+workspace_model::update_table ()
+{
+  beginResetModel ();
 
-    for (const auto& syminfo : m_syminfo_list)
-      {
-        std::string nm = syminfo.name ();
+  for (const auto& syminfo : m_syminfo_list)
+    {
+      std::string nm = syminfo.name ();
 
-        octave_value val = syminfo.value ();
+      octave_value val = syminfo.value ();
 
-        // FIXME: fix size for objects, see kluge in ov.cc
-        Matrix sz = val.size ();
-        dim_vector dv = dim_vector::alloc (sz.numel ());
-        for (octave_idx_type i = 0; i < dv.ndims (); i++)
-          dv(i) = sz(i);
+      // FIXME: fix size for objects, see kluge in ov.cc
+      Matrix sz = val.size ();
+      dim_vector dv = dim_vector::alloc (sz.numel ());
+      for (octave_idx_type i = 0; i < dv.ndims (); i++)
+        dv(i) = sz(i);
 
-        char storage = ' ';
-        if (syminfo.is_formal ())
-          storage = 'a';
-        else if (syminfo.is_global ())
-          storage = 'g';
-        else if (syminfo.is_persistent ())
-          storage = 'p';
+      char storage = ' ';
+      if (syminfo.is_formal ())
+        storage = 'a';
+      else if (syminfo.is_global ())
+        storage = 'g';
+      else if (syminfo.is_persistent ())
+        storage = 'p';
 
-        std::ostringstream buf;
-        val.short_disp (buf);
-        std::string short_disp_str = buf.str ();
+      std::ostringstream buf;
+      val.short_disp (buf);
+      std::string short_disp_str = buf.str ();
 
-        m_scopes.append (storage);
-        m_symbols.append (QString::fromStdString (nm));
-        m_class_names.append (QString::fromStdString (val.class_name ()));
-        m_dimensions.append (QString::fromStdString (dv.str ()));
-        m_values.append (QString::fromStdString (short_disp_str));
-        m_complex_flags.append (val.iscomplex ());
-      }
+      m_scopes.append (storage);
+      m_symbols.append (QString::fromStdString (nm));
+      m_class_names.append (QString::fromStdString (val.class_name ()));
+      m_dimensions.append (QString::fromStdString (dv.str ()));
+      m_values.append (QString::fromStdString (short_disp_str));
+      m_complex_flags.append (val.iscomplex ());
+    }
 
-    endResetModel ();
+  endResetModel ();
 
-    emit model_changed ();
-  }
+  emit model_changed ();
+}
 
 OCTAVE_END_NAMESPACE(octave)
--- a/libgui/src/workspace-model.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/workspace-model.h	Thu Feb 02 12:25:51 2023 -0800
@@ -41,75 +41,75 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class workspace_model : public QAbstractTableModel
-  {
-    Q_OBJECT
+class workspace_model : public QAbstractTableModel
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    workspace_model (QObject *parent = nullptr);
+  workspace_model (QObject *parent = nullptr);
 
-    ~workspace_model () = default;
+  ~workspace_model () = default;
 
-    int rowCount (const QModelIndex& parent = QModelIndex ()) const;
+  int rowCount (const QModelIndex& parent = QModelIndex ()) const;
 
-    int columnCount (const QModelIndex& parent = QModelIndex ()) const;
+  int columnCount (const QModelIndex& parent = QModelIndex ()) const;
 
-    Qt::ItemFlags flags (const QModelIndex& index) const;
+  Qt::ItemFlags flags (const QModelIndex& index) const;
 
-    QVariant headerData (int section, Qt::Orientation orientation,
-                         int role = Qt::DisplayRole) const;
+  QVariant headerData (int section, Qt::Orientation orientation,
+                       int role = Qt::DisplayRole) const;
 
-    QVariant data (const QModelIndex& index, int role) const;
+  QVariant data (const QModelIndex& index, int role) const;
 
-    bool is_top_level () const { return m_top_level; }
+  bool is_top_level () const { return m_top_level; }
 
-    QColor storage_class_color (int s_class)
-    {
-      return m_storage_class_colors.at (s_class);
-    }
+  QColor storage_class_color (int s_class)
+  {
+    return m_storage_class_colors.at (s_class);
+  }
 
-    symbol_info_list get_symbol_info () const { return m_syminfo_list; }
+  symbol_info_list get_symbol_info () const { return m_syminfo_list; }
 
-    QStringList get_symbol_names () const { return m_symbols; }
-    QStringList get_symbol_values () const { return m_values; }
+  QStringList get_symbol_names () const { return m_symbols; }
+  QStringList get_symbol_values () const { return m_values; }
 
-  signals:
+signals:
 
-    void model_changed ();
-    void prompt_variable_editor();
+  void model_changed ();
+  void prompt_variable_editor();
 
-  public slots:
+public slots:
 
-    void set_workspace (bool top_level, bool debug,
-                        const symbol_info_list& syminfo);
+  void set_workspace (bool top_level, bool debug,
+                      const symbol_info_list& syminfo);
 
-    void clear_workspace ();
+  void clear_workspace ();
 
-    void notice_settings ();
+  void notice_settings ();
 
-    void show_symbol_tooltip (const QPoint& pos, const QString& symbol);
+  void show_symbol_tooltip (const QPoint& pos, const QString& symbol);
 
-  private:
+private:
 
-    void clear_data ();
-    void update_table ();
+  void clear_data ();
+  void update_table ();
 
-    bool m_top_level;
-    symbol_info_list m_syminfo_list;
-    QString m_scopes;
-    QStringList m_symbols;
-    QStringList m_class_names;
-    QStringList m_dimensions;
-    QStringList m_values;
-    QIntList m_complex_flags;
+  bool m_top_level;
+  symbol_info_list m_syminfo_list;
+  QString m_scopes;
+  QStringList m_symbols;
+  QStringList m_class_names;
+  QStringList m_dimensions;
+  QStringList m_values;
+  QIntList m_complex_flags;
 
-    QStringList m_columnNames;
+  QStringList m_columnNames;
 
-    QList<QColor>  m_storage_class_colors;
-    bool m_enable_colors;
+  QList<QColor>  m_storage_class_colors;
+  bool m_enable_colors;
 
-  };
+};
 
 OCTAVE_END_NAMESPACE(octave)
 
--- a/libgui/src/workspace-view.cc	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/workspace-view.cc	Thu Feb 02 12:25:51 2023 -0800
@@ -47,501 +47,501 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  workspace_view::workspace_view (QWidget *p)
-    : octave_dock_widget ("WorkspaceView", p),
-      m_view (new QTableView (this)),
-      m_filter_checkbox (new QCheckBox ()),
-      m_filter (new QComboBox (this)),
-      m_filter_widget (new QWidget (this))
-  {
-    set_title (tr ("Workspace"));
-    setStatusTip (tr ("View the variables in the active workspace."));
+workspace_view::workspace_view (QWidget *p)
+  : octave_dock_widget ("WorkspaceView", p),
+    m_view (new QTableView (this)),
+    m_filter_checkbox (new QCheckBox ()),
+    m_filter (new QComboBox (this)),
+    m_filter_widget (new QWidget (this))
+{
+  set_title (tr ("Workspace"));
+  setStatusTip (tr ("View the variables in the active workspace."));
+
+  m_filter->setToolTip (tr ("Enter text to filter the workspace"));
+  m_filter->setEditable (true);
+  m_filter->setMaxCount (ws_max_filter_history.def ().toInt ());
+  m_filter->setInsertPolicy (QComboBox::NoInsert);
+  m_filter->setSizeAdjustPolicy (QComboBox::AdjustToMinimumContentsLengthWithIcon);
+  QSizePolicy sizePol (QSizePolicy::Expanding, QSizePolicy::Preferred);
+  m_filter->setSizePolicy (sizePol);
+  m_filter->completer ()->setCaseSensitivity (Qt::CaseSensitive);
+
+  QLabel *filter_label = new QLabel (tr ("Filter"));
+
+  m_view->setWordWrap (false);
+  m_view->setContextMenuPolicy (Qt::CustomContextMenu);
+  m_view->setShowGrid (false);
+  (m_view->verticalHeader) ()->hide ();
+  m_view->setAlternatingRowColors (true);
+  m_view_previous_row_count = 0;
 
-    m_filter->setToolTip (tr ("Enter text to filter the workspace"));
-    m_filter->setEditable (true);
-    m_filter->setMaxCount (ws_max_filter_history.def ().toInt ());
-    m_filter->setInsertPolicy (QComboBox::NoInsert);
-    m_filter->setSizeAdjustPolicy (QComboBox::AdjustToMinimumContentsLengthWithIcon);
-    QSizePolicy sizePol (QSizePolicy::Expanding, QSizePolicy::Preferred);
-    m_filter->setSizePolicy (sizePol);
-    m_filter->completer ()->setCaseSensitivity (Qt::CaseSensitive);
+  // Set an empty widget, so we can assign a layout to it.
+  setWidget (new QWidget (this));
+
+  // Create the layouts
+  QHBoxLayout *filter_layout = new QHBoxLayout ();
 
-    QLabel *filter_label = new QLabel (tr ("Filter"));
+  filter_layout->addWidget (filter_label);
+  filter_layout->addWidget (m_filter_checkbox);
+  filter_layout->addWidget (m_filter);
+  filter_layout->setMargin (0);
+
+  m_filter_widget->setLayout (filter_layout);
 
-    m_view->setWordWrap (false);
-    m_view->setContextMenuPolicy (Qt::CustomContextMenu);
-    m_view->setShowGrid (false);
-    (m_view->verticalHeader) ()->hide ();
-    m_view->setAlternatingRowColors (true);
-    m_view_previous_row_count = 0;
+  QVBoxLayout *ws_layout = new QVBoxLayout ();
+  ws_layout->addWidget (m_filter_widget);
+  ws_layout->addWidget (m_view);
+  ws_layout->setSpacing (0);
+
+  gui_settings settings;
 
-    // Set an empty widget, so we can assign a layout to it.
-    setWidget (new QWidget (this));
+  m_filter_shown = settings.bool_value (ws_filter_shown);
+  m_filter_widget->setVisible (m_filter_shown);
+
+  ws_layout->setMargin (2);
 
-    // Create the layouts
-    QHBoxLayout *filter_layout = new QHBoxLayout ();
+  // Set the empty widget to have our layout.
+  widget ()->setLayout (ws_layout);
+
+  // Initialize collapse/expand state of the workspace subcategories.
 
-    filter_layout->addWidget (filter_label);
-    filter_layout->addWidget (m_filter_checkbox);
-    filter_layout->addWidget (m_filter);
-    filter_layout->setMargin (0);
+  //enable sorting (setting column and order after model was set)
+  m_view->setSortingEnabled (true);
+  // Initialize column order and width of the workspace
+  m_view->horizontalHeader ()->restoreState
+    (settings.value (ws_column_state.settings_key ()).toByteArray ());
 
-    m_filter_widget->setLayout (filter_layout);
+  // Set header properties for sorting
+  m_view->horizontalHeader ()->setSectionsClickable (true);
+  m_view->horizontalHeader ()->setSectionsMovable (true);
+  m_view->horizontalHeader ()->setSortIndicator
+    (settings.int_value (ws_sort_column),
+     static_cast<Qt::SortOrder> (settings.uint_value (ws_sort_order)));
+  // FIXME: use value<Qt::SortOrder> instead of static cast after
+  //        dropping support of Qt 5.4
 
-    QVBoxLayout *ws_layout = new QVBoxLayout ();
-    ws_layout->addWidget (m_filter_widget);
-    ws_layout->addWidget (m_view);
-    ws_layout->setSpacing (0);
+  m_view->horizontalHeader ()->setSortIndicatorShown (true);
+
+  m_view->horizontalHeader ()->setContextMenuPolicy (Qt::CustomContextMenu);
+  connect (m_view->horizontalHeader (),
+           &QTableView::customContextMenuRequested,
+           this, &workspace_view::header_contextmenu_requested);
 
-    gui_settings settings;
+  // Init state of the filter
+  m_filter->addItems (settings.value (ws_mru_list.settings_key ()).toStringList ());
 
-    m_filter_shown = settings.bool_value (ws_filter_shown);
-    m_filter_widget->setVisible (m_filter_shown);
+  bool filter_state = settings.bool_value (ws_filter_active);
+  m_filter_checkbox->setChecked (filter_state);
+  filter_activate (filter_state);
+
+  // Connect signals and slots.
 
-    ws_layout->setMargin (2);
+  connect (m_filter, &QComboBox::editTextChanged,
+           this, &workspace_view::filter_update);
+  connect (m_filter_checkbox, &QCheckBox::toggled,
+           this, &workspace_view::filter_activate);
+  connect (m_filter->lineEdit (), &QLineEdit::editingFinished,
+           this, &workspace_view::update_filter_history);
 
-    // Set the empty widget to have our layout.
-    widget ()->setLayout (ws_layout);
+  connect (m_view, &QTableView::customContextMenuRequested,
+           this, &workspace_view::contextmenu_requested);
 
-    // Initialize collapse/expand state of the workspace subcategories.
+  connect (m_view, &QTableView::activated,
+           this, &workspace_view::handle_contextmenu_edit);
 
-    //enable sorting (setting column and order after model was set)
-    m_view->setSortingEnabled (true);
-    // Initialize column order and width of the workspace
-    m_view->horizontalHeader ()->restoreState
-      (settings.value (ws_column_state.settings_key ()).toByteArray ());
+  if (! p)
+    make_window ();
+}
+
+void workspace_view::setModel (workspace_model *model)
+{
+  m_filter_model.setSourceModel (model);
+  m_filter_model.setFilterKeyColumn(0);
 
-    // Set header properties for sorting
-    m_view->horizontalHeader ()->setSectionsClickable (true);
-    m_view->horizontalHeader ()->setSectionsMovable (true);
-    m_view->horizontalHeader ()->setSortIndicator
-      (settings.int_value (ws_sort_column),
-       static_cast<Qt::SortOrder> (settings.uint_value (ws_sort_order)));
+  m_view->setModel (&m_filter_model);
+
+  // set the sorting after the model is set, it would be ignored otherwise
+
+  gui_settings settings;
+
+  m_view->sortByColumn
+    (settings.int_value (ws_sort_column),
+     static_cast<Qt::SortOrder> (settings.uint_value (ws_sort_order)));
     // FIXME: use value<Qt::SortOrder> instead of static cast after
     //        dropping support of Qt 5.4
 
-    m_view->horizontalHeader ()->setSortIndicatorShown (true);
+  m_model = model;
+}
 
-    m_view->horizontalHeader ()->setContextMenuPolicy (Qt::CustomContextMenu);
-    connect (m_view->horizontalHeader (),
-             &QTableView::customContextMenuRequested,
-             this, &workspace_view::header_contextmenu_requested);
+void
+workspace_view::notice_settings ()
+{
+  gui_settings settings;
 
-    // Init state of the filter
-    m_filter->addItems (settings.value (ws_mru_list.settings_key ()).toStringList ());
+  m_model->notice_settings (); // update colors of model first
 
-    bool filter_state = settings.bool_value (ws_filter_active);
-    m_filter_checkbox->setChecked (filter_state);
-    filter_activate (filter_state);
+  for (int i = 0; i < ws_columns_shown.length (); i++)
+    m_view->setColumnHidden (i + 1, ! settings.value (ws_columns_shown_keys.at (i), true).toBool ());
 
-    // Connect signals and slots.
+  QString tool_tip;
 
-    connect (m_filter, &QComboBox::editTextChanged,
-             this, &workspace_view::filter_update);
-    connect (m_filter_checkbox, &QCheckBox::toggled,
-             this, &workspace_view::filter_activate);
-    connect (m_filter->lineEdit (), &QLineEdit::editingFinished,
-             this, &workspace_view::update_filter_history);
+  if (settings.bool_value (ws_enable_colors)
+      && ! settings.bool_value (ws_hide_tool_tips))
+    {
+      tool_tip  = QString (tr ("View the variables in the active workspace.<br>"));
+      tool_tip += QString (tr ("Colors for variable attributes:"));
 
-    connect (m_view, &QTableView::customContextMenuRequested,
-             this, &workspace_view::contextmenu_requested);
-
-    connect (m_view, &QTableView::activated,
-             this, &workspace_view::handle_contextmenu_edit);
-
-    if (! p)
-      make_window ();
-  }
+      for (int i = 0; i < ws_colors_count; i++)
+        {
+          tool_tip +=
+            QString (R"(<div style="background-color:%1;color:%2">%3</div>)")
+            .arg (m_model->storage_class_color (i).name ())
+            .arg (m_model->storage_class_color (i + ws_colors_count).name ())
+            .arg (QCoreApplication::translate ("octave::settings_dialog",
+                                               ws_color_names.at (i).toStdString ().data ()));
+        }
+    }
 
-  void workspace_view::setModel (workspace_model *model)
-  {
-    m_filter_model.setSourceModel (model);
-    m_filter_model.setFilterKeyColumn(0);
-
-    m_view->setModel (&m_filter_model);
+  setToolTip (tool_tip);
+}
 
-    // set the sorting after the model is set, it would be ignored otherwise
-
-    gui_settings settings;
+void
+workspace_view::save_settings ()
+{
+  gui_settings settings;
 
-    m_view->sortByColumn
-      (settings.int_value (ws_sort_column),
-       static_cast<Qt::SortOrder> (settings.uint_value (ws_sort_order)));
-      // FIXME: use value<Qt::SortOrder> instead of static cast after
-      //        dropping support of Qt 5.4
+  settings.setValue (ws_column_state.settings_key (),
+                     m_view->horizontalHeader ()->saveState ());
 
-    m_model = model;
-  }
+  int sort_column = m_view->horizontalHeader ()->sortIndicatorSection ();
+  Qt::SortOrder sort_order = m_view->horizontalHeader ()->sortIndicatorOrder ();
+  settings.setValue (ws_sort_column.settings_key (), sort_column);
+  settings.setValue (ws_sort_order.settings_key (), sort_order);
 
-  void
-  workspace_view::notice_settings ()
-  {
-    gui_settings settings;
-
-    m_model->notice_settings (); // update colors of model first
+  settings.setValue (ws_filter_active.settings_key (), m_filter_checkbox->isChecked ());
+  settings.setValue (ws_filter_shown.settings_key (), m_filter_shown);
 
-    for (int i = 0; i < ws_columns_shown.length (); i++)
-      m_view->setColumnHidden (i + 1, ! settings.value (ws_columns_shown_keys.at (i), true).toBool ());
-
-    QString tool_tip;
+  QStringList mru;
+  for (int i = 0; i < m_filter->count (); i++)
+    mru.append (m_filter->itemText (i));
+  settings.setValue (ws_mru_list.settings_key (), mru);
 
-    if (settings.bool_value (ws_enable_colors)
-        && ! settings.bool_value (ws_hide_tool_tips))
-      {
-        tool_tip  = QString (tr ("View the variables in the active workspace.<br>"));
-        tool_tip += QString (tr ("Colors for variable attributes:"));
+  settings.sync ();
+
+  octave_dock_widget::save_settings ();
+}
 
-        for (int i = 0; i < ws_colors_count; i++)
-          {
-            tool_tip +=
-              QString (R"(<div style="background-color:%1;color:%2">%3</div>)")
-              .arg (m_model->storage_class_color (i).name ())
-              .arg (m_model->storage_class_color (i + ws_colors_count).name ())
-              .arg (QCoreApplication::translate ("octave::settings_dialog",
-                                                 ws_color_names.at (i).toStdString ().data ()));
-          }
-      }
-
-    setToolTip (tool_tip);
-  }
+void workspace_view::set_filter_focus (bool focus)
+{
+  if (focus)
+    {
+      m_filter->setFocus ();
+      setFocusProxy (m_filter);
+    }
+  else
+    {
+      m_view->setFocus ();
+      setFocusProxy (m_view);
+    }
+}
 
-  void
-  workspace_view::save_settings ()
-  {
-    gui_settings settings;
-
-    settings.setValue (ws_column_state.settings_key (),
-                       m_view->horizontalHeader ()->saveState ());
+void
+workspace_view::filter_update (const QString& expression)
+{
+  m_filter_model.setFilterWildcard (expression);
+  handle_model_changed ();
+}
 
-    int sort_column = m_view->horizontalHeader ()->sortIndicatorSection ();
-    Qt::SortOrder sort_order = m_view->horizontalHeader ()->sortIndicatorOrder ();
-    settings.setValue (ws_sort_column.settings_key (), sort_column);
-    settings.setValue (ws_sort_order.settings_key (), sort_order);
-
-    settings.setValue (ws_filter_active.settings_key (), m_filter_checkbox->isChecked ());
-    settings.setValue (ws_filter_shown.settings_key (), m_filter_shown);
+void
+workspace_view::filter_activate (bool state)
+{
+  m_filter->setEnabled (state);
+  m_filter_model.setDynamicSortFilter (state);
 
-    QStringList mru;
-    for (int i = 0; i < m_filter->count (); i++)
-      mru.append (m_filter->itemText (i));
-    settings.setValue (ws_mru_list.settings_key (), mru);
+  if (state)
+    filter_update (m_filter->currentText ());
+  else
+    filter_update (QString ());
 
-    settings.sync ();
-
-    octave_dock_widget::save_settings ();
-  }
+  set_filter_focus (state);
+}
 
-  void workspace_view::set_filter_focus (bool focus)
-  {
-    if (focus)
-      {
-        m_filter->setFocus ();
-        setFocusProxy (m_filter);
-      }
-    else
-      {
-        m_view->setFocus ();
-        setFocusProxy (m_view);
-      }
-  }
+void
+workspace_view::update_filter_history ()
+{
+  QString text = m_filter->currentText ();   // get current text
+  int index = m_filter->findText (text);     // and its actual index
+
+  if (index > -1)
+    m_filter->removeItem (index);    // remove if already existing
 
-  void
-  workspace_view::filter_update (const QString& expression)
-  {
-    m_filter_model.setFilterWildcard (expression);
-    handle_model_changed ();
-  }
+  m_filter->insertItem (0, text);    // (re)insert at beginning
+  m_filter->setCurrentIndex (0);
+}
 
-  void
-  workspace_view::filter_activate (bool state)
-  {
-    m_filter->setEnabled (state);
-    m_filter_model.setDynamicSortFilter (state);
+void
+workspace_view::header_contextmenu_requested (const QPoint& mpos)
+{
+  QMenu menu (this);
+  QSignalMapper sig_mapper (this);
 
-    if (state)
-      filter_update (m_filter->currentText ());
-    else
-      filter_update (QString ());
-
-    set_filter_focus (state);
-  }
+  gui_settings settings;
 
-  void
-  workspace_view::update_filter_history ()
-  {
-    QString text = m_filter->currentText ();   // get current text
-    int index = m_filter->findText (text);     // and its actual index
-
-    if (index > -1)
-      m_filter->removeItem (index);    // remove if already existing
+  for (int i = 0; i < ws_columns_shown.length (); i++)
+    {
+      QAction *action
+        = menu.addAction (tr (ws_columns_shown.at (i).toStdString ().data ()),
+                          &sig_mapper, SLOT (map ()));
+      sig_mapper.setMapping (action, i);
+      action->setCheckable (true);
+      action->setChecked (settings.value (ws_columns_shown_keys.at (i), true).toBool ());
+    }
 
-    m_filter->insertItem (0, text);    // (re)insert at beginning
-    m_filter->setCurrentIndex (0);
-  }
-
-  void
-  workspace_view::header_contextmenu_requested (const QPoint& mpos)
-  {
-    QMenu menu (this);
-    QSignalMapper sig_mapper (this);
+  // FIXME: We could use
+  //
+  //   connect (&m_sig_mapper, QOverload<int>::of (&QSignalMapper::mapped),
+  //            this, &workspace_view::toggle_header);
+  //
+  // but referring to QSignalMapper::mapped will generate deprecated
+  // function warnings from GCC.  We could also use
+  //
+  //   connect (&m_sig_mapper, &QSignalMapper::mappedInt,
+  //            this, &workspace_view::toggle_header);
+  //
+  // but the function mappedInt was not introduced until Qt 5.15 so
+  // we'll need a feature test.
 
-    gui_settings settings;
+  connect (&sig_mapper, SIGNAL (mapped (int)),
+           this, SLOT (toggle_header (int)));
+
+  menu.exec (m_view->mapToGlobal (mpos));
+}
 
-    for (int i = 0; i < ws_columns_shown.length (); i++)
-      {
-        QAction *action
-          = menu.addAction (tr (ws_columns_shown.at (i).toStdString ().data ()),
-                            &sig_mapper, SLOT (map ()));
-        sig_mapper.setMapping (action, i);
-        action->setCheckable (true);
-        action->setChecked (settings.value (ws_columns_shown_keys.at (i), true).toBool ());
-      }
+void
+workspace_view::toggle_header (int col)
+{
+  gui_settings settings;
+
+  QString key = ws_columns_shown_keys.at (col);
+  bool shown = settings.value (key, true).toBool ();
 
-    // FIXME: We could use
-    //
-    //   connect (&m_sig_mapper, QOverload<int>::of (&QSignalMapper::mapped),
-    //            this, &workspace_view::toggle_header);
-    //
-    // but referring to QSignalMapper::mapped will generate deprecated
-    // function warnings from GCC.  We could also use
-    //
-    //   connect (&m_sig_mapper, &QSignalMapper::mappedInt,
-    //            this, &workspace_view::toggle_header);
-    //
-    // but the function mappedInt was not introduced until Qt 5.15 so
-    // we'll need a feature test.
+  m_view->setColumnHidden (col + 1, shown);
+
+  settings.setValue (key, ! shown);
+  settings.sync ();
+
+  octave_dock_widget::save_settings ();
+}
+
+void
+workspace_view::contextmenu_requested (const QPoint& qpos)
+{
+  QMenu menu (this);
 
-    connect (&sig_mapper, SIGNAL (mapped (int)),
-             this, SLOT (toggle_header (int)));
+  QModelIndex index = m_view->indexAt (qpos);
 
-    menu.exec (m_view->mapToGlobal (mpos));
-  }
+  // if it isn't Local, Global etc, allow the ctx menu
+  if (index.isValid () && index.column () == 0)
+    {
+      QString var_name = get_var_name (index);
 
-  void
-  workspace_view::toggle_header (int col)
-  {
-    gui_settings settings;
+      menu.addAction (tr ("Open in Variable Editor"), this,
+                      &workspace_view::handle_contextmenu_edit);
 
-    QString key = ws_columns_shown_keys.at (col);
-    bool shown = settings.value (key, true).toBool ();
+      menu.addAction (tr ("Copy name"), this,
+                      &workspace_view::handle_contextmenu_copy);
 
-    m_view->setColumnHidden (col + 1, shown);
-
-    settings.setValue (key, ! shown);
-    settings.sync ();
+      menu.addAction (tr ("Copy value"), this,
+                      &workspace_view::handle_contextmenu_copy_value);
 
-    octave_dock_widget::save_settings ();
-  }
-
-  void
-  workspace_view::contextmenu_requested (const QPoint& qpos)
-  {
-    QMenu menu (this);
-
-    QModelIndex index = m_view->indexAt (qpos);
+      QAction *rename
+        = menu.addAction (tr ("Rename"), this,
+                          &workspace_view::handle_contextmenu_rename);
 
-    // if it isn't Local, Global etc, allow the ctx menu
-    if (index.isValid () && index.column () == 0)
-      {
-        QString var_name = get_var_name (index);
+      // Use m_model here instead of using "m_view->model ()" because
+      // that points to the proxy model.
+      if (! m_model->is_top_level ())
+        {
+          rename->setDisabled (true);
+          rename->setToolTip (tr ("Only top-level symbols may be renamed"));
+        }
 
-        menu.addAction (tr ("Open in Variable Editor"), this,
-                        &workspace_view::handle_contextmenu_edit);
+      menu.addAction ("Clear " + var_name, this,
+                      &workspace_view::handle_contextmenu_clear);
 
-        menu.addAction (tr ("Copy name"), this,
-                        &workspace_view::handle_contextmenu_copy);
+      menu.addSeparator ();
 
-        menu.addAction (tr ("Copy value"), this,
-                        &workspace_view::handle_contextmenu_copy_value);
+      menu.addAction ("disp (" + var_name + ')', this,
+                      &workspace_view::handle_contextmenu_disp);
 
-        QAction *rename
-          = menu.addAction (tr ("Rename"), this,
-                            &workspace_view::handle_contextmenu_rename);
+      menu.addAction ("plot (" + var_name + ')', this,
+                      &workspace_view::handle_contextmenu_plot);
 
-        // Use m_model here instead of using "m_view->model ()" because
-        // that points to the proxy model.
-        if (! m_model->is_top_level ())
-          {
-            rename->setDisabled (true);
-            rename->setToolTip (tr ("Only top-level symbols may be renamed"));
-          }
+      menu.addAction ("stem (" + var_name + ')', this,
+                      &workspace_view::handle_contextmenu_stem);
+
+      menu.addSeparator ();
+
+    }
 
-        menu.addAction ("Clear " + var_name, this,
-                        &workspace_view::handle_contextmenu_clear);
-
-        menu.addSeparator ();
-
-        menu.addAction ("disp (" + var_name + ')', this,
-                        &workspace_view::handle_contextmenu_disp);
+  if (m_filter_shown)
+    menu.addAction (tr ("Hide filter"), this,
+                    &workspace_view::handle_contextmenu_filter);
+  else
+    menu.addAction (tr ("Show filter"), this,
+                    &workspace_view::handle_contextmenu_filter);
 
-        menu.addAction ("plot (" + var_name + ')', this,
-                        &workspace_view::handle_contextmenu_plot);
+  menu.exec (m_view->mapToGlobal (qpos));
+}
 
-        menu.addAction ("stem (" + var_name + ')', this,
-                        &workspace_view::handle_contextmenu_stem);
-
-        menu.addSeparator ();
+void
+workspace_view::handle_contextmenu_copy ()
+{
+  QModelIndex index = m_view->currentIndex ();
 
-      }
+  if (index.isValid ())
+    {
+      QString var_name = get_var_name (index);
 
-    if (m_filter_shown)
-      menu.addAction (tr ("Hide filter"), this,
-                      &workspace_view::handle_contextmenu_filter);
-    else
-      menu.addAction (tr ("Show filter"), this,
-                      &workspace_view::handle_contextmenu_filter);
+      QClipboard *clipboard = QApplication::clipboard ();
 
-    menu.exec (m_view->mapToGlobal (qpos));
-  }
+      clipboard->setText (var_name);
+    }
+}
 
-  void
-  workspace_view::handle_contextmenu_copy ()
-  {
-    QModelIndex index = m_view->currentIndex ();
+void
+workspace_view::handle_contextmenu_copy_value ()
+{
+  QModelIndex index = m_view->currentIndex ();
 
-    if (index.isValid ())
-      {
-        QString var_name = get_var_name (index);
+  if (index.isValid ())
+    emit copy_variable_value_to_clipboard (get_var_name (index));
+}
 
-        QClipboard *clipboard = QApplication::clipboard ();
-
-        clipboard->setText (var_name);
-      }
-  }
+void
+workspace_view::handle_contextmenu_rename ()
+{
+  QModelIndex index = m_view->currentIndex ();
 
-  void
-  workspace_view::handle_contextmenu_copy_value ()
-  {
-    QModelIndex index = m_view->currentIndex ();
+  if (index.isValid ())
+    {
+      QString var_name = get_var_name (index);
 
-    if (index.isValid ())
-      emit copy_variable_value_to_clipboard (get_var_name (index));
-  }
+      QInputDialog *inputDialog = new QInputDialog ();
 
-  void
-  workspace_view::handle_contextmenu_rename ()
-  {
-    QModelIndex index = m_view->currentIndex ();
+      inputDialog->setOptions (QInputDialog::NoButtons);
+
+      bool ok = false;
 
-    if (index.isValid ())
-      {
-        QString var_name = get_var_name (index);
-
-        QInputDialog *inputDialog = new QInputDialog ();
+      QString new_name
+        = inputDialog->getText (nullptr, "Rename Variable", "New name:",
+                                QLineEdit::Normal, var_name, &ok);
 
-        inputDialog->setOptions (QInputDialog::NoButtons);
-
-        bool ok = false;
+      if (ok && ! new_name.isEmpty ())
+        emit rename_variable_signal (var_name, new_name);
+    }
+}
 
-        QString new_name
-          = inputDialog->getText (nullptr, "Rename Variable", "New name:",
-                                  QLineEdit::Normal, var_name, &ok);
+void
+workspace_view::handle_contextmenu_edit ()
+{
+  QModelIndex index = m_view->currentIndex ();
 
-        if (ok && ! new_name.isEmpty ())
-          emit rename_variable_signal (var_name, new_name);
-      }
-  }
-
-  void
-  workspace_view::handle_contextmenu_edit ()
-  {
-    QModelIndex index = m_view->currentIndex ();
+  if (index.isValid ())
+    emit edit_variable_signal (get_var_name (index));
+}
 
-    if (index.isValid ())
-      emit edit_variable_signal (get_var_name (index));
-  }
+void
+workspace_view::handle_contextmenu_clear ()
+{
+  relay_contextmenu_command ("clear", true);
+}
 
-  void
-  workspace_view::handle_contextmenu_clear ()
-  {
-    relay_contextmenu_command ("clear", true);
-  }
+void
+workspace_view::handle_contextmenu_disp ()
+{
+  relay_contextmenu_command ("disp");
+}
 
-  void
-  workspace_view::handle_contextmenu_disp ()
-  {
-    relay_contextmenu_command ("disp");
-  }
-
-  void
-  workspace_view::handle_contextmenu_plot ()
-  {
-    relay_contextmenu_command ("figure (); plot");
-  }
+void
+workspace_view::handle_contextmenu_plot ()
+{
+  relay_contextmenu_command ("figure (); plot");
+}
 
-  void
-  workspace_view::handle_contextmenu_stem ()
-  {
-    relay_contextmenu_command ("figure (); stem");
-  }
+void
+workspace_view::handle_contextmenu_stem ()
+{
+  relay_contextmenu_command ("figure (); stem");
+}
 
-  void
-  workspace_view::handle_contextmenu_filter ()
-  {
-    m_filter_shown = ! m_filter_shown;
-    m_filter_widget->setVisible (m_filter_shown);
+void
+workspace_view::handle_contextmenu_filter ()
+{
+  m_filter_shown = ! m_filter_shown;
+  m_filter_widget->setVisible (m_filter_shown);
 
-    set_filter_focus (m_filter_shown && m_filter_checkbox->isChecked ());
-  }
+  set_filter_focus (m_filter_shown && m_filter_checkbox->isChecked ());
+}
 
-  void
-  workspace_view::handle_model_changed ()
-  {
-    // m_view->resizeRowsToContents ();
-    // Just modify those rows that have been added rather than go through
-    // the whole list.  For-loop test will handle when number of rows reduced.
-    QFontMetrics fm = m_view->fontMetrics ();
-    int row_height = fm.height ();
-    int new_row_count = m_filter_model.rowCount ();
-    for (int i = m_view_previous_row_count; i < new_row_count; i++)
-      m_view->setRowHeight (i, row_height);
-    m_view_previous_row_count = new_row_count;
-  }
+void
+workspace_view::handle_model_changed ()
+{
+  // m_view->resizeRowsToContents ();
+  // Just modify those rows that have been added rather than go through
+  // the whole list.  For-loop test will handle when number of rows reduced.
+  QFontMetrics fm = m_view->fontMetrics ();
+  int row_height = fm.height ();
+  int new_row_count = m_filter_model.rowCount ();
+  for (int i = m_view_previous_row_count; i < new_row_count; i++)
+    m_view->setRowHeight (i, row_height);
+  m_view_previous_row_count = new_row_count;
+}
 
-  void
-  workspace_view::copyClipboard ()
-  {
-    if (m_view->hasFocus ())
-      handle_contextmenu_copy ();
-  }
+void
+workspace_view::copyClipboard ()
+{
+  if (m_view->hasFocus ())
+    handle_contextmenu_copy ();
+}
 
-  void
-  workspace_view::selectAll ()
-  {
-    if (m_view->hasFocus ())
-      m_view->selectAll ();
-  }
+void
+workspace_view::selectAll ()
+{
+  if (m_view->hasFocus ())
+    m_view->selectAll ();
+}
 
-  void
-  workspace_view::relay_contextmenu_command (const QString& cmdname, bool str)
-  {
-    QModelIndex index = m_view->currentIndex ();
+void
+workspace_view::relay_contextmenu_command (const QString& cmdname, bool str)
+{
+  QModelIndex index = m_view->currentIndex ();
 
-    if (index.isValid ())
-      {
-        QString var_name;
+  if (index.isValid ())
+    {
+      QString var_name;
 
-        if (str)
-          var_name = "\'" + get_var_name (index) + "\'";
-        else
-          var_name = get_var_name (index);
+      if (str)
+        var_name = "\'" + get_var_name (index) + "\'";
+      else
+        var_name = get_var_name (index);
 
-        emit command_requested (cmdname + " (" + var_name + ");");
-      }
-  }
+      emit command_requested (cmdname + " (" + var_name + ");");
+    }
+}
 
-  QString
-  workspace_view::get_var_name (const QModelIndex& index)
-  {
-    // We are using a sort model proxy so m_model won't provide the
-    // correct ordering.
+QString
+workspace_view::get_var_name (const QModelIndex& index)
+{
+  // We are using a sort model proxy so m_model won't provide the
+  // correct ordering.
 
-    QAbstractItemModel *m = m_view->model ();
+  QAbstractItemModel *m = m_view->model ();
 
-    QMap<int, QVariant> item_data
-      = m->itemData (index.sibling (index.row (), 0));
+  QMap<int, QVariant> item_data
+    = m->itemData (index.sibling (index.row (), 0));
 
-    return item_data[0].toString ();
-  }
+  return item_data[0].toString ();
+}
 
 OCTAVE_END_NAMESPACE(octave)
--- a/libgui/src/workspace-view.h	Thu Feb 02 11:10:18 2023 -0800
+++ b/libgui/src/workspace-view.h	Thu Feb 02 12:25:51 2023 -0800
@@ -39,93 +39,93 @@
 
 OCTAVE_BEGIN_NAMESPACE(octave)
 
-  class workspace_view : public octave_dock_widget
-  {
-    Q_OBJECT
+class workspace_view : public octave_dock_widget
+{
+  Q_OBJECT
 
-  public:
+public:
 
-    workspace_view (QWidget *parent);
+  workspace_view (QWidget *parent);
 
-    ~workspace_view () = default;
+  ~workspace_view () = default;
 
-  signals:
+signals:
 
-    //! Signal that user had requested a command on a variable.
+  //! Signal that user had requested a command on a variable.
 
-    void command_requested (const QString& cmd);
+  void command_requested (const QString& cmd);
 
-    //! Signal that user wnats to copy a variable value to the
-    //! clipboard.
+  //! Signal that user wnats to copy a variable value to the
+  //! clipboard.
 
-    void copy_variable_value_to_clipboard (const QString&);
+  void copy_variable_value_to_clipboard (const QString&);
 
-    //! Signal that user wants to rename a variable.
+  //! Signal that user wants to rename a variable.
 
-    void rename_variable_signal (const QString&, const QString&);
+  void rename_variable_signal (const QString&, const QString&);
 
-    //! Signal that user wants to edit a variable.
+  //! Signal that user wants to edit a variable.
 
-    void edit_variable_signal (const QString&);
+  void edit_variable_signal (const QString&);
 
-  public slots:
+public slots:
 
-    void setModel (workspace_model *model);
+  void setModel (workspace_model *model);
 
-    void notice_settings ();
+  void notice_settings ();
 
-    void save_settings ();
+  void save_settings ();
 
-  protected slots:
+protected slots:
 
-    void filter_update (const QString& expression);
-    void filter_activate (bool enable);
-    void update_filter_history ();
+  void filter_update (const QString& expression);
+  void filter_activate (bool enable);
+  void update_filter_history ();
 
-    void header_contextmenu_requested (const QPoint& mpos);
+  void header_contextmenu_requested (const QPoint& mpos);
 
-    void toggle_header (int column);
+  void toggle_header (int column);
 
-    void contextmenu_requested (const QPoint& pos);
+  void contextmenu_requested (const QPoint& pos);
 
-    void handle_contextmenu_copy ();
-    void handle_contextmenu_copy_value ();
-    void handle_contextmenu_rename ();
-    void handle_contextmenu_edit ();
-    void handle_contextmenu_clear ();
-    void handle_contextmenu_disp ();
-    void handle_contextmenu_plot ();
-    void handle_contextmenu_stem ();
-    void handle_contextmenu_filter ();
+  void handle_contextmenu_copy ();
+  void handle_contextmenu_copy_value ();
+  void handle_contextmenu_rename ();
+  void handle_contextmenu_edit ();
+  void handle_contextmenu_clear ();
+  void handle_contextmenu_disp ();
+  void handle_contextmenu_plot ();
+  void handle_contextmenu_stem ();
+  void handle_contextmenu_filter ();
 
-  public slots:
+public slots:
 
-    void handle_model_changed ();
+  void handle_model_changed ();
 
-    void copyClipboard ();
-    void selectAll ();
+  void copyClipboard ();
+  void selectAll ();
 
-  private:
+private:
 
-    void relay_contextmenu_command (const QString& cmdname, bool str = false);
-    void set_filter_focus (bool focus);
+  void relay_contextmenu_command (const QString& cmdname, bool str = false);
+  void set_filter_focus (bool focus);
 
-    QString get_var_name (const QModelIndex& index);
+  QString get_var_name (const QModelIndex& index);
 
-    QTableView *m_view;
-    int m_view_previous_row_count;
+  QTableView *m_view;
+  int m_view_previous_row_count;
 
-    // We are using a sort model proxy so m_model won't provide the
-    // correct ordering.  It is still OK to use this pointer to access
-    // other info attached to the model, for example the scope or colors.
-    workspace_model *m_model;
+  // We are using a sort model proxy so m_model won't provide the
+  // correct ordering.  It is still OK to use this pointer to access
+  // other info attached to the model, for example the scope or colors.
+  workspace_model *m_model;
 
-    QSortFilterProxyModel m_filter_model;
-    QCheckBox *m_filter_checkbox;
-    QComboBox *m_filter;
-    QWidget *m_filter_widget;
-    bool m_filter_shown;
-  };
+  QSortFilterProxyModel m_filter_model;
+  QCheckBox *m_filter_checkbox;
+  QComboBox *m_filter;
+  QWidget *m_filter_widget;
+  bool m_filter_shown;
+};
 
 OCTAVE_END_NAMESPACE(octave)