/* Returns whether any color sequence was printed. */
bool
-_rl_print_color_indicator (char *f)
+_rl_print_color_indicator (const char *f)
{
enum indicator_no colored_filetype;
COLOR_EXT_TYPE *ext; /* Color extension */
extern void _rl_put_indicator (const struct bin_str *ind);
extern void _rl_set_normal_color (void);
extern bool _rl_print_prefix_color (void);
-extern bool _rl_print_color_indicator (char *f);
+extern bool _rl_print_color_indicator (const char *f);
extern void _rl_prep_non_filename_text (void);
#endif /* !_COLORS_H_ */
#endif
#if defined (COLOR_SUPPORT)
-static int colored_stat_start PARAMS((char *));
+static int colored_stat_start PARAMS((const char *));
static void colored_stat_end PARAMS((void));
static int colored_prefix_start PARAMS((void));
static void colored_prefix_end PARAMS((void));
#if defined (COLOR_SUPPORT)
static int
colored_stat_start (filename)
- char *filename;
+ const char *filename;
{
_rl_set_normal_color ();
return (_rl_print_color_indicator (filename));
extern char *xmalloc PARAMS((size_t));
+void initialize_readline PARAMS((void));
+void too_dangerous PARAMS((char *));
+
+int execute_line PARAMS((char *));
+int valid_argument PARAMS((char *, char *));
+
/* The names of functions that actually do the manipulation. */
int com_list PARAMS((char *));
int com_view PARAMS((char *));
return (r);
}
+int
main (argc, argv)
int argc;
char **argv;
/* Tell the GNU Readline library how to complete. We want to try to complete
on command names if this is the first word in the line, or on filenames
if not. */
+void
initialize_readline ()
{
/* Allow conditional parsing of the ~/.inputrc file. */
static char syscom[1024];
/* List the file(s) named in arg. */
+int
com_list (arg)
char *arg;
{
return (system (syscom));
}
+int
com_view (arg)
char *arg;
{
return (system (syscom));
}
+int
com_rename (arg)
char *arg;
{
return (1);
}
+int
com_stat (arg)
char *arg;
{
return (0);
}
+int
com_delete (arg)
char *arg;
{
/* Print out help for ARG, or for all of the commands if ARG is
not present. */
+int
com_help (arg)
char *arg;
{
}
/* Change to the directory ARG. */
+int
com_cd (arg)
char *arg;
{
}
/* Print out the current working directory. */
+int
com_pwd (ignore)
char *ignore;
{
}
/* The user wishes to quit using this program. Just set DONE non-zero. */
+int
com_quit (arg)
char *arg;
{
}
/* Function which tells you that you can't do this. */
+void
too_dangerous (caller)
char *caller;
{
# include <config.h>
#endif
+#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
+#include <string.h>
#if defined (READLINE_LIBRARY)
# include "readline.h"
# include <readline/readline.h>
#endif
+int
main()
{
printf ("%s\n", rl_library_version ? rl_library_version : "unknown");
/* Allocate new context here. Use linked contexts (linked through
cxt->ocxt) to simulate recursion */
#if defined (READLINE_CALLBACKS)
+# if defined (VI_MODE)
+ /* If we're redoing a vi mode command and we know there is a shadowed
+ function corresponding to this key, just call it -- all the redoable
+ vi mode commands already have all the input they need, and rl_vi_redo
+ assumes that one call to rl_dispatch is sufficient to complete the
+ command. */
+ if (_rl_vi_redoing && RL_ISSTATE (RL_STATE_CALLBACK) &&
+ map[ANYOTHERKEY].function != 0)
+ return (_rl_subseq_result (-2, map, key, got_subseq));
+# endif
if (RL_ISSTATE (RL_STATE_CALLBACK))
{
/* Return 0 only the first time, to indicate success to
}
break;
}
+
#if defined (VI_MODE)
if (rl_editing_mode == vi_mode && _rl_keymap == vi_movement_keymap &&
key != ANYOTHERKEY &&
m[key].type = type;
m[key].function = func;
- r = _rl_dispatch (key, m);
+ /* Don't change _rl_dispatching_keymap, set it here */
+ _rl_dispatching_keymap = map; /* previous map */
+ r = _rl_dispatch_subseq (key, m, 0);
m[key].type = nt;
m[key].function = nf;
}
#define RL_STATE_CHARSEARCH 0x0800000 /* vi mode char search */
#define RL_STATE_REDISPLAYING 0x1000000 /* updating terminal display */
-#define RL_STATE_DONE 0x1000000 /* done; accepted line */
+#define RL_STATE_DONE 0x2000000 /* done; accepted line */
#define RL_SETSTATE(x) (rl_readline_state |= (x))
#define RL_UNSETSTATE(x) (rl_readline_state &= ~(x))
/* vi_mode.c */
extern int _rl_vi_last_command;
+extern int _rl_vi_redoing;
extern _rl_vimotion_cxt *_rl_vimvcxt;
#endif /* _RL_PRIVATE_H_ */
extern HIST_ENTRY *_rl_saved_line_for_history;
/* Functions imported from the rest of the library. */
-extern int _rl_free_history_entry PARAMS((HIST_ENTRY *));
+extern void _rl_free_history_entry PARAMS((HIST_ENTRY *));
static char *noninc_search_string = (char *) NULL;
static int noninc_history_pos;
_rl_vimotion_cxt *_rl_vimvcxt = 0;
+/* Non-zero indicates we are redoing a vi-mode command with `.' */
+int _rl_vi_redoing;
+
/* Non-zero means enter insertion mode. */
static int _rl_vi_doing_insert;
static int _rl_vi_last_key_before_insert;
-static int vi_redoing;
-
/* Text modification commands. These are the `redoable' commands. */
static const char * const vi_textmod = "_*\\AaIiCcDdPpYyRrSsXx~";
}
r = 0;
- vi_redoing = 1;
+ _rl_vi_redoing = 1;
/* If we're redoing an insert with `i', stuff in the inserted text
and do not go into insertion mode. */
if (_rl_vi_last_command == 'i' && vi_insert_buffer && *vi_insert_buffer)
}
else
r = _rl_dispatch (_rl_vi_last_command, _rl_keymap);
- vi_redoing = 0;
+
+ _rl_vi_redoing = 0;
return (r);
}
_rl_vimvcxt->motion = '$';
r = rl_domove_motion_callback (_rl_vimvcxt);
}
- else if (vi_redoing && _rl_vi_last_motion != 'd') /* `dd' is special */
+ else if (_rl_vi_redoing && _rl_vi_last_motion != 'd') /* `dd' is special */
{
_rl_vimvcxt->motion = _rl_vi_last_motion;
r = rl_domove_motion_callback (_rl_vimvcxt);
}
- else if (vi_redoing) /* handle redoing `dd' here */
+ else if (_rl_vi_redoing) /* handle redoing `dd' here */
{
_rl_vimvcxt->motion = _rl_vi_last_motion;
rl_mark = rl_end;
if ((_rl_to_upper (m->motion) == 'W') && rl_point < m->start)
rl_point = m->start;
- if (vi_redoing)
+ if (_rl_vi_redoing)
{
if (vi_insert_buffer && *vi_insert_buffer)
rl_begin_undo_group ();
_rl_vimvcxt->motion = '$';
r = rl_domove_motion_callback (_rl_vimvcxt);
}
- else if (vi_redoing && _rl_vi_last_motion != 'c') /* `cc' is special */
+ else if (_rl_vi_redoing && _rl_vi_last_motion != 'c') /* `cc' is special */
{
_rl_vimvcxt->motion = _rl_vi_last_motion;
r = rl_domove_motion_callback (_rl_vimvcxt);
}
- else if (vi_redoing) /* handle redoing `cc' here */
+ else if (_rl_vi_redoing) /* handle redoing `cc' here */
{
_rl_vimvcxt->motion = _rl_vi_last_motion;
rl_mark = rl_end;
_rl_vimvcxt->motion = '$';
r = rl_domove_motion_callback (_rl_vimvcxt);
}
- else if (vi_redoing && _rl_vi_last_motion != 'y') /* `yy' is special */
+ else if (_rl_vi_redoing && _rl_vi_last_motion != 'y') /* `yy' is special */
{
_rl_vimvcxt->motion = _rl_vi_last_motion;
r = rl_domove_motion_callback (_rl_vimvcxt);
}
- else if (vi_redoing) /* handle redoing `yy' here */
+ else if (_rl_vi_redoing) /* handle redoing `yy' here */
{
_rl_vimvcxt->motion = _rl_vi_last_motion;
rl_mark = rl_end;
break;
}
- if (vi_redoing)
+ if (_rl_vi_redoing)
{
/* set target and tlen below */
}
int c;
char mb[MB_LEN_MAX];
- if (vi_redoing)
+ if (_rl_vi_redoing)
{
c = _rl_vi_last_replacement;
mb[0] = c;
int count, key;
{
/* If we are redoing, rl_vi_change_to will stuff the last motion char */
- if (vi_redoing == 0)
+ if (_rl_vi_redoing == 0)
rl_stuff_char ((key == 'S') ? 'c' : 'l'); /* `S' == `cc', `s' == `cl' */
return (rl_vi_change_to (count, 'c'));