summaryrefslogtreecommitdiff
path: root/readline/undo.c
diff options
context:
space:
mode:
authorElena Zannoni <ezannoni@kwikemart.cygnus.com>2002-12-08 22:31:39 +0000
committerElena Zannoni <ezannoni@kwikemart.cygnus.com>2002-12-08 22:31:39 +0000
commit711a125cd3c4a70294cd96615120cb61b64ef88e (patch)
treecd5afad1dcbda8ecd4316225edaed77fc3174ee6 /readline/undo.c
parent726941b1ecf998b928ad0e0f84d637849f6c3e63 (diff)
downloadgdb-711a125cd3c4a70294cd96615120cb61b64ef88e.tar.gz
Import of readline 4.3.
Non-readline modified files: src/gdb/ChangeLog src/gdb/defs.h src/gdb/cli/cli-cmds.c src/gdb/cli/cli-setshow.c src/gdb/tui/ChangeLog src/gdb/tui/tuiWin.c In readline directory: * compat.c, mbutil.c, misc.c, rlmbutil.h, rltypedefs.h, text.c, doc/history.0, doc/history.3, support/wcwidth.c, examples/readlinebuf.h, examples/rlcat.c: New files. * CHANGELOG, CHANGES, INSTALL, MANIFEST, Makefile.in, README, aclocal.m4, ansi_stdlib.h, bind.c, callback.c, chardefs.h, complete.c, config.h.in, configure, configure.in, display.c, emacs_keymap.c, funmap.c, histexpand.c, histfile.c, histlib.h, history.c, history.h, histsearch.c, input.c, isearch.c, keymaps.c, keymaps.h, kill.c, macro.c, nls.c, parens.c, posixdir.h, readline.c, readline.h, rlconf.h, rldefs.h, rlprivate.h, rlshell.h, rlstdc.h, rltty.c, savestring.c, search.c, shell.c, signals.c, terminal.c, tilde.c, tilde.h, undo.c, util.c, vi_keymap.c, vi_mode.c, xmalloc.c, xmalloc.h, doc/Makefile.in, doc/hist.texinfo, doc/hstech.texinfo, doc/hsuser.texinfo, doc/manvers.texinfo, doc/readline.3, doc/rlman.texinfo, doc/rltech.texinfo, doc/rluser.texinfo doc/rluserman.texinfo, doc/texi2dvi, doc/texi2html, shlib/Makefile.in, support/install.sh, support/mkdirs, support/mkdist, support/shlib-install, support/shobj-conf, examples/Inputrc, examples/Makefile.in, examples/fileman.c, examples/histexamp.c, examples/manexamp.c, examples/rl.c, examples/rlfe.c, examples/rltest.c, examples/rlversion.c: Modified files.
Diffstat (limited to 'readline/undo.c')
-rw-r--r--readline/undo.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/readline/undo.c b/readline/undo.c
index f7f30d17d9d..25c287b5a2d 100644
--- a/readline/undo.c
+++ b/readline/undo.c
@@ -48,8 +48,7 @@
#include "history.h"
#include "rlprivate.h"
-
-#define SWAP(s, e) do { int t; t = s; s = e; e = t; } while (0)
+#include "xmalloc.h"
/* Non-zero tells rl_delete_text and rl_insert_text to not add to
the undo list. */
@@ -86,7 +85,7 @@ rl_add_undo (what, start, end, text)
/* Free the existing undo list. */
void
-free_undo_list ()
+rl_free_undo_list ()
{
while (rl_undo_list)
{
@@ -107,17 +106,18 @@ int
rl_do_undo ()
{
UNDO_LIST *release;
- int waiting_for_begin = 0;
- int start, end;
+ int waiting_for_begin, start, end;
#define TRANS(i) ((i) == -1 ? rl_point : ((i) == -2 ? rl_end : (i)))
+ start = end = waiting_for_begin = 0;
do
{
if (!rl_undo_list)
return (0);
_rl_doing_an_undo = 1;
+ RL_SETSTATE(RL_STATE_UNDOING);
/* To better support vi-mode, a start or end value of -1 means
rl_point, and a value of -2 means rl_end. */
@@ -152,11 +152,12 @@ rl_do_undo ()
if (waiting_for_begin)
waiting_for_begin--;
else
- ding ();
+ rl_ding ();
break;
}
_rl_doing_an_undo = 0;
+ RL_UNSETSTATE(RL_STATE_UNDOING);
release = rl_undo_list;
rl_undo_list = rl_undo_list->next;
@@ -231,7 +232,7 @@ rl_revert_line (count, key)
int count, key;
{
if (!rl_undo_list)
- ding ();
+ rl_ding ();
else
{
while (rl_undo_list)
@@ -254,7 +255,7 @@ rl_undo_command (count, key)
count--;
else
{
- ding ();
+ rl_ding ();
break;
}
}