Permalink
Browse files

Add option to exit copy-mode when scrolling past bottom

  • Loading branch information...
dv committed May 2, 2015
1 parent c0cf484 commit 19448c5a17f6a44ad52a2858fd40acd4b4e5aeed
Showing with 14 additions and 1 deletion.
  1. +5 −0 options-table.c
  2. +9 −1 window-copy.c
@@ -509,6 +509,11 @@ const struct options_table_entry window_options_table[] = {
.default_num = 1
},
{ .name = "exit-copy-past-bottom",
.type = OPTIONS_TABLE_FLAG,
.default_num = 0
},
{ .name = "force-height",
.type = OPTIONS_TABLE_NUMBER,
.minimum = 0,
@@ -1848,7 +1848,8 @@ window_copy_cursor_down(struct window_pane *wp, int scroll_only)
{
struct window_copy_mode_data *data = wp->modedata;
struct screen *s = &data->screen;
u_int ox, oy, px, py;
u_int scrolled_past_bottom = 0;
u_int ox, oy, px, py;
oy = screen_hsize(data->backing) + data->cy - data->oy;
ox = window_copy_find_length(wp, oy);
@@ -1862,6 +1863,8 @@ window_copy_cursor_down(struct window_pane *wp, int scroll_only)
data->cx = data->lastcx;
if (scroll_only || data->cy == screen_size_y(s) - 1) {
scrolled_past_bottom = data->oy == 0;
window_copy_scroll_up(wp, 1);
if (scroll_only && data->cy > 0)
window_copy_redraw_lines(wp, data->cy - 1, 2);
@@ -1883,6 +1886,11 @@ window_copy_cursor_down(struct window_pane *wp, int scroll_only)
window_copy_cursor_end_of_line(wp);
else if (s->sel.lineflag == LINE_SEL_RIGHT_LEFT)
window_copy_cursor_start_of_line(wp);
if (scrolled_past_bottom && !s->sel.flag &&
s->sel.lineflag == LINE_SEL_NONE &&
options_get_number(&wp->window->options, "exit-copy-past-bottom"))
window_pane_reset_mode(wp);
}
void

4 comments on commit 19448c5

@stephencelis

This comment has been minimized.

stephencelis replied Apr 19, 2016

Have you opened a PR with this patch?

@reejosamuel

This comment has been minimized.

reejosamuel replied Jun 17, 2016

Is your PR merged?

@hongxiaolong

This comment has been minimized.

hongxiaolong replied Apr 11, 2017

Your PR still not be merged?

And I can not visit your homebrew formula with:

brew install https://raw.githubusercontent.com/dv/dotfiles/master/tmux/tmux.rb

@olehermanse

This comment has been minimized.

olehermanse replied Nov 20, 2017

@dv Any chance you will submit this as a patch to tmux?

Please sign in to comment.