1 #ifndef INPUTH
2 #define INPUTH
3 /*
4  * $Id: input.h,v 1.4 2000/08/10 21:02:50 danny Exp $
5  *
6  * Copyright � 1993 Free Software Foundation, Inc.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2, or (at your option)
11  * any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this software; see the file COPYING.  If not, write to
20  * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
21  */
22 
23 /* Display-generic updating logic for the input area. */
24 typedef int (*text_measure) (char * str, int len);
25 
26 /* These are for the field REDRAW_NEEDED */
27 #define NO_REDRAW		-2
28 #define FULL_REDRAW		-1
29 
30 struct input_view
31 {
32   /* If this is less than 0, see the #defines above.
33    * >= 0, this is the index of a character in the
34    * input string.  All characters at that index and
35    * greater need to be redrawn.
36    */
37   int redraw_needed;
38 
39   /* These are provided by io-{curses,x11} and tell how to convert
40    * strings to widths.
41    */
42   text_measure prompt_metric;
43   text_measure input_metric;
44 
45   /* If the currently mapped keymap has a prompt, the display of that
46    * prompt takes precedence.
47    */
48   char * keymap_prompt;
49   char * expanded_keymap_prompt;
50 
51   /* This is the width of either the keymap_prompt or the input text
52    * prompt, whichever is current (0 if neither is).
53    */
54 
55   int prompt_wid;
56 
57   /* The parameters below are a cache.  If this flag is true,
58    * the cache is known to be wrong.
59    */
60   int must_fix_input;
61 
62   struct line * input_area;	/* The text editted in the input area or 0. */
63   char * prompt;
64   int visibility_begin;		/* Index of first visible char or 0. */
65   int visibility_end;		/* Index of last visible char or 0. */
66   int input_cursor;		/* Index of the cursor position or 0. */
67   int vis_wid;			/* This is the width of the visible text
68 				 * with extra space for the cursor, if it
69 				 * happens to be past the end of the string.
70 				 */
71 
72   /* A command_arg can specify an info buffer which should be displayed
73    * while prompting for that arg.
74    */
75   struct info_buffer * current_info;
76   int info_pos;		/* In the current info, the first vis. line */
77   int info_redraw_needed;	/* != 0 if redraw needed */
78 };
79 
80 
81 extern void iv_fix_input (struct input_view * this_iv);
82 extern void iv_move_cursor (struct input_view * this_iv);
83 extern void iv_erase (struct input_view * this_iv, int len);
84 extern void iv_insert (struct input_view * this_iv, int len);
85 extern void iv_over (struct input_view * this_iv, int len);
86 
87 #endif  /* INPUTH */
88