GithubHelp home page GithubHelp logo

Comments (2)

dumblob avatar dumblob commented on July 20, 2024

I'll take the liberty to respond first 😉.

There are two ways how I'd approach this question.

  1. user experience (and actually programmer experience as well) definitely needs to remember the cursor position - thus this should be the default (which it isn't currently)

  2. the solution of yours nicely shows the advantage of immediate mode way of things - it's easy to track the cursor position on your own (though a bit verbose) and thus one would say Nuklear doesn't need such things

My personal opinion is, that in this case we should somehow provide better defaults as described in (1). On the other hand, the helpers from @alexandervanrenen's solution are not comfortable enough IMHO as they don't store the information anywhere per widget instance.

My suggestion would be to either somehow abuse ctx in nuklear.h itself or if we wanted to stay conservative, then I'd say we should provide this functionality in each backend through an additional struct pointed to by void pointer in each widget instance (this second idea is more work, but wouldn't cause nuklear.h to grow).

Don't know what would be better - anyone wants to comment on this?

from nuklear.

skinnyjames avatar skinnyjames commented on July 20, 2024

Noticing this too when interacting non-programmatically if the text editor unfocused position is below the scrollbar.

Don't know what would be better - anyone wants to comment on this?

Just an opinion, but what about specifying callbacks for focus/blur stored on nk_text_edit and invoked by nk_do_edit? This could work well with widget userdata or possibly context userdata. It would also be cool to adjust the scrollbar position and do other things as well without having to provide more configuration upfront or having to reinvent things.

from nuklear.

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.