Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiline input example #3

Open
jubalh opened this issue Oct 22, 2019 · 1 comment
Open

Multiline input example #3

jubalh opened this issue Oct 22, 2019 · 1 comment

Comments

@jubalh
Copy link

jubalh commented Oct 22, 2019

Would you mind adding a multiline input example?

@ulfalizer
Copy link
Owner

I think this should work:

  1. Do something like what this StackOverflow answer does to preserve newlines in the input (there seems to be some other good links too when googling "readline multiline").

  2. Modify the strnwidth() code so that instead of just returning the width (x coordinate), it returns an x/y coordinate. When you see a newline in the input, do x = 0; y++;.

  3. Use the returned x/y to position the cursor.

Might be quite a big change though, and I want to keep rlncurses.c relatively simple. If you come up with something that works, I'm happy to link it though. Could add it as a separate example in the repo too.

Might look at it myself some time. No guarantees though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants