Discussion:
[patch] Make jump-to keys repeat correctly
(too old to reply)
Jacob Niehus
2015-04-19 22:21:21 UTC
Permalink
This patch implements the changes described in my pull request here:
https://sourceforge.net/p/tmux/tmux-code/merge-requests/13/

In summary, it makes 'T' and 't' repeatable with ';' and ',' in the
same way that 'F' and 'f' are repeatable.

I generated a new patch just now on top of
24c8f523eb8b294d057d617bc27cfbd2a4773f19 and compiled/tested it again.

Thanks,
Jake



commit 9c861f02bb04a900fdaf4218009b6f380982e857
Author: Jacob Niehus <***@gmail.com>
Date: Sun Apr 19 15:09:48 2015 -0700

Make jump-to keys repeat correctly

diff --git a/window-copy.c b/window-copy.c
index feb8c48..300f602 100644
--- a/window-copy.c
+++ b/window-copy.c
@@ -76,8 +76,8 @@ void window_copy_cursor_up(struct window_pane *, int);
void window_copy_cursor_down(struct window_pane *, int);
void window_copy_cursor_jump(struct window_pane *);
void window_copy_cursor_jump_back(struct window_pane *);
-void window_copy_cursor_jump_to(struct window_pane *);
-void window_copy_cursor_jump_to_back(struct window_pane *);
+void window_copy_cursor_jump_to(struct window_pane *, int);
+void window_copy_cursor_jump_to_back(struct window_pane *, int);
void window_copy_cursor_next_word(struct window_pane *, const char *);
void window_copy_cursor_next_word_end(struct window_pane *, const char *);
void window_copy_cursor_previous_word(struct window_pane *, const char *);
@@ -398,11 +398,11 @@ window_copy_key(struct window_pane *wp, struct
session *sess, int key)
}
if (data->inputtype == WINDOW_COPY_JUMPTOFORWARD) {
for (; np != 0; np--)
- window_copy_cursor_jump_to(wp);
+ window_copy_cursor_jump_to(wp, 0);
}
if (data->inputtype == WINDOW_COPY_JUMPTOBACK) {
for (; np != 0; np--)
- window_copy_cursor_jump_to_back(wp);
+ window_copy_cursor_jump_to_back(wp, 0);
}
}
data->jumptype = data->inputtype;
@@ -639,10 +639,10 @@ window_copy_key(struct window_pane *wp, struct
session *sess, int key)
window_copy_cursor_jump_back(wp);
} else if (data->jumptype == WINDOW_COPY_JUMPTOFORWARD) {
for (; np != 0; np--)
- window_copy_cursor_jump_to(wp);
+ window_copy_cursor_jump_to(wp, 1);
} else if (data->jumptype == WINDOW_COPY_JUMPTOBACK) {
for (; np != 0; np--)
- window_copy_cursor_jump_to_back(wp);
+ window_copy_cursor_jump_to_back(wp, 1);
}
break;
case MODEKEYCOPY_JUMPREVERSE:
@@ -654,10 +654,10 @@ window_copy_key(struct window_pane *wp, struct
session *sess, int key)
window_copy_cursor_jump(wp);
} else if (data->jumptype == WINDOW_COPY_JUMPTOFORWARD) {
for (; np != 0; np--)
- window_copy_cursor_jump_to_back(wp);
+ window_copy_cursor_jump_to_back(wp, 1);
} else if (data->jumptype == WINDOW_COPY_JUMPTOBACK) {
for (; np != 0; np--)
- window_copy_cursor_jump_to(wp);
+ window_copy_cursor_jump_to(wp, 1);
}
break;
case MODEKEYCOPY_JUMPBACK:
@@ -2009,7 +2009,7 @@ window_copy_cursor_jump_back(struct window_pane *wp)
}

void
-window_copy_cursor_jump_to(struct window_pane *wp)
+window_copy_cursor_jump_to(struct window_pane *wp, int jump_again)
{
struct window_copy_mode_data *data = wp->modedata;
struct screen *back_s = data->backing;
@@ -2017,7 +2017,7 @@ window_copy_cursor_jump_to(struct window_pane *wp)
struct utf8_data ud;
u_int px, py, xx;

- px = data->cx + 1;
+ px = data->cx + 1 + jump_again;
py = screen_hsize(back_s) + data->cy - data->oy;
xx = window_copy_find_length(wp, py);

@@ -2036,7 +2036,7 @@ window_copy_cursor_jump_to(struct window_pane *wp)
}

void
-window_copy_cursor_jump_to_back(struct window_pane *wp)
+window_copy_cursor_jump_to_back(struct window_pane *wp, int jump_again)
{
struct window_copy_mode_data *data = wp->modedata;
struct screen *back_s = data->backing;
@@ -2050,6 +2050,9 @@ window_copy_cursor_jump_to_back(struct window_pane *wp)
if (px > 0)
px--;

+ if (jump_again && px > 0)
+ px--;
+
for (;;) {
gc = grid_peek_cell(back_s->grid, px, py);
grid_cell_get(gc, &ud);
Nicholas Marriott
2015-04-20 09:39:34 UTC
Permalink
Applied to OpenBSD now, thanks, will be in SF at next sync.
Post by Jacob Niehus
https://sourceforge.net/p/tmux/tmux-code/merge-requests/13/
In summary, it makes 'T' and 't' repeatable with ';' and ',' in the
same way that 'F' and 'f' are repeatable.
I generated a new patch just now on top of
24c8f523eb8b294d057d617bc27cfbd2a4773f19 and compiled/tested it again.
Thanks,
Jake
commit 9c861f02bb04a900fdaf4218009b6f380982e857
Date: Sun Apr 19 15:09:48 2015 -0700
Make jump-to keys repeat correctly
diff --git a/window-copy.c b/window-copy.c
index feb8c48..300f602 100644
--- a/window-copy.c
+++ b/window-copy.c
@@ -76,8 +76,8 @@ void window_copy_cursor_up(struct window_pane *, int);
void window_copy_cursor_down(struct window_pane *, int);
void window_copy_cursor_jump(struct window_pane *);
void window_copy_cursor_jump_back(struct window_pane *);
-void window_copy_cursor_jump_to(struct window_pane *);
-void window_copy_cursor_jump_to_back(struct window_pane *);
+void window_copy_cursor_jump_to(struct window_pane *, int);
+void window_copy_cursor_jump_to_back(struct window_pane *, int);
void window_copy_cursor_next_word(struct window_pane *, const char *);
void window_copy_cursor_next_word_end(struct window_pane *, const char *);
void window_copy_cursor_previous_word(struct window_pane *, const char *);
@@ -398,11 +398,11 @@ window_copy_key(struct window_pane *wp, struct
session *sess, int key)
}
if (data->inputtype == WINDOW_COPY_JUMPTOFORWARD) {
for (; np != 0; np--)
- window_copy_cursor_jump_to(wp);
+ window_copy_cursor_jump_to(wp, 0);
}
if (data->inputtype == WINDOW_COPY_JUMPTOBACK) {
for (; np != 0; np--)
- window_copy_cursor_jump_to_back(wp);
+ window_copy_cursor_jump_to_back(wp, 0);
}
}
data->jumptype = data->inputtype;
@@ -639,10 +639,10 @@ window_copy_key(struct window_pane *wp, struct
session *sess, int key)
window_copy_cursor_jump_back(wp);
} else if (data->jumptype == WINDOW_COPY_JUMPTOFORWARD) {
for (; np != 0; np--)
- window_copy_cursor_jump_to(wp);
+ window_copy_cursor_jump_to(wp, 1);
} else if (data->jumptype == WINDOW_COPY_JUMPTOBACK) {
for (; np != 0; np--)
- window_copy_cursor_jump_to_back(wp);
+ window_copy_cursor_jump_to_back(wp, 1);
}
break;
@@ -654,10 +654,10 @@ window_copy_key(struct window_pane *wp, struct
session *sess, int key)
window_copy_cursor_jump(wp);
} else if (data->jumptype == WINDOW_COPY_JUMPTOFORWARD) {
for (; np != 0; np--)
- window_copy_cursor_jump_to_back(wp);
+ window_copy_cursor_jump_to_back(wp, 1);
} else if (data->jumptype == WINDOW_COPY_JUMPTOBACK) {
for (; np != 0; np--)
- window_copy_cursor_jump_to(wp);
+ window_copy_cursor_jump_to(wp, 1);
}
break;
@@ -2009,7 +2009,7 @@ window_copy_cursor_jump_back(struct window_pane *wp)
}
void
-window_copy_cursor_jump_to(struct window_pane *wp)
+window_copy_cursor_jump_to(struct window_pane *wp, int jump_again)
{
struct window_copy_mode_data *data = wp->modedata;
struct screen *back_s = data->backing;
@@ -2017,7 +2017,7 @@ window_copy_cursor_jump_to(struct window_pane *wp)
struct utf8_data ud;
u_int px, py, xx;
- px = data->cx + 1;
+ px = data->cx + 1 + jump_again;
py = screen_hsize(back_s) + data->cy - data->oy;
xx = window_copy_find_length(wp, py);
@@ -2036,7 +2036,7 @@ window_copy_cursor_jump_to(struct window_pane *wp)
}
void
-window_copy_cursor_jump_to_back(struct window_pane *wp)
+window_copy_cursor_jump_to_back(struct window_pane *wp, int jump_again)
{
struct window_copy_mode_data *data = wp->modedata;
struct screen *back_s = data->backing;
@@ -2050,6 +2050,9 @@ window_copy_cursor_jump_to_back(struct window_pane *wp)
if (px > 0)
px--;
+ if (jump_again && px > 0)
+ px--;
+
for (;;) {
gc = grid_peek_cell(back_s->grid, px, py);
grid_cell_get(gc, &ud);
------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
tmux-users mailing list
https://lists.sourceforge.net/lists/listinfo/tmux-users
Loading...