qemacs-commit
[Top][All Lists]
Advanced

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

[Qemacs-commit] qemacs qe.h qe.c qeconfig.h TODO.org


From: Charlie Gordon
Subject: [Qemacs-commit] qemacs qe.h qe.c qeconfig.h TODO.org
Date: Fri, 29 Jul 2016 11:20:08 +0000 (UTC)

CVSROOT:        /sources/qemacs
Module name:    qemacs
Changes by:     Charlie Gordon <chqrlie>        16/07/29 11:20:08

Modified files:
        .              : qe.h qe.c qeconfig.h TODO.org 

Log message:
        completion: improve popup window handling
        
        - fix completion popup current selection display
        - TAB toggles completion popup open/close if there are matches
        - SPC opens the completion popup and pages down through matches
        - add non ambiguous completion as highlighted region in mini-nbuffer
        - adding more characters with popup active rescans and filters list
        - remove completion popup as more typing occurs without a match

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.h?cvsroot=qemacs&r1=1.221&r2=1.222
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.c?cvsroot=qemacs&r1=1.228&r2=1.229
http://cvs.savannah.gnu.org/viewcvs/qemacs/qeconfig.h?cvsroot=qemacs&r1=1.58&r2=1.59
http://cvs.savannah.gnu.org/viewcvs/qemacs/TODO.org?cvsroot=qemacs&r1=1.14&r2=1.15

Patches:
Index: qe.h
===================================================================
RCS file: /sources/qemacs/qemacs/qe.h,v
retrieving revision 1.221
retrieving revision 1.222
diff -u -b -r1.221 -r1.222
--- qe.h        29 Jul 2016 11:04:31 -0000      1.221
+++ qe.h        29 Jul 2016 11:20:08 -0000      1.222
@@ -1983,7 +1983,10 @@
 void qe_save_macros(EditState *s, EditBuffer *b);
 
 void edit_attach(EditState *s, EditState *e);
-void do_completion(EditState *s);
+#define COMPLETION_TAB    0
+#define COMPLETION_SPACE  1
+#define COMPLETION_OTHER  2
+void do_completion(EditState *s, int type);
 void do_completion_space(EditState *s);
 void do_electric_filename(EditState *s, int key);
 void minibuf_complete_scroll_up_down(EditState *s, int dir);

Index: qe.c
===================================================================
RCS file: /sources/qemacs/qemacs/qe.c,v
retrieving revision 1.228
retrieving revision 1.229
diff -u -b -r1.228 -r1.229
--- qe.c        29 Jul 2016 11:04:31 -0000      1.228
+++ qe.c        29 Jul 2016 11:20:08 -0000      1.229
@@ -5518,7 +5518,7 @@
 static int minibuffer_history_index;
 static int minibuffer_history_saved_offset;
 
-void do_completion(EditState *s)
+void do_completion(EditState *s, int type)
 {
     QEmacsState *qs = s->qe_state;
     int count, i, match_len, c;
@@ -5531,13 +5531,17 @@
     if (!completion_function)
         return;
 
-    /* XXX: if completion_popup_window already displayed, should page
-     * through the window, if at end, should remove focus from
-     * completion_popup_window or close it.
-     */
+    /* Remove highlighted selection. */
+    // XXX: Should complete based on point position,
+    //      not necessarily full minibuffer contents
+    do_delete_selection(s);
+
     /* check completion window */
     check_window(&completion_popup_window);
-    if (completion_popup_window && qs->last_cmd_func == qs->this_cmd_func) {
+    if (completion_popup_window
+    &&  type == COMPLETION_TAB
+    &&  qs->last_cmd_func == qs->this_cmd_func) {
+        /* toggle cpmpletion popup on TAB */
         edit_close(&completion_popup_window);
         do_refresh(s);
         return;
@@ -5575,15 +5579,19 @@
     }
     if (match_len > cs.len) {
         /* add the possible chars */
-        /* XXX: should insert utf-8? */
+        // XXX: potential utf-8 issue?
         eb_write(s->b, 0, outputs[0]->str, match_len);
         s->offset = match_len;
+        if (type == COMPLETION_OTHER) {
+            do_mark_region(s, match_len, cs.len);
+        }
     } else {
         if (count > 1) {
             /* if more than one match, then display them in a new popup
                buffer */
             if (!completion_popup_window) {
-                b = eb_new("*completion*", BF_SYSTEM | BF_UTF8 | BF_TRANSIENT);
+                b = eb_new("*completion*", 
+                           BF_SYSTEM | BF_UTF8 | BF_TRANSIENT | BF_STYLE1);
                 b->default_mode = &list_mode;
                 w1 = qs->screen->width;
                 h1 = qs->screen->height - qs->status_height;
@@ -5593,8 +5601,9 @@
                 do_refresh(e);
                 completion_popup_window = e;
             }
-        } else {
-            if (completion_popup_window) {
+        } else
+        if (count == 0 || type != COMPLETION_OTHER) {
+            /* close the popup when minibuf contents matches nothing */
                 edit_close(&completion_popup_window);
                 do_refresh(s);
             }
@@ -5616,7 +5625,6 @@
             e->force_highlight = 1;
             e->offset = 0;
         }
-    }
     complete_end(&cs);
 }
 
@@ -5655,18 +5663,28 @@
 /* space does completion only if a completion method is defined */
 void do_completion_space(EditState *s)
 {
+    QEmacsState *qs = s->qe_state;
+
     if (!completion_function) {
         do_char(s, ' ', 1);
+    } else
+    if (completion_popup_window && qs->last_cmd_func == qs->this_cmd_func) {
+        /* page through the list */
+        // XXX: should close the popup at the bottom of the list
+        do_scroll_up_down(completion_popup_window, 2);
     } else {
-        do_completion(s);
+        do_completion(s, COMPLETION_SPACE);
     }
 }
 
 static void do_minibuffer_char(EditState *s, int key, int argval)
 {
     do_char(s, key, argval);
-    if (completion_popup_window)
-        do_completion(s);
+    if (completion_popup_window) {
+        /* automatic filtering of completion list */
+        // XXX: should prevent auto-completion
+        do_completion(s, COMPLETION_OTHER);
+    }
 }
 
 /* scroll in completion popup */

Index: qeconfig.h
===================================================================
RCS file: /sources/qemacs/qemacs/qeconfig.h,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -b -r1.58 -r1.59
--- qeconfig.h  7 Jun 2016 08:56:40 -0000       1.58
+++ qeconfig.h  29 Jul 2016 11:20:08 -0000      1.59
@@ -447,8 +447,8 @@
           "minibuffer-exit", do_minibuffer_exit, 0)
     CMD1( KEY_CTRL('g'), KEY_NONE,
           "minibuffer-abort", do_minibuffer_exit, 1)
-    CMD0( KEY_CTRL('i'), KEY_NONE,
-          "minibuffer-complete", do_completion)
+    CMD1( KEY_CTRL('i'), KEY_NONE,
+          "minibuffer-complete", do_completion, COMPLETION_TAB)
     /* should take numeric prefix to specify word size */
     CMD0( KEY_META('='), KEY_NONE,
           "minibuffer-get-binary", do_minibuffer_get_binary)

Index: TODO.org
===================================================================
RCS file: /sources/qemacs/qemacs/TODO.org,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- TODO.org    13 Jun 2016 17:12:35 -0000      1.14
+++ TODO.org    29 Jul 2016 11:20:08 -0000      1.15
@@ -1,29 +1,23 @@
 ; TODO list for qemacs
 ;
 ; Author: Charles Gordon
-; Updated: 2016-06-08
+; Updated: 2016-07-29
 
 * Needed for release version 5
 
 * Priority 0
 
 ** basic: reset last command when executing macro
-** extra: add function to add entry in TODO.org
 ** clang: indentation bug on {\nputchar(expr ? 'a' : 'b');\n}
-** completion: completion behaviour on SPC
-** completion: fix or disable fuzzy/glob matcher
 ** completion: fix electric behavior
-** completion: hilite current line in popup-view
 ** files: track file modifications and reload upon change
 ** files: check file date to detect asynchronous modifications on disk
 ** shell: turn on interactive mode on commands that move the cursor to EOB
 ** shell: asynchronous input buffer
 ** shell: give commands a chance to execute for macros to behave correctly
-** x11: commit patches
 
 * Priority 1
 
-** shell: M-l, M-u, M-c and other buffer modifications in shell input region
 ** basic: improve speed: C-x C-f ~/x2m RET A-r 20140101 RET 20140101 RET -> 96s
 ** basic: improve speed: C-x C-f ~/x2m RET C-u 1000 C-n -> 4s
 ** basic: check abort during long operations: bufferize input and check for ^G
@@ -39,8 +33,11 @@
 ** basic: fix behaviour on overlong lines
 ** basic: fix offset when exiting s->hex_mode
 ** completion: minibuffer completion: bad return on C-x C-f . SPC qe SPC RET
-** completion: remove or update popup-view as more typing occurs
 ** dired: display directory links as directories and links
+** dired: fork process and use asynchronous function to:
+   - list directory contents
+   - track directory contents file stats
+   - compute subdirectory sizes
 ** doc: migrate TODO and documentation to markdown or reStructuredText
 ** doc: rewrite TODO file with more sections and explanations
 ** doc: migrate coding-rules.html to markdown
@@ -75,6 +72,7 @@
 ** shell: fix crash bug when invoking qemacs recursively in the terminal
 ** shell: set current directory of new shell buffer to that of current window
 ** shell: use auxiliary buffer to make process input asynchronous
+** shell: M-l, M-u, M-c and other buffer modifications in shell input region
 ** syntax: fix overlong line coloring
 ** syntax: support ReStructuredText (RST)
 ** text: \u200c -> zero width
@@ -107,6 +105,7 @@
 ** clang: fix c indentation inside struct, array and enum initializers
 ** dired: keep dired current file upon: RET C-x C-k RET
 ** dired: fork for directory scan, background inode tracking, dir size scan
+** extra: add function to add entry in TODO.org
 ** hex: extend hex mode to support 16,32,64 bit words as little and big endian
 ** html/xml: merge xml / htmlsrc modes
 ** html/xml: fix colorizer for multi-line tags and attributes
@@ -145,11 +144,12 @@
 
 * Basic stuff
 
-** crash bug on johnmacfarlane.net/texmath.xhtml
-** abbreviate lines in file completion list popup
-** wrap long lines past line numbers column
-** tty_put_char should convert charsets
-** current path in compile set to current buffer path
+** xml: crash bug on johnmacfarlane.net/texmath.xhtml
+** completion: abbreviate lines in file completion list popup
+** display: wrap long lines past line numbers column
+** shell: tty_put_char should convert charsets
+** shell: current path in compile set to current buffer path
+** shell: current path retrieved from shell prompt backwards from point
 ** avoid error in new file
 ** add custom memory handling functions.
 ** use failsafe memory allocator and longjmp recover.
@@ -372,6 +372,7 @@
 *** ada-mode
 *** asm-mode: handle various assembly styles
 *** calc-mode: fix syntax, disable C++ comments
+*** cmake-mode
 *** cobol-mode
 *** css-mode
 *** erlang-mode
@@ -404,14 +405,14 @@
 ** missing languages:
 *** asp-mode:
 *** automake-mode:
-*** batch-mode: Windows Batch files.
+*** bat-mode: DOS command.com batch files.
 *** bennugd-mode
 *** bluespec-mode
 *** boo-mode
 *** cg-mode
 *** changelog-mode
 *** chdr-mode
-*** cmake-mode
+*** cmd-mode: Windows cmd.exe command files.
 *** conf-mode: configuration files.
 *** cuda-mode
 *** DCL mode
@@ -480,7 +481,7 @@
 
 * Ideas from other editors
 
-** prevent edit in browse mode
+** prevent edit in browse mode (current called preview-mode)
 ** dynamic project based settings, include, exclude patterns...
 ** electric-c-mode
 ** http request with headings



reply via email to

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