aboutsummaryrefslogtreecommitdiffstats
path: root/src/term.c
diff options
context:
space:
mode:
authorJoakim Verona2010-10-18 22:05:07 +0200
committerJoakim Verona2010-10-18 22:05:07 +0200
commit13cfe8df462ab8da9f0028e16cc84dcaceaca3d1 (patch)
tree723f254768f9e503504ab4c8b68801f80a56591a /src/term.c
parent35f4b80a934b299b3b18e62f5db44f64c240e65b (diff)
parente48eb34332dc91de823314090451459ba2ffacbf (diff)
downloademacs-13cfe8df462ab8da9f0028e16cc84dcaceaca3d1.tar.gz
emacs-13cfe8df462ab8da9f0028e16cc84dcaceaca3d1.zip
merge from upstream
Diffstat (limited to 'src/term.c')
-rw-r--r--src/term.c164
1 files changed, 76 insertions, 88 deletions
diff --git a/src/term.c b/src/term.c
index f090cdd2792..4baea231de3 100644
--- a/src/term.c
+++ b/src/term.c
@@ -23,7 +23,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
23#include <config.h> 23#include <config.h>
24#include <stdio.h> 24#include <stdio.h>
25#include <ctype.h> 25#include <ctype.h>
26#include <string.h>
27#include <errno.h> 26#include <errno.h>
28#include <sys/file.h> 27#include <sys/file.h>
29 28
@@ -31,10 +30,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
31#include <unistd.h> 30#include <unistd.h>
32#endif 31#endif
33 32
34#ifdef HAVE_SYS_IOCTL_H
35#include <sys/ioctl.h>
36#endif
37
38#include <signal.h> 33#include <signal.h>
39#include <stdarg.h> 34#include <stdarg.h>
40#include <setjmp.h> 35#include <setjmp.h>
@@ -247,7 +242,6 @@ tty_set_terminal_modes (struct terminal *terminal)
247 cmputc ('\n'); 242 cmputc ('\n');
248 } 243 }
249 244
250 OUTPUT_IF (tty, tty->TS_termcap_modes);
251 OUTPUT_IF (tty, visible_cursor ? tty->TS_cursor_visible : tty->TS_cursor_normal); 245 OUTPUT_IF (tty, visible_cursor ? tty->TS_cursor_visible : tty->TS_cursor_normal);
252 OUTPUT_IF (tty, tty->TS_keypad_mode); 246 OUTPUT_IF (tty, tty->TS_keypad_mode);
253 losecursor (tty); 247 losecursor (tty);
@@ -599,7 +593,7 @@ encode_terminal_code (struct glyph *src, int src_len, struct coding_system *codi
599 if (src->u.cmp.automatic) 593 if (src->u.cmp.automatic)
600 { 594 {
601 gstring = composition_gstring_from_id (src->u.cmp.id); 595 gstring = composition_gstring_from_id (src->u.cmp.id);
602 required = src->u.cmp.to + 1 - src->u.cmp.from; 596 required = src->slice.cmp.to + 1 - src->slice.cmp.from;
603 } 597 }
604 else 598 else
605 { 599 {
@@ -616,7 +610,7 @@ encode_terminal_code (struct glyph *src, int src_len, struct coding_system *codi
616 } 610 }
617 611
618 if (src->u.cmp.automatic) 612 if (src->u.cmp.automatic)
619 for (i = src->u.cmp.from; i <= src->u.cmp.to; i++) 613 for (i = src->slice.cmp.from; i <= src->slice.cmp.to; i++)
620 { 614 {
621 Lisp_Object g = LGSTRING_GLYPH (gstring, i); 615 Lisp_Object g = LGSTRING_GLYPH (gstring, i);
622 int c = LGLYPH_CHAR (g); 616 int c = LGLYPH_CHAR (g);
@@ -1796,8 +1790,8 @@ append_composite_glyph (struct it *it)
1796 { 1790 {
1797 glyph->u.cmp.automatic = 1; 1791 glyph->u.cmp.automatic = 1;
1798 glyph->u.cmp.id = it->cmp_it.id; 1792 glyph->u.cmp.id = it->cmp_it.id;
1799 glyph->u.cmp.from = it->cmp_it.from; 1793 glyph->slice.cmp.from = it->cmp_it.from;
1800 glyph->u.cmp.to = it->cmp_it.to - 1; 1794 glyph->slice.cmp.to = it->cmp_it.to - 1;
1801 } 1795 }
1802 1796
1803 glyph->face_id = it->face_id; 1797 glyph->face_id = it->face_id;
@@ -2619,9 +2613,10 @@ term_clear_mouse_face (void)
2619 If POS is after end of W, return end of last line in W. 2613 If POS is after end of W, return end of last line in W.
2620 - taken from msdos.c */ 2614 - taken from msdos.c */
2621static int 2615static int
2622fast_find_position (struct window *w, int pos, int *hpos, int *vpos) 2616fast_find_position (struct window *w, EMACS_INT pos, int *hpos, int *vpos)
2623{ 2617{
2624 int i, lastcol, line_start_position, maybe_next_line_p = 0; 2618 int i, lastcol, maybe_next_line_p = 0;
2619 EMACS_INT line_start_position;
2625 int yb = window_text_bottom_y (w); 2620 int yb = window_text_bottom_y (w);
2626 struct glyph_row *row = MATRIX_ROW (w->current_matrix, 0), *best_row = row; 2621 struct glyph_row *row = MATRIX_ROW (w->current_matrix, 0), *best_row = row;
2627 2622
@@ -2659,7 +2654,7 @@ fast_find_position (struct window *w, int pos, int *hpos, int *vpos)
2659 for (i = 0; i < row->used[TEXT_AREA]; i++) 2654 for (i = 0; i < row->used[TEXT_AREA]; i++)
2660 { 2655 {
2661 struct glyph *glyph = row->glyphs[TEXT_AREA] + i; 2656 struct glyph *glyph = row->glyphs[TEXT_AREA] + i;
2662 int charpos; 2657 EMACS_INT charpos;
2663 2658
2664 charpos = glyph->charpos; 2659 charpos = glyph->charpos;
2665 if (charpos == pos) 2660 if (charpos == pos)
@@ -2720,7 +2715,8 @@ term_mouse_highlight (struct frame *f, int x, int y)
2720 && XFASTINT (w->last_modified) == BUF_MODIFF (b) 2715 && XFASTINT (w->last_modified) == BUF_MODIFF (b)
2721 && XFASTINT (w->last_overlay_modified) == BUF_OVERLAY_MODIFF (b)) 2716 && XFASTINT (w->last_overlay_modified) == BUF_OVERLAY_MODIFF (b))
2722 { 2717 {
2723 int pos, i, nrows = w->current_matrix->nrows; 2718 int i, nrows = w->current_matrix->nrows;
2719 EMACS_INT pos;
2724 struct glyph_row *row; 2720 struct glyph_row *row;
2725 struct glyph *glyph; 2721 struct glyph *glyph;
2726 2722
@@ -2764,7 +2760,8 @@ term_mouse_highlight (struct frame *f, int x, int y)
2764 /* Check for mouse-face. */ 2760 /* Check for mouse-face. */
2765 { 2761 {
2766 Lisp_Object mouse_face, overlay, position, *overlay_vec; 2762 Lisp_Object mouse_face, overlay, position, *overlay_vec;
2767 int noverlays, obegv, ozv; 2763 int noverlays;
2764 EMACS_INT obegv, ozv;
2768 struct buffer *obuf; 2765 struct buffer *obuf;
2769 2766
2770 /* If we get an out-of-range value, return now; avoid an error. */ 2767 /* If we get an out-of-range value, return now; avoid an error. */
@@ -3405,6 +3402,15 @@ init_tty (const char *name, const char *terminal_type, int must_succeed)
3405 tty->Wcm = (struct cm *) xmalloc (sizeof (struct cm)); 3402 tty->Wcm = (struct cm *) xmalloc (sizeof (struct cm));
3406 Wcm_clear (tty); 3403 Wcm_clear (tty);
3407 3404
3405 encode_terminal_src_size = 0;
3406 encode_terminal_dst_size = 0;
3407
3408#ifdef HAVE_GPM
3409 terminal->mouse_position_hook = term_mouse_position;
3410 mouse_face_window = Qnil;
3411#endif
3412
3413
3408#ifndef DOS_NT 3414#ifndef DOS_NT
3409 set_tty_hooks (terminal); 3415 set_tty_hooks (terminal);
3410 3416
@@ -3458,78 +3464,6 @@ init_tty (const char *name, const char *terminal_type, int must_succeed)
3458 3464
3459 add_keyboard_wait_descriptor (fileno (tty->input)); 3465 add_keyboard_wait_descriptor (fileno (tty->input));
3460 3466
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); 3467 Wcm_clear (tty);
3534 3468
3535 tty->termcap_term_buffer = (char *) xmalloc (buffer_size); 3469 tty->termcap_term_buffer = (char *) xmalloc (buffer_size);
@@ -3681,7 +3615,61 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
3681 tty->TF_underscore = tgetflag ("ul"); 3615 tty->TF_underscore = tgetflag ("ul");
3682 tty->TF_teleray = tgetflag ("xt"); 3616 tty->TF_teleray = tgetflag ("xt");
3683 3617
3684#endif /* !DOS_NT */ 3618#else /* DOS_NT */
3619#ifdef WINDOWSNT
3620 {
3621 struct frame *f = XFRAME (selected_frame);
3622
3623 initialize_w32_display (terminal);
3624
3625 FrameRows (tty) = FRAME_LINES (f);
3626 FrameCols (tty) = FRAME_COLS (f);
3627 tty->specified_window = FRAME_LINES (f);
3628
3629 FRAME_CAN_HAVE_SCROLL_BARS (f) = 0;
3630 FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none;
3631 terminal->char_ins_del_ok = 1;
3632 baud_rate = 19200;
3633 }
3634#else /* MSDOS */
3635 {
3636 int height, width;
3637 if (strcmp (terminal_type, "internal") == 0)
3638 terminal->type = output_msdos_raw;
3639 initialize_msdos_display (terminal);
3640
3641 get_tty_size (fileno (tty->input), &width, &height);
3642 FrameCols (tty) = width;
3643 FrameRows (tty) = height;
3644 terminal->char_ins_del_ok = 0;
3645 init_baud_rate (fileno (tty->input));
3646 }
3647#endif /* MSDOS */
3648 tty->output = stdout;
3649 tty->input = stdin;
3650 /* The following two are inaccessible from w32console.c. */
3651 terminal->delete_frame_hook = &tty_free_frame_resources;
3652 terminal->delete_terminal_hook = &delete_tty;
3653
3654 tty->name = xstrdup (name);
3655 terminal->name = xstrdup (name);
3656 tty->type = xstrdup (terminal_type);
3657
3658 add_keyboard_wait_descriptor (0);
3659
3660 tty->delete_in_insert_mode = 1;
3661
3662 UseTabs (tty) = 0;
3663 terminal->scroll_region_ok = 0;
3664
3665 /* Seems to insert lines when it's not supposed to, messing up the
3666 display. In doing a trace, it didn't seem to be called much, so I
3667 don't think we're losing anything by turning it off. */
3668 terminal->line_ins_del_ok = 0;
3669
3670 tty->TN_max_colors = 16; /* Required to be non-zero for tty-display-color-p */
3671#endif /* DOS_NT */
3672
3685 terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); 3673 terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
3686 init_kboard (terminal->kboard); 3674 init_kboard (terminal->kboard);
3687 terminal->kboard->Vwindow_system = Qnil; 3675 terminal->kboard->Vwindow_system = Qnil;