qemacs-commit
[Top][All Lists]
Advanced

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

[Qemacs-commit] qemacs hex.c html.c list.c mpeg.c unihex.c shell.c


From: Charlie Gordon
Subject: [Qemacs-commit] qemacs hex.c html.c list.c mpeg.c unihex.c shell.c
Date: Wed, 15 Jan 2014 15:54:33 +0000

CVSROOT:        /sources/qemacs
Module name:    qemacs
Changes by:     Charlie Gordon <chqrlie>        14/01/15 15:54:33

Modified files:
        .              : hex.c html.c list.c mpeg.c unihex.c shell.c 

Log message:
        fix bugs in mode initializations
        
        * mode initializers should call text-mode-init to register ccallback
          for s->offset and s->top_offset, and other generic stuff.
        * this is error prone, should simplify this with base_mode property and
          keep unmapped windows lingering to get rid of ModeSavedData handlers

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/hex.c?cvsroot=qemacs&r1=1.33&r2=1.34
http://cvs.savannah.gnu.org/viewcvs/qemacs/html.c?cvsroot=qemacs&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/qemacs/list.c?cvsroot=qemacs&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/qemacs/mpeg.c?cvsroot=qemacs&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/qemacs/unihex.c?cvsroot=qemacs&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/qemacs/shell.c?cvsroot=qemacs&r1=1.77&r2=1.78

Patches:
Index: hex.c
===================================================================
RCS file: /sources/qemacs/qemacs/hex.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -b -r1.33 -r1.34
--- hex.c       12 Jan 2014 01:39:10 -0000      1.33
+++ hex.c       15 Jan 2014 15:54:27 -0000      1.34
@@ -153,11 +153,8 @@
     QEFont *font;
     QEStyleDef style;
     int num_width;
-    int ret;
 
-    ret = text_mode_init(s, saved_data);
-    if (ret)
-        return ret;
+    text_mode_init(s, saved_data);
 
     /* get typical number width */
     get_style(s, &style, s->default_style);
@@ -178,11 +175,7 @@
 
 static int hex_mode_init(EditState *s, ModeSavedData *saved_data)
 {
-    int ret;
-
-    ret = text_mode_init(s, saved_data);
-    if (ret)
-        return ret;
+    text_mode_init(s, saved_data);
 
     s->disp_width = 16;
     s->hex_mode = 1;

Index: html.c
===================================================================
RCS file: /sources/qemacs/qemacs/html.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- html.c      14 Jan 2014 03:29:37 -0000      1.24
+++ html.c      15 Jan 2014 15:54:27 -0000      1.25
@@ -786,6 +786,8 @@
 {
     HTMLState *hs = s->mode_data;
 
+    /* XXX: should register callbacks for s->offset and s->top_offset? */
+
     if (!saved_data) {
         memset(s, 0, SAVED_DATA_SIZE);
         s->insert = 1;

Index: list.c
===================================================================
RCS file: /sources/qemacs/qemacs/list.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- list.c      3 Dec 2013 17:36:15 -0000       1.10
+++ list.c      15 Jan 2014 15:54:27 -0000      1.11
@@ -81,22 +81,19 @@
 
 static int list_mode_init(EditState *s, __unused__ ModeSavedData *saved_data)
 {
+    text_mode_init(s, saved_data);
+
     s->wrap = WRAP_TRUNCATE;
     s->get_colorized_line = list_get_colorized_line;
     return 0;
 }
 
-static void list_mode_close(__unused__ EditState *s)
-{
-}
-
 static int list_init(void)
 {
     memcpy(&list_mode, &text_mode, sizeof(ModeDef));
     list_mode.name = "list";
     list_mode.mode_probe = NULL;
     list_mode.mode_init = list_mode_init;
-    list_mode.mode_close = list_mode_close;
     list_mode.mode_flags = MODEF_NOCMD;
 
     qe_register_mode(&list_mode);

Index: mpeg.c
===================================================================
RCS file: /sources/qemacs/qemacs/mpeg.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- mpeg.c      4 Jan 2014 17:28:35 -0000       1.6
+++ mpeg.c      15 Jan 2014 15:54:27 -0000      1.7
@@ -140,14 +140,12 @@
 
 static int mpeg_mode_init(EditState *s, ModeSavedData *saved_data)
 {
-    int ret;
-    ret = text_mode_init(s, saved_data);
-    if (ret)
-        return ret;
+    text_mode_init(s, saved_data);
 
     s->hex_mode = 1;
     s->hex_nibble = 0;
     s->wrap = WRAP_TRUNCATE;
+
     return 0;
 }
 
@@ -167,7 +165,6 @@
     .name = "mpeg",
     .mode_probe = mpeg_mode_probe,
     .mode_init = mpeg_mode_init,
-    .mode_close = NULL,
     .text_display = mpeg_display,
     .text_backward_offset = mpeg_backward_offset,
     .write_char = hex_write_char,

Index: unihex.c
===================================================================
RCS file: /sources/qemacs/qemacs/unihex.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- unihex.c    12 Jan 2014 01:39:10 -0000      1.18
+++ unihex.c    15 Jan 2014 15:54:27 -0000      1.19
@@ -23,11 +23,9 @@
 
 static int unihex_mode_init(EditState *s, ModeSavedData *saved_data)
 {
-    int ret, c, maxc, offset, max_offset;
+    int c, maxc, offset, max_offset;
 
-    ret = text_mode_init(s, saved_data);
-    if (ret)
-        return ret;
+    text_mode_init(s, saved_data);
 
     /* Compute max width of character in hex dump (limit to first 64K) */
     maxc = 0xFF;

Index: shell.c
===================================================================
RCS file: /sources/qemacs/qemacs/shell.c,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -b -r1.77 -r1.78
--- shell.c     14 Jan 2014 03:53:56 -0000      1.77
+++ shell.c     15 Jan 2014 15:54:30 -0000      1.78
@@ -1654,16 +1654,19 @@
     } else {
         /* Should dispatch as in fundamental mode */
         switch (c) {
-        case 4:
+        case KEY_CTRL('d'):
             do_delete_char(e, NO_ARG);
             break;
         // Do not do this: it is useless and causes infinite recursion
         //case 9:
         //    do_tab(e, 1);
         //    break;
-        case 11:
+        case KEY_CTRL('k'):
             do_kill_line(e, 1);
             break;
+        case KEY_CTRL('y'):
+            do_yank(e);
+            break;
         case KEY_BS:
         case KEY_DEL:
             do_backspace(e, NO_ARG);
@@ -1895,9 +1898,9 @@
 
 static int shell_mode_init(EditState *s, __unused__ ModeSavedData *saved_data)
 {
+    text_mode_init(s, saved_data);
     s->tab_size = 8;
     s->wrap = WRAP_TRUNCATE;
-    set_colorize_func(s, NULL);
     s->get_colorized_line = shell_get_colorized_line;
     s->interactive = 1;
     return 0;
@@ -1905,9 +1908,9 @@
 
 static int pager_mode_init(EditState *s, __unused__ ModeSavedData *saved_data)
 {
+    text_mode_init(s, saved_data);
     s->tab_size = 8;
     s->wrap = WRAP_TRUNCATE;
-    set_colorize_func(s, NULL);
     s->get_colorized_line = shell_get_colorized_line;
     return 0;
 }



reply via email to

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