=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/mode-tree.c,v retrieving revision 1.9 retrieving revision 1.10 diff -c -r1.9 -r1.10 *** src/usr.bin/tmux/mode-tree.c 2017/08/23 09:39:11 1.9 --- src/usr.bin/tmux/mode-tree.c 2017/08/27 09:08:36 1.10 *************** *** 1,4 **** ! /* $OpenBSD: mode-tree.c,v 1.9 2017/08/23 09:39:11 nicm Exp $ */ /* * Copyright (c) 2017 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: mode-tree.c,v 1.10 2017/08/27 09:08:36 nicm Exp $ */ /* * Copyright (c) 2017 Nicholas Marriott *************** *** 870,875 **** --- 870,884 ---- case 'v': mtd->preview = !mtd->preview; mode_tree_build(mtd); + + /* + * If the current line would now be off screen now the preview + * is on, reset the the offset to the last visible line. + */ + if (mtd->preview && mtd->current > mtd->height - 1) { + mtd->offset = mtd->current - mtd->height; + mtd->current--; + } break; } return (0);