From caeab9bd19a920f940dbcf0cfdc0350d86f4b7e6 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Thu, 24 Jul 2014 16:40:06 +0000 Subject: [PATCH 1/5] fix mouse scroll down - add a comment in the README how to enable mouse scrolling. This is a limitation in ncurses. - read count can be 0 (not an error), this is reproducable if you scroll down with the mouse with ncurses and --disable-mouse-ext. --- README | 4 ++++ config.def.h | 4 +++- sandy.c | 3 ++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README b/README index 67967ba..1112f4c 100644 --- a/README +++ b/README @@ -40,3 +40,7 @@ Name In case you are wondering, sandy was the smartest pet ferret. She died of cancer though. We were sad and started coding this editor. + +Known issues +------------ +Mouse scroll down works if ncurses is compiled with --enable-ext-mouse. diff --git a/config.def.h b/config.def.h index 9469130..fa80e52 100644 --- a/config.def.h +++ b/config.def.h @@ -266,7 +266,9 @@ static const Click clks[] = { {BUTTON3_CLICKED, { TRUE , FALSE }, { t_sel, 0, 0 }, f_pipero, { .v = TOSEL } }, {BUTTON2_CLICKED, { FALSE, FALSE }, { t_rw, 0, 0 }, f_pipenull, { .v = FROMSEL } }, {BUTTON4_CLICKED, { FALSE, FALSE }, { 0, 0, 0 }, f_move, { .m = m_prevscr } }, -/*{BUTTON5_CLICKED, { FALSE, FALSE }, { 0, 0, 0 }, f_move, { .m = m_nextscr } },*/ +#ifdef BUTTON5_CLICKED +{BUTTON5_CLICKED, { FALSE, FALSE }, { 0, 0, 0 }, f_move, { .m = m_nextscr } }, +#endif /* ^^ NCurses is a sad old library.... it does not include button 5 nor * cursor movement in its mouse declaration by default */ {BUTTON1_DOUBLE_CLICKED, { TRUE , TRUE }, { 0, 0, 0 }, f_extsel, { .i = ExtWord } }, diff --git a/sandy.c b/sandy.c index ba4a39f..32acff5 100644 --- a/sandy.c +++ b/sandy.c @@ -1371,8 +1371,9 @@ i_pipetext(const char *cmd) { } if(FD_ISSET(perr[0], &fdI) && nerr > 0) { /* Blatant TODO: take last line of stderr and copy as tmptitle */ + ebuf[0] = '\0'; nerr = read(perr[0], ebuf, BUFSIZ); - if(nerr != 0) + if(nerr == -1) tmptitle = "WARNING! command reported an error!!!"; if(nerr < 0) break; -- 2.0.2