diff options
| author | Joakim Verona | 2011-08-27 19:45:48 +0200 |
|---|---|---|
| committer | Joakim Verona | 2011-08-27 19:45:48 +0200 |
| commit | 9fb7b0cab34a48a4c7b66abb6b8edc4ee20467b4 (patch) | |
| tree | e94476d49f15747fcb9409d773702e88201855a4 /src/indent.c | |
| parent | c7489583c30031c0ecfae9d20b20c149ca1935e9 (diff) | |
| parent | b75258b32810f3690442bddef2e10eef126d2d25 (diff) | |
| download | emacs-9fb7b0cab34a48a4c7b66abb6b8edc4ee20467b4.tar.gz emacs-9fb7b0cab34a48a4c7b66abb6b8edc4ee20467b4.zip | |
upstream
Diffstat (limited to 'src/indent.c')
| -rw-r--r-- | src/indent.c | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/src/indent.c b/src/indent.c index 70689311dd5..313315e9081 100644 --- a/src/indent.c +++ b/src/indent.c | |||
| @@ -284,7 +284,7 @@ skip_invisible (EMACS_INT pos, EMACS_INT *next_boundary_p, EMACS_INT to, Lisp_Ob | |||
| 284 | else \ | 284 | else \ |
| 285 | { \ | 285 | { \ |
| 286 | if (dp != 0 && VECTORP (DISP_CHAR_VECTOR (dp, ch))) \ | 286 | if (dp != 0 && VECTORP (DISP_CHAR_VECTOR (dp, ch))) \ |
| 287 | width = ASIZE (DISP_CHAR_VECTOR (dp, ch)); \ | 287 | width = sanitize_char_width (ASIZE (DISP_CHAR_VECTOR (dp, ch))); \ |
| 288 | else \ | 288 | else \ |
| 289 | width = CHAR_WIDTH (ch); \ | 289 | width = CHAR_WIDTH (ch); \ |
| 290 | } \ | 290 | } \ |
| @@ -318,15 +318,6 @@ invalidate_current_column (void) | |||
| 318 | last_known_column_point = 0; | 318 | last_known_column_point = 0; |
| 319 | } | 319 | } |
| 320 | 320 | ||
| 321 | /* Return a non-outlandish value for the tab width. */ | ||
| 322 | |||
| 323 | static int | ||
| 324 | sane_tab_width (void) | ||
| 325 | { | ||
| 326 | EMACS_INT n = XFASTINT (BVAR (current_buffer, tab_width)); | ||
| 327 | return 0 < n && n <= 1000 ? n : 8; | ||
| 328 | } | ||
| 329 | |||
| 330 | EMACS_INT | 321 | EMACS_INT |
| 331 | current_column (void) | 322 | current_column (void) |
| 332 | { | 323 | { |
| @@ -335,7 +326,7 @@ current_column (void) | |||
| 335 | register int tab_seen; | 326 | register int tab_seen; |
| 336 | EMACS_INT post_tab; | 327 | EMACS_INT post_tab; |
| 337 | register int c; | 328 | register int c; |
| 338 | int tab_width = sane_tab_width (); | 329 | int tab_width = SANE_TAB_WIDTH (current_buffer); |
| 339 | int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow)); | 330 | int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow)); |
| 340 | register struct Lisp_Char_Table *dp = buffer_display_table (); | 331 | register struct Lisp_Char_Table *dp = buffer_display_table (); |
| 341 | 332 | ||
| @@ -515,7 +506,7 @@ check_display_width (EMACS_INT pos, EMACS_INT col, EMACS_INT *endpos) | |||
| 515 | static void | 506 | static void |
| 516 | scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol) | 507 | scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol) |
| 517 | { | 508 | { |
| 518 | int tab_width = sane_tab_width (); | 509 | int tab_width = SANE_TAB_WIDTH (current_buffer); |
| 519 | register int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow)); | 510 | register int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow)); |
| 520 | register struct Lisp_Char_Table *dp = buffer_display_table (); | 511 | register struct Lisp_Char_Table *dp = buffer_display_table (); |
| 521 | int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); | 512 | int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); |
| @@ -732,7 +723,7 @@ string_display_width (Lisp_Object string, Lisp_Object beg, Lisp_Object end) | |||
| 732 | register int tab_seen; | 723 | register int tab_seen; |
| 733 | int post_tab; | 724 | int post_tab; |
| 734 | register int c; | 725 | register int c; |
| 735 | int tab_width = sane_tab_width (); | 726 | int tab_width = SANE_TAB_WIDTH (current_buffer); |
| 736 | int ctl_arrow = !NILP (current_buffer->ctl_arrow); | 727 | int ctl_arrow = !NILP (current_buffer->ctl_arrow); |
| 737 | register struct Lisp_Char_Table *dp = buffer_display_table (); | 728 | register struct Lisp_Char_Table *dp = buffer_display_table (); |
| 738 | int b, e; | 729 | int b, e; |
| @@ -808,7 +799,7 @@ The return value is COLUMN. */) | |||
| 808 | { | 799 | { |
| 809 | EMACS_INT mincol; | 800 | EMACS_INT mincol; |
| 810 | register EMACS_INT fromcol; | 801 | register EMACS_INT fromcol; |
| 811 | int tab_width = sane_tab_width (); | 802 | int tab_width = SANE_TAB_WIDTH (current_buffer); |
| 812 | 803 | ||
| 813 | CHECK_NUMBER (column); | 804 | CHECK_NUMBER (column); |
| 814 | if (NILP (minimum)) | 805 | if (NILP (minimum)) |
| @@ -867,7 +858,7 @@ static EMACS_INT | |||
| 867 | position_indentation (register int pos_byte) | 858 | position_indentation (register int pos_byte) |
| 868 | { | 859 | { |
| 869 | register EMACS_INT column = 0; | 860 | register EMACS_INT column = 0; |
| 870 | int tab_width = sane_tab_width (); | 861 | int tab_width = SANE_TAB_WIDTH (current_buffer); |
| 871 | register unsigned char *p; | 862 | register unsigned char *p; |
| 872 | register unsigned char *stop; | 863 | register unsigned char *stop; |
| 873 | unsigned char *start; | 864 | unsigned char *start; |
| @@ -1116,7 +1107,7 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_ | |||
| 1116 | register EMACS_INT pos; | 1107 | register EMACS_INT pos; |
| 1117 | EMACS_INT pos_byte; | 1108 | EMACS_INT pos_byte; |
| 1118 | register int c = 0; | 1109 | register int c = 0; |
| 1119 | int tab_width = sane_tab_width (); | 1110 | int tab_width = SANE_TAB_WIDTH (current_buffer); |
| 1120 | register int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow)); | 1111 | register int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow)); |
| 1121 | register struct Lisp_Char_Table *dp = window_display_table (win); | 1112 | register struct Lisp_Char_Table *dp = window_display_table (win); |
| 1122 | EMACS_INT selective | 1113 | EMACS_INT selective |
| @@ -1432,7 +1423,7 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_ | |||
| 1432 | the text character-by-character. */ | 1423 | the text character-by-character. */ |
| 1433 | if (current_buffer->width_run_cache && pos >= next_width_run) | 1424 | if (current_buffer->width_run_cache && pos >= next_width_run) |
| 1434 | { | 1425 | { |
| 1435 | EMACS_INT run_end; | 1426 | ptrdiff_t run_end; |
| 1436 | int common_width | 1427 | int common_width |
| 1437 | = region_cache_forward (current_buffer, | 1428 | = region_cache_forward (current_buffer, |
| 1438 | current_buffer->width_run_cache, | 1429 | current_buffer->width_run_cache, |