http://www.midnight-commander.org/ticket/2678
diff -ur mc-4.8.0.orig/src/main.c mc-4.8.0/src/main.c
old
|
new
|
|
288 | 288 | int |
289 | 289 | load_prompt (int fd, void *unused) |
290 | 290 | { |
| 291 | char *tmp_prompt; |
| 292 | int prompt_len; |
| 293 | |
291 | 294 | (void) fd; |
292 | 295 | (void) unused; |
293 | 296 | |
294 | 297 | if (!read_subshell_prompt ()) |
295 | 298 | return 0; |
296 | 299 | |
| 300 | tmp_prompt = strip_ctrl_codes (subshell_prompt); |
| 301 | prompt_len = str_term_width1 (tmp_prompt); |
| 302 | |
| 303 | /* Check for prompts too big */ |
| 304 | if (COLS > 8 && prompt_len > COLS - 8) |
| 305 | { |
| 306 | prompt_len = COLS - 8; |
| 307 | tmp_prompt[prompt_len] = '\0'; |
| 308 | } |
| 309 | mc_prompt = tmp_prompt; |
| 310 | label_set_text (the_prompt, mc_prompt); |
| 311 | input_set_origin ((WInput *) cmdline, prompt_len, COLS - prompt_len); |
| 312 | |
297 | 313 | /* Don't actually change the prompt if it's invisible */ |
298 | 314 | if (((Dlg_head *) top_dlg->data == midnight_dlg) && command_prompt) |
299 | 315 | { |
300 | | char *tmp_prompt; |
301 | | int prompt_len; |
302 | | |
303 | | tmp_prompt = strip_ctrl_codes (subshell_prompt); |
304 | | prompt_len = str_term_width1 (tmp_prompt); |
305 | | |
306 | | /* Check for prompts too big */ |
307 | | if (COLS > 8 && prompt_len > COLS - 8) |
308 | | { |
309 | | prompt_len = COLS - 8; |
310 | | tmp_prompt[prompt_len] = '\0'; |
311 | | } |
312 | | mc_prompt = tmp_prompt; |
313 | | label_set_text (the_prompt, mc_prompt); |
314 | | input_set_origin ((WInput *) cmdline, prompt_len, COLS - prompt_len); |
315 | | |
316 | 316 | /* since the prompt has changed, and we are called from one of the |
317 | 317 | * tty_get_event channels, the prompt updating does not take place |
318 | 318 | * automatically: force a cursor update and a screen refresh |