qemacs-commit
[Top][All Lists]
Advanced

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

[Qemacs-commit] qemacs qe.c


From: Charlie Gordon
Subject: [Qemacs-commit] qemacs qe.c
Date: Mon, 11 Dec 2006 23:21:05 +0000

CVSROOT:        /cvsroot/qemacs
Module name:    qemacs
Changes by:     Charlie Gordon <chqrlie>        06/12/11 23:21:05

Modified files:
        .              : qe.c 

Log message:
        moved charset_complete() to charset.c
        added do_set_trace()
        added mode_completion()
        simplified command_completion()
        simplified style_completion()
        simplified buffer_completion()
        fixed bogus terminal display for character ^? (DEL or 127)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.c?cvsroot=qemacs&r1=1.28&r2=1.29

Patches:
Index: qe.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/qe.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- qe.c        9 Dec 2006 19:47:20 -0000       1.28
+++ qe.c        11 Dec 2006 23:21:04 -0000      1.29
@@ -65,6 +65,7 @@
 static int screen_width = 0;
 static int screen_height = 0;
 EditBuffer *trace_buffer;
+int trace_buffer_state;
 int no_init_file;
 const char *user_option;
 
@@ -117,9 +118,20 @@
     }
 }
 
+void mode_completion(StringArray *cs, const char *input)
+{
+    ModeDef *p;
+    
+    for (p = first_mode; p != NULL; p = p->next) {
+        if (strstart(p->name, input, NULL))
+            add_string(cs, p->name);
+    }
+}
+
 static ModeDef *find_mode(const char *mode_name)
 {
     ModeDef *p;
+
     p = first_mode;
     while (p != NULL) {
         if (!strcmp(mode_name, p->name))
@@ -250,6 +262,13 @@
     }
 }
 
+void do_set_trace(EditState *s)
+{
+    do_split_window(s, 0);
+    do_switch_to_buffer(s, "*trace*");
+    do_previous_window(s);
+}
+
 void do_cd(EditState *s, const char *name)
 {
     chdir(name);
@@ -341,15 +360,12 @@
 
 void command_completion(StringArray *cs, const char *input)
 {
-    int count, len;
     CmdDef *d;
-    count = 0;
     
-    len = strlen(input);
     d = first_cmd;
     while (d != NULL) {
         while (d->name != NULL) {
-            if (!strncmp(d->name, input, len))
+            if (strstart(d->name, input, NULL))
                 add_string(cs, d->name);
             d++;
         }
@@ -1585,18 +1601,6 @@
         do_set_mode(s, m, NULL);
 }
 
-void charset_completion(StringArray *cs, const char *charset_str)
-{
-    QECharset *p;
-    int len;
-
-    len = strlen(charset_str);
-    for (p = first_charset; p != NULL; p = p->next) {
-        if (!strncmp(p->name, charset_str, len))
-            add_string(cs, p->name);
-    }
-}
-
 QECharset *read_charset(EditState *s, const char *charset_str)
 {
     QECharset *charset;
@@ -1749,16 +1753,6 @@
     s->indent_tabs_mode = (mode != 0);
 }
 
-void do_quit(EditState *s);
-void do_load(EditState *s, const char *filename);
-void do_switch_to_buffer(EditState *s, const char *bufname);
-void do_break(EditState *s);
-void do_insert_file(EditState *s, const char *filename);
-void do_save(EditState *s, int save_as);
-void do_isearch(EditState *s, int dir);
-void do_refresh(EditState *s);
-void do_refresh_complete(EditState *s);
-
 /* compute string for the first part of the mode line (flags,
    filename, modename) */
 void basic_mode_line(EditState *s, char *buf, int buf_size, int c1)
@@ -1944,12 +1938,11 @@
 void style_completion(StringArray *cs, const char *input)
 {
     QEStyleDef *style;
-    int len, i;
+    int i;
 
-    len = strlen(input);
     for (i = 0; i < QE_STYLE_NB; i++) {
         style = &qe_styles[i];
-        if (!strncmp(style->name, input, len))
+        if (strstart(style->name, input, NULL))
             add_string(cs, style->name);
     }
 }
@@ -2959,8 +2952,8 @@
             embedding_level = bd[0].level;
             /* XXX: use embedding level for all cases ? */
             /* CG: should query screen or window about display methods */
-            if (c < ' ' && c != '\t') {
-                display_printf(ds, offset0, offset, "^%c", '@' + c);
+            if ((c < ' ' && c != '\t') || c == 127) {
+                display_printf(ds, offset0, offset, "^%c", ('@' + c) & 127);
             } else if (c >= 0x10000) {
                 /* currently, we cannot display these chars */
                 display_printf(ds, offset0, offset, "\\U%08x", c);
@@ -4204,11 +4197,9 @@
 {
     QEmacsState *qs = &qe_state;
     EditBuffer *b;
-    int len;
 
-    len = strlen(input);
     for (b = qs->first_buffer; b != NULL; b = b->next) {
-        if (!(b->flags & BF_SYSTEM) && !strncmp(b->name, input, len))
+        if (!(b->flags & BF_SYSTEM) && strstart(b->name, input, NULL))
             add_string(cs, b->name);
     }
 }
@@ -7219,6 +7210,7 @@
 
     register_completion("command", command_completion);
     register_completion("charset", charset_completion);
+    register_completion("mode", mode_completion);
     register_completion("style", style_completion);
     register_completion("file", file_completion);
     register_completion("buffer", buffer_completion);




reply via email to

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