Mercurial > hg > xemacs-beta
comparison src/indent.c @ 422:95016f13131a r21-2-19
Import from CVS: tag r21-2-19
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:25:01 +0200 |
parents | 41dbb7a9d5f2 |
children |
comparison
equal
deleted
inserted
replaced
421:fff06e11db74 | 422:95016f13131a |
---|---|
187 { | 187 { |
188 last_known_column_buffer = buf; | 188 last_known_column_buffer = buf; |
189 last_known_column = col; | 189 last_known_column = col; |
190 last_known_column_point = init_pos; | 190 last_known_column_point = init_pos; |
191 last_known_column_modified = BUF_MODIFF (buf); | 191 last_known_column_modified = BUF_MODIFF (buf); |
192 } | |
193 | |
194 return col; | |
195 } | |
196 | |
197 int | |
198 string_column_at_point (struct Lisp_String* s, Bufpos init_pos, int tab_width) | |
199 { | |
200 int col; | |
201 int tab_seen; | |
202 int post_tab; | |
203 Bufpos pos = init_pos; | |
204 Emchar c; | |
205 | |
206 if (tab_width <= 0 || tab_width > 1000) tab_width = 8; | |
207 col = tab_seen = post_tab = 0; | |
208 | |
209 while (1) | |
210 { | |
211 if (pos <= 0) | |
212 break; | |
213 | |
214 pos--; | |
215 c = string_char (s, pos); | |
216 if (c == '\t') | |
217 { | |
218 if (tab_seen) | |
219 col = ((col + tab_width) / tab_width) * tab_width; | |
220 | |
221 post_tab += col; | |
222 col = 0; | |
223 tab_seen = 1; | |
224 } | |
225 else if (c == '\n') | |
226 break; | |
227 else | |
228 #ifdef MULE | |
229 col += XCHARSET_COLUMNS (CHAR_CHARSET (c)); | |
230 #else | |
231 col ++; | |
232 #endif /* MULE */ | |
233 } | |
234 | |
235 if (tab_seen) | |
236 { | |
237 col = ((col + tab_width) / tab_width) * tab_width; | |
238 col += post_tab; | |
192 } | 239 } |
193 | 240 |
194 return col; | 241 return col; |
195 } | 242 } |
196 | 243 |