Coder Social home page Coder Social logo

Comments (5)

wmcbrine avatar wmcbrine commented on May 24, 2024 1

Personally, I'd be OK with it crashing, since that tells you right away "oops, forgot initscr()". But, fine, I realize curses doesn't work that way in general. I've put in SP checks throughout mouse.c (to be committed later).

For this particular function, though, I'm not really seeing the logic of returning the maximum interval on no SP. I realize that's what ncurses does, but not why. Zero would seem to make at least as much sense, reflecting the fact that you're not going to get any click events (or any other input events).

from pdcurses.

GitMensch avatar GitMensch commented on May 24, 2024

I'm not really seeing the logic of returning the maximum interval on no SP

Maybe that's a "proper way" to know the maximum up-front? I don't know, it was just something I've stumbled over.

from pdcurses.

wmcbrine avatar wmcbrine commented on May 24, 2024

For now, I've decided to return ERR in this situation. 7e04826

from pdcurses.

Bill-Gray avatar Bill-Gray commented on May 24, 2024

@wmcbrine 'fixed' this by having a slew of functions return ERR if called before initscr(). However, I agree strongly that (in most cases) the program should crash, and certainly should do so when compiled for debug mode. Calling, for example, init_color() in ncurses without init_scr() does not crash, but it also has no effect. If you do it, you've done something wrong, and could spend some time trying to figure it out if your mistake is simply ignored.
For my fork, I've added an assert(SP) for each such case. This -- at least in debug mode -- makes considerably more sense to me. I also revised mouseinterval() to follow ncurses' lead and return the maximum mouse interval (which I made a defined constant and bumped up to 32767 milliseconds).

from pdcurses.

wmcbrine avatar wmcbrine commented on May 24, 2024

Returning ERR is the documented behavior for most of these functions, per both X/Open and the ncurses man pages. But certainly, more detailed feedback would be desirable in some cases.

from pdcurses.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.