Mercurial > hg > xemacs-beta
comparison src/indent.c @ 16:0293115a14e9 r19-15b91
Import from CVS: tag r19-15b91
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:49:20 +0200 |
parents | 376386a54a3c |
children | 859a2309aef8 |
comparison
equal
deleted
inserted
replaced
15:ad457d5f7d04 | 16:0293115a14e9 |
---|---|
127 int col; | 127 int col; |
128 int tab_seen; | 128 int tab_seen; |
129 int tab_width = XINT (buf->tab_width); | 129 int tab_width = XINT (buf->tab_width); |
130 int post_tab; | 130 int post_tab; |
131 Bufpos pos = init_pos; | 131 Bufpos pos = init_pos; |
132 Emchar c; | |
132 | 133 |
133 if (tab_width <= 0 || tab_width > 1000) tab_width = 8; | 134 if (tab_width <= 0 || tab_width > 1000) tab_width = 8; |
134 col = tab_seen = post_tab = 0; | 135 col = tab_seen = post_tab = 0; |
135 | 136 |
136 while (1) | 137 while (1) |
137 { | 138 { |
138 if (pos <= BUF_BEGV (buf)) | 139 if (pos <= BUF_BEGV (buf)) |
139 break; | 140 break; |
140 | 141 |
141 pos--; | 142 pos--; |
142 if (BUF_FETCH_CHAR (buf, pos) == '\t') | 143 c = BUF_FETCH_CHAR (buf, pos); |
144 if (c == '\t') | |
143 { | 145 { |
144 if (tab_seen) | 146 if (tab_seen) |
145 col = ((col + tab_width) / tab_width) * tab_width; | 147 col = ((col + tab_width) / tab_width) * tab_width; |
146 | 148 |
147 post_tab += col; | 149 post_tab += col; |
148 col = 0; | 150 col = 0; |
149 tab_seen = 1; | 151 tab_seen = 1; |
150 } | 152 } |
151 else if (BUF_FETCH_CHAR (buf, pos) == '\n' || | 153 else if (c == '\n' || |
152 (EQ (buf->selective_display, Qt) && | 154 (EQ (buf->selective_display, Qt) && c == '\r')) |
153 BUF_FETCH_CHAR (buf, pos) == '\r')) | |
154 break; | 155 break; |
155 else | 156 else |
156 { | 157 { |
157 /* #### This needs updating to handle the new redisplay. */ | 158 /* #### This needs updating to handle the new redisplay. */ |
158 /* #### FSFmacs looks at ctl_arrow, display tables. | 159 /* #### FSFmacs looks at ctl_arrow, display tables. |
162 XWINDOW (selected_window), | 163 XWINDOW (selected_window), |
163 pos, dp, 0, col, 0, 0, 0); | 164 pos, dp, 0, col, 0, 0, 0); |
164 col += (displayed_glyphs->columns | 165 col += (displayed_glyphs->columns |
165 - (displayed_glyphs->begin_columns | 166 - (displayed_glyphs->begin_columns |
166 + displayed_glyphs->end_columns)); | 167 + displayed_glyphs->end_columns)); |
167 #else | 168 #else /* XEmacs */ |
168 col++; | 169 col ++; |
169 #endif | 170 #endif /* XEmacs */ |
170 } | 171 } |
171 } | 172 } |
172 | 173 |
173 if (tab_seen) | 174 if (tab_seen) |
174 { | 175 { |
356 int goal; | 357 int goal; |
357 Bufpos end; | 358 Bufpos end; |
358 int tab_width = XINT (buf->tab_width); | 359 int tab_width = XINT (buf->tab_width); |
359 | 360 |
360 int prev_col = 0; | 361 int prev_col = 0; |
361 Emchar c = 0; | 362 Emchar c; |
362 | 363 |
363 XSETBUFFER (buffer, buf); | 364 XSETBUFFER (buffer, buf); |
364 if (tab_width <= 0 || tab_width > 1000) tab_width = 8; | 365 if (tab_width <= 0 || tab_width > 1000) tab_width = 8; |
365 CHECK_NATNUM (column); | 366 CHECK_NATNUM (column); |
366 goal = XINT (column); | 367 goal = XINT (column); |
401 XWINDOW (Fselected_window (Qnil)), | 402 XWINDOW (Fselected_window (Qnil)), |
402 pos, dp, 0, col, 0, 0, 0); | 403 pos, dp, 0, col, 0, 0, 0); |
403 col += (displayed_glyphs->columns | 404 col += (displayed_glyphs->columns |
404 - (displayed_glyphs->begin_columns | 405 - (displayed_glyphs->begin_columns |
405 + displayed_glyphs->end_columns)); | 406 + displayed_glyphs->end_columns)); |
406 #else | 407 #else /* XEmacs */ |
407 col++; | 408 col ++; |
408 #endif | 409 #endif /* XEmacs */ |
409 } | 410 } |
410 | 411 |
411 pos++; | 412 pos++; |
412 } | 413 } |
413 | 414 |