X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/666453fec61109771b34ff1d86ab1ac47e36c4dc..0affbab4b5e2a5fac19b261c4f74ea868f138340:/macosx/osxwin.m diff --git a/macosx/osxwin.m b/macosx/osxwin.m index a4fac71d..7c9118b8 100644 --- a/macosx/osxwin.m +++ b/macosx/osxwin.m @@ -232,15 +232,9 @@ /* * Set up a backend. */ - { - int i; + back = backend_from_proto(cfg.protocol); + if (!back) back = &pty_backend; - for (i = 0; backends[i].backend != NULL; i++) - if (backends[i].protocol == cfg.protocol) { - back = backends[i].backend; - break; - } - } { const char *error; @@ -743,23 +737,8 @@ case NSLeftArrowFunctionKey: xkey = 'D'; break; } if (xkey) { - /* - * The arrow keys normally do ESC [ A and so on. In - * app cursor keys mode they do ESC O A instead. - * Ctrl toggles the two modes. - */ - if (term->vt52_mode) { - output[end++] = '\033'; - output[end++] = xkey; - } else if (!term->app_cursor_keys ^ !(m & NSControlKeyMask)) { - output[end++] = '\033'; - output[end++] = 'O'; - output[end++] = xkey; - } else { - output[end++] = '\033'; - output[end++] = '['; - output[end++] = xkey; - } + end += format_arrow_key(output+end, term, xkey, + m & NSControlKeyMask); goto done; } } @@ -794,6 +773,11 @@ return term_data(term, is_stderr, data, len); } +- (int)fromBackendUntrusted:(const char *)data len:(int)len +{ + return term_data_untrusted(term, data, len); +} + - (void)startAlert:(NSAlert *)alert withCallback:(void (*)(void *, int))callback andCtx:(void *)ctx { @@ -885,6 +869,11 @@ // FIXME: else show restart menu item } +- (Terminal *)term +{ + return term; +} + @end int from_backend(void *frontend, int is_stderr, const char *data, int len) @@ -893,6 +882,12 @@ int from_backend(void *frontend, int is_stderr, const char *data, int len) return [win fromBackend:data len:len isStderr:is_stderr]; } +int from_backend_untrusted(void *frontend, const char *data, int len) +{ + SessionWindow *win = (SessionWindow *)frontend; + return [win fromBackendUntrusted:data len:len]; +} + int get_userpass_input(prompts_t *p, unsigned char *in, int inlen) { SessionWindow *win = (SessionWindow *)p->frontend; @@ -922,7 +917,7 @@ void ldisc_update(void *frontend, int echo, int edit) char *get_ttymode(void *frontend, const char *mode) { - SessionWindow *win = (SessionWindow *)ctx; + SessionWindow *win = (SessionWindow *)frontend; Terminal *term = [win term]; return term_get_ttymode(term, mode); }