Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add Paste Delay option #115

Closed
wants to merge 1 commit into from

2 participants

thechile Chris West
thechile

Add Paste Delay option under Window, the same as TeraTerm has and other
SSH clients.

When staging configuration changes in notepad or whatever to then be
bulk pasted into an SSH session for a network device.. router, switch,
firewall, load balancer etc.. they don't like having 100+ lines of
config commands sent at them in one blast which putty does by default.
This result in some of the config lines being dropped or interpreted out
of order by the device.

This patch adds a new option which just sleeps for the specified
duration after each line break in the paste buffer, before sending.

SMG Add Paste Delay option
Add Paste Delay option under Window, the same as TeraTerm has and other
SSH clients.

When staging configuration changes in notepad or whatever to then be
bulk pasted into an SSH session for a network device.. router, switch,
firewall, load balancer etc.. they don't like having 100+ lines of
config commands sent at them in one blast which putty does by default.
This result in some of the config lines being dropped or interpreted out
of order by the device.

This patch adds a new option which just sleeps for the specified
duration after each line break in the paste buffer, before sending.
e497af5
Chris West FauxFaux referenced this pull request from a commit
SMG GH-115: Add Paste Delay option
Add Paste Delay option under Window, the same as TeraTerm has and other
SSH clients.

When staging configuration changes in notepad or whatever to then be
bulk pasted into an SSH session for a network device.. router, switch,
firewall, load balancer etc.. they don't like having 100+ lines of
config commands sent at them in one blast which putty does by default.
This result in some of the config lines being dropped or interpreted out
of order by the device.

This patch adds a new option which just sleeps for the specified
duration after each line break in the paste buffer, before sending.
8d6fb14
Chris West
Owner

Woo, that seems to work, thanks!

  • I've rejiggled the whitespace. See the end of Building with VS2010 to make PuTTY not look like poo in Visual Studio, or the committed local vimrc style for vim-like editors.
  • I moved the config option to evade having to resize the main dialog. I'm picky about that kind of thing.

Might have a look at fixing the fact that it hangs the whole window. GH-117.

Chris West FauxFaux closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 27, 2013
  1. Add Paste Delay option

    SMG authored
    Add Paste Delay option under Window, the same as TeraTerm has and other
    SSH clients.
    
    When staging configuration changes in notepad or whatever to then be
    bulk pasted into an SSH session for a network device.. router, switch,
    firewall, load balancer etc.. they don't like having 100+ lines of
    config commands sent at them in one blast which putty does by default.
    This result in some of the config lines being dropped or interpreted out
    of order by the device.
    
    This patch adds a new option which just sleeps for the specified
    duration after each line break in the paste buffer, before sending.
This page is out of date. Refresh to see the latest.
6 config.c
View
@@ -1713,6 +1713,12 @@ void setup_config_box(struct controlbox *b, int midsession,
conf_checkbox_handler,
I(CONF_erase_to_scrollback));
+ s = ctrl_getset(b, "Window", "pastedelay", "Copy and Paste");
+ ctrl_editbox(s, "Paste Delay per Line (ms)", '9', 20,
+ HELPCTX(window_pastedelay),
+ conf_editbox_handler,
+ I(CONF_pastedelay), I(-1));
+
/*
* The Window/Appearance panel.
*/
1  putty.h
View
@@ -784,6 +784,7 @@ void cleanup_exit(int);
X(STR, NONE, wintitle) /* initial window title */ \
/* Terminal options */ \
X(INT, NONE, savelines) \
+ X(INT, NONE, pastedelay) \
X(INT, NONE, scrolllines) \
X(INT, NONE, dec_om) \
X(INT, NONE, wrap_mode) \
2  settings.c
View
@@ -602,6 +602,7 @@ void save_open_settings(void *sesskey, Conf *conf)
#endif
);
write_setting_i(sesskey, "ScrollbackLines", conf_get_int(conf, CONF_savelines));
+ write_setting_i(sesskey, "PasteDelayms", conf_get_int(conf, CONF_pastedelay));
write_setting_i(sesskey, "LinesAtAScroll", conf_get_int(conf, CONF_scrolllines));
write_setting_i(sesskey, "DECOriginMode", conf_get_int(conf, CONF_dec_om));
write_setting_i(sesskey, "AutoWrapMode", conf_get_int(conf, CONF_wrap_mode));
@@ -941,6 +942,7 @@ void load_open_settings(void *sesskey, Conf *conf)
#endif
);
gppi(sesskey, "ScrollbackLines", 2000, conf, CONF_savelines);
+ gppi(sesskey, "PasteDelayms", 0, conf, CONF_pastedelay);
gppi(sesskey, "LinesAtAScroll", -1, conf, CONF_scrolllines);
gppi(sesskey, "DECOriginMode", 0, conf, CONF_dec_om);
gppi(sesskey, "AutoWrapMode", 1, conf, CONF_wrap_mode);
10 terminal.c
View
@@ -1344,6 +1344,7 @@ static void set_erase_char(Terminal *term)
void term_copy_stuff_from_conf(Terminal *term)
{
term->ansi_colour = conf_get_int(term->conf, CONF_ansi_colour);
+ term->pastedelay = conf_get_int(term->conf, CONF_pastedelay);
term->arabicshaping = conf_get_int(term->conf, CONF_arabicshaping);
term->beep = conf_get_int(term->conf, CONF_beep);
term->bellovl = conf_get_int(term->conf, CONF_bellovl);
@@ -6225,8 +6226,13 @@ void term_paste(Terminal *term)
while (term->paste_pos < term->paste_len) {
int n = 0;
while (n + term->paste_pos < term->paste_len) {
- if (term->paste_buffer[term->paste_pos + n++] == '\015')
- break;
+ if (term->paste_buffer[term->paste_pos + n++] == '\015') {
+ if (term->pastedelay > 0) {
+ for (int i = 0; i < term->pastedelay;i++)
+ Sleep(1);
+ }
+ break;
+ }
}
if (term->ldisc)
luni_send(term->ldisc, term->paste_buffer + term->paste_pos, n, 0);
2  terminal.h
View
@@ -151,6 +151,8 @@ struct terminal_tag {
int seen_disp_event;
int big_cursor;
+ int pastedelay;
+
int xterm_mouse; /* send mouse messages to host */
int xterm_extended_mouse;
int urxvt_extended_mouse;
2  windows/win_res.rc2
View
@@ -31,7 +31,7 @@ BEGIN
END
/* Accelerators used: aco */
-IDD_MAINBOX DIALOG DISCARDABLE 0, 0, 300, 262
+IDD_MAINBOX DIALOG DISCARDABLE 0, 0, 300, 280
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "PuTTY Configuration"
FONT 8, "MS Shell Dlg"
4 windows/windlg.c
View
@@ -341,7 +341,7 @@ static void create_controls(HWND hwnd, char *path)
/*
* Here we must create the basic standard controls.
*/
- ctlposinit(&cp, hwnd, 3, 3, 245);
+ ctlposinit(&cp, hwnd, 3, 3, 260);
wc = &ctrls_base;
base_id = IDCX_STDBASE;
} else {
@@ -432,7 +432,7 @@ static int CALLBACK GenericMainDlgProc(HWND hwnd, UINT msg,
r.left = 3;
r.right = r.left + 95;
r.top = 13;
- r.bottom = r.top + 229;
+ r.bottom = r.top + 242;
MapDialogRect(hwnd, &r);
treeview = CreateWindowEx(WS_EX_CLIENTEDGE, WC_TREEVIEW, "",
WS_CHILD | WS_VISIBLE |
1  windows/winhelp.h
View
@@ -60,6 +60,7 @@
#define WINHELP_CTX_window_resize "window.resize:config-winsizelock"
#define WINHELP_CTX_window_scrollback "window.scrollback:config-scrollback"
#define WINHELP_CTX_window_erased "window.erased:config-erasetoscrollback"
+#define WINHELP_CTX_window_pastedelay "window.scrollback:config-pastedelay"
#define WINHELP_CTX_behaviour_closewarn "behaviour.closewarn:config-warnonclose"
#define WINHELP_CTX_behaviour_altf4 "behaviour.altf4:config-altf4"
#define WINHELP_CTX_behaviour_altspace "behaviour.altspace:config-altspace"
Something went wrong with that request. Please try again.