]> asedeno.scripts.mit.edu Git - PuTTY.git/blobdiff - macosx/osxwin.m
Centralise generation of the control sequences for arrow keys into a
[PuTTY.git] / macosx / osxwin.m
index f61e6bff73a9aee093e06cafb3cba06e08fe7872..7c9118b82c5de0065c9ecd6cd34cbccfaa67fad0 100644 (file)
          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;
        }
     }