Signed-off-by: Takeshi Banse <[email protected]>
---
Hi,

I've found a question about copy-mode rectangle selection.

In commit:
https://github.com/tmux/tmux/commit/82776c456e1ad4ba2c9466e90f51179d07a4c9c2#diff-f37a1a6f8b7458f5f418b0e59ddd2e5aL2081

> @@ -2078,7 +2090,7 @@ window_copy_cursor_up(struct window_pane *wp, int 
> scroll_only)
> ... 
> -     if (!data->screen.sel.flag || !data->rectflag) {
> +     if (data->screen.sel != NULL || !data->rectflag) {
                        ^^^^
Is this intentional?  I think that it could be

  data->screen.sel == NULL

like in `window_copy_cursor_down()` below:

> @@ -2106,7 +2118,7 @@ window_copy_cursor_down(struct window_pane *wp, int 
> scroll_only)
> ...
> -     if (!data->screen.sel.flag || !data->rectflag) {
> +     if (data->screen.sel == NULL || !data->rectflag) {

It shrinks the selections after cursor-up, but not after cursor-down
in copy-mode when rectangle selection is activated.


Step to reproduce following (1) - (5).

Note:
* between '----' and '----' denotes a buffer
* ^ : cursor position
* | : selection
* A screen capture here:
https://gist.github.com/hchbaw/3b8af0e6f6510164d42ee92a33c4356e/raw/911c6340a680e7f3825693983b548d9983f16a21/video.mp4


(1) begin-selection and rectangle-toggle,
----
test test
^

test test
----

(2) move the cursor after the second 'e',
----
|test te|st
        ^

test test
----

(3) move the cursor down one line,
----
|test te|st
|       |
        ^
test test
----

(4) move the cursor down 2 lines,
----
|test te|st
|       |
|       |
|test te|st
        ^
----

(5) move the cursor up. It shrinks the selections like this:
----
|t|est test
||
^ 
test test
----

I expect the following behavior:

(5)+ it should hold the selection's width like below according to the
behavior prior to this commit. (same as above step (3) behavior)
----
|test te|st
|       |
        ^ 
test test
----

tmux-server-*.log here:
https://gist.github.com/hchbaw/3b8af0e6f6510164d42ee92a33c4356e/raw/911c6340a680e7f3825693983b548d9983f16a21/tmux-server-14566.log

 window-copy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/window-copy.c b/window-copy.c
index 6ef4b29d..39bf2c2e 100644
--- a/window-copy.c
+++ b/window-copy.c
@@ -2082,7 +2082,7 @@ window_copy_cursor_up(struct window_pane *wp, int 
scroll_only)
                }
        }
 
-       if (data->screen.sel != NULL || !data->rectflag) {
+       if (data->screen.sel == NULL || !data->rectflag) {
                py = screen_hsize(data->backing) + data->cy - data->oy;
                px = window_copy_find_length(wp, py);
                if ((data->cx >= data->lastsx && data->cx != px) ||
-- 
2.19.0.rc1

-- 
You received this message because you are subscribed to the Google Groups 
"tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to