From 0984a2f8b4e6aac1a5094d522746afcee03c9ee2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20H=C3=BCbschle-Schneider?= Date: Mon, 21 Jul 2014 15:07:38 +0100 Subject: [PATCH] Make readline/emacs keybindings a setting Also fix some labels while we're at it --- index.html | 18 ++++++++++++++---- js/glowingbear.js | 9 ++++++++- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index 146b64f..66243b9 100644 --- a/index.html +++ b/index.html @@ -118,10 +118,10 @@
  • ALT-a: Focus on next buffer with activity
  • ALT-<: Switch to previous active buffer
  • ALT-g: Focus on buffer list filter
  • -
  • Esc-Esc: disconnect (double-tap)
  • -
  • Arrow keys: history navigation
  • -
  • Tab key: nick complete
  • -
  • The following readline/emacs style keybindings works: Ctrl-a, Ctrl-e, Ctrl-u, Ctrl-k, Ctrl-w
  • +
  • Esc-Esc: Disconnect (double-tap)
  • +
  • Arrow keys: Navigate history
  • +
  • Tab key: Complete nick
  • +
  • The following readline/emacs style keybindings can be enabled with a setting: Ctrl-a, Ctrl-e, Ctrl-u, Ctrl-k, Ctrl-w
  • @@ -364,6 +364,16 @@ $ openssl req -nodes -newkey rsa:4096 -keyout relay.pem -x509 -days 365 -out rel +
  • +
    +
    + +
    +
    +
  • diff --git a/js/glowingbear.js b/js/glowingbear.js index 7a74d61..8d32898 100644 --- a/js/glowingbear.js +++ b/js/glowingbear.js @@ -868,6 +868,8 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', $store.bind($scope, "fontfamily", getClassStyle('monospace', 'fontFamily')); // Save setting for font size $store.bind($scope, "fontsize", getClassStyle('monospace', 'fontSize')); + // Save setting for readline keybindings + $store.bind($scope, "readlineBindings", false); // Save setting for displaying embeds in rootScope so it can be used from service $rootScope.visible = $scope.noembed === false; @@ -943,6 +945,11 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', $scope.$watch('fontsize', function() { changeClassStyle('monospace', 'fontSize', $scope.fontsize); }); + // Crude scoping hack. The keypress listener does not live in the same scope as + // the checkbox, so we need to transfer this between scopes here. + $scope.$watch('readlineBindings', function() { + $rootScope.readlineBindings = $scope.readlineBindings; + }); $scope.setActiveBuffer = function(bufferId, key) { // If we are on mobile we need to collapse the menu on sidebar clicks @@ -1523,7 +1530,7 @@ weechat.directive('inputBar', function() { return true; } // Some readline keybindings - if ($event.ctrlKey && !$event.altKey && !$event.shiftKey && document.activeElement === inputNode) { + if ($rootScope.readlineBindings && $event.ctrlKey && !$event.altKey && !$event.shiftKey && document.activeElement === inputNode) { // get current caret position var caretPos = inputNode.selectionStart; // Ctrl-a