1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-01 19:42:48 -05:00

Allow CTRL_TEXT controls to be non-wrapping.

This is for cases where they're presenting information to the user
that wouldn't wrap sensibly anyway (such as an SSH key fingerprint
which is mostly all one word), and in which newlines might be
significant.

On GTK, the implementing widget is still a GtkLabel, but without the
wrap flag set, and wrapped in a GtkScrolledWindow in case the text is
too wide to fit.

On Windows, I've switched to using an edit box instead of a static
text control, making it readonly, and borderless via my existing
MakeDlgItemBorderless helper function. This doesn't get you an actual
scrollbar, but it does mean you can scroll left and right by dragging
with the mouse.
This commit is contained in:
Simon Tatham
2022-05-07 08:23:38 +01:00
parent 5390aef3fc
commit cd094b28a3
5 changed files with 41 additions and 16 deletions

View File

@ -2509,7 +2509,17 @@ GtkWidget *layout_ctrls(
gtk_label_set_selectable(GTK_LABEL(w), true);
gtk_widget_set_can_focus(w, false);
align_label_left(GTK_LABEL(w));
gtk_label_set_line_wrap(GTK_LABEL(w), true);
gtk_label_set_line_wrap(GTK_LABEL(w), ctrl->text.wrap);
if (!ctrl->text.wrap) {
gtk_widget_show(uc->text);
w = gtk_scrolled_window_new(NULL, NULL);
gtk_container_set_border_width(GTK_CONTAINER(w), 0);
gtk_container_add(GTK_CONTAINER(w), uc->text);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(w),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_NEVER);
gtk_widget_set_can_focus(w, false);
}
break;
}