diff options
| author | Karoly Lorentey | 2003-12-27 01:12:57 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2003-12-27 01:12:57 +0000 |
| commit | 6548cf002c635f6799e2e127393128842be35632 (patch) | |
| tree | fd4c575d43e456302e02f3bd042046730bd7ac8c | |
| parent | ce9d5d591d781613a3e3a7c4f43ab53bb0fe6637 (diff) | |
| download | emacs-6548cf002c635f6799e2e127393128842be35632.tar.gz emacs-6548cf002c635f6799e2e127393128842be35632.zip | |
Full support for multiple terminal I/O (with some rough edges).
lib-src/emacsclient.c (emacs_pid): New variable.
(window_change): Forward the SIGWINCH signal to the Emacs process
after copying the size parameters to the proxy terminal.
(copy_from_to): New parameter (sigio), kill Emacs with SIGIO if it is
nonzero.
(main): Set emacs_pid.
lisp/server.el (server-process-filter): Send the pid of Emacs to emacsclient.
src/cm.c: Added tty parameters to all functions and all Wcm macro calls.
src/cm.h: Added tty parameters to all macros. Updated function prototypes.
(Wcm): Moved to struct tty_output.
src/dispextern.h: Updated function prototypes.
src/dispnew.c: Added tty parameters to all Wcm macro calls.
(do_switch_frame): Make old frame obscured, not invisible, to solve
problems with other-frame.
(Wcm): Moved to struct tty_output.
src/keyboard.c (read_avail_input): Select the frame corresponding to
the tty that was read. Slight rearrangement of tty loop.
src/lisp.h (tabs_safe_p): Removed duplicate prototype.
src/sysdep.c (hft_init, hft_reset): Added tty_output parameter.
(discard_tty_input): Discard input from all ttys on APOLLO, too.
Whatever it is.
(narrow_foreground_group, widen_foreground_group): Added tty parameter
(not really useful, the functions only work on the controlling tty.)
(tabs_safe_p): Added tty parameter.
src/term.c Added tty parameters to all Wcm macro calls.
Standardised updating_frame vs. selected frame and tty_output access.
(term_init): Allocate Wcm.
(syms_of_term): Provide the `multi-tty' feature.
src/termchar.h (struct tty_output): Added Wcm.
src/xdisp.c (try_window_id): Make sure we use the tty device
corresponding to the current frame.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-8
| -rw-r--r-- | README.multi-tty | 108 | ||||
| -rw-r--r-- | lib-src/emacsclient.c | 29 | ||||
| -rw-r--r-- | lisp/server.el | 6 | ||||
| -rw-r--r-- | src/cm.c | 141 | ||||
| -rw-r--r-- | src/cm.h | 109 | ||||
| -rw-r--r-- | src/dispextern.h | 6 | ||||
| -rw-r--r-- | src/dispnew.c | 8 | ||||
| -rw-r--r-- | src/frame.c | 2 | ||||
| -rw-r--r-- | src/frame.h | 14 | ||||
| -rw-r--r-- | src/keyboard.c | 22 | ||||
| -rw-r--r-- | src/lisp.h | 1 | ||||
| -rw-r--r-- | src/sysdep.c | 48 | ||||
| -rw-r--r-- | src/term.c | 378 | ||||
| -rw-r--r-- | src/termchar.h | 4 | ||||
| -rw-r--r-- | src/xdisp.c | 6 |
15 files changed, 489 insertions, 393 deletions
diff --git a/README.multi-tty b/README.multi-tty index c8cd7279adf..ed2fb17770f 100644 --- a/README.multi-tty +++ b/README.multi-tty | |||
| @@ -13,7 +13,7 @@ I'm Károly Lőrentey. My address: lorentey@elte.hu. | |||
| 13 | 13 | ||
| 14 | Patches or suggestions are welcome! | 14 | Patches or suggestions are welcome! |
| 15 | 15 | ||
| 16 | Retrieving the branch: | 16 | Retrieving the latest version of the branch: |
| 17 | 17 | ||
| 18 | tla register-archive lorentey@elte.hu--2004 http://lorentey.web.elte.hu/arch/2004/ | 18 | tla register-archive lorentey@elte.hu--2004 http://lorentey.web.elte.hu/arch/2004/ |
| 19 | tla get lorentey@elte.hu--2004/emacs--multi-tty--0 <directory> | 19 | tla get lorentey@elte.hu--2004/emacs--multi-tty--0 <directory> |
| @@ -24,21 +24,24 @@ Retrieving the branch: | |||
| 24 | STATUS | 24 | STATUS |
| 25 | ------ | 25 | ------ |
| 26 | 26 | ||
| 27 | We can create frames on new tty devices, but there are problems with | 27 | Basic support is there; there are some rough edges, but it already |
| 28 | redisplay. Input is read from all terminals (NOT via MULTIKBOARD!). | 28 | seems to be usable. Input is read from all terminals (NOT via |
| 29 | At the moment, the type of the new terminals must be the same as the | 29 | MULTIKBOARD!). At the moment, the type of the new terminals must be |
| 30 | initial terminal. Emacsclient is extended to support opening a new | 30 | the same as the initial terminal. Emacsclient was extended to support |
| 31 | terminal frame. | 31 | opening a new terminal frame. |
| 32 | 32 | ||
| 33 | To try it out, start up the emacs server (M-x server-start), and then | 33 | To try it out, start up the emacs server (M-x server-start), and then |
| 34 | start emacsclient with | 34 | (from a shell prompt on another terminal) start emacsclient with |
| 35 | 35 | ||
| 36 | emacsclient -h | 36 | emacsclient -h |
| 37 | 37 | ||
| 38 | If you exit emacs, both terminals are restored to their previous | 38 | You'll have two fully working frames on separate terminals. If you |
| 39 | exit emacs, both terminals should be restored to their previous | ||
| 39 | states. | 40 | states. |
| 40 | 41 | ||
| 41 | X, Mac, Windows and DOS support is broken. | 42 | X, Mac, Windows and DOS support is broken at the moment. |
| 43 | |||
| 44 | Tested under GNU/Linux only. | ||
| 42 | 45 | ||
| 43 | NEWS | 46 | NEWS |
| 44 | ---- | 47 | ---- |
| @@ -47,7 +50,19 @@ For the NEWS file: | |||
| 47 | 50 | ||
| 48 | ** Support for multiple terminal devices has been added. You can | 51 | ** Support for multiple terminal devices has been added. You can |
| 49 | specify a terminal device (`tty' parameter) and a terminal type | 52 | specify a terminal device (`tty' parameter) and a terminal type |
| 50 | (`tty-type' parameter) to `make-terminal-frame'. | 53 | (`tty-type' parameter) to `make-terminal-frame'. `tty' must be a |
| 54 | terminal device created by the new emacsclient, or there will be | ||
| 55 | problems with terminal input and window resizes. (The kernel | ||
| 56 | notifies processes about pending input or terminal resizes only on | ||
| 57 | the controlling terminal, so we need emacsclient to sit on the real | ||
| 58 | terminal device, create SIGIO signals upon terminal input, and | ||
| 59 | forward SIGWINCH signals to us.) | ||
| 60 | |||
| 61 | You can test for the presence of multiple terminal support by | ||
| 62 | testing for the `multi-tty' feature. | ||
| 63 | |||
| 64 | ** A make-frame-on-tty function has been added to make it easier to | ||
| 65 | create frames on new terminals. | ||
| 51 | 66 | ||
| 52 | ** Emacsclient has been extended to support opening a new terminal | 67 | ** Emacsclient has been extended to support opening a new terminal |
| 53 | frame. | 68 | frame. |
| @@ -58,8 +73,10 @@ CHANGELOG | |||
| 58 | See arch logs. | 73 | See arch logs. |
| 59 | 74 | ||
| 60 | 75 | ||
| 61 | THINGS THAT ARE DONE | 76 | DIARY OF CHANGES |
| 62 | -------------------- | 77 | ---------------- |
| 78 | |||
| 79 | (ex-TODO items with explanations.) | ||
| 63 | 80 | ||
| 64 | -- Introduce a new abstraction for terminal devices. | 81 | -- Introduce a new abstraction for terminal devices. |
| 65 | 82 | ||
| @@ -80,12 +97,13 @@ THINGS THAT ARE DONE | |||
| 80 | -- Implement support for reading from multiple terminals. | 97 | -- Implement support for reading from multiple terminals. |
| 81 | 98 | ||
| 82 | (Done, read_avail_input tries to read from each terminal, until one | 99 | (Done, read_avail_input tries to read from each terminal, until one |
| 83 | succeeds.) | 100 | succeeds. MULTIKBOARD is not used. Secondary terminals don't send |
| 101 | SIGIO!) | ||
| 84 | 102 | ||
| 85 | -- other-frame should cycle through the frames on the `current' | 103 | -- other-frame should cycle through the frames on the `current' |
| 86 | terminal. | 104 | terminal only. |
| 87 | 105 | ||
| 88 | (Done. A little fragile, but seems to work.) | 106 | (Done, by trivially modifiying next_frame and prev_frame.) |
| 89 | 107 | ||
| 90 | -- Support different terminal sizes. | 108 | -- Support different terminal sizes. |
| 91 | 109 | ||
| @@ -94,7 +112,8 @@ THINGS THAT ARE DONE | |||
| 94 | -- Make sure terminal resizes are handled gracefully. (Could be | 112 | -- Make sure terminal resizes are handled gracefully. (Could be |
| 95 | problematic.) | 113 | problematic.) |
| 96 | 114 | ||
| 97 | (Done. We don't get SIGWINCH for additional ttys, though.) | 115 | (Done. We don't get automatic SIGWINCH for additional ttys, |
| 116 | though.) | ||
| 98 | 117 | ||
| 99 | -- Extend emacsclient to automatically open a new tty when it connects | 118 | -- Extend emacsclient to automatically open a new tty when it connects |
| 100 | to Emacs. | 119 | to Emacs. |
| @@ -106,46 +125,71 @@ THINGS THAT ARE DONE | |||
| 106 | 125 | ||
| 107 | (Done, but introduced ugly redisplay problems. Ugh.) | 126 | (Done, but introduced ugly redisplay problems. Ugh.) |
| 108 | 127 | ||
| 128 | -- Fix redisplay problems. | ||
| 129 | |||
| 130 | (Done, it turned out that the entire Wcm structure must be moved | ||
| 131 | inside tty_output. Why was it so hard for me to find this out?) | ||
| 132 | |||
| 133 | -- Provide a way for emacsclient to tell Emacs that the tty has been | ||
| 134 | resized. | ||
| 135 | |||
| 136 | (Done, simply forward the SIGWINCH signal.) | ||
| 137 | |||
| 138 | -- Each keypress should automatically select the frame corresponding | ||
| 139 | to the terminal that it was coming from. This means that Emacs | ||
| 140 | must know from which terminal the last keyboard event came from. | ||
| 141 | (Multikeyboard support may help with this.) | ||
| 142 | |||
| 143 | (Done, it was quite simple.) | ||
| 144 | |||
| 145 | -- Fix SIGIO issue with secondary terminals. | ||
| 146 | |||
| 147 | (Done, emacsclient signals Emacs after writing to the proxy pseudo | ||
| 148 | terminal. This means that multi-tty does not work with raw ttys!) | ||
| 109 | 149 | ||
| 110 | THINGS TO DO | 150 | THINGS TO DO |
| 111 | ------------ | 151 | ------------ |
| 112 | 152 | ||
| 113 | ** Fix redisplay problems. | 153 | ** Implement sane error handling after initialization. (Currently |
| 154 | emacs exits if you specify a bad terminal type.) The helpful error | ||
| 155 | messages must still be provided when Emacs starts. | ||
| 156 | |||
| 157 | ** C-g should work on secondary terminals. | ||
| 114 | 158 | ||
| 115 | ** Make make-terminal-frame look up the tty and tty-type parameters | 159 | ** Make make-terminal-frame look up the tty and tty-type parameters |
| 116 | from the currently selected terminal before the global default. | 160 | from the currently selected terminal before the global default. |
| 117 | 161 | ||
| 118 | ** Move optimalization parameters (costs) from union output_data to | 162 | ** Move optimalization parameters (costs) from union output_data to |
| 119 | struct frame. | 163 | a backend-neutral per-device structure. |
| 120 | 164 | ||
| 121 | ** Provide a way for emacsclient to tell Emacs that the tty has been | 165 | ** Implement terminal deletion, i.e., deleting local frames, closing |
| 122 | resized. | 166 | the tty device and restoring its previous state without exiting |
| 167 | Emacs. This should be exported to the Lisp environment. | ||
| 123 | 168 | ||
| 124 | ** Implement terminal deletion, i.e., closing the tty device and | 169 | ** Implement automatic deletion of terminals when the last frame on |
| 125 | restoring its previous state without exiting Emacs. This should be | ||
| 126 | exported to the Lisp interpreter. | ||
| 127 | |||
| 128 | ** Implement automatic deletion of terminals, when the last frame on | ||
| 129 | that terminal is closed. | 170 | that terminal is closed. |
| 130 | 171 | ||
| 131 | ** Put all cached terminal escape sequences into struct tty_output. | 172 | ** Put all cached terminal escape sequences into struct tty_output. |
| 132 | Currently, they are still stored in global variables, so we don't | 173 | Currently, they are still stored in global variables, so we don't |
| 133 | really support multiple terminal types. | 174 | really support multiple terminal types. |
| 134 | 175 | ||
| 135 | 176 | ** Make parts of struct tty_output accessible from Lisp. The device | |
| 136 | ** Each keypress should automatically select the frame corresponding | 177 | name and the type is sufficient. |
| 137 | to the terminal that it was coming from. This means that Emacs | ||
| 138 | must know from which terminal the last keyboard event came from. | ||
| 139 | (Multikeyboard support may help with this.) | ||
| 140 | |||
| 141 | ** Make struct tty_output available from Lisp. | ||
| 142 | 178 | ||
| 143 | ** Implement support for starting an interactive Emacs session without | 179 | ** Implement support for starting an interactive Emacs session without |
| 144 | an initial frame. (The user would connect to it and open frames | 180 | an initial frame. (The user would connect to it and open frames |
| 145 | later, with emacsclient.) Not necessary a good idea. | 181 | later, with emacsclient.) Not necessary a good idea. |
| 146 | 182 | ||
| 183 | ** Support raw secondary terminals. (This one is tricky, SIGIO works | ||
| 184 | only on the controlling terminal.) | ||
| 185 | |||
| 186 | ** What does interrupt_input do? I tried to disable it for raw | ||
| 187 | secondary tty support, but it seems not to do anything useful. | ||
| 188 | |||
| 147 | ** Fix X support. | 189 | ** Fix X support. |
| 148 | 190 | ||
| 191 | ** Do tty output through term_hooks, too. | ||
| 192 | |||
| 149 | ** Allow simultaneous X and tty frames. | 193 | ** Allow simultaneous X and tty frames. |
| 150 | 194 | ||
| 151 | ** Fix Mac support (I can't do this myself). | 195 | ** Fix Mac support (I can't do this myself). |
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 2f0f45e1f59..14da37b1bb8 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c | |||
| @@ -380,6 +380,7 @@ int tty_erase_char; | |||
| 380 | int flow_control = 0; | 380 | int flow_control = 0; |
| 381 | int meta_key = 0; | 381 | int meta_key = 0; |
| 382 | char _sobuf[BUFSIZ]; | 382 | char _sobuf[BUFSIZ]; |
| 383 | int emacs_pid; | ||
| 383 | 384 | ||
| 384 | /* Adapted from init_sys_modes() in sysdep.c. */ | 385 | /* Adapted from init_sys_modes() in sysdep.c. */ |
| 385 | int | 386 | int |
| @@ -548,7 +549,7 @@ init_tty () | |||
| 548 | void | 549 | void |
| 549 | window_change () | 550 | window_change () |
| 550 | { | 551 | { |
| 551 | int width, height; | 552 | int width = 0, height = 0; |
| 552 | 553 | ||
| 553 | #ifdef TIOCGWINSZ | 554 | #ifdef TIOCGWINSZ |
| 554 | { | 555 | { |
| @@ -601,6 +602,9 @@ window_change () | |||
| 601 | } | 602 | } |
| 602 | #endif /* not SunOS-style */ | 603 | #endif /* not SunOS-style */ |
| 603 | #endif /* not BSD-style */ | 604 | #endif /* not BSD-style */ |
| 605 | |||
| 606 | if (width != 0 && height != 0) | ||
| 607 | kill (emacs_pid, SIGWINCH); | ||
| 604 | } | 608 | } |
| 605 | 609 | ||
| 606 | int in_conversation = 0; | 610 | int in_conversation = 0; |
| @@ -696,7 +700,7 @@ init_pty () | |||
| 696 | } | 700 | } |
| 697 | 701 | ||
| 698 | int | 702 | int |
| 699 | copy_from_to (int in, int out) | 703 | copy_from_to (int in, int out, int sigio) |
| 700 | { | 704 | { |
| 701 | static char buf[BUFSIZ]; | 705 | static char buf[BUFSIZ]; |
| 702 | int nread = read (in, &buf, BUFSIZ); | 706 | int nread = read (in, &buf, BUFSIZ); |
| @@ -716,6 +720,11 @@ copy_from_to (int in, int out) | |||
| 716 | 720 | ||
| 717 | if (r < 0) | 721 | if (r < 0) |
| 718 | return 0; /* Error */ | 722 | return 0; /* Error */ |
| 723 | |||
| 724 | if (sigio) | ||
| 725 | { | ||
| 726 | kill (emacs_pid, SIGIO); | ||
| 727 | } | ||
| 719 | } | 728 | } |
| 720 | return 1; | 729 | return 1; |
| 721 | } | 730 | } |
| @@ -744,13 +753,13 @@ pty_conversation () | |||
| 744 | if (FD_ISSET (master, &set)) | 753 | if (FD_ISSET (master, &set)) |
| 745 | { | 754 | { |
| 746 | /* Copy Emacs output to stdout. */ | 755 | /* Copy Emacs output to stdout. */ |
| 747 | if (! copy_from_to (master, 0)) | 756 | if (! copy_from_to (master, 0, 0)) |
| 748 | return 1; | 757 | return 1; |
| 749 | } | 758 | } |
| 750 | if (FD_ISSET (1, &set)) | 759 | if (FD_ISSET (1, &set)) |
| 751 | { | 760 | { |
| 752 | /* Forward user input to Emacs. */ | 761 | /* Forward user input to Emacs. */ |
| 753 | if (! copy_from_to (1, master)) | 762 | if (! copy_from_to (1, master, 1)) |
| 754 | return 1; | 763 | return 1; |
| 755 | } | 764 | } |
| 756 | } | 765 | } |
| @@ -1078,6 +1087,18 @@ To start the server in Emacs, type \"M-x server-start\".\n", | |||
| 1078 | 1087 | ||
| 1079 | if (here) | 1088 | if (here) |
| 1080 | { | 1089 | { |
| 1090 | /* First of all, get the pid of the Emacs process. | ||
| 1091 | XXX Is there is some nifty libc/kernel feature for doing this? | ||
| 1092 | */ | ||
| 1093 | str = fgets (string, BUFSIZ, in); | ||
| 1094 | emacs_pid = atoi (str); | ||
| 1095 | if (emacs_pid == 0) | ||
| 1096 | { | ||
| 1097 | reset_tty (); | ||
| 1098 | fprintf (stderr, "%s: Could not get process id of Emacs\n", argv[0]); | ||
| 1099 | fail (argc, argv); | ||
| 1100 | } | ||
| 1101 | |||
| 1081 | if (! pty_conversation ()) | 1102 | if (! pty_conversation ()) |
| 1082 | { | 1103 | { |
| 1083 | reset_tty (); | 1104 | reset_tty (); |
diff --git a/lisp/server.el b/lisp/server.el index 37b8eeb7574..f2c1fc9ce2a 100644 --- a/lisp/server.el +++ b/lisp/server.el | |||
| @@ -319,13 +319,15 @@ PROC is the server process. Format of STRING is \"PATH PATH PATH... \\n\"." | |||
| 319 | (server-select-display display) | 319 | (server-select-display display) |
| 320 | (error (process-send-string proc (nth 1 err)) | 320 | (error (process-send-string proc (nth 1 err)) |
| 321 | (setq request ""))))) | 321 | (setq request ""))))) |
| 322 | ;; Open a new tty at the client. | 322 | ;; Open a new frame at the client. ARG is the name of the pseudo tty. |
| 323 | ((and (equal "-pty" arg) (string-match "\\([^ ]*\\) \\([^ ]*\\) " request)) | 323 | ((and (equal "-pty" arg) (string-match "\\([^ ]*\\) \\([^ ]*\\) " request)) |
| 324 | (let ((pty (server-unquote-arg (match-string 1 request))) | 324 | (let ((pty (server-unquote-arg (match-string 1 request))) |
| 325 | (type (server-unquote-arg (match-string 2 request)))) | 325 | (type (server-unquote-arg (match-string 2 request)))) |
| 326 | (setq request (substring request (match-end 0))) | 326 | (setq request (substring request (match-end 0))) |
| 327 | (condition-case err | 327 | (condition-case err |
| 328 | (make-terminal-frame `((tty . ,pty) (tty-type . ,type))) | 328 | (progn |
| 329 | (make-terminal-frame `((tty . ,pty) (tty-type . ,type))) | ||
| 330 | (process-send-string proc (concat (number-to-string (emacs-pid)) "\n"))) | ||
| 329 | (error (process-send-string proc (nth 1 err)) | 331 | (error (process-send-string proc (nth 1 err)) |
| 330 | (setq request ""))))) | 332 | (setq request ""))))) |
| 331 | ;; ARG is a line number option. | 333 | ;; ARG is a line number option. |
| @@ -137,9 +137,9 @@ void | |||
| 137 | cmcheckmagic (tty) | 137 | cmcheckmagic (tty) |
| 138 | struct tty_output *tty; | 138 | struct tty_output *tty; |
| 139 | { | 139 | { |
| 140 | if (curX == FrameCols) | 140 | if (curX (tty) == FrameCols (tty)) |
| 141 | { | 141 | { |
| 142 | if (!MagicWrap || curY >= FrameRows - 1) | 142 | if (!MagicWrap (tty) || curY (tty) >= FrameRows (tty) - 1) |
| 143 | abort (); | 143 | abort (); |
| 144 | if (TTY_TERMSCRIPT (tty)) | 144 | if (TTY_TERMSCRIPT (tty)) |
| 145 | putc ('\r', TTY_TERMSCRIPT (tty)); | 145 | putc ('\r', TTY_TERMSCRIPT (tty)); |
| @@ -147,8 +147,8 @@ cmcheckmagic (tty) | |||
| 147 | if (TTY_TERMSCRIPT (tty)) | 147 | if (TTY_TERMSCRIPT (tty)) |
| 148 | putc ('\n', TTY_TERMSCRIPT (tty)); | 148 | putc ('\n', TTY_TERMSCRIPT (tty)); |
| 149 | putc ('\n', TTY_OUTPUT (tty)); | 149 | putc ('\n', TTY_OUTPUT (tty)); |
| 150 | curX = 0; | 150 | curX (tty) = 0; |
| 151 | curY++; | 151 | curY (tty)++; |
| 152 | } | 152 | } |
| 153 | } | 153 | } |
| 154 | 154 | ||
| @@ -160,21 +160,21 @@ cmcheckmagic (tty) | |||
| 160 | */ | 160 | */ |
| 161 | 161 | ||
| 162 | void | 162 | void |
| 163 | cmcostinit () | 163 | cmcostinit (struct tty_output *tty) |
| 164 | { | 164 | { |
| 165 | char *p; | 165 | char *p; |
| 166 | 166 | ||
| 167 | #define COST(x,e) (x ? (cost = 0, tputs (x, 1, e), cost) : BIG) | 167 | #define COST(x,e) (x ? (cost = 0, tputs (x, 1, e), cost) : BIG) |
| 168 | #define CMCOST(x,e) ((x == 0) ? BIG : (p = tgoto(x, 0, 0), COST(p ,e))) | 168 | #define CMCOST(x,e) ((x == 0) ? BIG : (p = tgoto(x, 0, 0), COST(p ,e))) |
| 169 | 169 | ||
| 170 | Wcm.cc_up = COST (Wcm.cm_up, evalcost); | 170 | tty->Wcm->cc_up = COST (tty->Wcm->cm_up, evalcost); |
| 171 | Wcm.cc_down = COST (Wcm.cm_down, evalcost); | 171 | tty->Wcm->cc_down = COST (tty->Wcm->cm_down, evalcost); |
| 172 | Wcm.cc_left = COST (Wcm.cm_left, evalcost); | 172 | tty->Wcm->cc_left = COST (tty->Wcm->cm_left, evalcost); |
| 173 | Wcm.cc_right = COST (Wcm.cm_right, evalcost); | 173 | tty->Wcm->cc_right = COST (tty->Wcm->cm_right, evalcost); |
| 174 | Wcm.cc_home = COST (Wcm.cm_home, evalcost); | 174 | tty->Wcm->cc_home = COST (tty->Wcm->cm_home, evalcost); |
| 175 | Wcm.cc_cr = COST (Wcm.cm_cr, evalcost); | 175 | tty->Wcm->cc_cr = COST (tty->Wcm->cm_cr, evalcost); |
| 176 | Wcm.cc_ll = COST (Wcm.cm_ll, evalcost); | 176 | tty->Wcm->cc_ll = COST (tty->Wcm->cm_ll, evalcost); |
| 177 | Wcm.cc_tab = Wcm.cm_tabwidth ? COST (Wcm.cm_tab, evalcost) : BIG; | 177 | tty->Wcm->cc_tab = tty->Wcm->cm_tabwidth ? COST (tty->Wcm->cm_tab, evalcost) : BIG; |
| 178 | 178 | ||
| 179 | /* | 179 | /* |
| 180 | * These last three are actually minimum costs. When (if) they are | 180 | * These last three are actually minimum costs. When (if) they are |
| @@ -185,9 +185,9 @@ cmcostinit () | |||
| 185 | * cursor motion seem to take straight numeric values. --ACT) | 185 | * cursor motion seem to take straight numeric values. --ACT) |
| 186 | */ | 186 | */ |
| 187 | 187 | ||
| 188 | Wcm.cc_abs = CMCOST (Wcm.cm_abs, evalcost); | 188 | tty->Wcm->cc_abs = CMCOST (tty->Wcm->cm_abs, evalcost); |
| 189 | Wcm.cc_habs = CMCOST (Wcm.cm_habs, evalcost); | 189 | tty->Wcm->cc_habs = CMCOST (tty->Wcm->cm_habs, evalcost); |
| 190 | Wcm.cc_vabs = CMCOST (Wcm.cm_vabs, evalcost); | 190 | tty->Wcm->cc_vabs = CMCOST (tty->Wcm->cm_vabs, evalcost); |
| 191 | 191 | ||
| 192 | #undef CMCOST | 192 | #undef CMCOST |
| 193 | #undef COST | 193 | #undef COST |
| @@ -217,16 +217,16 @@ calccost (struct tty_output *tty, int srcy, int srcx, int dsty, int dstx, int do | |||
| 217 | don't believe the cursor position: give up here | 217 | don't believe the cursor position: give up here |
| 218 | and force use of absolute positioning. */ | 218 | and force use of absolute positioning. */ |
| 219 | 219 | ||
| 220 | if (curX == Wcm.cm_cols) | 220 | if (curX (tty) == tty->Wcm->cm_cols) |
| 221 | goto fail; | 221 | goto fail; |
| 222 | 222 | ||
| 223 | totalcost = 0; | 223 | totalcost = 0; |
| 224 | if ((deltay = dsty - srcy) == 0) | 224 | if ((deltay = dsty - srcy) == 0) |
| 225 | goto x; | 225 | goto x; |
| 226 | if (deltay < 0) | 226 | if (deltay < 0) |
| 227 | p = Wcm.cm_up, c = Wcm.cc_up, deltay = -deltay; | 227 | p = tty->Wcm->cm_up, c = tty->Wcm->cc_up, deltay = -deltay; |
| 228 | else | 228 | else |
| 229 | p = Wcm.cm_down, c = Wcm.cc_down; | 229 | p = tty->Wcm->cm_down, c = tty->Wcm->cc_down; |
| 230 | if (c == BIG) { /* caint get thar from here */ | 230 | if (c == BIG) { /* caint get thar from here */ |
| 231 | if (doit) | 231 | if (doit) |
| 232 | printf ("OOPS"); | 232 | printf ("OOPS"); |
| @@ -240,11 +240,11 @@ x: | |||
| 240 | if ((deltax = dstx - srcx) == 0) | 240 | if ((deltax = dstx - srcx) == 0) |
| 241 | goto done; | 241 | goto done; |
| 242 | if (deltax < 0) { | 242 | if (deltax < 0) { |
| 243 | p = Wcm.cm_left, c = Wcm.cc_left, deltax = -deltax; | 243 | p = tty->Wcm->cm_left, c = tty->Wcm->cc_left, deltax = -deltax; |
| 244 | goto dodelta; /* skip all the tab junk */ | 244 | goto dodelta; /* skip all the tab junk */ |
| 245 | } | 245 | } |
| 246 | /* Tabs (the toughie) */ | 246 | /* Tabs (the toughie) */ |
| 247 | if (Wcm.cc_tab >= BIG || !Wcm.cm_usetabs) | 247 | if (tty->Wcm->cc_tab >= BIG || !tty->Wcm->cm_usetabs) |
| 248 | goto olddelta; /* forget it! */ | 248 | goto olddelta; /* forget it! */ |
| 249 | 249 | ||
| 250 | /* | 250 | /* |
| @@ -255,12 +255,12 @@ x: | |||
| 255 | * we will put into tabx (for ntabs) and tab2x (for n2tabs)). | 255 | * we will put into tabx (for ntabs) and tab2x (for n2tabs)). |
| 256 | */ | 256 | */ |
| 257 | 257 | ||
| 258 | ntabs = (deltax + srcx % Wcm.cm_tabwidth) / Wcm.cm_tabwidth; | 258 | ntabs = (deltax + srcx % tty->Wcm->cm_tabwidth) / tty->Wcm->cm_tabwidth; |
| 259 | n2tabs = ntabs + 1; | 259 | n2tabs = ntabs + 1; |
| 260 | tabx = (srcx / Wcm.cm_tabwidth + ntabs) * Wcm.cm_tabwidth; | 260 | tabx = (srcx / tty->Wcm->cm_tabwidth + ntabs) * tty->Wcm->cm_tabwidth; |
| 261 | tab2x = tabx + Wcm.cm_tabwidth; | 261 | tab2x = tabx + tty->Wcm->cm_tabwidth; |
| 262 | 262 | ||
| 263 | if (tab2x >= Wcm.cm_cols) /* too far (past edge) */ | 263 | if (tab2x >= tty->Wcm->cm_cols) /* too far (past edge) */ |
| 264 | n2tabs = 0; | 264 | n2tabs = 0; |
| 265 | 265 | ||
| 266 | /* | 266 | /* |
| @@ -269,11 +269,11 @@ x: | |||
| 269 | */ | 269 | */ |
| 270 | 270 | ||
| 271 | /* cost for ntabs + cost for right motion */ | 271 | /* cost for ntabs + cost for right motion */ |
| 272 | tabcost = ntabs ? ntabs * Wcm.cc_tab + (dstx - tabx) * Wcm.cc_right | 272 | tabcost = ntabs ? ntabs * tty->Wcm->cc_tab + (dstx - tabx) * tty->Wcm->cc_right |
| 273 | : BIG; | 273 | : BIG; |
| 274 | 274 | ||
| 275 | /* cost for n2tabs + cost for left motion */ | 275 | /* cost for n2tabs + cost for left motion */ |
| 276 | c = n2tabs ? n2tabs * Wcm.cc_tab + (tab2x - dstx) * Wcm.cc_left | 276 | c = n2tabs ? n2tabs * tty->Wcm->cc_tab + (tab2x - dstx) * tty->Wcm->cc_left |
| 277 | : BIG; | 277 | : BIG; |
| 278 | 278 | ||
| 279 | if (c < tabcost) /* then cheaper to overshoot & back up */ | 279 | if (c < tabcost) /* then cheaper to overshoot & back up */ |
| @@ -286,11 +286,11 @@ x: | |||
| 286 | * See if tabcost is less than just moving right | 286 | * See if tabcost is less than just moving right |
| 287 | */ | 287 | */ |
| 288 | 288 | ||
| 289 | if (tabcost < (deltax * Wcm.cc_right)) { | 289 | if (tabcost < (deltax * tty->Wcm->cc_right)) { |
| 290 | totalcost += tabcost; /* use the tabs */ | 290 | totalcost += tabcost; /* use the tabs */ |
| 291 | if (doit) | 291 | if (doit) |
| 292 | while (--ntabs >= 0) | 292 | while (--ntabs >= 0) |
| 293 | emacs_tputs (tty, Wcm.cm_tab, 1, cmputc); | 293 | emacs_tputs (tty, tty->Wcm->cm_tab, 1, cmputc); |
| 294 | srcx = tabx; | 294 | srcx = tabx; |
| 295 | } | 295 | } |
| 296 | 296 | ||
| @@ -303,9 +303,9 @@ newdelta: | |||
| 303 | goto done; | 303 | goto done; |
| 304 | olddelta: | 304 | olddelta: |
| 305 | if (deltax > 0) | 305 | if (deltax > 0) |
| 306 | p = Wcm.cm_right, c = Wcm.cc_right; | 306 | p = tty->Wcm->cm_right, c = tty->Wcm->cc_right; |
| 307 | else | 307 | else |
| 308 | p = Wcm.cm_left, c = Wcm.cc_left, deltax = -deltax; | 308 | p = tty->Wcm->cm_left, c = tty->Wcm->cc_left, deltax = -deltax; |
| 309 | 309 | ||
| 310 | dodelta: | 310 | dodelta: |
| 311 | if (c == BIG) { /* caint get thar from here */ | 311 | if (c == BIG) { /* caint get thar from here */ |
| @@ -349,47 +349,47 @@ cmgoto (tty, row, col) | |||
| 349 | *dcm; | 349 | *dcm; |
| 350 | 350 | ||
| 351 | /* First the degenerate case */ | 351 | /* First the degenerate case */ |
| 352 | if (row == curY && col == curX) /* already there */ | 352 | if (row == curY (tty) && col == curX (tty)) /* already there */ |
| 353 | return; | 353 | return; |
| 354 | 354 | ||
| 355 | if (curY >= 0 && curX >= 0) | 355 | if (curY (tty) >= 0 && curX (tty) >= 0) |
| 356 | { | 356 | { |
| 357 | /* We may have quick ways to go to the upper-left, bottom-left, | 357 | /* We may have quick ways to go to the upper-left, bottom-left, |
| 358 | * start-of-line, or start-of-next-line. Or it might be best to | 358 | * start-of-line, or start-of-next-line. Or it might be best to |
| 359 | * start where we are. Examine the options, and pick the cheapest. | 359 | * start where we are. Examine the options, and pick the cheapest. |
| 360 | */ | 360 | */ |
| 361 | 361 | ||
| 362 | relcost = calccost (tty, curY, curX, row, col, 0); | 362 | relcost = calccost (tty, curY (tty), curX (tty), row, col, 0); |
| 363 | use = USEREL; | 363 | use = USEREL; |
| 364 | if ((homecost = Wcm.cc_home) < BIG) | 364 | if ((homecost = tty->Wcm->cc_home) < BIG) |
| 365 | homecost += calccost (tty, 0, 0, row, col, 0); | 365 | homecost += calccost (tty, 0, 0, row, col, 0); |
| 366 | if (homecost < relcost) | 366 | if (homecost < relcost) |
| 367 | relcost = homecost, use = USEHOME; | 367 | relcost = homecost, use = USEHOME; |
| 368 | if ((llcost = Wcm.cc_ll) < BIG) | 368 | if ((llcost = tty->Wcm->cc_ll) < BIG) |
| 369 | llcost += calccost (tty, Wcm.cm_rows - 1, 0, row, col, 0); | 369 | llcost += calccost (tty, tty->Wcm->cm_rows - 1, 0, row, col, 0); |
| 370 | if (llcost < relcost) | 370 | if (llcost < relcost) |
| 371 | relcost = llcost, use = USELL; | 371 | relcost = llcost, use = USELL; |
| 372 | if ((crcost = Wcm.cc_cr) < BIG) { | 372 | if ((crcost = tty->Wcm->cc_cr) < BIG) { |
| 373 | if (Wcm.cm_autolf) | 373 | if (tty->Wcm->cm_autolf) |
| 374 | if (curY + 1 >= Wcm.cm_rows) | 374 | if (curY (tty) + 1 >= tty->Wcm->cm_rows) |
| 375 | crcost = BIG; | 375 | crcost = BIG; |
| 376 | else | 376 | else |
| 377 | crcost += calccost (tty, curY + 1, 0, row, col, 0); | 377 | crcost += calccost (tty, curY (tty) + 1, 0, row, col, 0); |
| 378 | else | 378 | else |
| 379 | crcost += calccost (tty, curY, 0, row, col, 0); | 379 | crcost += calccost (tty, curY (tty), 0, row, col, 0); |
| 380 | } | 380 | } |
| 381 | if (crcost < relcost) | 381 | if (crcost < relcost) |
| 382 | relcost = crcost, use = USECR; | 382 | relcost = crcost, use = USECR; |
| 383 | directcost = Wcm.cc_abs, dcm = Wcm.cm_abs; | 383 | directcost = tty->Wcm->cc_abs, dcm = tty->Wcm->cm_abs; |
| 384 | if (row == curY && Wcm.cc_habs < BIG) | 384 | if (row == curY (tty) && tty->Wcm->cc_habs < BIG) |
| 385 | directcost = Wcm.cc_habs, dcm = Wcm.cm_habs; | 385 | directcost = tty->Wcm->cc_habs, dcm = tty->Wcm->cm_habs; |
| 386 | else if (col == curX && Wcm.cc_vabs < BIG) | 386 | else if (col == curX (tty) && tty->Wcm->cc_vabs < BIG) |
| 387 | directcost = Wcm.cc_vabs, dcm = Wcm.cm_vabs; | 387 | directcost = tty->Wcm->cc_vabs, dcm = tty->Wcm->cm_vabs; |
| 388 | } | 388 | } |
| 389 | else | 389 | else |
| 390 | { | 390 | { |
| 391 | directcost = 0, relcost = 100000; | 391 | directcost = 0, relcost = 100000; |
| 392 | dcm = Wcm.cm_abs; | 392 | dcm = tty->Wcm->cm_abs; |
| 393 | } | 393 | } |
| 394 | 394 | ||
| 395 | /* | 395 | /* |
| @@ -400,13 +400,14 @@ cmgoto (tty, row, col) | |||
| 400 | { | 400 | { |
| 401 | /* compute REAL direct cost */ | 401 | /* compute REAL direct cost */ |
| 402 | cost = 0; | 402 | cost = 0; |
| 403 | p = dcm == Wcm.cm_habs ? tgoto (dcm, row, col) : | 403 | p = dcm == tty->Wcm->cm_habs |
| 404 | tgoto (dcm, col, row); | 404 | ? tgoto (dcm, row, col) |
| 405 | : tgoto (dcm, col, row); | ||
| 405 | emacs_tputs (tty, p, 1, evalcost); | 406 | emacs_tputs (tty, p, 1, evalcost); |
| 406 | if (cost <= relcost) | 407 | if (cost <= relcost) |
| 407 | { /* really is cheaper */ | 408 | { /* really is cheaper */ |
| 408 | emacs_tputs (tty, p, 1, cmputc); | 409 | emacs_tputs (tty, p, 1, cmputc); |
| 409 | curY = row, curX = col; | 410 | curY (tty) = row, curX (tty) = col; |
| 410 | return; | 411 | return; |
| 411 | } | 412 | } |
| 412 | } | 413 | } |
| @@ -414,25 +415,25 @@ cmgoto (tty, row, col) | |||
| 414 | switch (use) | 415 | switch (use) |
| 415 | { | 416 | { |
| 416 | case USEHOME: | 417 | case USEHOME: |
| 417 | emacs_tputs (tty, Wcm.cm_home, 1, cmputc); | 418 | emacs_tputs (tty, tty->Wcm->cm_home, 1, cmputc); |
| 418 | curY = 0, curX = 0; | 419 | curY (tty) = 0, curX (tty) = 0; |
| 419 | break; | 420 | break; |
| 420 | 421 | ||
| 421 | case USELL: | 422 | case USELL: |
| 422 | emacs_tputs (tty, Wcm.cm_ll, 1, cmputc); | 423 | emacs_tputs (tty, tty->Wcm->cm_ll, 1, cmputc); |
| 423 | curY = Wcm.cm_rows - 1, curX = 0; | 424 | curY (tty) = tty->Wcm->cm_rows - 1, curX (tty) = 0; |
| 424 | break; | 425 | break; |
| 425 | 426 | ||
| 426 | case USECR: | 427 | case USECR: |
| 427 | emacs_tputs (tty, Wcm.cm_cr, 1, cmputc); | 428 | emacs_tputs (tty, tty->Wcm->cm_cr, 1, cmputc); |
| 428 | if (Wcm.cm_autolf) | 429 | if (tty->Wcm->cm_autolf) |
| 429 | curY++; | 430 | curY (tty)++; |
| 430 | curX = 0; | 431 | curX (tty) = 0; |
| 431 | break; | 432 | break; |
| 432 | } | 433 | } |
| 433 | 434 | ||
| 434 | (void) calccost (tty, curY, curX, row, col, 1); | 435 | (void) calccost (tty, curY (tty), curX (tty), row, col, 1); |
| 435 | curY = row, curX = col; | 436 | curY (tty) = row, curX (tty) = col; |
| 436 | } | 437 | } |
| 437 | 438 | ||
| 438 | /* Clear out all terminal info. | 439 | /* Clear out all terminal info. |
| @@ -440,9 +441,9 @@ cmgoto (tty, row, col) | |||
| 440 | */ | 441 | */ |
| 441 | 442 | ||
| 442 | void | 443 | void |
| 443 | Wcm_clear () | 444 | Wcm_clear (struct tty_output *tty) |
| 444 | { | 445 | { |
| 445 | bzero (&Wcm, sizeof Wcm); | 446 | bzero (tty->Wcm, sizeof (struct cm)); |
| 446 | UP = 0; | 447 | UP = 0; |
| 447 | BC = 0; | 448 | BC = 0; |
| 448 | } | 449 | } |
| @@ -455,21 +456,21 @@ Wcm_clear () | |||
| 455 | */ | 456 | */ |
| 456 | 457 | ||
| 457 | int | 458 | int |
| 458 | Wcm_init () | 459 | Wcm_init (struct tty_output *tty) |
| 459 | { | 460 | { |
| 460 | #if 0 | 461 | #if 0 |
| 461 | if (Wcm.cm_abs && !Wcm.cm_ds) | 462 | if (tty->Wcm->cm_abs && !tty->Wcm->cm_ds) |
| 462 | return 0; | 463 | return 0; |
| 463 | #endif | 464 | #endif |
| 464 | if (Wcm.cm_abs) | 465 | if (tty->Wcm->cm_abs) |
| 465 | return 0; | 466 | return 0; |
| 466 | /* Require up and left, and, if no absolute, down and right */ | 467 | /* Require up and left, and, if no absolute, down and right */ |
| 467 | if (!Wcm.cm_up || !Wcm.cm_left) | 468 | if (!tty->Wcm->cm_up || !tty->Wcm->cm_left) |
| 468 | return - 1; | 469 | return - 1; |
| 469 | if (!Wcm.cm_abs && (!Wcm.cm_down || !Wcm.cm_right)) | 470 | if (!tty->Wcm->cm_abs && (!tty->Wcm->cm_down || !tty->Wcm->cm_right)) |
| 470 | return - 1; | 471 | return - 1; |
| 471 | /* Check that we know the size of the screen.... */ | 472 | /* Check that we know the size of the screen.... */ |
| 472 | if (Wcm.cm_rows <= 0 || Wcm.cm_cols <= 0) | 473 | if (tty->Wcm->cm_rows <= 0 || tty->Wcm->cm_cols <= 0) |
| 473 | return - 2; | 474 | return - 2; |
| 474 | return 0; | 475 | return 0; |
| 475 | } | 476 | } |
| @@ -98,66 +98,65 @@ struct cm | |||
| 98 | int cc_vabs; | 98 | int cc_vabs; |
| 99 | }; | 99 | }; |
| 100 | 100 | ||
| 101 | extern struct cm Wcm; /* Terminal capabilities */ | ||
| 102 | extern char PC; /* Pad character */ | 101 | extern char PC; /* Pad character */ |
| 103 | 102 | ||
| 104 | /* Shorthand */ | 103 | /* Shorthand */ |
| 105 | #ifndef NoCMShortHand | 104 | #ifndef NoCMShortHand |
| 106 | #define curY Wcm.cm_curY | 105 | #define curY(tty) (tty)->Wcm->cm_curY |
| 107 | #define curX Wcm.cm_curX | 106 | #define curX(tty) (tty)->Wcm->cm_curX |
| 108 | #define Up Wcm.cm_up | 107 | #define Up(tty) (tty)->Wcm->cm_up |
| 109 | #define Down Wcm.cm_down | 108 | #define Down(tty) (tty)->Wcm->cm_down |
| 110 | #define Left Wcm.cm_left | 109 | #define Left(tty) (tty)->Wcm->cm_left |
| 111 | #define Right Wcm.cm_right | 110 | #define Right(tty) (tty)->Wcm->cm_right |
| 112 | #define Tab Wcm.cm_tab | 111 | #define Tab(tty) (tty)->Wcm->cm_tab |
| 113 | #define BackTab Wcm.cm_backtab | 112 | #define BackTab(tty) (tty)->Wcm->cm_backtab |
| 114 | #define TabWidth Wcm.cm_tabwidth | 113 | #define TabWidth(tty) (tty)->Wcm->cm_tabwidth |
| 115 | #define CR Wcm.cm_cr | 114 | #define CR(tty) (tty)->Wcm->cm_cr |
| 116 | #define Home Wcm.cm_home | 115 | #define Home(tty) (tty)->Wcm->cm_home |
| 117 | #define LastLine Wcm.cm_ll | 116 | #define LastLine(tty) (tty)->Wcm->cm_ll |
| 118 | #define AbsPosition Wcm.cm_abs | 117 | #define AbsPosition(tty) (tty)->Wcm->cm_abs |
| 119 | #define ColPosition Wcm.cm_habs | 118 | #define ColPosition(tty) (tty)->Wcm->cm_habs |
| 120 | #define RowPosition Wcm.cm_vabs | 119 | #define RowPosition(tty) (tty)->Wcm->cm_vabs |
| 121 | #define MultiUp Wcm.cm_multiup | 120 | #define MultiUp(tty) (tty)->Wcm->cm_multiup |
| 122 | #define MultiDown Wcm.cm_multidown | 121 | #define MultiDown(tty) (tty)->Wcm->cm_multidown |
| 123 | #define MultiLeft Wcm.cm_multileft | 122 | #define MultiLeft(tty) (tty)->Wcm->cm_multileft |
| 124 | #define MultiRight Wcm.cm_multiright | 123 | #define MultiRight(tty) (tty)->Wcm->cm_multiright |
| 125 | #define AutoWrap Wcm.cm_autowrap | 124 | #define AutoWrap(tty) (tty)->Wcm->cm_autowrap |
| 126 | #define MagicWrap Wcm.cm_magicwrap | 125 | #define MagicWrap(tty) (tty)->Wcm->cm_magicwrap |
| 127 | #define UseTabs Wcm.cm_usetabs | 126 | #define UseTabs(tty) (tty)->Wcm->cm_usetabs |
| 128 | #define FrameRows Wcm.cm_rows | 127 | #define FrameRows(tty) (tty)->Wcm->cm_rows |
| 129 | #define FrameCols Wcm.cm_cols | 128 | #define FrameCols(tty) (tty)->Wcm->cm_cols |
| 130 | 129 | ||
| 131 | #define UpCost Wcm.cc_up | 130 | #define UpCost(tty) (tty)->Wcm->cc_up |
| 132 | #define DownCost Wcm.cc_down | 131 | #define DownCost(tty) (tty)->Wcm->cc_down |
| 133 | #define LeftCost Wcm.cc_left | 132 | #define LeftCost(tty) (tty)->Wcm->cc_left |
| 134 | #define RightCost Wcm.cc_right | 133 | #define RightCost(tty) (tty)->Wcm->cc_right |
| 135 | #define HomeCost Wcm.cc_home | 134 | #define HomeCost(tty) (tty)->Wcm->cc_home |
| 136 | #define CRCost Wcm.cc_cr | 135 | #define CRCost(tty) (tty)->Wcm->cc_cr |
| 137 | #define LastLineCost Wcm.cc_ll | 136 | #define LastLineCost(tty) (tty)->Wcm->cc_ll |
| 138 | #define TabCost Wcm.cc_tab | 137 | #define TabCost(tty) (tty)->Wcm->cc_tab |
| 139 | #define BackTabCost Wcm.cc_backtab | 138 | #define BackTabCost(tty) (tty)->Wcm->cc_backtab |
| 140 | #define AbsPositionCost Wcm.cc_abs | 139 | #define AbsPositionCost(tty) (tty)->Wcm->cc_abs |
| 141 | #define ColPositionCost Wcm.cc_habs | 140 | #define ColPositionCost(tty) (tty)->Wcm->cc_habs |
| 142 | #define RowPositionCost Wcm.cc_vabs | 141 | #define RowPositionCost(tty) (tty)->Wcm->cc_vabs |
| 143 | #define MultiUpCost Wcm.cc_multiup | 142 | #define MultiUpCost(tty) (tty)->Wcm->cc_multiup |
| 144 | #define MultiDownCost Wcm.cc_multidown | 143 | #define MultiDownCost(tty) (tty)->Wcm->cc_multidown |
| 145 | #define MultiLeftCost Wcm.cc_multileft | 144 | #define MultiLeftCost(tty) (tty)->Wcm->cc_multileft |
| 146 | #define MultiRightCost Wcm.cc_multiright | 145 | #define MultiRightCost(tty) (tty)->Wcm->cc_multiright |
| 147 | #endif | 146 | #endif |
| 148 | 147 | ||
| 149 | #define cmat(row,col) (curY = (row), curX = (col)) | 148 | #define cmat(tty,row,col) (curY(tty) = (row), curX(tty) = (col)) |
| 150 | #define cmplus(n) \ | 149 | #define cmplus(tty,n) \ |
| 151 | { \ | 150 | { \ |
| 152 | if ((curX += (n)) >= FrameCols && !MagicWrap) \ | 151 | if ((curX (tty) += (n)) >= FrameCols (tty) && !MagicWrap (tty)) \ |
| 153 | { \ | 152 | { \ |
| 154 | if (Wcm.cm_losewrap) losecursor (); \ | 153 | if ((tty)->Wcm->cm_losewrap) losecursor (tty); \ |
| 155 | else if (AutoWrap) curX = 0, curY++; \ | 154 | else if (AutoWrap (tty)) curX (tty) = 0, curY (tty)++; \ |
| 156 | else curX--; \ | 155 | else curX (tty)--; \ |
| 157 | } \ | 156 | } \ |
| 158 | } | 157 | } |
| 159 | 158 | ||
| 160 | #define losecursor() (curX = -1, curY = -1) | 159 | #define losecursor(tty) (curX(tty) = -1, curY(tty) = -1) |
| 161 | 160 | ||
| 162 | extern int cost; | 161 | extern int cost; |
| 163 | extern int evalcost (); | 162 | extern int evalcost (); |
| @@ -167,10 +166,10 @@ extern int evalcost (); | |||
| 167 | extern struct tty_output *current_tty; | 166 | extern struct tty_output *current_tty; |
| 168 | extern void cmcheckmagic P_ ((struct tty_output *)); | 167 | extern void cmcheckmagic P_ ((struct tty_output *)); |
| 169 | extern int cmputc P_ ((int)); | 168 | extern int cmputc P_ ((int)); |
| 170 | extern void cmcostinit (); | 169 | extern void cmcostinit P_ ((struct tty_output *tty)); |
| 171 | extern void cmgoto P_ ((struct tty_output *, int, int)); | 170 | extern void cmgoto P_ ((struct tty_output *, int, int)); |
| 172 | extern void Wcm_clear (); | 171 | extern void Wcm_clear P_ ((struct tty_output *tty)); |
| 173 | extern int Wcm_init (); | 172 | extern int Wcm_init P_ ((struct tty_output *tty)); |
| 174 | 173 | ||
| 175 | /* arch-tag: acc1535a-7136-49d6-b22d-9bc85702251b | 174 | /* arch-tag: acc1535a-7136-49d6-b22d-9bc85702251b |
| 176 | (do not change this comment) */ | 175 | (do not change this comment) */ |
diff --git a/src/dispextern.h b/src/dispextern.h index 0d127ba778d..195d080ca92 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -2558,7 +2558,7 @@ extern int x_intersect_rectangles P_ ((XRectangle *, XRectangle *, | |||
| 2558 | void get_tty_size P_ ((struct tty_output *, int *, int *)); | 2558 | void get_tty_size P_ ((struct tty_output *, int *, int *)); |
| 2559 | void request_sigio P_ ((void)); | 2559 | void request_sigio P_ ((void)); |
| 2560 | void unrequest_sigio P_ ((void)); | 2560 | void unrequest_sigio P_ ((void)); |
| 2561 | int tabs_safe_p P_ ((void)); | 2561 | int tabs_safe_p P_ ((struct tty_output *)); |
| 2562 | void init_baud_rate P_ ((void)); | 2562 | void init_baud_rate P_ ((void)); |
| 2563 | void init_sigio P_ ((int)); | 2563 | void init_sigio P_ ((int)); |
| 2564 | 2564 | ||
| @@ -2724,8 +2724,8 @@ extern Lisp_Object Qredisplay_dont_pause; | |||
| 2724 | /* Defined in term.c */ | 2724 | /* Defined in term.c */ |
| 2725 | 2725 | ||
| 2726 | extern void ring_bell P_ ((void)); | 2726 | extern void ring_bell P_ ((void)); |
| 2727 | extern void set_terminal_modes P_ ((struct tty_output *)); | 2727 | extern void set_terminal_modes P_ (()); |
| 2728 | extern void reset_terminal_modes P_ ((struct tty_output *)); | 2728 | extern void reset_terminal_modes P_ (()); |
| 2729 | extern void update_begin P_ ((struct frame *)); | 2729 | extern void update_begin P_ ((struct frame *)); |
| 2730 | extern void update_end P_ ((struct frame *)); | 2730 | extern void update_end P_ ((struct frame *)); |
| 2731 | extern void set_terminal_window P_ ((int)); | 2731 | extern void set_terminal_window P_ ((int)); |
diff --git a/src/dispnew.c b/src/dispnew.c index b25b31b3aab..9d7281f32d4 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -259,10 +259,6 @@ Lisp_Object selected_frame; | |||
| 259 | 259 | ||
| 260 | struct frame *last_nonminibuf_frame; | 260 | struct frame *last_nonminibuf_frame; |
| 261 | 261 | ||
| 262 | /* Structure for info on cursor positioning. */ | ||
| 263 | |||
| 264 | struct cm Wcm; | ||
| 265 | |||
| 266 | /* 1 means SIGWINCH happened when not safe. */ | 262 | /* 1 means SIGWINCH happened when not safe. */ |
| 267 | 263 | ||
| 268 | int delayed_size_change; | 264 | int delayed_size_change; |
| @@ -6059,7 +6055,7 @@ change_frame_size_1 (f, newheight, newwidth, pretend, delay, safe) | |||
| 6059 | newheight - FRAME_TOP_MARGIN (f), 0); | 6055 | newheight - FRAME_TOP_MARGIN (f), 0); |
| 6060 | 6056 | ||
| 6061 | if (FRAME_TERMCAP_P (f) && !pretend) | 6057 | if (FRAME_TERMCAP_P (f) && !pretend) |
| 6062 | FrameRows = newheight; | 6058 | FrameRows (FRAME_TTY (f)) = newheight; |
| 6063 | } | 6059 | } |
| 6064 | 6060 | ||
| 6065 | if (new_frame_total_cols != FRAME_TOTAL_COLS (f)) | 6061 | if (new_frame_total_cols != FRAME_TOTAL_COLS (f)) |
| @@ -6069,7 +6065,7 @@ change_frame_size_1 (f, newheight, newwidth, pretend, delay, safe) | |||
| 6069 | set_window_width (FRAME_MINIBUF_WINDOW (f), new_frame_total_cols, 0); | 6065 | set_window_width (FRAME_MINIBUF_WINDOW (f), new_frame_total_cols, 0); |
| 6070 | 6066 | ||
| 6071 | if (FRAME_TERMCAP_P (f) && !pretend) | 6067 | if (FRAME_TERMCAP_P (f) && !pretend) |
| 6072 | FrameCols = newwidth; | 6068 | FrameCols (FRAME_TTY (f)) = newwidth; |
| 6073 | 6069 | ||
| 6074 | if (WINDOWP (f->tool_bar_window)) | 6070 | if (WINDOWP (f->tool_bar_window)) |
| 6075 | XSETFASTINT (XWINDOW (f->tool_bar_window)->total_cols, newwidth); | 6071 | XSETFASTINT (XWINDOW (f->tool_bar_window)->total_cols, newwidth); |
diff --git a/src/frame.c b/src/frame.c index 7945ba0454b..158aa1058fc 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -752,7 +752,7 @@ do_switch_frame (frame, track, for_deletion) | |||
| 752 | && FRAME_TERMCAP_P (XFRAME (frame)) | 752 | && FRAME_TERMCAP_P (XFRAME (frame)) |
| 753 | && FRAME_TTY (XFRAME (selected_frame)) == FRAME_TTY (XFRAME (frame))) | 753 | && FRAME_TTY (XFRAME (selected_frame)) == FRAME_TTY (XFRAME (frame))) |
| 754 | { | 754 | { |
| 755 | XFRAME (selected_frame)->async_visible = 0; | 755 | XFRAME (selected_frame)->async_visible = 2; /* obscured */ |
| 756 | XFRAME (frame)->async_visible = 1; | 756 | XFRAME (frame)->async_visible = 1; |
| 757 | FRAME_TTY (XFRAME (frame))->top_frame = frame; | 757 | FRAME_TTY (XFRAME (frame))->top_frame = frame; |
| 758 | } | 758 | } |
diff --git a/src/frame.h b/src/frame.h index 8b081e881a9..06af557f3ee 100644 --- a/src/frame.h +++ b/src/frame.h | |||
| @@ -341,13 +341,13 @@ struct frame | |||
| 341 | frame becomes visible again, it must be marked as garbaged. The | 341 | frame becomes visible again, it must be marked as garbaged. The |
| 342 | FRAME_SAMPLE_VISIBILITY macro takes care of this. | 342 | FRAME_SAMPLE_VISIBILITY macro takes care of this. |
| 343 | 343 | ||
| 344 | On Windows NT/9X, to avoid wasting effort updating visible frames | 344 | On ttys and on Windows NT/9X, to avoid wasting effort updating |
| 345 | that are actually completely obscured by other windows on the | 345 | visible frames that are actually completely obscured by other |
| 346 | display, we bend the meaning of visible slightly: if greater than | 346 | windows on the display, we bend the meaning of visible slightly: |
| 347 | 1, then the frame is obscured - we still consider it to be | 347 | if greater than 1, then the frame is obscured - we still consider |
| 348 | "visible" as seen from lisp, but we don't bother updating it. We | 348 | it to be "visible" as seen from lisp, but we don't bother |
| 349 | must take care to garbage the frame when it ceaces to be obscured | 349 | updating it. We must take care to garbage the frame when it |
| 350 | though. Note that these semantics are only used on NT/9X. | 350 | ceaces to be obscured though. |
| 351 | 351 | ||
| 352 | iconified is nonzero if the frame is currently iconified. | 352 | iconified is nonzero if the frame is currently iconified. |
| 353 | 353 | ||
diff --git a/src/keyboard.c b/src/keyboard.c index 069c605dc6a..810cf682b18 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -6460,7 +6460,7 @@ get_filtered_input_pending (addr, do_timers_now, filter_events) | |||
| 6460 | /* If input is being read as it arrives, and we have none, there is none. */ | 6460 | /* If input is being read as it arrives, and we have none, there is none. */ |
| 6461 | if (*addr > 0 || (interrupt_input && ! interrupts_deferred)) | 6461 | if (*addr > 0 || (interrupt_input && ! interrupts_deferred)) |
| 6462 | return; | 6462 | return; |
| 6463 | 6463 | ||
| 6464 | /* Try to read some input and see how much we get. */ | 6464 | /* Try to read some input and see how much we get. */ |
| 6465 | gobble_input (0); | 6465 | gobble_input (0); |
| 6466 | *addr = (!NILP (Vquit_flag) | 6466 | *addr = (!NILP (Vquit_flag) |
| @@ -6579,7 +6579,7 @@ read_avail_input (expected) | |||
| 6579 | struct input_event buf[KBD_BUFFER_SIZE]; | 6579 | struct input_event buf[KBD_BUFFER_SIZE]; |
| 6580 | register int i; | 6580 | register int i; |
| 6581 | int nread; | 6581 | int nread; |
| 6582 | 6582 | ||
| 6583 | for (i = 0; i < KBD_BUFFER_SIZE; i++) | 6583 | for (i = 0; i < KBD_BUFFER_SIZE; i++) |
| 6584 | EVENT_INIT (buf[i]); | 6584 | EVENT_INIT (buf[i]); |
| 6585 | 6585 | ||
| @@ -6611,8 +6611,8 @@ read_avail_input (expected) | |||
| 6611 | nread = 0; | 6611 | nread = 0; |
| 6612 | 6612 | ||
| 6613 | /* Try to read from each available tty, until one succeeds. */ | 6613 | /* Try to read from each available tty, until one succeeds. */ |
| 6614 | for (tty = tty_list; tty && !nread; tty = tty->next) { | 6614 | for (tty = tty_list; tty; tty = tty->next) { |
| 6615 | 6615 | ||
| 6616 | /* Determine how many characters we should *try* to read. */ | 6616 | /* Determine how many characters we should *try* to read. */ |
| 6617 | #ifdef FIONREAD | 6617 | #ifdef FIONREAD |
| 6618 | /* Find out how much input is available. */ | 6618 | /* Find out how much input is available. */ |
| @@ -6624,6 +6624,7 @@ read_avail_input (expected) | |||
| 6624 | /* ??? Is it really right to send the signal just to this process | 6624 | /* ??? Is it really right to send the signal just to this process |
| 6625 | rather than to the whole process group? | 6625 | rather than to the whole process group? |
| 6626 | Perhaps on systems with FIONREAD Emacs is alone in its group. */ | 6626 | Perhaps on systems with FIONREAD Emacs is alone in its group. */ |
| 6627 | /* It appears to be the case, see narrow_foreground_group. */ | ||
| 6627 | if (! noninteractive) | 6628 | if (! noninteractive) |
| 6628 | { | 6629 | { |
| 6629 | if (! tty_list->next) | 6630 | if (! tty_list->next) |
| @@ -6706,15 +6707,20 @@ read_avail_input (expected) | |||
| 6706 | #endif /* USG or DGUX or CYGWIN */ | 6707 | #endif /* USG or DGUX or CYGWIN */ |
| 6707 | #endif /* no FIONREAD */ | 6708 | #endif /* no FIONREAD */ |
| 6708 | 6709 | ||
| 6710 | if (nread > 0) | ||
| 6711 | break; | ||
| 6709 | } /* for each tty */ | 6712 | } /* for each tty */ |
| 6710 | 6713 | ||
| 6711 | if (! nread) | 6714 | if (nread <= 0) |
| 6712 | return 0; | 6715 | return 0; |
| 6713 | 6716 | ||
| 6714 | #endif /* not MSDOS */ | 6717 | #endif /* not MSDOS */ |
| 6715 | #endif /* not WINDOWSNT */ | 6718 | #endif /* not WINDOWSNT */ |
| 6716 | 6719 | ||
| 6717 | /* XXX Select frame corresponding to the tty. */ | 6720 | /* Select frame corresponding to the active tty. Note that the |
| 6721 | value of selected_frame is not reliable here, redisplay tends | ||
| 6722 | to temporarily change it. But tty should always be non-NULL. */ | ||
| 6723 | Lisp_Object frame = (tty ? tty->top_frame : selected_frame); | ||
| 6718 | 6724 | ||
| 6719 | for (i = 0; i < nread; i++) | 6725 | for (i = 0; i < nread; i++) |
| 6720 | { | 6726 | { |
| @@ -6725,8 +6731,8 @@ read_avail_input (expected) | |||
| 6725 | if (meta_key != 2) | 6731 | if (meta_key != 2) |
| 6726 | cbuf[i] &= ~0x80; | 6732 | cbuf[i] &= ~0x80; |
| 6727 | 6733 | ||
| 6728 | buf[i].code = cbuf[i]; | 6734 | buf[i].code = cbuf[i]; |
| 6729 | buf[i].frame_or_window = selected_frame; | 6735 | buf[i].frame_or_window = frame; |
| 6730 | buf[i].arg = Qnil; | 6736 | buf[i].arg = Qnil; |
| 6731 | } | 6737 | } |
| 6732 | } | 6738 | } |
diff --git a/src/lisp.h b/src/lisp.h index c2df96fe82d..de71cf7f7c9 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -2952,7 +2952,6 @@ extern void child_setup_tty P_ ((int)); | |||
| 2952 | extern void setup_pty P_ ((int)); | 2952 | extern void setup_pty P_ ((int)); |
| 2953 | extern int set_window_size P_ ((int, int, int)); | 2953 | extern int set_window_size P_ ((int, int, int)); |
| 2954 | extern void create_process P_ ((Lisp_Object, char **, Lisp_Object)); | 2954 | extern void create_process P_ ((Lisp_Object, char **, Lisp_Object)); |
| 2955 | extern int tabs_safe_p P_ ((void)); | ||
| 2956 | extern void init_baud_rate P_ ((void)); | 2955 | extern void init_baud_rate P_ ((void)); |
| 2957 | extern int emacs_open P_ ((const char *, int, int)); | 2956 | extern int emacs_open P_ ((const char *, int, int)); |
| 2958 | extern int emacs_close P_ ((int)); | 2957 | extern int emacs_close P_ ((int)); |
diff --git a/src/sysdep.c b/src/sysdep.c index 68cef5b7bd2..946e2c1384a 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -249,8 +249,8 @@ int emacs_ospeed; | |||
| 249 | void croak P_ ((char *)); | 249 | void croak P_ ((char *)); |
| 250 | 250 | ||
| 251 | #ifdef AIXHFT | 251 | #ifdef AIXHFT |
| 252 | void hft_init (); | 252 | void hft_init P_ ((struct tty_output *)); |
| 253 | void hft_reset (); | 253 | void hft_reset P_ ((struct tty_output *)); |
| 254 | #endif | 254 | #endif |
| 255 | 255 | ||
| 256 | /* Temporary used by `sigblock' when defined in terms of signprocmask. */ | 256 | /* Temporary used by `sigblock' when defined in terms of signprocmask. */ |
| @@ -282,8 +282,12 @@ discard_tty_input () | |||
| 282 | #else /* not VMS */ | 282 | #else /* not VMS */ |
| 283 | #ifdef APOLLO | 283 | #ifdef APOLLO |
| 284 | { | 284 | { |
| 285 | int zero = 0; | 285 | struct tty_output *tty; |
| 286 | ioctl (fileno (TTY_INPUT (CURTTY())), TIOCFLUSH, &zero); | 286 | for (tty = tty_list; tty; tty = tty->next) |
| 287 | { | ||
| 288 | int zero = 0; | ||
| 289 | ioctl (fileno (TTY_INPUT (tty)), TIOCFLUSH, &zero); | ||
| 290 | } | ||
| 287 | } | 291 | } |
| 288 | #else /* not Apollo */ | 292 | #else /* not Apollo */ |
| 289 | #ifdef MSDOS /* Demacs 1.1.1 91/10/16 HIRANO Satoshi */ | 293 | #ifdef MSDOS /* Demacs 1.1.1 91/10/16 HIRANO Satoshi */ |
| @@ -310,12 +314,7 @@ discard_tty_input () | |||
| 310 | the terminal. */ | 314 | the terminal. */ |
| 311 | 315 | ||
| 312 | void | 316 | void |
| 313 | #ifdef PROTOTYPES | ||
| 314 | stuff_char (char c) | 317 | stuff_char (char c) |
| 315 | #else | ||
| 316 | stuff_char (c) | ||
| 317 | char c; | ||
| 318 | #endif | ||
| 319 | { | 318 | { |
| 320 | if (read_socket_hook) | 319 | if (read_socket_hook) |
| 321 | return; | 320 | return; |
| @@ -1074,22 +1073,23 @@ int inherited_pgroup; | |||
| 1074 | group, redirect the TTY to point to our own process group. We need | 1073 | group, redirect the TTY to point to our own process group. We need |
| 1075 | to be in our own process group to receive SIGIO properly. */ | 1074 | to be in our own process group to receive SIGIO properly. */ |
| 1076 | void | 1075 | void |
| 1077 | narrow_foreground_group () | 1076 | narrow_foreground_group (struct tty_output *tty) |
| 1078 | { | 1077 | { |
| 1079 | int me = getpid (); | 1078 | int me = getpid (); |
| 1080 | 1079 | ||
| 1081 | setpgrp (0, inherited_pgroup); | 1080 | setpgrp (0, inherited_pgroup); |
| 1081 | /* XXX This only works on the controlling tty. */ | ||
| 1082 | if (inherited_pgroup != me) | 1082 | if (inherited_pgroup != me) |
| 1083 | EMACS_SET_TTY_PGRP (fileno (stdin), &me); /* stdin is intentional here */ | 1083 | EMACS_SET_TTY_PGRP (fileno (TTY_INPUT (tty)), &me); |
| 1084 | setpgrp (0, me); | 1084 | setpgrp (0, me); |
| 1085 | } | 1085 | } |
| 1086 | 1086 | ||
| 1087 | /* Set the tty to our original foreground group. */ | 1087 | /* Set the tty to our original foreground group. */ |
| 1088 | void | 1088 | void |
| 1089 | widen_foreground_group () | 1089 | widen_foreground_group (struct tty_output *tty) |
| 1090 | { | 1090 | { |
| 1091 | if (inherited_pgroup != getpid ()) | 1091 | if (inherited_pgroup != getpid ()) |
| 1092 | EMACS_SET_TTY_PGRP (fileno (stdin), &inherited_pgroup); /* stdin is intentional here */ | 1092 | EMACS_SET_TTY_PGRP (fileno (TTY_INPUT (tty)), &inherited_pgroup); |
| 1093 | setpgrp (0, inherited_pgroup); | 1093 | setpgrp (0, inherited_pgroup); |
| 1094 | } | 1094 | } |
| 1095 | 1095 | ||
| @@ -1353,7 +1353,7 @@ nil means don't delete them until `list-processes' is run. */); | |||
| 1353 | 1353 | ||
| 1354 | #ifdef BSD_PGRPS | 1354 | #ifdef BSD_PGRPS |
| 1355 | if (! read_socket_hook && EQ (Vwindow_system, Qnil)) | 1355 | if (! read_socket_hook && EQ (Vwindow_system, Qnil)) |
| 1356 | narrow_foreground_group (); | 1356 | narrow_foreground_group (tty_out); |
| 1357 | #endif | 1357 | #endif |
| 1358 | 1358 | ||
| 1359 | #ifdef HAVE_WINDOW_SYSTEM | 1359 | #ifdef HAVE_WINDOW_SYSTEM |
| @@ -1578,7 +1578,7 @@ nil means don't delete them until `list-processes' is run. */); | |||
| 1578 | #endif | 1578 | #endif |
| 1579 | 1579 | ||
| 1580 | #ifdef AIXHFT | 1580 | #ifdef AIXHFT |
| 1581 | hft_init (); | 1581 | hft_init (tty_out); |
| 1582 | #ifdef IBMR2AIX | 1582 | #ifdef IBMR2AIX |
| 1583 | { | 1583 | { |
| 1584 | /* IBM's HFT device usually thinks a ^J should be LF/CR. We need it | 1584 | /* IBM's HFT device usually thinks a ^J should be LF/CR. We need it |
| @@ -1678,12 +1678,12 @@ nil means don't delete them until `list-processes' is run. */); | |||
| 1678 | At the time this is called, init_sys_modes has not been done yet. */ | 1678 | At the time this is called, init_sys_modes has not been done yet. */ |
| 1679 | 1679 | ||
| 1680 | int | 1680 | int |
| 1681 | tabs_safe_p () | 1681 | tabs_safe_p (struct tty_output *tty) |
| 1682 | { | 1682 | { |
| 1683 | struct emacs_tty tty; | 1683 | struct emacs_tty etty; |
| 1684 | 1684 | ||
| 1685 | EMACS_GET_TTY (fileno (TTY_INPUT (CURTTY())), &tty); | 1685 | EMACS_GET_TTY (fileno (TTY_INPUT (tty)), &etty); |
| 1686 | return EMACS_TTY_TABS_OK (&tty); | 1686 | return EMACS_TTY_TABS_OK (&etty); |
| 1687 | } | 1687 | } |
| 1688 | 1688 | ||
| 1689 | /* Get terminal size from system. | 1689 | /* Get terminal size from system. |
| @@ -1888,7 +1888,7 @@ reset_sys_modes (tty_out) | |||
| 1888 | #endif | 1888 | #endif |
| 1889 | 1889 | ||
| 1890 | #ifdef BSD_PGRPS | 1890 | #ifdef BSD_PGRPS |
| 1891 | widen_foreground_group (); | 1891 | widen_foreground_group (tty_out); |
| 1892 | #endif | 1892 | #endif |
| 1893 | } | 1893 | } |
| 1894 | 1894 | ||
| @@ -5098,7 +5098,7 @@ srandom (seed) | |||
| 5098 | 5098 | ||
| 5099 | /* Called from init_sys_modes. */ | 5099 | /* Called from init_sys_modes. */ |
| 5100 | void | 5100 | void |
| 5101 | hft_init () | 5101 | hft_init (struct tty_output *tty_out) |
| 5102 | { | 5102 | { |
| 5103 | int junk; | 5103 | int junk; |
| 5104 | 5104 | ||
| @@ -5146,14 +5146,14 @@ hft_init () | |||
| 5146 | } | 5146 | } |
| 5147 | /* The HFT system on AIX doesn't optimize for scrolling, so it's really ugly | 5147 | /* The HFT system on AIX doesn't optimize for scrolling, so it's really ugly |
| 5148 | at times. */ | 5148 | at times. */ |
| 5149 | TTY_LINE_INS_DEL_OK (CURTTY ()) = 0; | 5149 | TTY_LINE_INS_DEL_OK (tty_out) = 0; |
| 5150 | TTY_CHAR_INS_DEL_OK (CURTTY ()) = 0; | 5150 | TTY_CHAR_INS_DEL_OK (tty_out) = 0; |
| 5151 | } | 5151 | } |
| 5152 | 5152 | ||
| 5153 | /* Reset the rubout key to backspace. */ | 5153 | /* Reset the rubout key to backspace. */ |
| 5154 | 5154 | ||
| 5155 | void | 5155 | void |
| 5156 | hft_reset () | 5156 | hft_reset (struct tty_output *tty_out) |
| 5157 | { | 5157 | { |
| 5158 | struct hfbuf buf; | 5158 | struct hfbuf buf; |
| 5159 | struct hfkeymap keymap; | 5159 | struct hfkeymap keymap; |
diff --git a/src/term.c b/src/term.c index 1df6e67a353..80e5e437e43 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -72,17 +72,23 @@ static void turn_off_face P_ ((struct frame *, int face_id)); | |||
| 72 | static void tty_show_cursor P_ ((void)); | 72 | static void tty_show_cursor P_ ((void)); |
| 73 | static void tty_hide_cursor P_ ((void)); | 73 | static void tty_hide_cursor P_ ((void)); |
| 74 | 74 | ||
| 75 | #define OUTPUT(tty, a) \ | 75 | #define OUTPUT(tty, a) \ |
| 76 | emacs_tputs ((tty), a, (int) (FRAME_LINES (XFRAME (selected_frame)) - curY), cmputc) | 76 | emacs_tputs ((tty), a, \ |
| 77 | (int) (FRAME_LINES (XFRAME (selected_frame)) \ | ||
| 78 | - curY (tty)), \ | ||
| 79 | cmputc) | ||
| 80 | |||
| 77 | #define OUTPUT1(tty, a) emacs_tputs ((tty), a, 1, cmputc) | 81 | #define OUTPUT1(tty, a) emacs_tputs ((tty), a, 1, cmputc) |
| 78 | #define OUTPUTL(tty, a, lines) emacs_tputs ((tty), a, lines, cmputc) | 82 | #define OUTPUTL(tty, a, lines) emacs_tputs ((tty), a, lines, cmputc) |
| 79 | 83 | ||
| 80 | #define OUTPUT_IF(tty, a) \ | 84 | #define OUTPUT_IF(tty, a) \ |
| 81 | do { \ | 85 | do { \ |
| 82 | if (a) \ | 86 | if (a) \ |
| 83 | emacs_tputs ((tty), a, (int) (FRAME_LINES (XFRAME (selected_frame)) \ | 87 | emacs_tputs ((tty), a, \ |
| 84 | - curY), cmputc); \ | 88 | (int) (FRAME_LINES (XFRAME (selected_frame)) \ |
| 85 | } while (0) | 89 | - curY (tty) ), \ |
| 90 | cmputc); \ | ||
| 91 | } while (0) | ||
| 86 | 92 | ||
| 87 | #define OUTPUT1_IF(tty, a) do { if (a) emacs_tputs ((tty), a, 1, cmputc); } while (0) | 93 | #define OUTPUT1_IF(tty, a) do { if (a) emacs_tputs ((tty), a, 1, cmputc); } while (0) |
| 88 | 94 | ||
| @@ -407,6 +413,8 @@ extern char *tgetstr (); | |||
| 407 | void | 413 | void |
| 408 | ring_bell () | 414 | ring_bell () |
| 409 | { | 415 | { |
| 416 | struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame)); | ||
| 417 | |||
| 410 | if (!NILP (Vring_bell_function)) | 418 | if (!NILP (Vring_bell_function)) |
| 411 | { | 419 | { |
| 412 | Lisp_Object function; | 420 | Lisp_Object function; |
| @@ -426,32 +434,37 @@ ring_bell () | |||
| 426 | 434 | ||
| 427 | Vring_bell_function = function; | 435 | Vring_bell_function = function; |
| 428 | } | 436 | } |
| 429 | else if (!FRAME_TERMCAP_P (XFRAME (selected_frame))) | 437 | else if (!FRAME_TERMCAP_P (f)) |
| 430 | (*ring_bell_hook) (); | 438 | (*ring_bell_hook) (); |
| 431 | else { | 439 | else { |
| 432 | OUTPUT (CURTTY (), TS_visible_bell && visible_bell ? TS_visible_bell : TS_bell); | 440 | struct tty_output *tty = FRAME_TTY (f); |
| 441 | OUTPUT (tty, TS_visible_bell && visible_bell ? TS_visible_bell : TS_bell); | ||
| 433 | } | 442 | } |
| 434 | } | 443 | } |
| 435 | 444 | ||
| 436 | void | 445 | void |
| 437 | set_terminal_modes (struct tty_output *tty) | 446 | set_terminal_modes () |
| 438 | { | 447 | { |
| 439 | if (FRAME_TERMCAP_P (XFRAME (selected_frame))) | 448 | struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame)); |
| 449 | if (FRAME_TERMCAP_P (f)) | ||
| 440 | { | 450 | { |
| 451 | struct tty_output *tty = FRAME_TTY (f); | ||
| 441 | OUTPUT_IF (tty, TS_termcap_modes); | 452 | OUTPUT_IF (tty, TS_termcap_modes); |
| 442 | OUTPUT_IF (tty, TS_cursor_visible); | 453 | OUTPUT_IF (tty, TS_cursor_visible); |
| 443 | OUTPUT_IF (tty, TS_keypad_mode); | 454 | OUTPUT_IF (tty, TS_keypad_mode); |
| 444 | losecursor (); | 455 | losecursor (tty); |
| 445 | } | 456 | } |
| 446 | else | 457 | else |
| 447 | (*set_terminal_modes_hook) (); | 458 | (*set_terminal_modes_hook) (); |
| 448 | } | 459 | } |
| 449 | 460 | ||
| 450 | void | 461 | void |
| 451 | reset_terminal_modes (struct tty_output *tty) | 462 | reset_terminal_modes () |
| 452 | { | 463 | { |
| 453 | if (FRAME_TERMCAP_P (XFRAME (selected_frame))) | 464 | struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame)); |
| 465 | if (FRAME_TERMCAP_P (f)) | ||
| 454 | { | 466 | { |
| 467 | struct tty_output *tty = FRAME_TTY (f); | ||
| 455 | turn_off_highlight (); | 468 | turn_off_highlight (); |
| 456 | turn_off_insert (); | 469 | turn_off_insert (); |
| 457 | OUTPUT_IF (tty, TS_end_keypad_mode); | 470 | OUTPUT_IF (tty, TS_end_keypad_mode); |
| @@ -496,10 +509,12 @@ void | |||
| 496 | set_terminal_window (size) | 509 | set_terminal_window (size) |
| 497 | int size; | 510 | int size; |
| 498 | { | 511 | { |
| 499 | if (FRAME_TERMCAP_P (updating_frame)) | 512 | struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame)); |
| 513 | if (FRAME_TERMCAP_P (f)) | ||
| 500 | { | 514 | { |
| 501 | specified_window = size ? size : FRAME_LINES (updating_frame); | 515 | struct tty_output *tty = FRAME_TTY (f); |
| 502 | if (TTY_SCROLL_REGION_OK (FRAME_TTY (updating_frame))) | 516 | specified_window = size ? size : FRAME_LINES (f); |
| 517 | if (TTY_SCROLL_REGION_OK (tty)) | ||
| 503 | set_scroll_region (0, specified_window); | 518 | set_scroll_region (0, specified_window); |
| 504 | } | 519 | } |
| 505 | else | 520 | else |
| @@ -511,9 +526,8 @@ set_scroll_region (start, stop) | |||
| 511 | int start, stop; | 526 | int start, stop; |
| 512 | { | 527 | { |
| 513 | char *buf; | 528 | char *buf; |
| 514 | struct frame *f = (updating_frame | 529 | struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame)); |
| 515 | ? updating_frame | 530 | struct tty_output *tty = FRAME_TTY (f); |
| 516 | : XFRAME (selected_frame)); | ||
| 517 | 531 | ||
| 518 | if (TS_set_scroll_region) | 532 | if (TS_set_scroll_region) |
| 519 | buf = tparam (TS_set_scroll_region, 0, 0, start, stop - 1); | 533 | buf = tparam (TS_set_scroll_region, 0, 0, start, stop - 1); |
| @@ -525,31 +539,29 @@ set_scroll_region (start, stop) | |||
| 525 | else | 539 | else |
| 526 | buf = tparam (TS_set_window, 0, 0, start, 0, stop, FRAME_COLS (f)); | 540 | buf = tparam (TS_set_window, 0, 0, start, 0, stop, FRAME_COLS (f)); |
| 527 | 541 | ||
| 528 | OUTPUT (FRAME_TTY (f), buf); | 542 | OUTPUT (tty, buf); |
| 529 | xfree (buf); | 543 | xfree (buf); |
| 530 | losecursor (); | 544 | losecursor (tty); |
| 531 | } | 545 | } |
| 532 | 546 | ||
| 533 | 547 | ||
| 534 | static void | 548 | static void |
| 535 | turn_on_insert () | 549 | turn_on_insert () |
| 536 | { | 550 | { |
| 537 | struct frame *f = (updating_frame | 551 | struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame)); |
| 538 | ? updating_frame | 552 | struct tty_output *tty = FRAME_TTY (f); |
| 539 | : XFRAME (selected_frame)); | ||
| 540 | if (!insert_mode) | 553 | if (!insert_mode) |
| 541 | OUTPUT (FRAME_TTY (f), TS_insert_mode); | 554 | OUTPUT (tty, TS_insert_mode); |
| 542 | insert_mode = 1; | 555 | insert_mode = 1; |
| 543 | } | 556 | } |
| 544 | 557 | ||
| 545 | void | 558 | void |
| 546 | turn_off_insert () | 559 | turn_off_insert () |
| 547 | { | 560 | { |
| 548 | struct frame *f = (updating_frame | 561 | struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame)); |
| 549 | ? updating_frame | 562 | struct tty_output *tty = FRAME_TTY (f); |
| 550 | : XFRAME (selected_frame)); | ||
| 551 | if (insert_mode) | 563 | if (insert_mode) |
| 552 | OUTPUT (FRAME_TTY (f), TS_end_insert_mode); | 564 | OUTPUT (tty, TS_end_insert_mode); |
| 553 | insert_mode = 0; | 565 | insert_mode = 0; |
| 554 | } | 566 | } |
| 555 | 567 | ||
| @@ -558,22 +570,20 @@ turn_off_insert () | |||
| 558 | void | 570 | void |
| 559 | turn_off_highlight () | 571 | turn_off_highlight () |
| 560 | { | 572 | { |
| 561 | struct frame *f = (updating_frame | 573 | struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame)); |
| 562 | ? updating_frame | 574 | struct tty_output *tty = FRAME_TTY (f); |
| 563 | : XFRAME (selected_frame)); | ||
| 564 | if (standout_mode) | 575 | if (standout_mode) |
| 565 | OUTPUT_IF (FRAME_TTY (f), TS_end_standout_mode); | 576 | OUTPUT_IF (tty, TS_end_standout_mode); |
| 566 | standout_mode = 0; | 577 | standout_mode = 0; |
| 567 | } | 578 | } |
| 568 | 579 | ||
| 569 | static void | 580 | static void |
| 570 | turn_on_highlight () | 581 | turn_on_highlight () |
| 571 | { | 582 | { |
| 572 | struct frame *f = (updating_frame | 583 | struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame)); |
| 573 | ? updating_frame | 584 | struct tty_output *tty = FRAME_TTY (f); |
| 574 | : XFRAME (selected_frame)); | ||
| 575 | if (!standout_mode) | 585 | if (!standout_mode) |
| 576 | OUTPUT_IF (FRAME_TTY (f), TS_standout_mode); | 586 | OUTPUT_IF (tty, TS_standout_mode); |
| 577 | standout_mode = 1; | 587 | standout_mode = 1; |
| 578 | } | 588 | } |
| 579 | 589 | ||
| @@ -592,14 +602,12 @@ toggle_highlight () | |||
| 592 | static void | 602 | static void |
| 593 | tty_hide_cursor () | 603 | tty_hide_cursor () |
| 594 | { | 604 | { |
| 595 | struct frame *f = (updating_frame | 605 | struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame)); |
| 596 | ? updating_frame | 606 | struct tty_output *tty = FRAME_TTY (f); |
| 597 | : XFRAME (selected_frame)); | ||
| 598 | |||
| 599 | if (tty_cursor_hidden == 0) | 607 | if (tty_cursor_hidden == 0) |
| 600 | { | 608 | { |
| 601 | tty_cursor_hidden = 1; | 609 | tty_cursor_hidden = 1; |
| 602 | OUTPUT_IF (FRAME_TTY (f), TS_cursor_invisible); | 610 | OUTPUT_IF (tty, TS_cursor_invisible); |
| 603 | } | 611 | } |
| 604 | } | 612 | } |
| 605 | 613 | ||
| @@ -609,15 +617,14 @@ tty_hide_cursor () | |||
| 609 | static void | 617 | static void |
| 610 | tty_show_cursor () | 618 | tty_show_cursor () |
| 611 | { | 619 | { |
| 612 | struct frame *f = (updating_frame | 620 | struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame)); |
| 613 | ? updating_frame | 621 | struct tty_output *tty = FRAME_TTY (f); |
| 614 | : XFRAME (selected_frame)); | ||
| 615 | 622 | ||
| 616 | if (tty_cursor_hidden) | 623 | if (tty_cursor_hidden) |
| 617 | { | 624 | { |
| 618 | tty_cursor_hidden = 0; | 625 | tty_cursor_hidden = 0; |
| 619 | OUTPUT_IF (FRAME_TTY (f), TS_cursor_normal); | 626 | OUTPUT_IF (tty, TS_cursor_normal); |
| 620 | OUTPUT_IF (FRAME_TTY (f), TS_cursor_visible); | 627 | OUTPUT_IF (tty, TS_cursor_visible); |
| 621 | } | 628 | } |
| 622 | } | 629 | } |
| 623 | 630 | ||
| @@ -654,7 +661,7 @@ void | |||
| 654 | cursor_to (vpos, hpos) | 661 | cursor_to (vpos, hpos) |
| 655 | int vpos, hpos; | 662 | int vpos, hpos; |
| 656 | { | 663 | { |
| 657 | struct frame *f = updating_frame ? updating_frame : XFRAME (selected_frame); | 664 | struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame)); |
| 658 | 665 | ||
| 659 | if (! FRAME_TERMCAP_P (f) && cursor_to_hook) | 666 | if (! FRAME_TERMCAP_P (f) && cursor_to_hook) |
| 660 | { | 667 | { |
| @@ -662,18 +669,21 @@ cursor_to (vpos, hpos) | |||
| 662 | return; | 669 | return; |
| 663 | } | 670 | } |
| 664 | 671 | ||
| 672 | struct tty_output *tty = FRAME_TTY (f); | ||
| 673 | |||
| 665 | /* Detect the case where we are called from reset_sys_modes | 674 | /* Detect the case where we are called from reset_sys_modes |
| 666 | and the costs have never been calculated. Do nothing. */ | 675 | and the costs have never been calculated. Do nothing. */ |
| 667 | if (! costs_set) | 676 | if (! costs_set) |
| 668 | return; | 677 | return; |
| 669 | 678 | ||
| 670 | if (curY == vpos && curX == hpos) | 679 | if (curY (tty) == vpos |
| 680 | && curX (tty) == hpos) | ||
| 671 | return; | 681 | return; |
| 672 | if (!TF_standout_motion) | 682 | if (!TF_standout_motion) |
| 673 | background_highlight (); | 683 | background_highlight (); |
| 674 | if (!TF_insmode_motion) | 684 | if (!TF_insmode_motion) |
| 675 | turn_off_insert (); | 685 | turn_off_insert (); |
| 676 | cmgoto (FRAME_TTY (f), vpos, hpos); | 686 | cmgoto (tty, vpos, hpos); |
| 677 | } | 687 | } |
| 678 | 688 | ||
| 679 | /* Similar but don't take any account of the wasted characters. */ | 689 | /* Similar but don't take any account of the wasted characters. */ |
| @@ -688,13 +698,15 @@ raw_cursor_to (row, col) | |||
| 688 | (*raw_cursor_to_hook) (row, col); | 698 | (*raw_cursor_to_hook) (row, col); |
| 689 | return; | 699 | return; |
| 690 | } | 700 | } |
| 691 | if (curY == row && curX == col) | 701 | struct tty_output *tty = FRAME_TTY (f); |
| 702 | if (curY (tty) == row | ||
| 703 | && curX (tty) == col) | ||
| 692 | return; | 704 | return; |
| 693 | if (!TF_standout_motion) | 705 | if (!TF_standout_motion) |
| 694 | background_highlight (); | 706 | background_highlight (); |
| 695 | if (!TF_insmode_motion) | 707 | if (!TF_insmode_motion) |
| 696 | turn_off_insert (); | 708 | turn_off_insert (); |
| 697 | cmgoto (FRAME_TTY (f), row, col); | 709 | cmgoto (tty, row, col); |
| 698 | } | 710 | } |
| 699 | 711 | ||
| 700 | /* Erase operations */ | 712 | /* Erase operations */ |
| @@ -705,23 +717,22 @@ clear_to_end () | |||
| 705 | { | 717 | { |
| 706 | register int i; | 718 | register int i; |
| 707 | 719 | ||
| 708 | struct frame *f = (updating_frame | 720 | struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame)); |
| 709 | ? updating_frame | ||
| 710 | : XFRAME (selected_frame)); | ||
| 711 | 721 | ||
| 712 | if (clear_to_end_hook && ! FRAME_TERMCAP_P (f)) | 722 | if (clear_to_end_hook && ! FRAME_TERMCAP_P (f)) |
| 713 | { | 723 | { |
| 714 | (*clear_to_end_hook) (); | 724 | (*clear_to_end_hook) (); |
| 715 | return; | 725 | return; |
| 716 | } | 726 | } |
| 727 | struct tty_output *tty = FRAME_TTY (f); | ||
| 717 | if (TS_clr_to_bottom) | 728 | if (TS_clr_to_bottom) |
| 718 | { | 729 | { |
| 719 | background_highlight (); | 730 | background_highlight (); |
| 720 | OUTPUT (FRAME_TTY (f), TS_clr_to_bottom); | 731 | OUTPUT (tty, TS_clr_to_bottom); |
| 721 | } | 732 | } |
| 722 | else | 733 | else |
| 723 | { | 734 | { |
| 724 | for (i = curY; i < FRAME_LINES (f); i++) | 735 | for (i = curY (tty); i < FRAME_LINES (f); i++) |
| 725 | { | 736 | { |
| 726 | cursor_to (i, 0); | 737 | cursor_to (i, 0); |
| 727 | clear_end_of_line (FRAME_COLS (f)); | 738 | clear_end_of_line (FRAME_COLS (f)); |
| @@ -734,20 +745,19 @@ clear_to_end () | |||
| 734 | void | 745 | void |
| 735 | clear_frame () | 746 | clear_frame () |
| 736 | { | 747 | { |
| 737 | struct frame *f = (updating_frame | 748 | struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame)); |
| 738 | ? updating_frame | ||
| 739 | : XFRAME (selected_frame)); | ||
| 740 | 749 | ||
| 741 | if (clear_frame_hook && ! FRAME_TERMCAP_P (f)) | 750 | if (clear_frame_hook && ! FRAME_TERMCAP_P (f)) |
| 742 | { | 751 | { |
| 743 | (*clear_frame_hook) (); | 752 | (*clear_frame_hook) (); |
| 744 | return; | 753 | return; |
| 745 | } | 754 | } |
| 755 | struct tty_output *tty = FRAME_TTY (f); | ||
| 746 | if (TS_clr_frame) | 756 | if (TS_clr_frame) |
| 747 | { | 757 | { |
| 748 | background_highlight (); | 758 | background_highlight (); |
| 749 | OUTPUT (FRAME_TTY (f), TS_clr_frame); | 759 | OUTPUT (tty, TS_clr_frame); |
| 750 | cmat (0, 0); | 760 | cmat (tty, 0, 0); |
| 751 | } | 761 | } |
| 752 | else | 762 | else |
| 753 | { | 763 | { |
| @@ -767,9 +777,7 @@ clear_end_of_line (first_unused_hpos) | |||
| 767 | { | 777 | { |
| 768 | register int i; | 778 | register int i; |
| 769 | 779 | ||
| 770 | struct frame *f = (updating_frame | 780 | struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame)); |
| 771 | ? updating_frame | ||
| 772 | : XFRAME (selected_frame)); | ||
| 773 | 781 | ||
| 774 | if (clear_end_of_line_hook | 782 | if (clear_end_of_line_hook |
| 775 | && ! FRAME_TERMCAP_P (f)) | 783 | && ! FRAME_TERMCAP_P (f)) |
| @@ -778,34 +786,37 @@ clear_end_of_line (first_unused_hpos) | |||
| 778 | return; | 786 | return; |
| 779 | } | 787 | } |
| 780 | 788 | ||
| 789 | struct tty_output *tty = FRAME_TTY (f); | ||
| 790 | |||
| 781 | /* Detect the case where we are called from reset_sys_modes | 791 | /* Detect the case where we are called from reset_sys_modes |
| 782 | and the costs have never been calculated. Do nothing. */ | 792 | and the costs have never been calculated. Do nothing. */ |
| 783 | if (! costs_set) | 793 | if (! costs_set) |
| 784 | return; | 794 | return; |
| 785 | 795 | ||
| 786 | if (curX >= first_unused_hpos) | 796 | if (curX (tty) >= first_unused_hpos) |
| 787 | return; | 797 | return; |
| 788 | background_highlight (); | 798 | background_highlight (); |
| 789 | if (TS_clr_line) | 799 | if (TS_clr_line) |
| 790 | { | 800 | { |
| 791 | OUTPUT1 (FRAME_TTY (f), TS_clr_line); | 801 | OUTPUT1 (tty, TS_clr_line); |
| 792 | } | 802 | } |
| 793 | else | 803 | else |
| 794 | { /* have to do it the hard way */ | 804 | { /* have to do it the hard way */ |
| 795 | turn_off_insert (); | 805 | turn_off_insert (); |
| 796 | 806 | ||
| 797 | /* Do not write in last row last col with Auto-wrap on. */ | 807 | /* Do not write in last row last col with Auto-wrap on. */ |
| 798 | if (AutoWrap && curY == FRAME_LINES (f) - 1 | 808 | if (AutoWrap (tty) |
| 809 | && curY (tty) == FRAME_LINES (f) - 1 | ||
| 799 | && first_unused_hpos == FRAME_COLS (f)) | 810 | && first_unused_hpos == FRAME_COLS (f)) |
| 800 | first_unused_hpos--; | 811 | first_unused_hpos--; |
| 801 | 812 | ||
| 802 | for (i = curX; i < first_unused_hpos; i++) | 813 | for (i = curX (tty); i < first_unused_hpos; i++) |
| 803 | { | 814 | { |
| 804 | if (TTY_TERMSCRIPT (FRAME_TTY (f))) | 815 | if (TTY_TERMSCRIPT (tty)) |
| 805 | fputc (' ', TTY_TERMSCRIPT (FRAME_TTY (f))); | 816 | fputc (' ', TTY_TERMSCRIPT (tty)); |
| 806 | fputc (' ', TTY_OUTPUT (FRAME_TTY (f))); | 817 | fputc (' ', TTY_OUTPUT (tty)); |
| 807 | } | 818 | } |
| 808 | cmplus (first_unused_hpos - curX); | 819 | cmplus (tty, first_unused_hpos - curX (tty)); |
| 809 | } | 820 | } |
| 810 | } | 821 | } |
| 811 | 822 | ||
| @@ -935,20 +946,22 @@ write_glyphs (string, len) | |||
| 935 | return; | 946 | return; |
| 936 | } | 947 | } |
| 937 | 948 | ||
| 949 | struct tty_output *tty = FRAME_TTY (f); | ||
| 950 | |||
| 938 | turn_off_insert (); | 951 | turn_off_insert (); |
| 939 | tty_hide_cursor (); | 952 | tty_hide_cursor (); |
| 940 | 953 | ||
| 941 | /* Don't dare write in last column of bottom line, if Auto-Wrap, | 954 | /* Don't dare write in last column of bottom line, if Auto-Wrap, |
| 942 | since that would scroll the whole frame on some terminals. */ | 955 | since that would scroll the whole frame on some terminals. */ |
| 943 | 956 | ||
| 944 | if (AutoWrap | 957 | if (AutoWrap (tty) |
| 945 | && curY + 1 == FRAME_LINES (f) | 958 | && curY (tty) + 1 == FRAME_LINES (f) |
| 946 | && (curX + len) == FRAME_COLS (f)) | 959 | && (curX (tty) + len) == FRAME_COLS (f)) |
| 947 | len --; | 960 | len --; |
| 948 | if (len <= 0) | 961 | if (len <= 0) |
| 949 | return; | 962 | return; |
| 950 | 963 | ||
| 951 | cmplus (len); | 964 | cmplus (tty, len); |
| 952 | 965 | ||
| 953 | /* The mode bit CODING_MODE_LAST_BLOCK should be set to 1 only at | 966 | /* The mode bit CODING_MODE_LAST_BLOCK should be set to 1 only at |
| 954 | the tail. */ | 967 | the tail. */ |
| @@ -979,12 +992,12 @@ write_glyphs (string, len) | |||
| 979 | if (produced > 0) | 992 | if (produced > 0) |
| 980 | { | 993 | { |
| 981 | fwrite (conversion_buffer, 1, produced, | 994 | fwrite (conversion_buffer, 1, produced, |
| 982 | TTY_OUTPUT (FRAME_TTY (f))); | 995 | TTY_OUTPUT (tty)); |
| 983 | if (ferror (TTY_OUTPUT (FRAME_TTY (f)))) | 996 | if (ferror (TTY_OUTPUT (tty))) |
| 984 | clearerr (TTY_OUTPUT (FRAME_TTY (f))); | 997 | clearerr (TTY_OUTPUT (tty)); |
| 985 | if (TTY_TERMSCRIPT (FRAME_TTY (f))) | 998 | if (TTY_TERMSCRIPT (tty)) |
| 986 | fwrite (conversion_buffer, 1, produced, | 999 | fwrite (conversion_buffer, 1, produced, |
| 987 | TTY_TERMSCRIPT (FRAME_TTY (f))); | 1000 | TTY_TERMSCRIPT (tty)); |
| 988 | } | 1001 | } |
| 989 | len -= consumed; | 1002 | len -= consumed; |
| 990 | n -= consumed; | 1003 | n -= consumed; |
| @@ -1005,16 +1018,16 @@ write_glyphs (string, len) | |||
| 1005 | if (terminal_coding.produced > 0) | 1018 | if (terminal_coding.produced > 0) |
| 1006 | { | 1019 | { |
| 1007 | fwrite (conversion_buffer, 1, terminal_coding.produced, | 1020 | fwrite (conversion_buffer, 1, terminal_coding.produced, |
| 1008 | TTY_OUTPUT (FRAME_TTY (f))); | 1021 | TTY_OUTPUT (tty)); |
| 1009 | if (ferror (TTY_OUTPUT (FRAME_TTY (f)))) | 1022 | if (ferror (TTY_OUTPUT (tty))) |
| 1010 | clearerr (TTY_OUTPUT (FRAME_TTY (f))); | 1023 | clearerr (TTY_OUTPUT (tty)); |
| 1011 | if (TTY_TERMSCRIPT (FRAME_TTY (f))) | 1024 | if (TTY_TERMSCRIPT (tty)) |
| 1012 | fwrite (conversion_buffer, 1, terminal_coding.produced, | 1025 | fwrite (conversion_buffer, 1, terminal_coding.produced, |
| 1013 | TTY_TERMSCRIPT (FRAME_TTY (f))); | 1026 | TTY_TERMSCRIPT (tty)); |
| 1014 | } | 1027 | } |
| 1015 | } | 1028 | } |
| 1016 | 1029 | ||
| 1017 | cmcheckmagic (FRAME_TTY (f)); | 1030 | cmcheckmagic (tty); |
| 1018 | } | 1031 | } |
| 1019 | 1032 | ||
| 1020 | /* If start is zero, insert blanks instead of a string at start */ | 1033 | /* If start is zero, insert blanks instead of a string at start */ |
| @@ -1026,23 +1039,23 @@ insert_glyphs (start, len) | |||
| 1026 | { | 1039 | { |
| 1027 | char *buf; | 1040 | char *buf; |
| 1028 | struct glyph *glyph = NULL; | 1041 | struct glyph *glyph = NULL; |
| 1029 | struct frame *f; | 1042 | struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame)); |
| 1030 | 1043 | ||
| 1031 | if (len <= 0) | 1044 | if (len <= 0) |
| 1032 | return; | 1045 | return; |
| 1033 | 1046 | ||
| 1034 | if (insert_glyphs_hook) | 1047 | if (insert_glyphs_hook && ! FRAME_TERMCAP_P (f)) |
| 1035 | { | 1048 | { |
| 1036 | (*insert_glyphs_hook) (start, len); | 1049 | (*insert_glyphs_hook) (start, len); |
| 1037 | return; | 1050 | return; |
| 1038 | } | 1051 | } |
| 1039 | 1052 | ||
| 1040 | f = updating_frame ? updating_frame : XFRAME (selected_frame); | 1053 | struct tty_output *tty = FRAME_TTY (f); |
| 1041 | 1054 | ||
| 1042 | if (TS_ins_multi_chars) | 1055 | if (TS_ins_multi_chars) |
| 1043 | { | 1056 | { |
| 1044 | buf = tparam (TS_ins_multi_chars, 0, 0, len); | 1057 | buf = tparam (TS_ins_multi_chars, 0, 0, len); |
| 1045 | OUTPUT1 (FRAME_TTY (f), buf); | 1058 | OUTPUT1 (tty, buf); |
| 1046 | xfree (buf); | 1059 | xfree (buf); |
| 1047 | if (start) | 1060 | if (start) |
| 1048 | write_glyphs (start, len); | 1061 | write_glyphs (start, len); |
| @@ -1050,7 +1063,7 @@ insert_glyphs (start, len) | |||
| 1050 | } | 1063 | } |
| 1051 | 1064 | ||
| 1052 | turn_on_insert (); | 1065 | turn_on_insert (); |
| 1053 | cmplus (len); | 1066 | cmplus (tty, len); |
| 1054 | /* The bit CODING_MODE_LAST_BLOCK should be set to 1 only at the tail. */ | 1067 | /* The bit CODING_MODE_LAST_BLOCK should be set to 1 only at the tail. */ |
| 1055 | terminal_coding.mode &= ~CODING_MODE_LAST_BLOCK; | 1068 | terminal_coding.mode &= ~CODING_MODE_LAST_BLOCK; |
| 1056 | while (len-- > 0) | 1069 | while (len-- > 0) |
| @@ -1059,7 +1072,7 @@ insert_glyphs (start, len) | |||
| 1059 | unsigned char conversion_buffer[1024]; | 1072 | unsigned char conversion_buffer[1024]; |
| 1060 | int conversion_buffer_size = sizeof conversion_buffer; | 1073 | int conversion_buffer_size = sizeof conversion_buffer; |
| 1061 | 1074 | ||
| 1062 | OUTPUT1_IF (FRAME_TTY (f), TS_ins_char); | 1075 | OUTPUT1_IF (tty, TS_ins_char); |
| 1063 | if (!start) | 1076 | if (!start) |
| 1064 | { | 1077 | { |
| 1065 | conversion_buffer[0] = SPACEGLYPH; | 1078 | conversion_buffer[0] = SPACEGLYPH; |
| @@ -1075,7 +1088,7 @@ insert_glyphs (start, len) | |||
| 1075 | occupies more than one column. */ | 1088 | occupies more than one column. */ |
| 1076 | while (len && CHAR_GLYPH_PADDING_P (*start)) | 1089 | while (len && CHAR_GLYPH_PADDING_P (*start)) |
| 1077 | { | 1090 | { |
| 1078 | OUTPUT1_IF (FRAME_TTY (f), TS_ins_char); | 1091 | OUTPUT1_IF (tty, TS_ins_char); |
| 1079 | start++, len--; | 1092 | start++, len--; |
| 1080 | } | 1093 | } |
| 1081 | 1094 | ||
| @@ -1092,15 +1105,15 @@ insert_glyphs (start, len) | |||
| 1092 | if (produced > 0) | 1105 | if (produced > 0) |
| 1093 | { | 1106 | { |
| 1094 | fwrite (conversion_buffer, 1, produced, | 1107 | fwrite (conversion_buffer, 1, produced, |
| 1095 | TTY_OUTPUT (FRAME_TTY (f))); | 1108 | TTY_OUTPUT (tty)); |
| 1096 | if (ferror (TTY_OUTPUT (FRAME_TTY (f)))) | 1109 | if (ferror (TTY_OUTPUT (tty))) |
| 1097 | clearerr (TTY_OUTPUT (FRAME_TTY (f))); | 1110 | clearerr (TTY_OUTPUT (tty)); |
| 1098 | if (TTY_TERMSCRIPT (FRAME_TTY (f))) | 1111 | if (TTY_TERMSCRIPT (tty)) |
| 1099 | fwrite (conversion_buffer, 1, produced, | 1112 | fwrite (conversion_buffer, 1, produced, |
| 1100 | TTY_TERMSCRIPT (FRAME_TTY (f))); | 1113 | TTY_TERMSCRIPT (tty)); |
| 1101 | } | 1114 | } |
| 1102 | 1115 | ||
| 1103 | OUTPUT1_IF (FRAME_TTY (f), TS_pad_inserted_char); | 1116 | OUTPUT1_IF (tty, TS_pad_inserted_char); |
| 1104 | if (start) | 1117 | if (start) |
| 1105 | { | 1118 | { |
| 1106 | turn_off_face (f, glyph->face_id); | 1119 | turn_off_face (f, glyph->face_id); |
| @@ -1108,7 +1121,7 @@ insert_glyphs (start, len) | |||
| 1108 | } | 1121 | } |
| 1109 | } | 1122 | } |
| 1110 | 1123 | ||
| 1111 | cmcheckmagic (FRAME_TTY (f)); | 1124 | cmcheckmagic (tty); |
| 1112 | } | 1125 | } |
| 1113 | 1126 | ||
| 1114 | void | 1127 | void |
| @@ -1117,13 +1130,16 @@ delete_glyphs (n) | |||
| 1117 | { | 1130 | { |
| 1118 | char *buf; | 1131 | char *buf; |
| 1119 | register int i; | 1132 | register int i; |
| 1133 | struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame)); | ||
| 1134 | struct tty_output *tty = FRAME_TTY (f); | ||
| 1120 | 1135 | ||
| 1121 | if (delete_glyphs_hook && ! FRAME_TERMCAP_P (updating_frame)) | 1136 | if (delete_glyphs_hook && ! FRAME_TERMCAP_P (f)) |
| 1122 | { | 1137 | { |
| 1123 | (*delete_glyphs_hook) (n); | 1138 | (*delete_glyphs_hook) (n); |
| 1124 | return; | 1139 | return; |
| 1125 | } | 1140 | } |
| 1126 | 1141 | ||
| 1142 | |||
| 1127 | if (delete_in_insert_mode) | 1143 | if (delete_in_insert_mode) |
| 1128 | { | 1144 | { |
| 1129 | turn_on_insert (); | 1145 | turn_on_insert (); |
| @@ -1131,20 +1147,20 @@ delete_glyphs (n) | |||
| 1131 | else | 1147 | else |
| 1132 | { | 1148 | { |
| 1133 | turn_off_insert (); | 1149 | turn_off_insert (); |
| 1134 | OUTPUT_IF (FRAME_TTY (updating_frame), TS_delete_mode); | 1150 | OUTPUT_IF (tty, TS_delete_mode); |
| 1135 | } | 1151 | } |
| 1136 | 1152 | ||
| 1137 | if (TS_del_multi_chars) | 1153 | if (TS_del_multi_chars) |
| 1138 | { | 1154 | { |
| 1139 | buf = tparam (TS_del_multi_chars, 0, 0, n); | 1155 | buf = tparam (TS_del_multi_chars, 0, 0, n); |
| 1140 | OUTPUT1 (FRAME_TTY (updating_frame), buf); | 1156 | OUTPUT1 (tty, buf); |
| 1141 | xfree (buf); | 1157 | xfree (buf); |
| 1142 | } | 1158 | } |
| 1143 | else | 1159 | else |
| 1144 | for (i = 0; i < n; i++) | 1160 | for (i = 0; i < n; i++) |
| 1145 | OUTPUT1 (FRAME_TTY (updating_frame), TS_del_char); | 1161 | OUTPUT1 (tty, TS_del_char); |
| 1146 | if (!delete_in_insert_mode) | 1162 | if (!delete_in_insert_mode) |
| 1147 | OUTPUT_IF (FRAME_TTY (updating_frame), TS_end_delete_mode); | 1163 | OUTPUT_IF (tty, TS_end_delete_mode); |
| 1148 | } | 1164 | } |
| 1149 | 1165 | ||
| 1150 | /* Insert N lines at vpos VPOS. If N is negative, delete -N lines. */ | 1166 | /* Insert N lines at vpos VPOS. If N is negative, delete -N lines. */ |
| @@ -1156,18 +1172,18 @@ ins_del_lines (vpos, n) | |||
| 1156 | char *multi = n > 0 ? TS_ins_multi_lines : TS_del_multi_lines; | 1172 | char *multi = n > 0 ? TS_ins_multi_lines : TS_del_multi_lines; |
| 1157 | char *single = n > 0 ? TS_ins_line : TS_del_line; | 1173 | char *single = n > 0 ? TS_ins_line : TS_del_line; |
| 1158 | char *scroll = n > 0 ? TS_rev_scroll : TS_fwd_scroll; | 1174 | char *scroll = n > 0 ? TS_rev_scroll : TS_fwd_scroll; |
| 1159 | struct frame *f; | 1175 | struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame)); |
| 1160 | 1176 | ||
| 1161 | register int i = n > 0 ? n : -n; | 1177 | register int i = n > 0 ? n : -n; |
| 1162 | register char *buf; | 1178 | register char *buf; |
| 1163 | 1179 | ||
| 1164 | if (ins_del_lines_hook && ! FRAME_TERMCAP_P (updating_frame)) | 1180 | if (ins_del_lines_hook && ! FRAME_TERMCAP_P (f)) |
| 1165 | { | 1181 | { |
| 1166 | (*ins_del_lines_hook) (vpos, n); | 1182 | (*ins_del_lines_hook) (vpos, n); |
| 1167 | return; | 1183 | return; |
| 1168 | } | 1184 | } |
| 1169 | 1185 | ||
| 1170 | f = (updating_frame ? updating_frame : XFRAME (selected_frame)); | 1186 | struct tty_output *tty = FRAME_TTY (f); |
| 1171 | 1187 | ||
| 1172 | /* If the lines below the insertion are being pushed | 1188 | /* If the lines below the insertion are being pushed |
| 1173 | into the end of the window, this is the same as clearing; | 1189 | into the end of the window, this is the same as clearing; |
| @@ -1176,10 +1192,10 @@ ins_del_lines (vpos, n) | |||
| 1176 | /* If the lines below the deletion are blank lines coming | 1192 | /* If the lines below the deletion are blank lines coming |
| 1177 | out of the end of the window, don't bother, | 1193 | out of the end of the window, don't bother, |
| 1178 | as there will be a matching inslines later that will flush them. */ | 1194 | as there will be a matching inslines later that will flush them. */ |
| 1179 | if (TTY_SCROLL_REGION_OK (FRAME_TTY (f)) | 1195 | if (TTY_SCROLL_REGION_OK (tty) |
| 1180 | && vpos + i >= specified_window) | 1196 | && vpos + i >= specified_window) |
| 1181 | return; | 1197 | return; |
| 1182 | if (!TTY_MEMORY_BELOW_FRAME (FRAME_TTY (f)) | 1198 | if (!TTY_MEMORY_BELOW_FRAME (tty) |
| 1183 | && vpos + i >= FRAME_LINES (f)) | 1199 | && vpos + i >= FRAME_LINES (f)) |
| 1184 | return; | 1200 | return; |
| 1185 | 1201 | ||
| @@ -1188,7 +1204,7 @@ ins_del_lines (vpos, n) | |||
| 1188 | raw_cursor_to (vpos, 0); | 1204 | raw_cursor_to (vpos, 0); |
| 1189 | background_highlight (); | 1205 | background_highlight (); |
| 1190 | buf = tparam (multi, 0, 0, i); | 1206 | buf = tparam (multi, 0, 0, i); |
| 1191 | OUTPUT (FRAME_TTY (f), buf); | 1207 | OUTPUT (tty, buf); |
| 1192 | xfree (buf); | 1208 | xfree (buf); |
| 1193 | } | 1209 | } |
| 1194 | else if (single) | 1210 | else if (single) |
| @@ -1196,9 +1212,9 @@ ins_del_lines (vpos, n) | |||
| 1196 | raw_cursor_to (vpos, 0); | 1212 | raw_cursor_to (vpos, 0); |
| 1197 | background_highlight (); | 1213 | background_highlight (); |
| 1198 | while (--i >= 0) | 1214 | while (--i >= 0) |
| 1199 | OUTPUT (FRAME_TTY (f), single); | 1215 | OUTPUT (tty, single); |
| 1200 | if (TF_teleray) | 1216 | if (TF_teleray) |
| 1201 | curX = 0; | 1217 | curX (tty) = 0; |
| 1202 | } | 1218 | } |
| 1203 | else | 1219 | else |
| 1204 | { | 1220 | { |
| @@ -1209,12 +1225,12 @@ ins_del_lines (vpos, n) | |||
| 1209 | raw_cursor_to (vpos, 0); | 1225 | raw_cursor_to (vpos, 0); |
| 1210 | background_highlight (); | 1226 | background_highlight (); |
| 1211 | while (--i >= 0) | 1227 | while (--i >= 0) |
| 1212 | OUTPUTL (FRAME_TTY (f), scroll, specified_window - vpos); | 1228 | OUTPUTL (tty, scroll, specified_window - vpos); |
| 1213 | set_scroll_region (0, specified_window); | 1229 | set_scroll_region (0, specified_window); |
| 1214 | } | 1230 | } |
| 1215 | 1231 | ||
| 1216 | if (!TTY_SCROLL_REGION_OK (FRAME_TTY (f)) | 1232 | if (!TTY_SCROLL_REGION_OK (tty) |
| 1217 | && TTY_MEMORY_BELOW_FRAME (FRAME_TTY (f)) | 1233 | && TTY_MEMORY_BELOW_FRAME (tty) |
| 1218 | && n < 0) | 1234 | && n < 0) |
| 1219 | { | 1235 | { |
| 1220 | cursor_to (FRAME_LINES (f) + n, 0); | 1236 | cursor_to (FRAME_LINES (f) + n, 0); |
| @@ -1392,7 +1408,7 @@ calculate_costs (frame) | |||
| 1392 | else | 1408 | else |
| 1393 | RPov = FRAME_COLS (frame) * 2; | 1409 | RPov = FRAME_COLS (frame) * 2; |
| 1394 | 1410 | ||
| 1395 | cmcostinit (); /* set up cursor motion costs */ | 1411 | cmcostinit (FRAME_TTY (frame)); /* set up cursor motion costs */ |
| 1396 | } | 1412 | } |
| 1397 | 1413 | ||
| 1398 | struct fkey_table { | 1414 | struct fkey_table { |
| @@ -1857,6 +1873,7 @@ turn_on_face (f, face_id) | |||
| 1857 | struct face *face = FACE_FROM_ID (f, face_id); | 1873 | struct face *face = FACE_FROM_ID (f, face_id); |
| 1858 | long fg = face->foreground; | 1874 | long fg = face->foreground; |
| 1859 | long bg = face->background; | 1875 | long bg = face->background; |
| 1876 | struct tty_output *tty = FRAME_TTY (f); | ||
| 1860 | 1877 | ||
| 1861 | /* Do this first because TS_end_standout_mode may be the same | 1878 | /* Do this first because TS_end_standout_mode may be the same |
| 1862 | as TS_exit_attribute_mode, which turns all appearances off. */ | 1879 | as TS_exit_attribute_mode, which turns all appearances off. */ |
| @@ -1907,23 +1924,23 @@ turn_on_face (f, face_id) | |||
| 1907 | if (face->tty_bold_p) | 1924 | if (face->tty_bold_p) |
| 1908 | { | 1925 | { |
| 1909 | if (MAY_USE_WITH_COLORS_P (NC_BOLD)) | 1926 | if (MAY_USE_WITH_COLORS_P (NC_BOLD)) |
| 1910 | OUTPUT1_IF (FRAME_TTY (f), TS_enter_bold_mode); | 1927 | OUTPUT1_IF (tty, TS_enter_bold_mode); |
| 1911 | } | 1928 | } |
| 1912 | else if (face->tty_dim_p) | 1929 | else if (face->tty_dim_p) |
| 1913 | if (MAY_USE_WITH_COLORS_P (NC_DIM)) | 1930 | if (MAY_USE_WITH_COLORS_P (NC_DIM)) |
| 1914 | OUTPUT1_IF (FRAME_TTY (f), TS_enter_dim_mode); | 1931 | OUTPUT1_IF (tty, TS_enter_dim_mode); |
| 1915 | 1932 | ||
| 1916 | /* Alternate charset and blinking not yet used. */ | 1933 | /* Alternate charset and blinking not yet used. */ |
| 1917 | if (face->tty_alt_charset_p | 1934 | if (face->tty_alt_charset_p |
| 1918 | && MAY_USE_WITH_COLORS_P (NC_ALT_CHARSET)) | 1935 | && MAY_USE_WITH_COLORS_P (NC_ALT_CHARSET)) |
| 1919 | OUTPUT1_IF (FRAME_TTY (f), TS_enter_alt_charset_mode); | 1936 | OUTPUT1_IF (tty, TS_enter_alt_charset_mode); |
| 1920 | 1937 | ||
| 1921 | if (face->tty_blinking_p | 1938 | if (face->tty_blinking_p |
| 1922 | && MAY_USE_WITH_COLORS_P (NC_BLINK)) | 1939 | && MAY_USE_WITH_COLORS_P (NC_BLINK)) |
| 1923 | OUTPUT1_IF (FRAME_TTY (f), TS_enter_blink_mode); | 1940 | OUTPUT1_IF (tty, TS_enter_blink_mode); |
| 1924 | 1941 | ||
| 1925 | if (face->tty_underline_p && MAY_USE_WITH_COLORS_P (NC_UNDERLINE)) | 1942 | if (face->tty_underline_p && MAY_USE_WITH_COLORS_P (NC_UNDERLINE)) |
| 1926 | OUTPUT1_IF (FRAME_TTY (f), TS_enter_underline_mode); | 1943 | OUTPUT1_IF (tty, TS_enter_underline_mode); |
| 1927 | 1944 | ||
| 1928 | if (TN_max_colors > 0) | 1945 | if (TN_max_colors > 0) |
| 1929 | { | 1946 | { |
| @@ -1932,14 +1949,14 @@ turn_on_face (f, face_id) | |||
| 1932 | if (fg >= 0 && TS_set_foreground) | 1949 | if (fg >= 0 && TS_set_foreground) |
| 1933 | { | 1950 | { |
| 1934 | p = tparam (TS_set_foreground, NULL, 0, (int) fg); | 1951 | p = tparam (TS_set_foreground, NULL, 0, (int) fg); |
| 1935 | OUTPUT (FRAME_TTY (f), p); | 1952 | OUTPUT (tty, p); |
| 1936 | xfree (p); | 1953 | xfree (p); |
| 1937 | } | 1954 | } |
| 1938 | 1955 | ||
| 1939 | if (bg >= 0 && TS_set_background) | 1956 | if (bg >= 0 && TS_set_background) |
| 1940 | { | 1957 | { |
| 1941 | p = tparam (TS_set_background, NULL, 0, (int) bg); | 1958 | p = tparam (TS_set_background, NULL, 0, (int) bg); |
| 1942 | OUTPUT (FRAME_TTY (f), p); | 1959 | OUTPUT (tty, p); |
| 1943 | xfree (p); | 1960 | xfree (p); |
| 1944 | } | 1961 | } |
| 1945 | } | 1962 | } |
| @@ -1954,6 +1971,7 @@ turn_off_face (f, face_id) | |||
| 1954 | int face_id; | 1971 | int face_id; |
| 1955 | { | 1972 | { |
| 1956 | struct face *face = FACE_FROM_ID (f, face_id); | 1973 | struct face *face = FACE_FROM_ID (f, face_id); |
| 1974 | struct tty_output *tty = FRAME_TTY (f); | ||
| 1957 | 1975 | ||
| 1958 | xassert (face != NULL); | 1976 | xassert (face != NULL); |
| 1959 | 1977 | ||
| @@ -1969,23 +1987,23 @@ turn_off_face (f, face_id) | |||
| 1969 | || face->tty_blinking_p | 1987 | || face->tty_blinking_p |
| 1970 | || face->tty_underline_p) | 1988 | || face->tty_underline_p) |
| 1971 | { | 1989 | { |
| 1972 | OUTPUT1_IF (FRAME_TTY (f), TS_exit_attribute_mode); | 1990 | OUTPUT1_IF (tty, TS_exit_attribute_mode); |
| 1973 | if (strcmp (TS_exit_attribute_mode, TS_end_standout_mode) == 0) | 1991 | if (strcmp (TS_exit_attribute_mode, TS_end_standout_mode) == 0) |
| 1974 | standout_mode = 0; | 1992 | standout_mode = 0; |
| 1975 | } | 1993 | } |
| 1976 | 1994 | ||
| 1977 | if (face->tty_alt_charset_p) | 1995 | if (face->tty_alt_charset_p) |
| 1978 | OUTPUT_IF (FRAME_TTY (f), TS_exit_alt_charset_mode); | 1996 | OUTPUT_IF (tty, TS_exit_alt_charset_mode); |
| 1979 | } | 1997 | } |
| 1980 | else | 1998 | else |
| 1981 | { | 1999 | { |
| 1982 | /* If we don't have "me" we can only have those appearances | 2000 | /* If we don't have "me" we can only have those appearances |
| 1983 | that have exit sequences defined. */ | 2001 | that have exit sequences defined. */ |
| 1984 | if (face->tty_alt_charset_p) | 2002 | if (face->tty_alt_charset_p) |
| 1985 | OUTPUT_IF (FRAME_TTY (f), TS_exit_alt_charset_mode); | 2003 | OUTPUT_IF (tty, TS_exit_alt_charset_mode); |
| 1986 | 2004 | ||
| 1987 | if (face->tty_underline_p) | 2005 | if (face->tty_underline_p) |
| 1988 | OUTPUT_IF (FRAME_TTY (f), TS_exit_underline_mode); | 2006 | OUTPUT_IF (tty, TS_exit_underline_mode); |
| 1989 | } | 2007 | } |
| 1990 | 2008 | ||
| 1991 | /* Switch back to default colors. */ | 2009 | /* Switch back to default colors. */ |
| @@ -1994,7 +2012,7 @@ turn_off_face (f, face_id) | |||
| 1994 | && face->foreground != FACE_TTY_DEFAULT_FG_COLOR) | 2012 | && face->foreground != FACE_TTY_DEFAULT_FG_COLOR) |
| 1995 | || (face->background != FACE_TTY_DEFAULT_COLOR | 2013 | || (face->background != FACE_TTY_DEFAULT_COLOR |
| 1996 | && face->background != FACE_TTY_DEFAULT_BG_COLOR))) | 2014 | && face->background != FACE_TTY_DEFAULT_BG_COLOR))) |
| 1997 | OUTPUT1_IF (FRAME_TTY (f), TS_orig_pair); | 2015 | OUTPUT1_IF (tty, TS_orig_pair); |
| 1998 | } | 2016 | } |
| 1999 | 2017 | ||
| 2000 | 2018 | ||
| @@ -2256,6 +2274,10 @@ term_init (name, terminal_type) | |||
| 2256 | tty_list = tty; | 2274 | tty_list = tty; |
| 2257 | } | 2275 | } |
| 2258 | 2276 | ||
| 2277 | if (tty->Wcm) | ||
| 2278 | xfree (tty->Wcm); | ||
| 2279 | tty->Wcm = (struct cm *) xmalloc (sizeof (struct cm)); | ||
| 2280 | |||
| 2259 | if (name) | 2281 | if (name) |
| 2260 | { | 2282 | { |
| 2261 | int fd; | 2283 | int fd; |
| @@ -2314,7 +2336,7 @@ term_init (name, terminal_type) | |||
| 2314 | return tty; | 2336 | return tty; |
| 2315 | #else /* not WINDOWSNT */ | 2337 | #else /* not WINDOWSNT */ |
| 2316 | 2338 | ||
| 2317 | Wcm_clear (); | 2339 | Wcm_clear (tty); |
| 2318 | 2340 | ||
| 2319 | TTY_TYPE (tty) = xstrdup (terminal_type); | 2341 | TTY_TYPE (tty) = xstrdup (terminal_type); |
| 2320 | 2342 | ||
| @@ -2357,16 +2379,16 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", | |||
| 2357 | TS_ins_line = tgetstr ("al", address); | 2379 | TS_ins_line = tgetstr ("al", address); |
| 2358 | TS_ins_multi_lines = tgetstr ("AL", address); | 2380 | TS_ins_multi_lines = tgetstr ("AL", address); |
| 2359 | TS_bell = tgetstr ("bl", address); | 2381 | TS_bell = tgetstr ("bl", address); |
| 2360 | BackTab = tgetstr ("bt", address); | 2382 | BackTab (tty) = tgetstr ("bt", address); |
| 2361 | TS_clr_to_bottom = tgetstr ("cd", address); | 2383 | TS_clr_to_bottom = tgetstr ("cd", address); |
| 2362 | TS_clr_line = tgetstr ("ce", address); | 2384 | TS_clr_line = tgetstr ("ce", address); |
| 2363 | TS_clr_frame = tgetstr ("cl", address); | 2385 | TS_clr_frame = tgetstr ("cl", address); |
| 2364 | ColPosition = NULL; /* tgetstr ("ch", address); */ | 2386 | ColPosition (tty) = NULL; /* tgetstr ("ch", address); */ |
| 2365 | AbsPosition = tgetstr ("cm", address); | 2387 | AbsPosition (tty) = tgetstr ("cm", address); |
| 2366 | CR = tgetstr ("cr", address); | 2388 | CR (tty) = tgetstr ("cr", address); |
| 2367 | TS_set_scroll_region = tgetstr ("cs", address); | 2389 | TS_set_scroll_region = tgetstr ("cs", address); |
| 2368 | TS_set_scroll_region_1 = tgetstr ("cS", address); | 2390 | TS_set_scroll_region_1 = tgetstr ("cS", address); |
| 2369 | RowPosition = tgetstr ("cv", address); | 2391 | RowPosition (tty) = tgetstr ("cv", address); |
| 2370 | TS_del_char = tgetstr ("dc", address); | 2392 | TS_del_char = tgetstr ("dc", address); |
| 2371 | TS_del_multi_chars = tgetstr ("DC", address); | 2393 | TS_del_multi_chars = tgetstr ("DC", address); |
| 2372 | TS_del_line = tgetstr ("dl", address); | 2394 | TS_del_line = tgetstr ("dl", address); |
| @@ -2374,40 +2396,40 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", | |||
| 2374 | TS_delete_mode = tgetstr ("dm", address); | 2396 | TS_delete_mode = tgetstr ("dm", address); |
| 2375 | TS_end_delete_mode = tgetstr ("ed", address); | 2397 | TS_end_delete_mode = tgetstr ("ed", address); |
| 2376 | TS_end_insert_mode = tgetstr ("ei", address); | 2398 | TS_end_insert_mode = tgetstr ("ei", address); |
| 2377 | Home = tgetstr ("ho", address); | 2399 | Home (tty) = tgetstr ("ho", address); |
| 2378 | TS_ins_char = tgetstr ("ic", address); | 2400 | TS_ins_char = tgetstr ("ic", address); |
| 2379 | TS_ins_multi_chars = tgetstr ("IC", address); | 2401 | TS_ins_multi_chars = tgetstr ("IC", address); |
| 2380 | TS_insert_mode = tgetstr ("im", address); | 2402 | TS_insert_mode = tgetstr ("im", address); |
| 2381 | TS_pad_inserted_char = tgetstr ("ip", address); | 2403 | TS_pad_inserted_char = tgetstr ("ip", address); |
| 2382 | TS_end_keypad_mode = tgetstr ("ke", address); | 2404 | TS_end_keypad_mode = tgetstr ("ke", address); |
| 2383 | TS_keypad_mode = tgetstr ("ks", address); | 2405 | TS_keypad_mode = tgetstr ("ks", address); |
| 2384 | LastLine = tgetstr ("ll", address); | 2406 | LastLine (tty) = tgetstr ("ll", address); |
| 2385 | Right = tgetstr ("nd", address); | 2407 | Right (tty) = tgetstr ("nd", address); |
| 2386 | Down = tgetstr ("do", address); | 2408 | Down (tty) = tgetstr ("do", address); |
| 2387 | if (!Down) | 2409 | if (!Down (tty)) |
| 2388 | Down = tgetstr ("nl", address); /* Obsolete name for "do" */ | 2410 | Down (tty) = tgetstr ("nl", address); /* Obsolete name for "do" */ |
| 2389 | #ifdef VMS | 2411 | #ifdef VMS |
| 2390 | /* VMS puts a carriage return before each linefeed, | 2412 | /* VMS puts a carriage return before each linefeed, |
| 2391 | so it is not safe to use linefeeds. */ | 2413 | so it is not safe to use linefeeds. */ |
| 2392 | if (Down && Down[0] == '\n' && Down[1] == '\0') | 2414 | if (Down (tty) && Down (tty)[0] == '\n' && Down (tty)[1] == '\0') |
| 2393 | Down = 0; | 2415 | Down (tty) = 0; |
| 2394 | #endif /* VMS */ | 2416 | #endif /* VMS */ |
| 2395 | if (tgetflag ("bs")) | 2417 | if (tgetflag ("bs")) |
| 2396 | Left = "\b"; /* can't possibly be longer! */ | 2418 | Left (tty) = "\b"; /* can't possibly be longer! */ |
| 2397 | else /* (Actually, "bs" is obsolete...) */ | 2419 | else /* (Actually, "bs" is obsolete...) */ |
| 2398 | Left = tgetstr ("le", address); | 2420 | Left (tty) = tgetstr ("le", address); |
| 2399 | if (!Left) | 2421 | if (!Left (tty)) |
| 2400 | Left = tgetstr ("bc", address); /* Obsolete name for "le" */ | 2422 | Left (tty) = tgetstr ("bc", address); /* Obsolete name for "le" */ |
| 2401 | TS_pad_char = tgetstr ("pc", address); | 2423 | TS_pad_char = tgetstr ("pc", address); |
| 2402 | TS_repeat = tgetstr ("rp", address); | 2424 | TS_repeat = tgetstr ("rp", address); |
| 2403 | TS_end_standout_mode = tgetstr ("se", address); | 2425 | TS_end_standout_mode = tgetstr ("se", address); |
| 2404 | TS_fwd_scroll = tgetstr ("sf", address); | 2426 | TS_fwd_scroll = tgetstr ("sf", address); |
| 2405 | TS_standout_mode = tgetstr ("so", address); | 2427 | TS_standout_mode = tgetstr ("so", address); |
| 2406 | TS_rev_scroll = tgetstr ("sr", address); | 2428 | TS_rev_scroll = tgetstr ("sr", address); |
| 2407 | Wcm.cm_tab = tgetstr ("ta", address); | 2429 | tty->Wcm->cm_tab = tgetstr ("ta", address); |
| 2408 | TS_end_termcap_modes = tgetstr ("te", address); | 2430 | TS_end_termcap_modes = tgetstr ("te", address); |
| 2409 | TS_termcap_modes = tgetstr ("ti", address); | 2431 | TS_termcap_modes = tgetstr ("ti", address); |
| 2410 | Up = tgetstr ("up", address); | 2432 | Up (tty) = tgetstr ("up", address); |
| 2411 | TS_visible_bell = tgetstr ("vb", address); | 2433 | TS_visible_bell = tgetstr ("vb", address); |
| 2412 | TS_cursor_normal = tgetstr ("ve", address); | 2434 | TS_cursor_normal = tgetstr ("ve", address); |
| 2413 | TS_cursor_visible = tgetstr ("vs", address); | 2435 | TS_cursor_visible = tgetstr ("vs", address); |
| @@ -2424,10 +2446,10 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", | |||
| 2424 | TS_exit_alt_charset_mode = tgetstr ("ae", address); | 2446 | TS_exit_alt_charset_mode = tgetstr ("ae", address); |
| 2425 | TS_exit_attribute_mode = tgetstr ("me", address); | 2447 | TS_exit_attribute_mode = tgetstr ("me", address); |
| 2426 | 2448 | ||
| 2427 | MultiUp = tgetstr ("UP", address); | 2449 | MultiUp (tty) = tgetstr ("UP", address); |
| 2428 | MultiDown = tgetstr ("DO", address); | 2450 | MultiDown (tty) = tgetstr ("DO", address); |
| 2429 | MultiLeft = tgetstr ("LE", address); | 2451 | MultiLeft (tty) = tgetstr ("LE", address); |
| 2430 | MultiRight = tgetstr ("RI", address); | 2452 | MultiRight (tty) = tgetstr ("RI", address); |
| 2431 | 2453 | ||
| 2432 | /* SVr4/ANSI color suppert. If "op" isn't available, don't support | 2454 | /* SVr4/ANSI color suppert. If "op" isn't available, don't support |
| 2433 | color because we can't switch back to the default foreground and | 2455 | color because we can't switch back to the default foreground and |
| @@ -2454,10 +2476,10 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", | |||
| 2454 | 2476 | ||
| 2455 | tty_default_color_capabilities (1); | 2477 | tty_default_color_capabilities (1); |
| 2456 | 2478 | ||
| 2457 | MagicWrap = tgetflag ("xn"); | 2479 | MagicWrap (tty) = tgetflag ("xn"); |
| 2458 | /* Since we make MagicWrap terminals look like AutoWrap, we need to have | 2480 | /* Since we make MagicWrap terminals look like AutoWrap, we need to have |
| 2459 | the former flag imply the latter. */ | 2481 | the former flag imply the latter. */ |
| 2460 | AutoWrap = MagicWrap || tgetflag ("am"); | 2482 | AutoWrap (tty) = MagicWrap (tty) || tgetflag ("am"); |
| 2461 | TTY_MEMORY_BELOW_FRAME (tty) = tgetflag ("db"); | 2483 | TTY_MEMORY_BELOW_FRAME (tty) = tgetflag ("db"); |
| 2462 | TF_hazeltine = tgetflag ("hz"); | 2484 | TF_hazeltine = tgetflag ("hz"); |
| 2463 | TTY_MUST_WRITE_SPACES (tty) = tgetflag ("in"); | 2485 | TTY_MUST_WRITE_SPACES (tty) = tgetflag ("in"); |
| @@ -2493,32 +2515,32 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", | |||
| 2493 | TTY_MIN_PADDING_SPEED (tty) = tgetnum ("pb"); | 2515 | TTY_MIN_PADDING_SPEED (tty) = tgetnum ("pb"); |
| 2494 | #endif | 2516 | #endif |
| 2495 | 2517 | ||
| 2496 | TabWidth = tgetnum ("tw"); | 2518 | TabWidth (tty) = tgetnum ("tw"); |
| 2497 | 2519 | ||
| 2498 | #ifdef VMS | 2520 | #ifdef VMS |
| 2499 | /* These capabilities commonly use ^J. | 2521 | /* These capabilities commonly use ^J. |
| 2500 | I don't know why, but sending them on VMS does not work; | 2522 | I don't know why, but sending them on VMS does not work; |
| 2501 | it causes following spaces to be lost, sometimes. | 2523 | it causes following spaces to be lost, sometimes. |
| 2502 | For now, the simplest fix is to avoid using these capabilities ever. */ | 2524 | For now, the simplest fix is to avoid using these capabilities ever. */ |
| 2503 | if (Down && Down[0] == '\n') | 2525 | if (Down (tty) && Down (tty)[0] == '\n') |
| 2504 | Down = 0; | 2526 | Down (tty) = 0; |
| 2505 | #endif /* VMS */ | 2527 | #endif /* VMS */ |
| 2506 | 2528 | ||
| 2507 | if (!TS_bell) | 2529 | if (!TS_bell) |
| 2508 | TS_bell = "\07"; | 2530 | TS_bell = "\07"; |
| 2509 | 2531 | ||
| 2510 | if (!TS_fwd_scroll) | 2532 | if (!TS_fwd_scroll) |
| 2511 | TS_fwd_scroll = Down; | 2533 | TS_fwd_scroll = Down (tty); |
| 2512 | 2534 | ||
| 2513 | PC = TS_pad_char ? *TS_pad_char : 0; | 2535 | PC = TS_pad_char ? *TS_pad_char : 0; |
| 2514 | 2536 | ||
| 2515 | if (TabWidth < 0) | 2537 | if (TabWidth (tty) < 0) |
| 2516 | TabWidth = 8; | 2538 | TabWidth (tty) = 8; |
| 2517 | 2539 | ||
| 2518 | /* Turned off since /etc/termcap seems to have :ta= for most terminals | 2540 | /* Turned off since /etc/termcap seems to have :ta= for most terminals |
| 2519 | and newer termcap doc does not seem to say there is a default. | 2541 | and newer termcap doc does not seem to say there is a default. |
| 2520 | if (!Wcm.cm_tab) | 2542 | if (!tty->Wcm->cm_tab) |
| 2521 | Wcm.cm_tab = "\t"; | 2543 | tty->Wcm->cm_tab = "\t"; |
| 2522 | */ | 2544 | */ |
| 2523 | 2545 | ||
| 2524 | /* We don't support standout modes that use `magic cookies', so | 2546 | /* We don't support standout modes that use `magic cookies', so |
| @@ -2554,14 +2576,14 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", | |||
| 2554 | 2576 | ||
| 2555 | if (TF_teleray) | 2577 | if (TF_teleray) |
| 2556 | { | 2578 | { |
| 2557 | Wcm.cm_tab = 0; | 2579 | tty->Wcm->cm_tab = 0; |
| 2558 | /* We can't support standout mode, because it uses magic cookies. */ | 2580 | /* We can't support standout mode, because it uses magic cookies. */ |
| 2559 | TS_standout_mode = 0; | 2581 | TS_standout_mode = 0; |
| 2560 | /* But that means we cannot rely on ^M to go to column zero! */ | 2582 | /* But that means we cannot rely on ^M to go to column zero! */ |
| 2561 | CR = 0; | 2583 | CR (tty) = 0; |
| 2562 | /* LF can't be trusted either -- can alter hpos */ | 2584 | /* LF can't be trusted either -- can alter hpos */ |
| 2563 | /* if move at column 0 thru a line with TS_standout_mode */ | 2585 | /* if move at column 0 thru a line with TS_standout_mode */ |
| 2564 | Down = 0; | 2586 | Down (tty) = 0; |
| 2565 | } | 2587 | } |
| 2566 | 2588 | ||
| 2567 | /* Special handling for certain terminal types known to need it */ | 2589 | /* Special handling for certain terminal types known to need it */ |
| @@ -2569,7 +2591,7 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", | |||
| 2569 | if (!strcmp (terminal_type, "supdup")) | 2591 | if (!strcmp (terminal_type, "supdup")) |
| 2570 | { | 2592 | { |
| 2571 | TTY_MEMORY_BELOW_FRAME (tty) = 1; | 2593 | TTY_MEMORY_BELOW_FRAME (tty) = 1; |
| 2572 | Wcm.cm_losewrap = 1; | 2594 | tty->Wcm->cm_losewrap = 1; |
| 2573 | } | 2595 | } |
| 2574 | if (!strncmp (terminal_type, "c10", 3) | 2596 | if (!strncmp (terminal_type, "c10", 3) |
| 2575 | || !strcmp (terminal_type, "perq")) | 2597 | || !strcmp (terminal_type, "perq")) |
| @@ -2602,7 +2624,7 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", | |||
| 2602 | strcat (area, "\033\007!"); | 2624 | strcat (area, "\033\007!"); |
| 2603 | TS_termcap_modes = area; | 2625 | TS_termcap_modes = area; |
| 2604 | area += strlen (area) + 1; | 2626 | area += strlen (area) + 1; |
| 2605 | p = AbsPosition; | 2627 | p = AbsPosition (tty); |
| 2606 | /* Change all %+ parameters to %C, to handle | 2628 | /* Change all %+ parameters to %C, to handle |
| 2607 | values above 96 correctly for the C100. */ | 2629 | values above 96 correctly for the C100. */ |
| 2608 | while (*p) | 2630 | while (*p) |
| @@ -2613,11 +2635,11 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", | |||
| 2613 | } | 2635 | } |
| 2614 | } | 2636 | } |
| 2615 | 2637 | ||
| 2616 | FrameRows = FRAME_LINES (sf); | 2638 | FrameRows (tty) = FRAME_LINES (sf); |
| 2617 | FrameCols = FRAME_COLS (sf); | 2639 | FrameCols (tty) = FRAME_COLS (sf); |
| 2618 | specified_window = FRAME_LINES (sf); | 2640 | specified_window = FRAME_LINES (sf); |
| 2619 | 2641 | ||
| 2620 | if (Wcm_init () == -1) /* can't do cursor motion */ | 2642 | if (Wcm_init (tty) == -1) /* can't do cursor motion */ |
| 2621 | #ifdef VMS | 2643 | #ifdef VMS |
| 2622 | fatal ("Terminal type \"%s\" is not powerful enough to run Emacs.\n\ | 2644 | fatal ("Terminal type \"%s\" is not powerful enough to run Emacs.\n\ |
| 2623 | It lacks the ability to position the cursor.\n\ | 2645 | It lacks the ability to position the cursor.\n\ |
| @@ -2656,10 +2678,10 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", | |||
| 2656 | && TS_end_standout_mode | 2678 | && TS_end_standout_mode |
| 2657 | && !strcmp (TS_standout_mode, TS_end_standout_mode)); | 2679 | && !strcmp (TS_standout_mode, TS_end_standout_mode)); |
| 2658 | 2680 | ||
| 2659 | UseTabs = tabs_safe_p () && TabWidth == 8; | 2681 | UseTabs (tty) = tabs_safe_p (tty) && TabWidth (tty) == 8; |
| 2660 | 2682 | ||
| 2661 | TTY_SCROLL_REGION_OK (tty) | 2683 | TTY_SCROLL_REGION_OK (tty) |
| 2662 | = (Wcm.cm_abs | 2684 | = (tty->Wcm->cm_abs |
| 2663 | && (TS_set_window || TS_set_scroll_region || TS_set_scroll_region_1)); | 2685 | && (TS_set_window || TS_set_scroll_region || TS_set_scroll_region_1)); |
| 2664 | 2686 | ||
| 2665 | TTY_LINE_INS_DEL_OK (tty) | 2687 | TTY_LINE_INS_DEL_OK (tty) |
| @@ -2720,6 +2742,8 @@ The function should accept no arguments. */); | |||
| 2720 | 2742 | ||
| 2721 | defsubr (&Stty_display_color_p); | 2743 | defsubr (&Stty_display_color_p); |
| 2722 | defsubr (&Stty_display_color_cells); | 2744 | defsubr (&Stty_display_color_cells); |
| 2745 | |||
| 2746 | Fprovide (intern ("multi-tty"), Qnil); | ||
| 2723 | } | 2747 | } |
| 2724 | 2748 | ||
| 2725 | struct tty_output * | 2749 | struct tty_output * |
diff --git a/src/termchar.h b/src/termchar.h index a58dbc62125..33170d5a78e 100644 --- a/src/termchar.h +++ b/src/termchar.h | |||
| @@ -41,6 +41,10 @@ struct tty_output | |||
| 41 | int old_tty_valid; /* 1 if outer tty status has been recorded. */ | 41 | int old_tty_valid; /* 1 if outer tty status has been recorded. */ |
| 42 | 42 | ||
| 43 | 43 | ||
| 44 | /* Structure for info on cursor positioning. */ | ||
| 45 | |||
| 46 | struct cm *Wcm; | ||
| 47 | |||
| 44 | /* Redisplay. */ | 48 | /* Redisplay. */ |
| 45 | 49 | ||
| 46 | /* XXX This may cause problems with GC. */ | 50 | /* XXX This may cause problems with GC. */ |
diff --git a/src/xdisp.c b/src/xdisp.c index 79630ebab22..020f5736d31 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -9567,7 +9567,7 @@ select_frame_for_redisplay (frame) | |||
| 9567 | { | 9567 | { |
| 9568 | Lisp_Object tail, sym, val; | 9568 | Lisp_Object tail, sym, val; |
| 9569 | Lisp_Object old = selected_frame; | 9569 | Lisp_Object old = selected_frame; |
| 9570 | 9570 | ||
| 9571 | selected_frame = frame; | 9571 | selected_frame = frame; |
| 9572 | 9572 | ||
| 9573 | for (tail = XFRAME (frame)->param_alist; CONSP (tail); tail = XCDR (tail)) | 9573 | for (tail = XFRAME (frame)->param_alist; CONSP (tail); tail = XCDR (tail)) |
| @@ -13319,7 +13319,7 @@ try_window_id (w) | |||
| 13319 | 13319 | ||
| 13320 | /* On dumb terminals delete dvpos lines at the end | 13320 | /* On dumb terminals delete dvpos lines at the end |
| 13321 | before inserting dvpos empty lines. */ | 13321 | before inserting dvpos empty lines. */ |
| 13322 | if (!TTY_SCROLL_REGION_OK (CURTTY ())) | 13322 | if (!TTY_SCROLL_REGION_OK (FRAME_TTY (f))) |
| 13323 | ins_del_lines (end - dvpos, -dvpos); | 13323 | ins_del_lines (end - dvpos, -dvpos); |
| 13324 | 13324 | ||
| 13325 | /* Insert dvpos empty lines in front of | 13325 | /* Insert dvpos empty lines in front of |
| @@ -13340,7 +13340,7 @@ try_window_id (w) | |||
| 13340 | 13340 | ||
| 13341 | /* On a dumb terminal insert dvpos empty lines at the | 13341 | /* On a dumb terminal insert dvpos empty lines at the |
| 13342 | end. */ | 13342 | end. */ |
| 13343 | if (!TTY_SCROLL_REGION_OK (CURTTY ())) | 13343 | if (!TTY_SCROLL_REGION_OK (FRAME_TTY (f))) |
| 13344 | ins_del_lines (end + dvpos, -dvpos); | 13344 | ins_del_lines (end + dvpos, -dvpos); |
| 13345 | } | 13345 | } |
| 13346 | 13346 | ||