myadm

Simple MySQL client for the terminal
git clone git://git.bitsmanent.org/myadm
Log | Files | Refs | README | LICENSE

commit 3ec4bfea0a087987a00ba9f0b0c0e207cda2df93
parent 14935088271224c69c32f251b7575efecbd59333
Author: Claudio Alessi <smoppy@gmail.com>
Date:   Tue, 10 May 2016 21:27:13 +0200

Reinitialize ncurses after edit a file.

This fix a corner case where you put the editor in background, then resize the
screen, than come back in foreground and exit from the editor. By doing so,
myadm would take into account the old screen size which is wrong and causes
glitches. This commit let ncurses properly reset the screen size.

Diffstat:
Mmyadm.c | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/myadm.c b/myadm.c @@ -315,7 +315,9 @@ editfile(char *file) { sigaction(SIGTSTP, &saold[2], NULL); sigaction(SIGWINCH, &saold[3], NULL); - ui_redraw(); + /* reinitialize ncurses */ + endwin(); + refresh(); } void @@ -372,7 +374,6 @@ getmaxlengths(Item *items, Field *fields) { if(!(items || fields)) return NULL; - if(items) ncols = items->ncols; else @@ -427,10 +428,10 @@ mksql_update_record(Item *item, Field *fields, char *tbl, char *pk) { cnt ? ',' : ' ', fld->name, col); cnt += len - 1; } - free(col); size = 1 + 28 + cnt + strlen(pk) + strlen(pkv) + strlen(tbl); sql = ecalloc(1, size); snprintf(sql, size, "UPDATE `%s` SET%s\nWHERE `%s` = '%s'", tbl, sqlfds, pk, pkv); + free(col); free(sqlfds); return sql; }