diff options
author | Yorhel <git@yorhel.nl> | 2014-10-07 14:57:08 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2014-10-07 14:57:08 +0200 |
commit | 4611514dfc8b2033e8adea159f54c0d2793a2e6c (patch) | |
tree | 6118e29fd7bf8e93e3caf02ed09d5d874130c255 | |
parent | 0f209687ee543152971b9713f2ff875afaada89e (diff) |
Add --no-bracketed-paste option
-rw-r--r-- | doc/ncdc.pod.in | 4 | ||||
-rw-r--r-- | src/main.c | 8 | ||||
-rw-r--r-- | src/ui.c | 12 |
3 files changed, 16 insertions, 8 deletions
diff --git a/doc/ncdc.pod.in b/doc/ncdc.pod.in index 87e4438..505afe2 100644 --- a/doc/ncdc.pod.in +++ b/doc/ncdc.pod.in @@ -81,6 +81,10 @@ Display summary of options. Don't automatically connect to hubs with the C<autoconnect> option set. +=item B<--no-bracketed-paste> + +Disable bracketed pasting. + =item B<-v, --version> Display ncdc version. @@ -359,6 +359,7 @@ static gboolean print_version(const gchar *name, const gchar *val, gpointer dat, static gboolean auto_open = TRUE; +static gboolean bracketed_paste = TRUE; static GOptionEntry cli_options[] = { { "version", 'v', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, print_version, @@ -367,6 +368,8 @@ static GOptionEntry cli_options[] = { "Use a different session directory. Default: `$NCDC_DIR' or `$HOME/.ncdc'.", "<dir>" }, { "no-autoconnect", 'n', G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &auto_open, "Don't automatically connect to hubs with the `autoconnect' option set.", NULL }, + { "no-bracketed-paste", 0, G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &bracketed_paste, + "Disable bracketed pasting.", NULL }, { NULL } }; @@ -449,7 +452,7 @@ int main(int argc, char **argv) { cc_global_init(); dl_init_global(); ui_cmdhist_init("history"); - ui_init(); + ui_init(bracketed_paste); // setup SIGWINCH struct sigaction act; @@ -505,7 +508,8 @@ int main(int argc, char **argv) { erase(); refresh(); endwin(); - ui_set_bracketed_paste(0); + if(bracketed_paste) + ui_set_bracketed_paste(0); printf("Flushing unsaved data to disk..."); fflush(stdout); @@ -260,7 +260,7 @@ void ui_set_bracketed_paste(int enable) { } -void ui_init() { +void ui_init(gboolean bracketed_paste) { // init curses initscr(); raw(); @@ -270,9 +270,11 @@ void ui_init() { nodelay(stdscr, 1); // ensure curses is init'd before event-keys defined before events happen - define_key("\x1b[200~", KEY_BRACKETED_PASTE_START); - define_key("\x1b[201~", KEY_BRACKETED_PASTE_END); - ui_set_bracketed_paste(1); + if(bracketed_paste) { + define_key("\x1b[200~", KEY_BRACKETED_PASTE_START); + define_key("\x1b[201~", KEY_BRACKETED_PASTE_END); + ui_set_bracketed_paste(1); + } // global textinput field ui_global_textinput = ui_textinput_create(TRUE, cmd_suggest); @@ -281,8 +283,6 @@ void ui_init() { ui_tab_open(uit_main_create(), TRUE, NULL); ui_colors_init(); - - // draw ui_draw(); } |