Skip to content

Commit 1b66643

Browse files
committed
play around with relativeToCursor and closeToLeft
Signed-off-by: Kipras Melnikovas <kipras@kipras.org>
1 parent 0e36d24 commit 1b66643

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

nvim-git-rebase-todo/nvim-git-rebase-todo.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,13 @@ export default function nvimGitRebaseTodo(plugin: NvimPlugin): void {
2727
maxWidth: 60,
2828
fixedWidth: 60,
2929
showStatParsingCount: false,
30+
31+
// relativeToCursor: true,
32+
// closeToLeft: 5,
33+
// rowLowerIfCloseToLeft: 1,
3034
relativeToCursor: false,
35+
closeToLeft: 0,
36+
rowLowerIfCloseToLeft: 0,
3137
};
3238

3339
let gBuffer: Buffer;
@@ -102,6 +108,7 @@ export default function nvimGitRebaseTodo(plugin: NvimPlugin): void {
102108
const cursor = await vim.window.cursor;
103109

104110
const relWin = await vim.window;
111+
const col: number = config.closeToLeft || (await relWin.width);
105112

106113
return {
107114
// relative: "cursor",
@@ -110,8 +117,8 @@ export default function nvimGitRebaseTodo(plugin: NvimPlugin): void {
110117
//
111118
bufpos: cursor,
112119
//
113-
row: -1, // TODO investigate when in very last row & fully scrolled down with Ctrl-E
114-
col: await relWin.width,
120+
row: -1 + (config.closeToLeft ? config.rowLowerIfCloseToLeft : 0), // TODO investigate when in very last row & fully scrolled down with Ctrl-E
121+
col,
115122
//
116123
width,
117124
height,
@@ -131,7 +138,7 @@ export default function nvimGitRebaseTodo(plugin: NvimPlugin): void {
131138
*/
132139

133140
const relWin: Window = await vim.getWindow();
134-
const relWinWidth: number = await relWin.width;
141+
const col: number = config.closeToLeft || (await relWin.width);
135142

136143
const opts: OpenWindowOptions = config.relativeToCursor
137144
? {
@@ -145,8 +152,8 @@ export default function nvimGitRebaseTodo(plugin: NvimPlugin): void {
145152
height,
146153
//
147154
// anchor: "NE", // TODO is this needed?
148-
row: 0,
149-
col: relWinWidth,
155+
row: 0 + (config.closeToLeft ? config.rowLowerIfCloseToLeft : 0),
156+
col,
150157
//
151158
style: "minimal",
152159
} as const);

0 commit comments

Comments
 (0)