Merge remote-tracking branch 'origin/pr/5498'
This commit is contained in:
commit
3dc4970460
|
|
@ -280,9 +280,9 @@
|
|||
|<<session.default_name,session.default_name>>|Name of the session to save by default.
|
||||
|<<session.lazy_restore,session.lazy_restore>>|Load a restored tab as soon as it takes focus.
|
||||
|<<spellcheck.languages,spellcheck.languages>>|Languages to use for spell checking.
|
||||
|<<statusbar.hide,statusbar.hide>>|Hide the statusbar unless a message is shown.
|
||||
|<<statusbar.padding,statusbar.padding>>|Padding (in pixels) for the statusbar.
|
||||
|<<statusbar.position,statusbar.position>>|Position of the status bar.
|
||||
|<<statusbar.show,statusbar.show>>|When to show the statusbar.
|
||||
|<<statusbar.widgets,statusbar.widgets>>|List of widgets displayed in the statusbar.
|
||||
|<<tabs.background,tabs.background>>|Open new tabs (middleclick/ctrl+click) in the background.
|
||||
|<<tabs.close_mouse_button,tabs.close_mouse_button>>|Mouse button with which to close tabs.
|
||||
|
|
@ -3585,14 +3585,6 @@ On QtWebEngine, this setting requires Qt 5.8 or newer.
|
|||
|
||||
On QtWebKit, this setting is unavailable.
|
||||
|
||||
[[statusbar.hide]]
|
||||
=== statusbar.hide
|
||||
Hide the statusbar unless a message is shown.
|
||||
|
||||
Type: <<types,Bool>>
|
||||
|
||||
Default: +pass:[false]+
|
||||
|
||||
[[statusbar.padding]]
|
||||
=== statusbar.padding
|
||||
Padding (in pixels) for the statusbar.
|
||||
|
|
@ -3619,6 +3611,20 @@ Valid values:
|
|||
|
||||
Default: +pass:[bottom]+
|
||||
|
||||
[[statusbar.show]]
|
||||
=== statusbar.show
|
||||
When to show the statusbar.
|
||||
|
||||
Type: <<types,String>>
|
||||
|
||||
Valid values:
|
||||
|
||||
* +always+: Always show the statusbar.
|
||||
* +never+: Always hide the statusbar unless a message is shown.
|
||||
* +in-mode+: Only show the statusbar when in modes other than normal mode or when a message is shown.
|
||||
|
||||
Default: +pass:[always]+
|
||||
|
||||
[[statusbar.widgets]]
|
||||
=== statusbar.widgets
|
||||
List of widgets displayed in the statusbar.
|
||||
|
|
|
|||
|
|
@ -1559,10 +1559,17 @@ spellcheck.languages:
|
|||
|
||||
## statusbar
|
||||
|
||||
statusbar.hide:
|
||||
type: Bool
|
||||
default: false
|
||||
desc: Hide the statusbar unless a message is shown.
|
||||
statusbar.show:
|
||||
default: always
|
||||
type:
|
||||
name: String
|
||||
valid_values:
|
||||
- always: Always show the statusbar.
|
||||
- never: Always hide the statusbar unless a message is shown.
|
||||
- in-mode: >-
|
||||
Only show the statusbar when in modes other than normal mode or
|
||||
when a message is shown.
|
||||
desc: When to show the statusbar.
|
||||
|
||||
statusbar.padding:
|
||||
type: Padding
|
||||
|
|
|
|||
|
|
@ -332,6 +332,11 @@ class YamlMigrations(QObject):
|
|||
new_name='tabs.mode_on_change',
|
||||
true_value='persist',
|
||||
false_value='normal')
|
||||
self._migrate_renamed_bool(
|
||||
old_name='statusbar.hide',
|
||||
new_name='statusbar.show',
|
||||
true_value='never',
|
||||
false_value='always')
|
||||
|
||||
for setting in ['tabs.title.format',
|
||||
'tabs.title.format_pinned',
|
||||
|
|
|
|||
|
|
@ -68,6 +68,14 @@ class NotInModeError(Exception):
|
|||
"""Exception raised when we want to leave a mode we're not in."""
|
||||
|
||||
|
||||
class UnavailableError(Exception):
|
||||
|
||||
"""Exception raised when trying to access modeman before initialization.
|
||||
|
||||
Thrown by instance() if modeman has not been initialized yet.
|
||||
"""
|
||||
|
||||
|
||||
def init(win_id: int, parent: QObject) -> 'ModeManager':
|
||||
"""Initialize the mode manager and the keyparsers for the given win_id."""
|
||||
modeman = ModeManager(win_id, parent)
|
||||
|
|
@ -169,8 +177,16 @@ def init(win_id: int, parent: QObject) -> 'ModeManager':
|
|||
|
||||
|
||||
def instance(win_id: Union[int, str]) -> 'ModeManager':
|
||||
"""Get a modemanager object."""
|
||||
return objreg.get('mode-manager', scope='window', window=win_id)
|
||||
"""Get a modemanager object.
|
||||
|
||||
Raises UnavailableError if there is no instance available yet.
|
||||
"""
|
||||
mode_manager = objreg.get('mode-manager', scope='window', window=win_id,
|
||||
default=None)
|
||||
if mode_manager is not None:
|
||||
return mode_manager
|
||||
else:
|
||||
raise UnavailableError("ModeManager is not initialized yet.")
|
||||
|
||||
|
||||
def enter(win_id: int,
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ class StatusBar(QWidget):
|
|||
|
||||
@pyqtSlot(str)
|
||||
def _on_config_changed(self, option):
|
||||
if option == 'statusbar.hide':
|
||||
if option == 'statusbar.show':
|
||||
self.maybe_hide()
|
||||
elif option == 'statusbar.padding':
|
||||
self._set_hbox_padding()
|
||||
|
|
@ -254,12 +254,26 @@ class StatusBar(QWidget):
|
|||
@pyqtSlot()
|
||||
def maybe_hide(self):
|
||||
"""Hide the statusbar if it's configured to do so."""
|
||||
strategy = config.val.statusbar.show
|
||||
tab = self._current_tab()
|
||||
hide = config.val.statusbar.hide
|
||||
if hide or (tab is not None and tab.data.fullscreen):
|
||||
if tab is not None and tab.data.fullscreen:
|
||||
self.hide()
|
||||
else:
|
||||
elif strategy == 'never':
|
||||
self.hide()
|
||||
elif strategy == 'in-mode':
|
||||
try:
|
||||
mode_manager = modeman.instance(self._win_id)
|
||||
except modeman.UnavailableError:
|
||||
self.hide()
|
||||
else:
|
||||
if mode_manager.mode == usertypes.KeyMode.normal:
|
||||
self.hide()
|
||||
else:
|
||||
self.show()
|
||||
elif strategy == 'always':
|
||||
self.show()
|
||||
else:
|
||||
raise utils.Unreachable
|
||||
|
||||
def _set_hbox_padding(self):
|
||||
padding = config.val.statusbar.padding
|
||||
|
|
@ -336,6 +350,8 @@ class StatusBar(QWidget):
|
|||
def on_mode_entered(self, mode):
|
||||
"""Mark certain modes in the commandline."""
|
||||
mode_manager = modeman.instance(self._win_id)
|
||||
if config.val.statusbar.show == 'in-mode':
|
||||
self.show()
|
||||
if mode_manager.parsers[mode].passthrough:
|
||||
self._set_mode_text(mode.name)
|
||||
if mode in [usertypes.KeyMode.insert,
|
||||
|
|
@ -350,6 +366,8 @@ class StatusBar(QWidget):
|
|||
def on_mode_left(self, old_mode, new_mode):
|
||||
"""Clear marked mode."""
|
||||
mode_manager = modeman.instance(self._win_id)
|
||||
if config.val.statusbar.show == 'in-mode':
|
||||
self.hide()
|
||||
if mode_manager.parsers[old_mode].passthrough:
|
||||
if mode_manager.parsers[new_mode].passthrough:
|
||||
self._set_mode_text(new_mode.name)
|
||||
|
|
|
|||
Loading…
Reference in New Issue