sandy

text editor
git clone git://git.suckless.org/sandy
Log | Files | Refs | README | LICENSE

commit 0d6aa9ce2a97bfe781ddb758913f629535b664ab
parent 8c1ab7f05494c9af8a947eb582fc67f0f30f439f
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Thu, 24 Jul 2014 16:40:06 +0000

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.

Diffstat:
README | 4++++
config.def.h | 4+++-
sandy.c | 3++-
3 files changed, 9 insertions(+), 2 deletions(-)

diff --git 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 @@ -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 @@ -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;