Opened 5 years ago

Last modified 2 years ago

#15664 new defect

Finch internal clipboard window does not stretch to fill the terminal

Reported by: risujin Owned by: sadrul
Milestone: Component: finch (gnt/ncurses)
Version: 2.10.6 Keywords: copy window
Cc:

Description

To copy text out of a Finch window running in GNU Screen, I enabled the mouse and selected a URL and pressed Ctrl+Alt+C. This opens a new window at the top that contains the URL. Unfortunately, this window's first and last column is padded with spaces, and the window is actually one column too short to fill the entire terminal. The effect is that Gnome Terminal does not recognize the entire URL as one link so right-clicking to open the link does not work, and furthermore, when shift-clicking to select using terminal selection any window decoration under the copy-paste window is copied as well.

Attachments (1)

finch-copy-window.png (164.1 KB) - added by risujin 5 years ago.
Screenshot of the internal copy buffer

Download all attachments as: .zip

Change History (2)

Changed 5 years ago by risujin

Screenshot of the internal copy buffer

comment:1 Changed 2 years ago by eth4-global

In case anyone is still interested. I've managed to track down two causes of the problem. First, in finch/libgnt/gntwm.c, in function toggle_clipboard there are these three lines:

gnt_box_add_widget(GNT_BOX(clip), gnt_label_new(" "));
gnt_box_add_widget(GNT_BOX(clip), gnt_label_new(text));
gnt_box_add_widget(GNT_BOX(clip), gnt_label_new(" "));

Not sure why, but two spaces are deliberately put before and after the clipboard content. However, removing them is not enough, there will always be an additional space if the clipboard content consists of multiple lines. This is because the following piece of code in finch/libgnt/gntutils.c (function gnt_util_get_text_bound):

if (width)
  *width = max + (count > 1);

Not sure why is the width extended. Commenting out the (count > 1) fixes the trailing space for multi-line clipboard content. But it might break something else somewhere (didn't test).

Now the last problem occurs if the text is multi-line, but shorter than the width of the terminal. As the text spans only to a part of the terminal, terminal copy/paste method will pick up the text sticking out on the right side of the clipboard window. I don't know what would be the right way to fix that. Of course it could be done by altering the text in the clipboard by padding any of the lines with spaces. But I hope there is a way to that easier.

Note: See TracTickets for help on using tickets.
All information, including names and email addresses, entered onto this website or sent to mailing lists affiliated with this website will be public. Do not post confidential information, especially passwords!