aboutsummaryrefslogtreecommitdiffstats
path: root/src/term.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/term.c')
-rw-r--r--src/term.c166
1 files changed, 79 insertions, 87 deletions
diff --git a/src/term.c b/src/term.c
index f090cdd2792..a2f7a9cbabe 100644
--- a/src/term.c
+++ b/src/term.c
@@ -31,10 +31,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
31#include <unistd.h> 31#include <unistd.h>
32#endif 32#endif
33 33
34#ifdef HAVE_SYS_IOCTL_H
35#include <sys/ioctl.h>
36#endif
37
38#include <signal.h> 34#include <signal.h>
39#include <stdarg.h> 35#include <stdarg.h>
40#include <setjmp.h> 36#include <setjmp.h>
@@ -247,7 +243,6 @@ tty_set_terminal_modes (struct terminal *terminal)
247 cmputc ('\n'); 243 cmputc ('\n');
248 } 244 }
249 245
250 OUTPUT_IF (tty, tty->TS_termcap_modes);
251 OUTPUT_IF (tty, visible_cursor ? tty->TS_cursor_visible : tty->TS_cursor_normal); 246 OUTPUT_IF (tty, visible_cursor ? tty->TS_cursor_visible : tty->TS_cursor_normal);
252 OUTPUT_IF (tty, tty->TS_keypad_mode); 247 OUTPUT_IF (tty, tty->TS_keypad_mode);
253 losecursor (tty); 248 losecursor (tty);
@@ -599,7 +594,7 @@ encode_terminal_code (struct glyph *src, int src_len, struct coding_system *codi
599 if (src->u.cmp.automatic) 594 if (src->u.cmp.automatic)
600 { 595 {
601 gstring = composition_gstring_from_id (src->u.cmp.id); 596 gstring = composition_gstring_from_id (src->u.cmp.id);
602 required = src->u.cmp.to + 1 - src->u.cmp.from; 597 required = src->slice.cmp.to + 1 - src->slice.cmp.from;
603 } 598 }
604 else 599 else
605 { 600 {
@@ -616,7 +611,7 @@ encode_terminal_code (struct glyph *src, int src_len, struct coding_system *codi
616 } 611 }
617 612
618 if (src->u.cmp.automatic) 613 if (src->u.cmp.automatic)
619 for (i = src->u.cmp.from; i <= src->u.cmp.to; i++) 614 for (i = src->slice.cmp.from; i <= src->slice.cmp.to; i++)
620 { 615 {
621 Lisp_Object g = LGSTRING_GLYPH (gstring, i); 616 Lisp_Object g = LGSTRING_GLYPH (gstring, i);
622 int c = LGLYPH_CHAR (g); 617 int c = LGLYPH_CHAR (g);
@@ -1796,8 +1791,8 @@ append_composite_glyph (struct it *it)
1796 { 1791 {
1797 glyph->u.cmp.automatic = 1; 1792 glyph->u.cmp.automatic = 1;
1798 glyph->u.cmp.id = it->cmp_it.id; 1793 glyph->u.cmp.id = it->cmp_it.id;
1799 glyph->u.cmp.from = it->cmp_it.from; 1794 glyph->slice.cmp.from = it->cmp_it.from;
1800 glyph->u.cmp.to = it->cmp_it.to - 1; 1795 glyph->slice.cmp.to = it->cmp_it.to - 1;
1801 } 1796 }
1802 1797
1803 glyph->face_id = it->face_id; 1798 glyph->face_id = it->face_id;
@@ -2619,9 +2614,10 @@ term_clear_mouse_face (void)
2619 If POS is after end of W, return end of last line in W. 2614 If POS is after end of W, return end of last line in W.
2620 - taken from msdos.c */ 2615 - taken from msdos.c */
2621static int 2616static int
2622fast_find_position (struct window *w, int pos, int *hpos, int *vpos) 2617fast_find_position (struct window *w, EMACS_INT pos, int *hpos, int *vpos)
2623{ 2618{
2624 int i, lastcol, line_start_position, maybe_next_line_p = 0; 2619 int i, lastcol, maybe_next_line_p = 0;
2620 EMACS_INT line_start_position;
2625 int yb = window_text_bottom_y (w); 2621 int yb = window_text_bottom_y (w);
2626 struct glyph_row *row = MATRIX_ROW (w->current_matrix, 0), *best_row = row; 2622 struct glyph_row *row = MATRIX_ROW (w->current_matrix, 0), *best_row = row;
2627 2623
@@ -2659,7 +2655,7 @@ fast_find_position (struct window *w, int pos, int *hpos, int *vpos)
2659 for (i = 0; i < row->used[TEXT_AREA]; i++) 2655 for (i = 0; i < row->used[TEXT_AREA]; i++)
2660 { 2656 {
2661 struct glyph *glyph = row->glyphs[TEXT_AREA] + i; 2657 struct glyph *glyph = row->glyphs[TEXT_AREA] + i;
2662 int charpos; 2658 EMACS_INT charpos;
2663 2659
2664 charpos = glyph->charpos; 2660 charpos = glyph->charpos;
2665 if (charpos == pos) 2661 if (charpos == pos)
@@ -2720,7 +2716,8 @@ term_mouse_highlight (struct frame *f, int x, int y)
2720 && XFASTINT (w->last_modified) == BUF_MODIFF (b) 2716 && XFASTINT (w->last_modified) == BUF_MODIFF (b)
2721 && XFASTINT (w->last_overlay_modified) == BUF_OVERLAY_MODIFF (b)) 2717 && XFASTINT (w->last_overlay_modified) == BUF_OVERLAY_MODIFF (b))
2722 { 2718 {
2723 int pos, i, nrows = w->current_matrix->nrows; 2719 int i, nrows = w->current_matrix->nrows;
2720 EMACS_INT pos;
2724 struct glyph_row *row; 2721 struct glyph_row *row;
2725 struct glyph *glyph; 2722 struct glyph *glyph;
2726 2723
@@ -2764,7 +2761,8 @@ term_mouse_highlight (struct frame *f, int x, int y)
2764 /* Check for mouse-face. */ 2761 /* Check for mouse-face. */
2765 { 2762 {
2766 Lisp_Object mouse_face, overlay, position, *overlay_vec; 2763 Lisp_Object mouse_face, overlay, position, *overlay_vec;
2767 int noverlays, obegv, ozv; 2764 int noverlays;
2765 EMACS_INT obegv, ozv;
2768 struct buffer *obuf; 2766 struct buffer *obuf;
2769 2767
2770 /* If we get an out-of-range value, return now; avoid an error. */ 2768 /* If we get an out-of-range value, return now; avoid an error. */
@@ -3405,6 +3403,15 @@ init_tty (const char *name, const char *terminal_type, int must_succeed)
3405 tty->Wcm = (struct cm *) xmalloc (sizeof (struct cm)); 3403 tty->Wcm = (struct cm *) xmalloc (sizeof (struct cm));
3406 Wcm_clear (tty); 3404 Wcm_clear (tty);
3407 3405
3406 encode_terminal_src_size = 0;
3407 encode_terminal_dst_size = 0;
3408
3409#ifdef HAVE_GPM
3410 terminal->mouse_position_hook = term_mouse_position;
3411 mouse_face_window = Qnil;
3412#endif
3413
3414
3408#ifndef DOS_NT 3415#ifndef DOS_NT
3409 set_tty_hooks (terminal); 3416 set_tty_hooks (terminal);
3410 3417
@@ -3458,78 +3465,6 @@ init_tty (const char *name, const char *terminal_type, int must_succeed)
3458 3465
3459 add_keyboard_wait_descriptor (fileno (tty->input)); 3466 add_keyboard_wait_descriptor (fileno (tty->input));
3460 3467
3461#endif /* !DOS_NT */
3462
3463 encode_terminal_src_size = 0;
3464 encode_terminal_dst_size = 0;
3465
3466#ifdef HAVE_GPM
3467 terminal->mouse_position_hook = term_mouse_position;
3468 mouse_face_window = Qnil;
3469#endif
3470
3471#ifdef DOS_NT
3472#ifdef WINDOWSNT
3473 initialize_w32_display (terminal);
3474#else /* MSDOS */
3475 if (strcmp (terminal_type, "internal") == 0)
3476 terminal->type = output_msdos_raw;
3477 initialize_msdos_display (terminal);
3478#endif /* MSDOS */
3479 tty->output = stdout;
3480 tty->input = stdin;
3481 /* The following two are inaccessible from w32console.c. */
3482 terminal->delete_frame_hook = &tty_free_frame_resources;
3483 terminal->delete_terminal_hook = &delete_tty;
3484
3485 tty->name = xstrdup (name);
3486 terminal->name = xstrdup (name);
3487 tty->type = xstrdup (terminal_type);
3488
3489 add_keyboard_wait_descriptor (0);
3490
3491 Wcm_clear (tty);
3492
3493#ifdef WINDOWSNT
3494 {
3495 struct frame *f = XFRAME (selected_frame);
3496
3497 FrameRows (tty) = FRAME_LINES (f);
3498 FrameCols (tty) = FRAME_COLS (f);
3499 tty->specified_window = FRAME_LINES (f);
3500
3501 FRAME_CAN_HAVE_SCROLL_BARS (f) = 0;
3502 FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none;
3503 }
3504#else /* MSDOS */
3505 {
3506 int height, width;
3507 get_tty_size (fileno (tty->input), &width, &height);
3508 FrameCols (tty) = width;
3509 FrameRows (tty) = height;
3510 }
3511#endif /* MSDOS */
3512 tty->delete_in_insert_mode = 1;
3513
3514 UseTabs (tty) = 0;
3515 terminal->scroll_region_ok = 0;
3516
3517 /* Seems to insert lines when it's not supposed to, messing up the
3518 display. In doing a trace, it didn't seem to be called much, so I
3519 don't think we're losing anything by turning it off. */
3520 terminal->line_ins_del_ok = 0;
3521#ifdef WINDOWSNT
3522 terminal->char_ins_del_ok = 1;
3523 baud_rate = 19200;
3524#else /* MSDOS */
3525 terminal->char_ins_del_ok = 0;
3526 init_baud_rate (fileno (tty->input));
3527#endif /* MSDOS */
3528
3529 tty->TN_max_colors = 16; /* Required to be non-zero for tty-display-color-p */
3530
3531#else /* not DOS_NT */
3532
3533 Wcm_clear (tty); 3468 Wcm_clear (tty);
3534 3469
3535 tty->termcap_term_buffer = (char *) xmalloc (buffer_size); 3470 tty->termcap_term_buffer = (char *) xmalloc (buffer_size);
@@ -3681,7 +3616,64 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
3681 tty->TF_underscore = tgetflag ("ul"); 3616 tty->TF_underscore = tgetflag ("ul");
3682 tty->TF_teleray = tgetflag ("xt"); 3617 tty->TF_teleray = tgetflag ("xt");
3683 3618
3684#endif /* !DOS_NT */ 3619#else /* DOS_NT */
3620#ifdef WINDOWSNT
3621 {
3622 struct frame *f = XFRAME (selected_frame);
3623
3624 initialize_w32_display (terminal);
3625
3626 FrameRows (tty) = FRAME_LINES (f);
3627 FrameCols (tty) = FRAME_COLS (f);
3628 tty->specified_window = FRAME_LINES (f);
3629
3630 FRAME_CAN_HAVE_SCROLL_BARS (f) = 0;
3631 FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none;
3632 terminal->char_ins_del_ok = 1;
3633 baud_rate = 19200;
3634 }
3635#else /* MSDOS */
3636 {
3637 int height, width;
3638 if (strcmp (terminal_type, "internal") == 0)
3639 terminal->type = output_msdos_raw;
3640 initialize_msdos_display (terminal);
3641
3642 get_tty_size (fileno (tty->input), &width, &height);
3643 FrameCols (tty) = width;
3644 FrameRows (tty) = height;
3645 terminal->char_ins_del_ok = 0;
3646 init_baud_rate (fileno (tty->input));
3647 }
3648#endif /* MSDOS */
3649 tty->output = stdout;
3650 tty->input = stdin;
3651 /* The following two are inaccessible from w32console.c. */
3652 terminal->delete_frame_hook = &tty_free_frame_resources;
3653 terminal->delete_terminal_hook = &delete_tty;
3654
3655 tty->name = xstrdup (name);
3656 terminal->name = xstrdup (name);
3657 tty->type = xstrdup (terminal_type);
3658
3659 add_keyboard_wait_descriptor (0);
3660
3661 /* FIXME: this should be removed, done earlier. */
3662 Wcm_clear (tty);
3663
3664 tty->delete_in_insert_mode = 1;
3665
3666 UseTabs (tty) = 0;
3667 terminal->scroll_region_ok = 0;
3668
3669 /* Seems to insert lines when it's not supposed to, messing up the
3670 display. In doing a trace, it didn't seem to be called much, so I
3671 don't think we're losing anything by turning it off. */
3672 terminal->line_ins_del_ok = 0;
3673
3674 tty->TN_max_colors = 16; /* Required to be non-zero for tty-display-color-p */
3675#endif /* DOS_NT */
3676
3685 terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); 3677 terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
3686 init_kboard (terminal->kboard); 3678 init_kboard (terminal->kboard);
3687 terminal->kboard->Vwindow_system = Qnil; 3679 terminal->kboard->Vwindow_system = Qnil;