diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2007-11-23 16:43:04 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2007-11-23 16:43:04 +0000 |
commit | 68b2d36e07455747fab5ec99dfae9895c8a043a4 (patch) | |
tree | 90d4b670c19968a0b144cf402bee960c6c2fb918 /window-copy.c | |
parent | b44bc4f8f5ce8207959df84177a0056ff7156400 (diff) | |
download | rtmux-68b2d36e07455747fab5ec99dfae9895c8a043a4.tar.gz rtmux-68b2d36e07455747fab5ec99dfae9895c8a043a4.tar.bz2 rtmux-68b2d36e07455747fab5ec99dfae9895c8a043a4.zip |
Rm some redundant checks, prevent issues when data->size == 0.
Diffstat (limited to 'window-copy.c')
-rw-r--r-- | window-copy.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/window-copy.c b/window-copy.c index 83e3f7b9..ce998b18 100644 --- a/window-copy.c +++ b/window-copy.c @@ -1,4 +1,4 @@ -/* $Id: window-copy.c,v 1.4 2007-11-22 19:40:17 nicm Exp $ */ +/* $Id: window-copy.c,v 1.5 2007-11-23 16:43:04 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -232,9 +232,6 @@ window_copy_cursor_left(struct window *w) { struct window_copy_mode_data *data = w->modedata; - if (data->ox + data->cx == 0) - return; - if (data->cx == 0) window_copy_scroll_right(w, 1); else { @@ -251,9 +248,6 @@ window_copy_cursor_right(struct window *w) struct window_copy_mode_data *data = w->modedata; struct screen *s = &w->screen; - if (data->ox + data->cx == SHRT_MAX) - return; - if (data->cx == screen_last_x(s)) window_copy_scroll_left(w, 1); else { @@ -269,9 +263,6 @@ window_copy_cursor_up(struct window *w) { struct window_copy_mode_data *data = w->modedata; - if (data->cy == 0 && data->oy == data->size) - return; - if (data->cy == 0) window_copy_scroll_down(w, 1); else { @@ -288,9 +279,6 @@ window_copy_cursor_down(struct window *w) struct window_copy_mode_data *data = w->modedata; struct screen *s = &w->screen; - if (data->cy == screen_last_y(s) && data->oy == 0) - return; - if (data->cy == screen_last_y(s)) window_copy_scroll_up(w, 1); else { @@ -343,7 +331,7 @@ window_copy_scroll_left(struct window *w, u_int nx) struct hdr hdr; size_t size; - if (data->ox >= SHRT_MAX - nx) + if (data->ox > SHRT_MAX - nx) nx = SHRT_MAX - data->ox; if (nx == 0) return; @@ -490,7 +478,10 @@ window_copy_scroll_down(struct window *w, u_int ny) struct hdr hdr; size_t size; - if (data->oy >= data->size - ny) + if (ny > data->size) + return; + + if (data->oy > data->size - ny) ny = data->size - data->oy; if (ny == 0) return; |