commit bash-20051123 snapshot
[platform/upstream/bash.git] / d1
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
3 ***************
4 *** 181,184 ****
5 --- 186,201 ----
6   static int prompt_physical_chars;
7   
8 + /* Variables to save and restore prompt and display information. */
9
10 + /* These are getting numerous enough that it's time to create a struct. */
11
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;
19
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
22 ***************
23 *** 1797,1803 ****
24     return ((ISPRINT (uc)) ? 1 : 2);
25   }
26
27   /* How to print things in the "echo-area".  The prompt is treated as a
28      mini-modeline. */
29   
30   #if defined (USE_VARARGS)
31 --- 1825,1831 ----
32     return ((ISPRINT (uc)) ? 1 : 2);
33   }
34   /* How to print things in the "echo-area".  The prompt is treated as a
35      mini-modeline. */
36 + static int msg_saved_prompt = 0;
37   
38   #if defined (USE_VARARGS)
39 ***************
40 *** 1830,1835 ****
41 --- 1858,1874 ----
42     va_end (args);
43   
44 +   if (saved_local_prompt == 0)
45 +     {
46 +       rl_save_prompt ();
47 +       msg_saved_prompt = 1;
48 +     }
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) ();
56
57     return 0;
58   }
59 ***************
60 *** 1841,1846 ****
61 --- 1880,1897 ----
62     sprintf (msg_buf, format, arg1, arg2);
63     msg_buf[sizeof(msg_buf) - 1] = '\0';        /* overflow? */
64
65     rl_display_prompt = msg_buf;
66 +   if (saved_local_prompt == 0)
67 +     {
68 +       rl_save_prompt ();
69 +       msg_saved_prompt = 1;
70 +     }
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) ();
77 +       
78     return 0;
79   }
80 ***************
81 *** 1852,1855 ****
82 --- 1903,1911 ----
83   {
84     rl_display_prompt = rl_prompt;
85 +   if (msg_saved_prompt)
86 +     {
87 +       rl_restore_prompt ();
88 +       msg_saved_prompt = 0;
89 +     }
90     (*rl_redisplay_function) ();
91     return 0;
92 ***************
93 *** 1866,1878 ****
94   }
95   
96 - /* These are getting numerous enough that it's time to create a struct. */
97
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;
104
105   void
106   rl_save_prompt ()
107 --- 1922,1925 ----
108 ***************
109 *** 1880,1883 ****
110 --- 1927,1931 ----
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;
116 ***************
117 *** 1886,1890 ****
118   
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;
122   }
123 --- 1934,1938 ----
124   
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;
128   }
129 ***************
130 *** 1898,1905 ****
131 --- 1946,1959 ----
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;
139
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;
144   }
145