scroll horizonally
This commit is contained in:
parent
36963b1b8b
commit
8c84930ca3
4 changed files with 22 additions and 9 deletions
|
@ -8,8 +8,10 @@ import * as consoleFrames from 'content/console-frames';
|
||||||
|
|
||||||
const exec = (operation) => {
|
const exec = (operation) => {
|
||||||
switch (operation.type) {
|
switch (operation.type) {
|
||||||
case operations.SCROLL_LINES:
|
case operations.SCROLL_VERTICALLY:
|
||||||
return scrolls.scrollLines(window, operation.count);
|
return scrolls.scrollVertically(window, operation.count);
|
||||||
|
case operations.SCROLL_HORIZONALLY:
|
||||||
|
return scrolls.scrollHorizonally(window, operation.count);
|
||||||
case operations.SCROLL_PAGES:
|
case operations.SCROLL_PAGES:
|
||||||
return scrolls.scrollPages(window, operation.count);
|
return scrolls.scrollPages(window, operation.count);
|
||||||
case operations.SCROLL_TOP:
|
case operations.SCROLL_TOP:
|
||||||
|
|
|
@ -1,8 +1,15 @@
|
||||||
const SCROLL_DELTA = 48;
|
const SCROLL_DELTA_X = 48;
|
||||||
|
const SCROLL_DELTA_Y = 48;
|
||||||
|
|
||||||
const scrollLines = (page, count) => {
|
const scrollVertically = (page, count) => {
|
||||||
let x = page.scrollX;
|
let x = page.scrollX;
|
||||||
let y = page.scrollY + SCROLL_DELTA * count;
|
let y = page.scrollY + SCROLL_DELTA_X * count;
|
||||||
|
page.scrollTo(x, y);
|
||||||
|
};
|
||||||
|
|
||||||
|
const scrollHorizonally = (page, count) => {
|
||||||
|
let x = page.scrollX + SCROLL_DELTA_Y * count;
|
||||||
|
let y = page.scrollY;
|
||||||
page.scrollTo(x, y);
|
page.scrollTo(x, y);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -38,5 +45,6 @@ const scrollRight = (page) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export {
|
export {
|
||||||
scrollLines, scrollPages, scrollTop, scrollBottom, scrollLeft, scrollRight
|
scrollVertically, scrollHorizonally, scrollPages,
|
||||||
|
scrollTop, scrollBottom, scrollLeft, scrollRight
|
||||||
};
|
};
|
||||||
|
|
|
@ -11,8 +11,10 @@ export default {
|
||||||
"w": { "type": "command.show.winopen", "alter": false },
|
"w": { "type": "command.show.winopen", "alter": false },
|
||||||
"W": { "type": "command.show.winopen", "alter": true },
|
"W": { "type": "command.show.winopen", "alter": true },
|
||||||
"b": { "type": "command.show.buffer" },
|
"b": { "type": "command.show.buffer" },
|
||||||
"k": { "type": "scroll.lines", "count": -1 },
|
"k": { "type": "scroll.vertically", "count": -1 },
|
||||||
"j": { "type": "scroll.lines", "count": 1 },
|
"j": { "type": "scroll.vertically", "count": 1 },
|
||||||
|
"h": { "type": "scroll.horizonally", "count": -1 },
|
||||||
|
"l": { "type": "scroll.horizonally", "count": 1 },
|
||||||
"<C-E>": { "type": "scroll.lines", "count": -1 },
|
"<C-E>": { "type": "scroll.lines", "count": -1 },
|
||||||
"<C-Y>": { "type": "scroll.lines", "count": 1 },
|
"<C-Y>": { "type": "scroll.lines", "count": 1 },
|
||||||
"<C-U>": { "type": "scroll.pages", "count": -0.5 },
|
"<C-U>": { "type": "scroll.pages", "count": -0.5 },
|
||||||
|
|
|
@ -7,7 +7,8 @@ export default {
|
||||||
COMMAND_SHOW_BUFFER: 'command.show.buffer',
|
COMMAND_SHOW_BUFFER: 'command.show.buffer',
|
||||||
|
|
||||||
// Scrolls
|
// Scrolls
|
||||||
SCROLL_LINES: 'scroll.lines',
|
SCROLL_VERTICALLY: 'scroll.vertically',
|
||||||
|
SCROLL_HORIZONALLY: 'scroll.horizonally',
|
||||||
SCROLL_PAGES: 'scroll.pages',
|
SCROLL_PAGES: 'scroll.pages',
|
||||||
SCROLL_TOP: 'scroll.top',
|
SCROLL_TOP: 'scroll.top',
|
||||||
SCROLL_BOTTOM: 'scroll.bottom',
|
SCROLL_BOTTOM: 'scroll.bottom',
|
||||||
|
|
Reference in a new issue