Changeset 201671 in webkit


Ignore:
Timestamp:
Jun 3, 2016 5:04:52 PM (8 years ago)
Author:
BJ Burg
Message:

Web Inspector: add a keyboard shortcut to close the current tab bar item
https://bugs.webkit.org/show_bug.cgi?id=158363
<rdar://problem/22677254>

Reviewed by Timothy Hatcher.

Make Cmd-w close the current tab. This matches Safari's keyboard shortcut.

  • UserInterface/Views/TabBrowser.js:

(WebInspector.TabBrowser):
Don't do anything if the New Tab tab is the only tab bar item besides the
pinned "new tab" button.

Location:
trunk/Source/WebInspectorUI
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r201669 r201671  
     12016-06-03  Brian Burg  <bburg@apple.com>
     2
     3        Web Inspector: add a keyboard shortcut to close the current tab bar item
     4        https://bugs.webkit.org/show_bug.cgi?id=158363
     5        <rdar://problem/22677254>
     6
     7        Reviewed by Timothy Hatcher.
     8
     9        Make Cmd-w close the current tab. This matches Safari's keyboard shortcut.
     10
     11        * UserInterface/Views/TabBrowser.js:
     12        (WebInspector.TabBrowser):
     13        Don't do anything if the New Tab tab is the only tab bar item besides the
     14        pinned "new tab" button.
     15
    1162016-06-03  Brian Burg  <bburg@apple.com>
    217
  • trunk/Source/WebInspectorUI/UserInterface/Views/TabBrowser.js

    r193432 r201671  
    4949        this.addSubview(this._contentViewContainer);
    5050
    51         var showNextTab = this._showNextTab.bind(this);
    52         var showPreviousTab = this._showPreviousTab.bind(this);
     51        let showNextTab = () => { this._showNextTab(); }
     52        let showPreviousTab = () => { this._showPreviousTab(); }
     53        let closeCurrentTab = () => {
     54            let selectedTabBarItem = this._tabBar.selectedTabBarItem;
     55            if (this._tabBar.tabBarItems.length > 2 || !selectedTabBarItem.isDefaultTab)
     56                this._tabBar.removeTabBarItem(selectedTabBarItem);
     57        }
     58
     59        this._closeCurrentTabKeyboardShortuct = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "W", closeCurrentTab);
    5360
    5461        this._showNextTabKeyboardShortcut1 = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl | WebInspector.KeyboardShortcut.Modifier.Shift, WebInspector.KeyboardShortcut.Key.RightCurlyBrace, showNextTab);
Note: See TracChangeset for help on using the changeset viewer.