commit 747d234bea0b52f7b0518d4769bb2991edfe915f
parent ae99ffa0fd68ea76b131d17004dea676ac03ee01
Author: Claudio Alessi <smoppy@gmail.com>
Date: Mon, 29 Feb 2016 19:16:15 +0100
Add reload()
Diffstat:
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/core.c b/core.c
@@ -79,6 +79,7 @@ void usedb(const Arg *arg);
void usetable(const Arg *arg);
void userecord(const Arg *arg);
void itempos(const Arg *arg);
+void reload(const Arg *arg);
/* config.h > */
@@ -105,6 +106,7 @@ static Key keys[] = {
{ NULL, L"E", setmode, {.v = &modes[3]} },
{ NULL, L"k", itempos, {.i = -1} },
{ NULL, L"j", itempos, {.i = +1} },
+ { NULL, L"I", reload, {0} },
{ "databases", L"q", quit, {.i = 0} },
{ "databases", L"ENTER", usedb, {.v = &modes[1]} },
{ "databases", L"SPACE", usedb, {.v = &modes[1]} },
@@ -192,12 +194,16 @@ setmode(const Arg *arg) {
v->mode = &modes[i];
attach(v);
}
-
selview = v;
v->mode->func();
}
void
+reload(const Arg *arg) {
+ selview->mode->func();
+}
+
+void
cleanupitems(Item *i) {
while(i && i->next) {
detachitemfrom(i, &i);
@@ -310,7 +316,7 @@ records(void) {
snprintf(txt, sizeof txt, "select * from `%s`", selitem->fields[0]);
if(!(res = mysql_exec(txt)))
- die("tables\n");
+ die("records\n");
cleanupitems(selview->items);
selview->nitems = mysql_items(res, &selview->items);