qemacs-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemacs-commit] qemacs clang.c html.c qe.c qe.h qeconfig.h shell.c


From: Charlie Gordon
Subject: [Qemacs-commit] qemacs clang.c html.c qe.c qe.h qeconfig.h shell.c
Date: Tue, 25 Dec 2007 07:54:00 +0000

CVSROOT:        /cvsroot/qemacs
Module name:    qemacs
Changes by:     Charlie Gordon <chqrlie>        07/12/25 07:54:00

Modified files:
        .              : clang.c html.c qe.c qe.h qeconfig.h shell.c 

Log message:
        pass argument to do_char, do_tab, do_quote (fixes bug in C-u C-q a)
        pass closure to quote_key

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/clang.c?cvsroot=qemacs&r1=1.19&r2=1.20
http://cvs.savannah.gnu.org/viewcvs/qemacs/html.c?cvsroot=qemacs&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.c?cvsroot=qemacs&r1=1.53&r2=1.54
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.h?cvsroot=qemacs&r1=1.47&r2=1.48
http://cvs.savannah.gnu.org/viewcvs/qemacs/qeconfig.h?cvsroot=qemacs&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/qemacs/shell.c?cvsroot=qemacs&r1=1.33&r2=1.34

Patches:
Index: clang.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/clang.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- clang.c     20 Dec 2007 11:52:33 -0000      1.19
+++ clang.c     25 Dec 2007 07:54:00 -0000      1.20
@@ -583,7 +583,7 @@
 
 static void do_c_electric(EditState *s, int key)
 {
-    do_char(s, key);
+    do_char(s, key, 1);
     do_c_indent(s);
 }
 

Index: html.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/html.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- html.c      21 Dec 2007 12:20:17 -0000      1.10
+++ html.c      25 Dec 2007 07:54:00 -0000      1.11
@@ -855,11 +855,11 @@
     const char *str;
     str = find_entity_str(key);
     if (str) {
-        do_char(s, '&');
+        do_char(s, '&', 1);
         while (*str) {
-            do_char(s, *str++);
+            do_char(s, *str++, 1);
         }
-        do_char(s, ';');
+        do_char(s, ';', 1);
     }
 }
 

Index: qe.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/qe.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -b -r1.53 -r1.54
--- qe.c        24 Dec 2007 10:22:22 -0000      1.53
+++ qe.c        25 Dec 2007 07:54:00 -0000      1.54
@@ -1208,12 +1208,17 @@
 }
 #endif
 
-void do_char(EditState *s, int key)
+void do_char(EditState *s, int key, int argument)
 {
     if (s->b->flags & BF_READONLY)
         return;
+
+    for (;;) {
     if (s->mode->write_char)
         s->mode->write_char(s, key);
+        if (argument-- <= 1)
+            break;
+    }
 }
 
 void text_write_char(EditState *s, int key)
@@ -1293,30 +1298,40 @@
     }
 }
 
+struct QuoteKeyArgument {
+    EditState *s;
+    int argument;
+};
+
 /* XXX: may be better to move it into qe_key_process() */
-static void quote_key(__unused__ void *opaque, int key)
+static void quote_key(void *opaque, int key)
 {
-    /* CG: should pass s as opaque */
-    QEmacsState *qs = &qe_state;
-    EditState *s;
+    struct QuoteKeyArgument *qa = opaque;
+    EditState *s = qa->s;
+
+    put_status(s, "");
 
-    s = qs->active_window;
     if (!s)
         return;
 
     /* CG: why not insert special keys as well? */
     if (!KEY_SPECIAL(key) ||
         (key >= 0 && key <= 31)) {
-        do_char(s, key);
-        edit_display(qs);
+        do_char(s, key, qa->argument);
+        edit_display(s->qe_state);
         dpy_flush(&global_screen);
     }
     qe_ungrab_keys();
 }
 
-void do_quote(EditState *s)
+void do_quote(EditState *s, int argument)
 {
-    qe_grab_keys(quote_key, NULL);
+    struct QuoteKeyArgument *qa = qe_mallocz(struct QuoteKeyArgument);
+
+    qa->s = s;
+    qa->argument = argument;
+
+    qe_grab_keys(quote_key, qa);
     put_status(s, "Quote: ");
 }
 
@@ -1325,9 +1340,9 @@
     s->insert = !s->insert;
 }
 
-void do_tab(EditState *s)
+void do_tab(EditState *s, int argument)
 {
-    do_char(s, 9);
+    do_char(s, 9, argument);
 }
 
 void do_open_line(EditState *s)
@@ -4456,7 +4471,7 @@
 void do_completion_space(EditState *s)
 {
     if (!completion_function) {
-        do_char(s, ' ');
+        do_char(s, ' ', 1);
     } else {
         do_completion(s);
     }

Index: qe.h
===================================================================
RCS file: /cvsroot/qemacs/qemacs/qe.h,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -b -r1.47 -r1.48
--- qe.h        24 Dec 2007 09:31:36 -0000      1.47
+++ qe.h        25 Dec 2007 07:54:00 -0000      1.48
@@ -1449,7 +1449,7 @@
                        int offset1, int line_num);
 
 // should take argval
-void do_char(EditState *s, int key);
+void do_char(EditState *s, int key, int argument);
 // bad name!
 // void do_set_mode(EditState *s, const char *mode_name);
 void do_set_mode(EditState *s, ModeDef *m, ModeSavedData *saved_data);
@@ -1462,7 +1462,7 @@
 void do_backspace(EditState *s, int argval);
 void do_delete_char(EditState *s, int argval);
 // should take argval
-void do_tab(EditState *s);
+void do_tab(EditState *s, int argument);
 EditBuffer *new_yank_buffer(void);
 void do_append_next_kill(EditState *s);
 void do_kill(EditState *s, int p1, int p2, int dir);
@@ -1509,7 +1509,7 @@
 void perform_scroll_up_down(EditState *s, int h);
 void do_center_cursor(EditState *s);
 // should take argval
-void do_quote(EditState *s);
+void do_quote(EditState *s, int argument);
 void do_insert(EditState *s);
 void do_open_line(EditState *s);
 // should take argval

Index: qeconfig.h
===================================================================
RCS file: /cvsroot/qemacs/qemacs/qeconfig.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- qeconfig.h  21 Dec 2007 22:34:32 -0000      1.21
+++ qeconfig.h  25 Dec 2007 07:54:00 -0000      1.22
@@ -26,8 +26,8 @@
 
     /*---------------- Simple commands ----------------*/
 
-    CMDV( KEY_DEFAULT, KEY_NONE, "self-insert-command", do_char, ' ', "*v") /* 
u? */
-    CMD_( KEY_META('#'), KEY_NONE, "insert-char", do_char, "*i{Insert char: 
}") /* u? */
+    CMDV( KEY_DEFAULT, KEY_NONE, "self-insert-command", do_char, ' ', "*vui")
+    CMD_( KEY_META('#'), KEY_NONE, "insert-char", do_char, "*i{Insert char: 
}ui")
     CMD1( KEY_CTRL('p'), KEY_UP, "previous-line", do_up_down, -1 )
     CMD1( KEY_CTRL('n'), KEY_DOWN, "next-line", do_up_down, 1 )
     CMD1( KEY_CTRL('b'), KEY_LEFT, "backward-char", do_left_right, -1 )
@@ -48,9 +48,9 @@
     CMD0( KEY_META('<'), KEY_CTRL_HOME, "beginning-of-buffer", do_bof )
     CMD0( KEY_META('>'), KEY_CTRL_END, "end-of-buffer", do_eof )
     /* do_tab will not change read only buffer */
-    CMD0( KEY_CTRL('i'), KEY_NONE, "tabulate", do_tab) /* u? */
+    CMD_( KEY_CTRL('i'), KEY_NONE, "tabulate", do_tab, "ui")
     //CMD0( KEY_SPC, KEY_NONE, "space", do_space) /* u? */
-    CMD_( KEY_CTRL('q'), KEY_NONE, "quoted-insert", do_quote, "*") /* u? */
+    CMD_( KEY_CTRL('q'), KEY_NONE, "quoted-insert", do_quote, "*ui")
     CMD_( KEY_CTRL('j'), KEY_RET, "newline", do_return, "*")
     CMD_( KEY_CTRL('o'), KEY_NONE, "open-line", do_open_line, "*")
 

Index: shell.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/shell.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -b -r1.33 -r1.34
--- shell.c     24 Dec 2007 09:31:36 -0000      1.33
+++ shell.c     25 Dec 2007 07:54:00 -0000      1.34
@@ -1243,7 +1243,7 @@
             break;
         // Do not do this: it is useless and causes infinite recursion 
         //case 9:
-        //    do_tab(e);
+        //    do_tab(e, 1);
         //    break;
         case 11:
             do_kill_line(e, 1);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]