>From 62319ce0422af23d2fb3d4f184840d9ac0298778 Mon Sep 17 00:00:00 2001
From: M Farkas-Dyck <strake...@gmail.com>
Date: Thu, 5 Jun 2014 12:27:27 -0500
Subject: [PATCH 1/5] call endwin on suspend

---
 sandy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sandy.c b/sandy.c
index 5d049f3..5e519b7 100644
--- a/sandy.c
+++ b/sandy.c
@@ -470,7 +470,7 @@ f_spawn(const Arg *arg) {
 
 void
 f_suspend(const Arg *arg) {
-       wclear(textwin);
+       endwin();
        signal (SIGCONT, i_sigcont);
        raise(SIGSTOP);
 }
-- 
2.0.0

>From 2a4d90afce642ec4f72fc0b6ec500b649a652648 Mon Sep 17 00:00:00 2001
From: M Farkas-Dyck <strake...@gmail.com>
Date: Fri, 16 May 2014 06:42:52 +0000
Subject: [PATCH 2/5] better regcomp failure messages

---
 sandy.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/sandy.c b/sandy.c
index 5e519b7..05851a5 100644
--- a/sandy.c
+++ b/sandy.c
@@ -276,6 +276,16 @@ static regex_t *cmd_res[LENGTH(cmds)];
 static regex_t *syntax_file_res[LENGTH(syntaxes)];
 static regex_t *syntax_res[LENGTH(syntaxes)][SYN_COLORS];
 
+static int
+xregcomp(regex_t *p_re, const char *s, int flags) {
+       int c=regcomp(p_re, s, flags);
+       if(c != 0) {
+               uint8_t msg[4096];
+               regerror(c, p_re, msg, 4096);
+               i_die(msg);
+       }
+}
+
 /* F_* FUNCTIONS
        Can be linked to an action or keybinding. Always return void and take 
const Arg* */
 
@@ -485,7 +495,7 @@ f_syntax(const Arg *arg) {
                                   : !regexec(syntax_file_res[i], filename, 1, 
NULL, 0)) {
                        for(j=0; j<SYN_COLORS; j++) {
                                if((syntx >= 0) && syntax_res[syntx][j]) 
regfree(syntax_res[syntx][j]);
-                               if(syntaxes[i].re_text[j] && 
regcomp(syntax_res[i][j], syntaxes[i].re_text[j], REG_EXTENDED|REG_NEWLINE)) 
i_die("Faulty regex.\n");
+                               xregcomp(syntax_res[i][j], 
syntaxes[i].re_text[j], REG_EXTENDED|REG_NEWLINE);
                        }
                        syntx=i;
                        setenv(envs[EnvSyntax], syntaxes[syntx].name, 1);
@@ -1182,12 +1192,12 @@ i_setup(void){
 
        for(i=0; i<LENGTH(cmds); i++) {
                if((cmd_res[i]=(regex_t*)calloc(1, sizeof (regex_t))) == NULL) 
i_die("Can't malloc.\n");
-               if(regcomp(cmd_res[i], cmds[i].re_text, 
REG_EXTENDED|REG_ICASE|REG_NEWLINE)) i_die("Faulty regex.\n");
+               xregcomp(cmd_res[i], cmds[i].re_text, 
REG_EXTENDED|REG_ICASE|REG_NEWLINE);
        }
 
        for(i=0; i<LENGTH(syntaxes); i++) {
                if((syntax_file_res[i]=(regex_t*)calloc(1, sizeof (regex_t))) 
== NULL) i_die("Can't malloc.\n");
-               if(regcomp(syntax_file_res[i], syntaxes[i].file_re_text, 
REG_EXTENDED|REG_NOSUB|REG_ICASE|REG_NEWLINE)) i_die("Faulty regex.\n");
+               xregcomp(syntax_file_res[i], syntaxes[i].file_re_text, 
REG_EXTENDED|REG_NOSUB|REG_ICASE|REG_NEWLINE);
                for(j=0; j<SYN_COLORS; j++)
                        if((syntax_res[i][j]=(regex_t*)calloc(1, sizeof 
(regex_t))) == NULL) i_die("Can't malloc.\n");
        }
-- 
2.0.0

>From 86c693736a4000eb4731962cc40257b8caf34357 Mon Sep 17 00:00:00 2001
From: Strake <strake...@gmail.com>
Date: Fri, 7 Mar 2014 12:29:05 -0500
Subject: [PATCH 3/5] simplify c file regex

---
 config.def.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config.def.h b/config.def.h
index a280e06..98ccf3e 100644
--- a/config.def.h
+++ b/config.def.h
@@ -203,7 +203,7 @@ static const Command cmds[] = { /* REMEMBER: if(arg == 0) 
arg.v=regex_match */
 
 static const Syntax syntaxes[] = {
 #if HILIGHT_SYNTAX
-{"c", "\\.(c(pp|xx)?|h(pp|xx)?|cc)$", {
+{"c", "\\.([ch](pp|xx)?|cc)$", {
        /* HiRed   */  "$^",
        /* HiGreen */  
B"(for|if|while|do|else|case|default|switch|try|throw|catch|operator|new|delete)"B,
        /* LoGreen */  
B"(float|double|bool|char|int|short|long|sizeof|enum|void|static|const|struct|union|typedef|extern|(un)?signed|inline|((s?size)|((u_?)?int(8|16|32|64|ptr)))_t|class|namespace|template|public|protected|private|typename|this|friend|virtual|using|mutable|volatile|register|explicit)"B,
-- 
2.0.0

>From 2426819a62cf2c360663b1ba74cb966a07ddcdb6 Mon Sep 17 00:00:00 2001
From: Strake <strake...@gmail.com>
Date: Fri, 7 Mar 2014 12:11:47 -0500
Subject: [PATCH 4/5] optionalize to use term status feature

---
 config.def.h | 1 +
 sandy.c      | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/config.def.h b/config.def.h
index 98ccf3e..0ddb85a 100644
--- a/config.def.h
+++ b/config.def.h
@@ -1,4 +1,5 @@
 /* A simplified way to customize */
+#define USE_TERM_STATUS 1
 #define HILIGHT_CURRENT 1
 #define HILIGHT_SYNTAX  1
 #define SHOW_NONPRINT   0
diff --git a/sandy.c b/sandy.c
index 05851a5..71c014b 100644
--- a/sandy.c
+++ b/sandy.c
@@ -1275,7 +1275,7 @@ i_termwininit(void) {
        noecho();
        nl();
        if(textwin) delwin(textwin);
-       if(tigetflag("hs") > 0) {
+       if(USE_TERM_STATUS && tigetflag("hs") > 0) {
                tsl_str=tigetstr("tsl");
                fsl_str=tigetstr("fsl");
                textwin=newwin(lines,cols,0,0);
-- 
2.0.0

>From 81c58094e13ca126e691dac00bccc872dfc83025 Mon Sep 17 00:00:00 2001
From: Strake <strake...@gmail.com>
Date: Fri, 7 Mar 2014 12:15:18 -0500
Subject: [PATCH 5/5] possibilize title bar at bottom

---
 config.def.h | 1 +
 sandy.c      | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/config.def.h b/config.def.h
index 0ddb85a..c873ac4 100644
--- a/config.def.h
+++ b/config.def.h
@@ -1,5 +1,6 @@
 /* A simplified way to customize */
 #define USE_TERM_STATUS 1
+#define BOTTOM_TITLE    0
 #define HILIGHT_CURRENT 1
 #define HILIGHT_SYNTAX  1
 #define SHOW_NONPRINT   0
diff --git a/sandy.c b/sandy.c
index 71c014b..3313178 100644
--- a/sandy.c
+++ b/sandy.c
@@ -1281,9 +1281,9 @@ i_termwininit(void) {
                textwin=newwin(lines,cols,0,0);
        } else {
                if(titlewin) delwin(titlewin);
-               titlewin=newwin(1,cols,0,0);
+               titlewin=newwin(1,cols,BOTTOM_TITLE?lines-1:0,0);
                wattron(titlewin,A_REVERSE);
-               textwin=newwin(lines-1,cols,1,0);
+               textwin=newwin(lines-1,cols,BOTTOM_TITLE?0:1,0);
        }
        idlok(textwin, TRUE);
        keypad(textwin, TRUE);
-- 
2.0.0


Reply via email to