#include "history.h"
#ifndef RL_LIBRARY_VERSION
-# define RL_LIBRARY_VERSION "2.2-bash"
+# define RL_LIBRARY_VERSION "4.0"
#endif
/* Evaluates its arguments multiple times. */
#else
extern int _rl_output_character_function ();
#endif
-extern void _rl_get_screen_size ();
extern int _rl_enable_meta;
extern int _rl_term_autowrap;
/* Functions imported from bind.c. */
extern void _rl_bind_if_unbound ();
-extern int rl_set_keymap_from_edit_mode ();
/* Functions imported from input.c. */
extern int _rl_any_typein ();
extern void _rl_update_final ();
extern void _rl_clear_to_eol ();
extern void _rl_clear_screen ();
-
-extern void _rl_save_prompt ();
-extern void _rl_restore_prompt ();
+extern void _rl_erase_entire_line ();
extern void _rl_erase_at_end_of_line ();
extern void _rl_move_cursor_relative ();
static void start_using_history ();
static void bind_arrow_keys ();
-#if !defined (__GO32__)
+#if !defined (__GO32__) || defined (HAVE_TERMIOS_H)
static void readline_default_bindings ();
#endif /* !__GO32__ */
#if defined (__GO32__)
# include <go32.h>
# include <pc.h>
-# undef HANDLE_SIGNALS
+# if !defined (__DJGPP__)
+# undef HANDLE_SIGNALS
+# endif /* !__DJGPP__ */
#endif /* __GO32__ */
extern char *xmalloc (), *xrealloc ();
int rl_key_sequence_length = 0;
/* If non-zero, then this is the address of a function to call just
- before readline_internal () prints the first prompt. */
+ before readline_internal_setup () prints the first prompt. */
Function *rl_startup_hook = (Function *)NULL;
+/* If non-zero, this is the address of a function to call just before
+ readline_internal_setup () returns and readline_internal starts
+ reading input characters. */
+Function *rl_pre_input_hook = (Function *)NULL;
+
/* What we use internally. You should always refer to RL_LINE_BUFFER. */
static char *the_line;
/* Keymap holding the function currently being executed. */
Keymap rl_executing_keymap;
+/* Non-zero means to erase entire line, including prompt, on empty input lines. */
+int rl_erase_empty_line = 0;
+
/* Line buffer and maintenence. */
char *rl_line_buffer = (char *)NULL;
int rl_line_buffer_len = 0;
rl_vi_insertion_mode (1, 0);
#endif /* VI_MODE */
}
+
+ if (rl_pre_input_hook)
+ (*rl_pre_input_hook) ();
}
STATIC_CALLBACK char *
{
temp = savestring (the_line);
rl_revert_line (1, 0);
- entry = replace_history_entry (where_history (), the_line, (HIST_ENTRY *)NULL);
+ entry = replace_history_entry (where_history (), the_line, (histdata_t)NULL);
_rl_free_history_entry (entry);
strcpy (the_line, temp);
if (rl_done == 0)
(*rl_redisplay_function) ();
+ /* If the application writer has told us to erase the entire line if
+ the only character typed was something bound to rl_newline, do so. */
+ if (rl_erase_empty_line && rl_done && rl_last_func == rl_newline &&
+ rl_point == 0 && rl_end == 0)
+ _rl_erase_entire_line ();
+
#if defined (READLINE_CALLBACKS)
return 0;
#else
static int
readline_internal_charloop ()
{
- int eof;
+ int eof = 1;
while (rl_done == 0)
eof = readline_internal_char ();
/* Initialize the terminal interface. */
_rl_init_terminal_io ((char *)NULL);
-#if !defined (__GO32__)
+#if !defined (__GO32__) || defined (HAVE_TERMIOS_H)
/* Bind tty characters to readline functions. */
readline_default_bindings ();
-#endif /* !__GO32__ */
+#endif /* !__GO32__ || HAVE_TERMIOS_H */
/* Initialize the function names. */
rl_initialize_funmap ();
{
int key, c, sawminus, sawdigits;
- _rl_save_prompt ();
+ rl_save_prompt ();
sawminus = sawdigits = 0;
while (1)
{
+ if (rl_numeric_arg > 1000000)
+ {
+ sawdigits = rl_explicit_arg = rl_numeric_arg = 0;
+ ding ();
+ rl_restore_prompt ();
+ rl_clear_message ();
+ return 1;
+ }
rl_message ("(arg: %d) ", rl_arg_sign * rl_numeric_arg);
key = c = rl_read_key ();
else
{
key = rl_read_key ();
- _rl_restore_prompt ();
+ rl_restore_prompt ();
rl_clear_message ();
return (_rl_dispatch (key, _rl_keymap));
}
/* Make M-- command equivalent to M--1 command. */
if (sawminus && rl_numeric_arg == 1 && rl_explicit_arg == 0)
rl_explicit_arg = 1;
- _rl_restore_prompt ();
+ rl_restore_prompt ();
rl_clear_message ();
return (_rl_dispatch (key, _rl_keymap));
}
/* Clear the current line. Numeric argument to C-l does this. */
int
-rl_refresh_line ()
+rl_refresh_line (ignore1, ignore2)
+ int ignore1, ignore2;
{
int curr_line, nleft;
_rl_move_vert (curr_line);
_rl_move_cursor_relative (0, the_line); /* XXX is this right */
-#if defined (__GO32__)
+#if defined (__GO32__) && !defined (__DJGPP__)
{
int row, col, width, row_start;
row_start = ScreenPrimary + (row * width);
memset (row_start + col, 0, (width - col) * 2);
}
-#else /* !__GO32__ */
+#else /* !__GO32__ || __DJGPP__ */
_rl_clear_to_eol (0); /* arg of 0 means to not use spaces */
-#endif /* !__GO32__ */
+#endif /* !__GO32__ || __DJGPP__ */
rl_forced_update_display ();
rl_display_fixed = 1;
{
if (rl_explicit_arg)
{
- rl_refresh_line ();
+ rl_refresh_line (count, key);
return 0;
}
}
#endif /* VI_MODE */
+ /* If we've been asked to erase empty lines, suppress the final update,
+ since _rl_update_final calls crlf(). */
+ if (rl_erase_empty_line && rl_point == 0 && rl_end == 0)
+ return 0;
+
if (readline_echoing_p)
_rl_update_final ();
return 0;
}
else
return (rl_delete_text (rl_point, rl_point + 1));
-
}
+/* Delete the character under the cursor, unless the insertion
+ point is at the end of the line, in which case the character
+ behind the cursor is deleted. COUNT is obeyed and may be used
+ to delete forward or backward that many characters. */
+int
+rl_rubout_or_delete (count, key)
+ int count, key;
+{
+ if (rl_end != 0 && rl_point == rl_end)
+ return (rl_rubout (count, key));
+ else
+ return (rl_delete (count, key));
+}
+
/* Delete all spaces and tabs around point. */
int
rl_delete_horizontal_space (count, ignore)
return 0;
}
+/* Like the tcsh editing function delete-char-or-list. The eof character
+ is caught before this is invoked, so this really does the same thing as
+ delete-char-or-list-or-eof, as long as it's bound to the eof character. */
+int
+rl_delete_or_show_completions (count, key)
+ int count, key;
+{
+ if (rl_end != 0 && rl_point == rl_end)
+ return (rl_possible_completions (count, key));
+ else
+ return (rl_delete (count, key));
+}
+
#ifndef RL_COMMENT_BEGIN_DEFAULT
#define RL_COMMENT_BEGIN_DEFAULT "#"
#endif
/* If the current line has changed, save the changes. */
if (temp && ((UNDO_LIST *)(temp->data) != rl_undo_list))
{
- temp = replace_history_entry (where_history (), the_line, rl_undo_list);
+ temp = replace_history_entry (where_history (), the_line, (histdata_t)rl_undo_list);
free (temp->line);
free (temp);
}