Merge pull request #399 from glowing-bear/fix-keypress

Handle keypress events as well
This commit is contained in:
David Cormier 2014-08-26 20:23:58 -04:00
commit 06b1db8c9d
2 changed files with 3 additions and 3 deletions

View file

@ -29,7 +29,7 @@
<script type="text/javascript" src="js/plugins.js"></script>
<script type="text/javascript" src="3rdparty/favico-0.3.4-mod.min.js"></script>
</head>
<body ng-controller="WeechatCtrl" ng-keydown="handleKeyPress($event)" ng-class="{'no-overflow': connected}" lang="en-US">
<body ng-controller="WeechatCtrl" ng-keydown="handleKeyPress($event)" ng-keypress="handleKeyPress($event)" ng-class="{'no-overflow': connected}" lang="en-US">
<div ng-hide="connected" class="container">
<h2>
<img alt="logo" src="assets/img/glowing-bear.svg">

View file

@ -1604,7 +1604,7 @@ weechat.directive('inputBar', function() {
}
// Arrow up -> go up in history
if (code === 38) {
if ($event.type === "keydown" && code === 38) {
$scope.command = models.getActiveBuffer().getHistoryUp($scope.command);
// Set cursor to last position. Need 0ms timeout because browser sets cursor
// position to the beginning after this key handler returns.
@ -1617,7 +1617,7 @@ weechat.directive('inputBar', function() {
}
// Arrow down -> go down in history
if (code === 40) {
if ($event.type === "keydown" && code === 40) {
$scope.command = models.getActiveBuffer().getHistoryDown($scope.command);
// We don't need to set the cursor to the rightmost position here, the browser does that for us
return true;