summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmd-find.c40
-rw-r--r--input.c1
-rw-r--r--screen-write.c7
3 files changed, 37 insertions, 11 deletions
diff --git a/cmd-find.c b/cmd-find.c
index 67f6dbe8..3c0085e0 100644
--- a/cmd-find.c
+++ b/cmd-find.c
@@ -453,6 +453,7 @@ cmd_find_get_window_with_session(struct cmd_find_state *fs, const char *window)
if (errstr == NULL) {
fs->wl = winlink_find_by_index(&fs->s->windows, idx);
if (fs->wl != NULL) {
+ fs->idx = fs->wl->idx;
fs->w = fs->wl->window;
return (0);
}
@@ -970,7 +971,7 @@ cmd_find_target(struct cmd_find_state *fs, struct cmdq_item *item,
{
struct mouse_event *m;
struct cmd_find_state current;
- char *colon, *period, *copy = NULL;
+ char *colon, *period, *copy = NULL, tmp[256];
const char *session, *window, *pane, *s;
int window_only = 0, pane_only = 0;
@@ -987,11 +988,25 @@ cmd_find_target(struct cmd_find_state *fs, struct cmdq_item *item,
s = "session";
else
s = "unknown";
- if (target == NULL)
- log_debug("%s: target none, type %s", __func__, s);
- else
- log_debug("%s: target %s, type %s", __func__, target, s);
- log_debug("%s: item %p, flags %#x", __func__, item, flags);
+ *tmp = '\0';
+ if (flags & CMD_FIND_PREFER_UNATTACHED)
+ strlcat(tmp, "PREFER_UNATTACHED,", sizeof tmp);
+ if (flags & CMD_FIND_QUIET)
+ strlcat(tmp, "QUIET,", sizeof tmp);
+ if (flags & CMD_FIND_WINDOW_INDEX)
+ strlcat(tmp, "WINDOW_INDEX,", sizeof tmp);
+ if (flags & CMD_FIND_DEFAULT_MARKED)
+ strlcat(tmp, "DEFAULT_MARKED,", sizeof tmp);
+ if (flags & CMD_FIND_EXACT_SESSION)
+ strlcat(tmp, "EXACT_SESSION,", sizeof tmp);
+ if (flags & CMD_FIND_EXACT_WINDOW)
+ strlcat(tmp, "EXACT_WINDOW,", sizeof tmp);
+ if (flags & CMD_FIND_CANFAIL)
+ strlcat(tmp, "CANFAIL,", sizeof tmp);
+ if (*tmp != '\0')
+ tmp[strlen(tmp) - 1] = '\0';
+ log_debug("%s: target %s, type %s, item %p, flags %s", __func__,
+ target == NULL ? "none" : target, s, item, tmp);
/* Clear new state. */
cmd_find_clear_state(fs, flags);
@@ -1131,9 +1146,16 @@ cmd_find_target(struct cmd_find_state *fs, struct cmdq_item *item,
if (pane != NULL)
pane = cmd_find_map_table(cmd_find_pane_table, pane);
- log_debug("%s: target %s (flags %#x): session=%s, window=%s, pane=%s",
- __func__, target, flags, session == NULL ? "none" : session,
- window == NULL ? "none" : window, pane == NULL ? "none" : pane);
+ if (session != NULL || window != NULL || pane != NULL) {
+ log_debug("%s: target %s is %s%s%s%s%s%s",
+ __func__, target,
+ session == NULL ? "" : "session ",
+ session == NULL ? "" : session,
+ window == NULL ? "" : "window ",
+ window == NULL ? "" : window,
+ pane == NULL ? "" : "pane ",
+ pane == NULL ? "" : pane);
+ }
/* No pane is allowed if want an index. */
if (pane != NULL && (flags & CMD_FIND_WINDOW_INDEX)) {
diff --git a/input.c b/input.c
index 049b82e1..73bd099b 100644
--- a/input.c
+++ b/input.c
@@ -1197,7 +1197,6 @@ input_esc_dispatch(struct input_ctx *ictx)
window_pane_reset_palette(ictx->wp);
input_reset_cell(ictx);
screen_write_reset(sctx);
- screen_write_clearhistory(sctx);
break;
case INPUT_ESC_IND:
screen_write_linefeed(sctx, 0, ictx->cell.cell.bg);
diff --git a/screen-write.c b/screen-write.c
index e8aa0973..a6e78f42 100644
--- a/screen-write.c
+++ b/screen-write.c
@@ -75,7 +75,7 @@ screen_write_set_cursor(struct screen_write_ctx *ctx, int cx, int cy)
return;
if (cx != -1) {
- if ((u_int)cx > screen_size_x(s) - 1)
+ if ((u_int)cx > screen_size_x(s)) /* allow last column */
cx = screen_size_x(s) - 1;
s->cx = cx;
}
@@ -1045,6 +1045,11 @@ screen_write_cursormove(struct screen_write_ctx *ctx, u_int px, u_int py)
py += s->rupper;
}
+ if (px > screen_size_x(s) - 1)
+ px = screen_size_x(s) - 1;
+ if (py > screen_size_y(s) - 1)
+ py = screen_size_y(s) - 1;
+
screen_write_set_cursor(ctx, px, py);
}