1 *** ../bash-3.0-patched/lib/readline/display.c Wed Sep 8 11:07:51 2004
2 --- lib/readline/display.c Sat Jan 8 21:51:40 2005
6 static int prompt_physical_chars;
8 + /* Variables to save and restore prompt and display information. */
10 + /* These are getting numerous enough that it's time to create a struct. */
12 + static char *saved_local_prompt;
13 + static char *saved_local_prefix;
14 + static int saved_last_invisible;
15 + static int saved_visible_length;
16 + static int saved_prefix_length;
17 + static int saved_invis_chars_first_line;
18 + static int saved_physical_chars;
20 /* Expand the prompt string S and return the number of visible
21 characters in *LP, if LP is not null. This is currently more-or-less
24 return ((ISPRINT (uc)) ? 1 : 2);
27 /* How to print things in the "echo-area". The prompt is treated as a
30 #if defined (USE_VARARGS)
32 return ((ISPRINT (uc)) ? 1 : 2);
34 /* How to print things in the "echo-area". The prompt is treated as a
36 + static int msg_saved_prompt = 0;
38 #if defined (USE_VARARGS)
44 + if (saved_local_prompt == 0)
47 + msg_saved_prompt = 1;
49 rl_display_prompt = msg_buf;
50 + local_prompt = expand_prompt (msg_buf, &prompt_visible_length,
51 + &prompt_last_invisible,
52 + &prompt_invis_chars_first_line,
53 + &prompt_physical_chars);
54 + local_prompt_prefix = (char *)NULL;
55 (*rl_redisplay_function) ();
62 sprintf (msg_buf, format, arg1, arg2);
63 msg_buf[sizeof(msg_buf) - 1] = '\0'; /* overflow? */
65 rl_display_prompt = msg_buf;
66 + if (saved_local_prompt == 0)
69 + msg_saved_prompt = 1;
71 + local_prompt = expand_prompt (msg_buf, &prompt_visible_length,
72 + &prompt_last_invisible,
73 + &prompt_invis_chars_first_line,
74 + &prompt_physical_chars);
75 + local_prompt_prefix = (char *)NULL;
76 (*rl_redisplay_function) ();
84 rl_display_prompt = rl_prompt;
85 + if (msg_saved_prompt)
87 + rl_restore_prompt ();
88 + msg_saved_prompt = 0;
90 (*rl_redisplay_function) ();
96 - /* These are getting numerous enough that it's time to create a struct. */
98 - static char *saved_local_prompt;
99 - static char *saved_local_prefix;
100 - static int saved_last_invisible;
101 - static int saved_visible_length;
102 - static int saved_invis_chars_first_line;
103 - static int saved_physical_chars;
111 saved_local_prompt = local_prompt;
112 saved_local_prefix = local_prompt_prefix;
113 + saved_prefix_length = prompt_prefix_length;
114 saved_last_invisible = prompt_last_invisible;
115 saved_visible_length = prompt_visible_length;
119 local_prompt = local_prompt_prefix = (char *)0;
120 ! prompt_last_invisible = prompt_visible_length = 0;
121 prompt_invis_chars_first_line = prompt_physical_chars = 0;
125 local_prompt = local_prompt_prefix = (char *)0;
126 ! prompt_last_invisible = prompt_visible_length = prompt_prefix_length = 0;
127 prompt_invis_chars_first_line = prompt_physical_chars = 0;
132 local_prompt = saved_local_prompt;
133 local_prompt_prefix = saved_local_prefix;
134 + prompt_prefix_length = saved_prefix_length;
135 prompt_last_invisible = saved_last_invisible;
136 prompt_visible_length = saved_visible_length;
137 prompt_invis_chars_first_line = saved_invis_chars_first_line;
138 prompt_physical_chars = saved_physical_chars;
140 + /* can test saved_local_prompt to see if prompt info has been saved. */
141 + saved_local_prompt = saved_local_prefix = (char *)0;
142 + saved_last_invisible = saved_visible_length = saved_prefix_length = 0;
143 + saved_invis_chars_first_line = saved_physical_chars = 0;