diff --git a/keymap/vim.js b/keymap/vim.js index 59815957ca2161cd93e2370adbf58f8e3bf14975..0548b75be7b232c6ca7a5e36a10d8ebd9e6dc2a9 100644 --- a/keymap/vim.js +++ b/keymap/vim.js @@ -2147,9 +2147,7 @@ switch (actionArgs.position) { case 'center': y = y - (height / 2) + lineHeight; break; - case 'bottom': y = y - height + lineHeight*1.4; - break; - case 'top': y = y + lineHeight*0.4; + case 'bottom': y = y - height + lineHeight; break; } cm.scrollTo(null, y); diff --git a/test/vim_test.js b/test/vim_test.js index 74c6a95071a34ee868fab73883e2ec7009a6361d..25f7e75e9074bceee0fb068373b5f17f3cb0930a 100644 --- a/test/vim_test.js +++ b/test/vim_test.js @@ -3119,6 +3119,25 @@ forEach(['zb','zz','zt','z-','z.','z<CR>'], function(e, idx){ return new Array(500).join('\n'); })()}); }); +testVim('zb_to_bottom', function(cm, vim, helpers){ + var lineNum = 250; + cm.setSize(600, 35*cm.defaultTextHeight()); + cm.setCursor(lineNum, 0); + helpers.doKeys('z', 'b'); + var scrollInfo = cm.getScrollInfo(); + eq(scrollInfo.top + scrollInfo.clientHeight, cm.charCoords(Pos(lineNum, 0), 'local').bottom); +}, { value: (function(){ + return new Array(500).join('\n'); +})()}); +testVim('zt_to_top', function(cm, vim, helpers){ + var lineNum = 250; + cm.setSize(600, 35*cm.defaultTextHeight()); + cm.setCursor(lineNum, 0); + helpers.doKeys('z', 't'); + eq(cm.getScrollInfo().top, cm.charCoords(Pos(lineNum, 0), 'local').top); +}, { value: (function(){ + return new Array(500).join('\n'); +})()}); testVim('zb<zz', function(cm, vim, helpers){ eq(zVals[0]<zVals[1], true); });