Warn against using `length' to compute display width of a string.
[emacs.git] / src / indent.h
blobc5114b812c8598a94ec963b64f72be6a8b10aaee
1 /* Definitions for interface to indent.c
2 Copyright (C) 1985-1986, 2001-2012 Free Software Foundation, Inc.
4 This file is part of GNU Emacs.
6 GNU Emacs is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 GNU Emacs is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 /* We introduce new member `tab_offset'. We need it because of the
20 existence of wide-column characters. There is a case that the
21 line-break occurs at a wide-column character and the number of
22 columns of the line gets less than width.
24 Example (where W_ stands for a wide-column character):
25 ----------
26 abcdefgh\\
28 ----------
30 To handle this case, we should not calculate the tab offset by
31 tab_offset += width;
33 Instead, we must remember tab_offset of the line.
37 struct position
39 EMACS_INT bufpos;
40 EMACS_INT bytepos;
41 EMACS_INT hpos;
42 EMACS_INT vpos;
43 EMACS_INT prevhpos;
44 EMACS_INT contin;
45 /* Number of characters we have already handled
46 from the before and after strings at this position. */
47 EMACS_INT ovstring_chars_done;
48 EMACS_INT tab_offset;
51 struct position *compute_motion (EMACS_INT from, EMACS_INT fromvpos,
52 EMACS_INT fromhpos, int did_motion,
53 EMACS_INT to, EMACS_INT tovpos,
54 EMACS_INT tohpos,
55 EMACS_INT width, EMACS_INT hscroll,
56 EMACS_INT tab_offset, struct window *);
57 struct position *vmotion (EMACS_INT from, EMACS_INT vtarget,
58 struct window *);
59 EMACS_INT skip_invisible (EMACS_INT pos, EMACS_INT *next_boundary_p,
60 EMACS_INT to, Lisp_Object window);
62 /* Value of point when current_column was called */
63 extern EMACS_INT last_known_column_point;
65 /* Functions for dealing with the column cache. */
67 /* Return true if the display table DISPTAB specifies the same widths
68 for characters as WIDTHTAB. We use this to decide when to
69 invalidate the buffer's column_cache. */
70 int disptab_matches_widthtab (struct Lisp_Char_Table *disptab,
71 struct Lisp_Vector *widthtab);
73 /* Recompute BUF's width table, using the display table DISPTAB. */
74 void recompute_width_table (struct buffer *buf,
75 struct Lisp_Char_Table *disptab);