Title: [203804] trunk/Source/WebInspectorUI
Revision
203804
Author
[email protected]
Date
2016-07-27 16:36:05 -0700 (Wed, 27 Jul 2016)

Log Message

[Mac] Web Inspector: CodeMirror-based editor bindings for Home and End don't match system behavior
https://bugs.webkit.org/show_bug.cgi?id=160267
<rdar://problem/27575553>

Patch by Joseph Pecoraro <[email protected]> on 2016-07-27
Reviewed by Brian Burg.

* UserInterface/Views/CodeMirrorEditor.js:
(WebInspector.CodeMirrorEditor.create):
(WebInspector.CodeMirrorEditor):
Add some key map overrides for Home and End to better match system Mac
behavior. This scrolls to the start or end of a document and does not
change the cursor position.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (203803 => 203804)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-07-27 23:28:27 UTC (rev 203803)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-07-27 23:36:05 UTC (rev 203804)
@@ -1,3 +1,18 @@
+2016-07-27  Joseph Pecoraro  <[email protected]>
+
+        [Mac] Web Inspector: CodeMirror-based editor bindings for Home and End don't match system behavior
+        https://bugs.webkit.org/show_bug.cgi?id=160267
+        <rdar://problem/27575553>
+
+        Reviewed by Brian Burg.
+
+        * UserInterface/Views/CodeMirrorEditor.js:
+        (WebInspector.CodeMirrorEditor.create):
+        (WebInspector.CodeMirrorEditor):
+        Add some key map overrides for Home and End to better match system Mac
+        behavior. This scrolls to the start or end of a document and does not
+        change the cursor position.
+
 2016-07-27  Brian Burg  <[email protected]>
 
         Regression(r203535): Uncaught Exception: TypeError: Not enough arguments at LayerTreeDataGridNode.js:47

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CodeMirrorEditor.js (203803 => 203804)


--- trunk/Source/WebInspectorUI/UserInterface/Views/CodeMirrorEditor.js	2016-07-27 23:28:27 UTC (rev 203803)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CodeMirrorEditor.js	2016-07-27 23:36:05 UTC (rev 203804)
@@ -32,6 +32,14 @@
 
         let codeMirror = new CodeMirror(place, options);
 
+        // Override some Mac specific keybindings.
+        if (WebInspector.Platform.name === "mac") {
+            codeMirror.addKeyMap({
+                "Home": () => { codeMirror.scrollIntoView({line: 0, ch: 0}); },
+                "End": () => { codeMirror.scrollIntoView({line: codeMirror.lineCount() - 1, ch: null}); },
+            });
+        }
+
         // Set up default controllers that should be present for
         // all CodeMirror editor instances.
         new WebInspector.CodeMirrorTextKillController(codeMirror);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to