mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-09 13:02:01 +03:00
* main.h: Added const qualifier to the global prompt variable.
* main.c: Likewise.
This commit is contained in:
parent
1a0fad0d01
commit
03759c8f34
@ -5,6 +5,8 @@
|
||||
change time.
|
||||
* achown.c: Likewise.
|
||||
* layout.c: Likewise.
|
||||
* menu.c: Likewise.
|
||||
* screen.c: Likewise.
|
||||
* main.h: Added const qualifier to the global prompt variable.
|
||||
* main.c: Likewise.
|
||||
|
||||
|
10
src/main.c
10
src/main.c
@ -175,7 +175,7 @@ int force_ugly_line_drawing = 0;
|
||||
int reset_hp_softkeys = 0;
|
||||
|
||||
/* The prompt */
|
||||
char *prompt = NULL;
|
||||
const char *prompt = NULL;
|
||||
|
||||
/* The widget where we draw the prompt */
|
||||
WLabel *the_prompt;
|
||||
@ -693,16 +693,18 @@ load_prompt (int fd, void *unused)
|
||||
|
||||
/* Don't actually change the prompt if it's invisible */
|
||||
if (current_dlg == midnight_dlg && command_prompt) {
|
||||
char *tmp_prompt;
|
||||
int prompt_len;
|
||||
|
||||
prompt = strip_ctrl_codes (subshell_prompt);
|
||||
prompt_len = strlen (prompt);
|
||||
tmp_prompt = strip_ctrl_codes (subshell_prompt);
|
||||
prompt_len = strlen (tmp_prompt);
|
||||
|
||||
/* Check for prompts too big */
|
||||
if (COLS > 8 && prompt_len > COLS - 8) {
|
||||
prompt[COLS - 8] = 0;
|
||||
tmp_prompt[COLS - 8] = '\0';
|
||||
prompt_len = COLS - 8;
|
||||
}
|
||||
prompt = tmp_prompt;
|
||||
label_set_text (the_prompt, prompt);
|
||||
winput_set_origin ((WInput *) cmdline, prompt_len,
|
||||
COLS - prompt_len);
|
||||
|
@ -106,7 +106,7 @@ void load_hint (int force);
|
||||
void print_vfs_message(const char *msg, ...)
|
||||
__attribute__ ((format (printf, 1, 2)));
|
||||
|
||||
extern char *prompt;
|
||||
extern const char *prompt;
|
||||
extern const char *edit_one_file;
|
||||
extern char *mc_home;
|
||||
char *get_mc_lib_dir (void);
|
||||
|
@ -168,7 +168,7 @@ static void menubar_draw (WMenu *menubar)
|
||||
if (menubar->active)
|
||||
attrset(i == menubar->selected?MENU_SELECTED_COLOR:SELECTED_COLOR);
|
||||
widget_move (&menubar->widget, 0, menubar->menu [i]->start_x);
|
||||
printw ("%s", menubar->menu [i]->name);
|
||||
tty_printf ("%s", menubar->menu [i]->name);
|
||||
}
|
||||
|
||||
if (menubar->dropped)
|
||||
|
14
src/screen.c
14
src/screen.c
@ -665,7 +665,7 @@ display_mini_info (WPanel *panel)
|
||||
|
||||
if (panel->searching){
|
||||
attrset (INPUT_COLOR);
|
||||
printw ("/%-*s", panel->widget.cols-3, panel->search_buffer);
|
||||
tty_printf ("/%-*s", panel->widget.cols-3, panel->search_buffer);
|
||||
attrset (NORMAL_COLOR);
|
||||
return;
|
||||
}
|
||||
@ -677,7 +677,7 @@ display_mini_info (WPanel *panel)
|
||||
int cols = panel->widget.cols-2;
|
||||
|
||||
attrset (MARKED_COLOR);
|
||||
printw ("%*s", cols, " ");
|
||||
tty_printf ("%*s", cols, " ");
|
||||
widget_move (&panel->widget, llines (panel)+3, 1);
|
||||
/* FIXME: use ngettext() here when gettext-0.10.35 becomes history */
|
||||
g_snprintf (buffer, sizeof (buffer), (panel->marked == 1) ?
|
||||
@ -688,7 +688,7 @@ display_mini_info (WPanel *panel)
|
||||
p += 2;
|
||||
} else
|
||||
cols -= 2;
|
||||
printw ((char *) p, cols, buffer);
|
||||
tty_printf (p, cols, buffer);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -704,10 +704,10 @@ display_mini_info (WPanel *panel)
|
||||
g_free (link);
|
||||
if (len > 0){
|
||||
link_target[len] = 0;
|
||||
printw ("-> %-*s", panel->widget.cols - 5,
|
||||
tty_printf ("-> %-*s", panel->widget.cols - 5,
|
||||
name_trunc (link_target, panel->widget.cols - 5));
|
||||
} else
|
||||
printw ("%-*s", panel->widget.cols - 2, _("<readlink failed>"));
|
||||
tty_printf ("%-*s", panel->widget.cols - 2, _("<readlink failed>"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1123,7 +1123,7 @@ paint_frame (WPanel *panel)
|
||||
attrset (MARKED_COLOR);
|
||||
spaces = (format->field_len - header_len) / 2;
|
||||
extra = (format->field_len - header_len) % 2;
|
||||
printw ("%*s%.*s%*s", spaces, "",
|
||||
tty_printf ("%*s%.*s%*s", spaces, "",
|
||||
header_len, txt, spaces+extra, "");
|
||||
width -= 2 * spaces + extra + header_len;
|
||||
} else {
|
||||
@ -1135,7 +1135,7 @@ paint_frame (WPanel *panel)
|
||||
}
|
||||
|
||||
if (width > 0)
|
||||
printw ("%*s", width, "");
|
||||
tty_printf ("%*s", width, "");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user