Skip to content

Commit 16cdd08

Browse files
committed
Merge pull request #1 from vimperator/master
update to master branch
2 parents 9cce653 + c0ce5ca commit 16cdd08

File tree

10 files changed

+90
-14
lines changed

10 files changed

+90
-14
lines changed

common/content/buffer.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ const Buffer = Module("buffer", {
703703
* Scrolls to the bottom of the current buffer.
704704
*/
705705
scrollBottom: function () {
706-
Buffer.scrollToPercent(null, 100);
706+
Buffer.scrollElemToPercent(null, null, 100);
707707
},
708708

709709
/**
@@ -720,7 +720,7 @@ const Buffer = Module("buffer", {
720720
* Scrolls to the top of the current buffer.
721721
*/
722722
scrollEnd: function () {
723-
Buffer.scrollToPercent(100, null);
723+
Buffer.scrollElemToPercent(null, 100, null);
724724
},
725725

726726
/**
@@ -747,21 +747,19 @@ const Buffer = Module("buffer", {
747747
* Scrolls the buffer vertically 'scroll' lines.
748748
*
749749
* @param {boolean} direction The direction to scroll. If true then
750-
* scroll up and if false scroll down.
750+
* scroll down and if false scroll up.
751751
* @param {number} count The multiple of 'scroll' lines to scroll.
752752
* @optional
753753
*/
754754
scrollByScrollSize: function (direction, count) {
755755
direction = direction ? 1 : -1;
756756
count = count || 1;
757-
let win = Buffer.findScrollableWindow();
758-
759-
Buffer.checkScrollYBounds(win, direction);
757+
let elem = Buffer.findScrollable(direction, false);
760758

761759
if (options["scroll"] > 0)
762760
this.scrollLines(options["scroll"] * direction);
763761
else // scroll half a page down in pixels
764-
win.scrollBy(0, win.innerHeight / 2 * direction);
762+
elem.scrollTop += Buffer.findScrollableWindow().innerHeight / 2 * direction;
765763
},
766764

767765
_scrollByScrollSize: function _scrollByScrollSize(count, direction) {
@@ -777,7 +775,7 @@ const Buffer = Module("buffer", {
777775
* @param {number} y The vertical page percentile.
778776
*/
779777
scrollToPercent: function (x, y) {
780-
Buffer.scrollToPercent(x, y);
778+
Buffer.scrollElemToPercent(null, x, y);
781779
},
782780

783781
/**
@@ -795,14 +793,14 @@ const Buffer = Module("buffer", {
795793
* Scrolls the current buffer laterally to its leftmost.
796794
*/
797795
scrollStart: function () {
798-
Buffer.scrollToPercent(0, null);
796+
Buffer.scrollElemToPercent(null, 0, null);
799797
},
800798

801799
/**
802800
* Scrolls the current buffer vertically to the top.
803801
*/
804802
scrollTop: function () {
805-
Buffer.scrollToPercent(null, 0);
803+
Buffer.scrollElemToPercent(null, null, 0);
806804
},
807805

808806
// TODO: allow callback for filtering out unwanted frames? User defined?
@@ -1069,7 +1067,7 @@ const Buffer = Module("buffer", {
10691067
return win;
10701068
},
10711069

1072-
findScrollable: function findScrollable(dir, horizontal) {
1070+
findScrollable: function findScrollable(dir = 0, horizontal) {
10731071
let pos = "scrollTop", maxPos = "scrollTopMax", clientSize = "clientHeight";
10741072
if (horizontal)
10751073
pos = "scrollLeft", maxPos = "scrollLeftMax", clientSize = "clientWidth";
@@ -1081,7 +1079,7 @@ const Buffer = Module("buffer", {
10811079
for (; elem && elem.parentNode instanceof Element; elem = elem.parentNode) {
10821080
if (elem[clientSize] == 0)
10831081
continue;
1084-
if (dir < 0 && elem[pos] > 0 || dir > 0 && elem[pos] < elem[maxPos])
1082+
if (dir < 0 && elem[pos] > 0 || dir > 0 && elem[pos] < elem[maxPos] || dir == 0 && elem[maxPos] > 0)
10851083
break;
10861084
}
10871085
return elem;
@@ -1816,4 +1814,7 @@ const Buffer = Module("buffer", {
18161814
}
18171815
});
18181816

1817+
/* Expose Buffer constructor */
1818+
Object.defineProperty(this, "Buffer", { value: Buffer });
1819+
18191820
// vim: set fdm=marker sw=4 ts=4 et:

common/content/commands.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,6 +1187,8 @@ const Commands = Module("commands", {
11871187
});
11881188

11891189
(function () {
1190+
/* Expose Command constructor for user-defined sub-commands. */
1191+
Object.defineProperty(this, "Command", { value: Command });
11901192

11911193
Commands.quoteMap = {
11921194
"\n": "n",

common/content/events.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,6 +1147,9 @@ const Events = Module("events", {
11471147
return;
11481148
}
11491149

1150+
if (!options['passthrough'])
1151+
event.stopPropagation();
1152+
11501153
// liberator.echo ("key: " + key + "\nkeycode: " + event.keyCode + "\nchar: " + event.charCode + "\ntype: " + event.type + "\nwhich: " + event.which);
11511154
},
11521155

common/content/statusline.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ const StatusLine = Module("statusline", {
154154
var toggle_on = function () {
155155
bb.style.height = '';
156156
bb.style.overflow = '';
157-
highlight.set('ContentSeparator', sv.contentSeparatorValue);
157+
highlight.set('ContentSeparator', sv.contentSeparator);
158158
};
159159

160160
switch (request) {

common/content/tabs.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,6 +1130,10 @@ const Tabs = Module("tabs", {
11301130
]
11311131
});
11321132

1133+
options.add(["passthrough"],
1134+
"Define if keypresses are passed to webpages outside of Insert mode",
1135+
"boolean", false);
1136+
11331137
options.add(["popups", "pps"],
11341138
"Where to show requested popup windows",
11351139
"stringlist", "tab",

common/locale/en-US/options.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,17 @@
893893
</item>
894894

895895

896+
<item>
897+
<tags>'nopassthrough' 'passthrough'</tags>
898+
<spec>'passthrough'</spec>
899+
<type>boolean</type>
900+
<default>off</default>
901+
<description>
902+
<p>Define if keypresses are passed to webpages if you are not in Insert mode.</p>
903+
</description>
904+
</item>
905+
906+
896907
<item>
897908
<tags>'pps' 'popups'</tags>
898909
<spec>'popups' 'pps'</spec>

vimperator/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#### configuration
22

3-
VERSION = 3.10.1
3+
VERSION = 3.11.3
44
NAME = vimperator
55

66
include ../common/Makefile

vimperator/NEWS

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
201x-xx-xx:
2+
3+
2016-01-30:
4+
* Expose Buffer constructor
5+
* Fix scrolling on some pages with gg/G/<C-d>/<C-u>
6+
* Make sure to get latest content separator in setVisibility
7+
* Expose Command constructor
8+
9+
2016-01-26:
210
* QuickMarks: new mapping [m]gw{a-z}[m] to open Quickmark in a new window as the single open tab
311
* :delmacro matches the syntax and behaviour of :delqmark, e.g. allowing ranges as argument
412
* Stop propagation for keyboard event if that key are contained in -except option on :ignorekeys
@@ -7,6 +15,9 @@
715
browser.tabs.closeWindowWithLastTab, which means those who are used to :tabclose never closing
816
the window when closing the last tab, should set this option to false (either through about:config
917
or with :set! browser.tabs.closeWindowWithLastTab=false)
18+
* Added setting for controlling if keypresses are passed to webpages when
19+
outside of Insert/Passthrough modes (to revert to old setting,
20+
:set passthrough=true)
1021
* gr toggles Reader View
1122
* Autohide statusbar: When entering fullscreen mode, the statusbar is
1223
hidden and temporarily showed up with command inputs. Also, Users can

vimperator/content/tabgroup.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,35 @@ var TabGroup = Module("tabGroup", {
346346
literal: 0,
347347
completer: function (context) completion.tabgroup(context, false),
348348
}),
349+
/**
350+
* Panorama SubCommand rename
351+
* rename {name}.
352+
* clear the name of the current group if bang(!) specified and {name} is ommited.
353+
*/
354+
new Command(["rename", "mv"], "Rename current tab group (or reset to '(Untitled)').",
355+
function (args) {
356+
let title = args.literalArg;
357+
if (!title) {
358+
if (args.bang)
359+
title = "";
360+
else {
361+
liberator.echoerr("No title supplied! Add \"!\" if want to clear it.");
362+
return;
363+
}
364+
}
365+
let activeGroup = tabGroup.tabView.GroupItems.getActiveGroupItem();
366+
if (activeGroup)
367+
activeGroup.setTitle(title);
368+
}, {
369+
bang: true,
370+
literal: 0,
371+
completer: function (context) {
372+
context.title = ["Rename current group"];
373+
let activeGroup = tabGroup.tabView.GroupItems.getActiveGroupItem();
374+
let title = activeGroup ? activeGroup.getTitle() : "";
375+
context.completions = title ? [[title, ""]] : [];
376+
}
377+
}),
349378
/**
350379
* Panorama SubCommand switch
351380
* switch to the {group}.

vimperator/locale/en-US/tabs.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,21 @@
123123
</description>
124124
</item>
125125

126+
<item>
127+
<tags>tabgroups-rename tabgroups-mv</tags>
128+
<spec>rename<oa>!</oa> <oa>newGroupName</oa></spec>
129+
<spec>mv<oa>!</oa> <oa>newGroupName</oa></spec>
130+
<description>
131+
<p>
132+
Rename current tab group to <oa>newGroupName</oa>.
133+
</p>
134+
<p>
135+
If <oa>newGroupName</oa> is not supplied and <oa>!</oa> is
136+
specified, resets group's name to <o>(Untitled)</o>.
137+
</p>
138+
</description>
139+
</item>
140+
126141
<item>
127142
<tags>tabgroups-switch</tags>
128143
<spec><oa>count</oa>switch <a>groupName</a></spec>

0 commit comments

Comments
 (0)