comparison src/indent.c @ 13185:5b1671bd3cc1

(buffer_display_table): Use DISP_TABLE_P. Return type is now struct Lisp_Char_Table * since display tables are now char-tables. (character_width, disptab_matches_widthtab, recompute_width_table) (current_column, Fmove_to_column, compute_motion): Corresponding changes.
author Richard M. Stallman <rms@gnu.org>
date Wed, 11 Oct 1995 17:12:59 +0000
parents e44b06fc718d
children 941c37982f37
comparison
equal deleted inserted replaced
13184:04170e19b3d4 13185:5b1671bd3cc1
49 /* Value of MODIFF when current_column was called */ 49 /* Value of MODIFF when current_column was called */
50 int last_known_column_modified; 50 int last_known_column_modified;
51 51
52 /* Get the display table to use for the current buffer. */ 52 /* Get the display table to use for the current buffer. */
53 53
54 struct Lisp_Vector * 54 struct Lisp_Char_Table *
55 buffer_display_table () 55 buffer_display_table ()
56 { 56 {
57 Lisp_Object thisbuf; 57 Lisp_Object thisbuf;
58 58
59 thisbuf = current_buffer->display_table; 59 thisbuf = current_buffer->display_table;
60 if (VECTORP (thisbuf) && XVECTOR (thisbuf)->size == DISP_TABLE_SIZE) 60 if (DISP_TABLE_P (thisbuf))
61 return XVECTOR (thisbuf); 61 return XCHAR_TABLE (thisbuf);
62 if (VECTORP (Vstandard_display_table) 62 if (DISP_TABLE_P (Vstandard_display_table))
63 && XVECTOR (Vstandard_display_table)->size == DISP_TABLE_SIZE) 63 return XCHAR_TABLE (Vstandard_display_table);
64 return XVECTOR (Vstandard_display_table);
65 return 0; 64 return 0;
66 } 65 }
67 66
68 /* Width run cache considerations. */ 67 /* Width run cache considerations. */
69 68
70 /* Return the width of character C under display table DP. */ 69 /* Return the width of character C under display table DP. */
71 70
72 static int 71 static int
73 character_width (c, dp) 72 character_width (c, dp)
74 int c; 73 int c;
75 struct Lisp_Vector *dp; 74 struct Lisp_Char_Table *dp;
76 { 75 {
77 Lisp_Object elt; 76 Lisp_Object elt;
78 77
79 /* These width computations were determined by examining the cases 78 /* These width computations were determined by examining the cases
80 in display_text_line. */ 79 in display_text_line. */
104 /* Return true iff the display table DISPTAB specifies the same widths 103 /* Return true iff the display table DISPTAB specifies the same widths
105 for characters as WIDTHTAB. We use this to decide when to 104 for characters as WIDTHTAB. We use this to decide when to
106 invalidate the buffer's width_run_cache. */ 105 invalidate the buffer's width_run_cache. */
107 int 106 int
108 disptab_matches_widthtab (disptab, widthtab) 107 disptab_matches_widthtab (disptab, widthtab)
109 struct Lisp_Vector *disptab; 108 struct Lisp_Char_Table *disptab;
110 struct Lisp_Vector *widthtab; 109 struct Lisp_Vector *widthtab;
111 { 110 {
112 int i; 111 int i;
113 112
114 if (widthtab->size != 256) 113 if (widthtab->size != 256)
124 123
125 /* Recompute BUF's width table, using the display table DISPTAB. */ 124 /* Recompute BUF's width table, using the display table DISPTAB. */
126 void 125 void
127 recompute_width_table (buf, disptab) 126 recompute_width_table (buf, disptab)
128 struct buffer *buf; 127 struct buffer *buf;
129 struct Lisp_Vector *disptab; 128 struct Lisp_Char_Table *disptab;
130 { 129 {
131 int i; 130 int i;
132 struct Lisp_Vector *widthtab; 131 struct Lisp_Vector *widthtab;
133 132
134 if (!VECTORP (buf->width_table)) 133 if (!VECTORP (buf->width_table))
200 register int tab_seen; 199 register int tab_seen;
201 int post_tab; 200 int post_tab;
202 register int c; 201 register int c;
203 register int tab_width = XINT (current_buffer->tab_width); 202 register int tab_width = XINT (current_buffer->tab_width);
204 int ctl_arrow = !NILP (current_buffer->ctl_arrow); 203 int ctl_arrow = !NILP (current_buffer->ctl_arrow);
205 register struct Lisp_Vector *dp = buffer_display_table (); 204 register struct Lisp_Char_Table *dp = buffer_display_table ();
206 int stopchar; 205 int stopchar;
207 206
208 if (point == last_known_column_point 207 if (point == last_known_column_point
209 && MODIFF == last_known_column_modified) 208 && MODIFF == last_known_column_modified)
210 return last_known_column; 209 return last_known_column;
287 register int tab_seen; 286 register int tab_seen;
288 int post_tab; 287 int post_tab;
289 register int c; 288 register int c;
290 register int tab_width = XINT (current_buffer->tab_width); 289 register int tab_width = XINT (current_buffer->tab_width);
291 int ctl_arrow = !NILP (current_buffer->ctl_arrow); 290 int ctl_arrow = !NILP (current_buffer->ctl_arrow);
292 register struct Lisp_Vector *dp = buffer_display_table (); 291 register struct Lisp_Char_Table *dp = buffer_display_table ();
293 int b, e; 292 int b, e;
294 293
295 if (NILP (end)) 294 if (NILP (end))
296 e = XSTRING (string)->size; 295 e = XSTRING (string)->size;
297 else 296 else
483 register int col = current_column (); 482 register int col = current_column ();
484 register int goal; 483 register int goal;
485 register int end; 484 register int end;
486 register int tab_width = XINT (current_buffer->tab_width); 485 register int tab_width = XINT (current_buffer->tab_width);
487 register int ctl_arrow = !NILP (current_buffer->ctl_arrow); 486 register int ctl_arrow = !NILP (current_buffer->ctl_arrow);
488 register struct Lisp_Vector *dp = buffer_display_table (); 487 register struct Lisp_Char_Table *dp = buffer_display_table ();
489 488
490 Lisp_Object val; 489 Lisp_Object val;
491 int prev_col; 490 int prev_col;
492 int c; 491 int c;
493 492
647 646
648 register int pos; 647 register int pos;
649 register int c; 648 register int c;
650 register int tab_width = XFASTINT (current_buffer->tab_width); 649 register int tab_width = XFASTINT (current_buffer->tab_width);
651 register int ctl_arrow = !NILP (current_buffer->ctl_arrow); 650 register int ctl_arrow = !NILP (current_buffer->ctl_arrow);
652 register struct Lisp_Vector *dp = window_display_table (win); 651 register struct Lisp_Char_Table *dp = window_display_table (win);
653 int selective 652 int selective
654 = (INTEGERP (current_buffer->selective_display) 653 = (INTEGERP (current_buffer->selective_display)
655 ? XINT (current_buffer->selective_display) 654 ? XINT (current_buffer->selective_display)
656 : !NILP (current_buffer->selective_display) ? -1 : 0); 655 : !NILP (current_buffer->selective_display) ? -1 : 0);
657 int prev_vpos = vpos, prev_hpos = 0; 656 int prev_vpos = vpos, prev_hpos = 0;