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

Formspecs: Add text field enter key event, allow fields to disable form close on enter #4417

Closed
wants to merge 2 commits into from

Conversation

Projects
None yet
5 participants
@rubenwardy
Copy link
Member

commented Aug 7, 2016

This PR can make the creative inventory search box search on enter press

If enter is pressed with the focus in a text field, fields are submitted to the server.
If the text field is set to close afterwards, these additional fields are set:

quit = true
key_enter = true
key_enter_field = "nameoftextfield"

if the text field doesn't close the form on enter press, then:

key_enter = true
key_enter_field = "nameoftextfield"

This is how you set a field to make it not close on enter press:

field[<X>,<Y>;<W>,<H>;<name>;<label>;<default>;false]

the default is to close on enter press, so the following two elements are the same:

field[<X>,<Y>;<W>,<H>;<name>;<label>;<default>]
field[<X>,<Y>;<W>,<H>;<name>;<label>;<default>;true]

@rubenwardy rubenwardy changed the title Fs text enter Add field enter event, allow fields to disable form close on enter Aug 7, 2016

@rubenwardy

This comment has been minimized.

Copy link
Member Author

commented Aug 7, 2016

sfinv PR now supports this: minetest/minetest_game@5e76f2b

@rubenwardy

This comment has been minimized.

Copy link
Member Author

commented Aug 7, 2016

possible problems: fields[name;label;default] already allows tags with a forth parameter, but never uses it - did there used to be a forth parameter?

After investigation, simple field supports a forth param due to this commit by RBA: 04fbf47#diff-65f34680878a6bd86f3a59ebc0c06c6dL1065
but the forth param is never actually used. Also looked through future commits and it seems like it was never used after that as well. So this PR is safe in that respect

@rubenwardy rubenwardy changed the title Add field enter event, allow fields to disable form close on enter Formspecs: Add field enter event, allow fields to disable form close on enter Aug 7, 2016

@rubenwardy rubenwardy changed the title Formspecs: Add field enter event, allow fields to disable form close on enter Formspecs: Add text field enter key event, allow fields to disable form close on enter Aug 7, 2016

@est31

This comment has been minimized.

Copy link
Contributor

commented Aug 20, 2016

👍 looks good

@est31 est31 added the One approval label Aug 20, 2016

@paramat

This comment has been minimized.

Copy link
Member

commented Aug 26, 2016

Rubenwardy since you're a core dev now your own approval counts towards the 2 needed to merge (however we don't count self-approval in the label because it upsets some people).
So all 3 formspec PRs can be merged now.

@Ekdohibs

This comment has been minimized.

Copy link
Member

commented Aug 26, 2016

Looks good!

@est31

This comment has been minimized.

Copy link
Contributor

commented Aug 26, 2016

@paramat the PR author still needs to express their own approval explicitly. It implies that the PR author has read through their own implementation.

@paramat

This comment has been minimized.

Copy link
Member

commented Aug 26, 2016

est31 agreed, we should always check the author is happy.

@rubenwardy

This comment has been minimized.

Copy link
Member Author

commented Aug 26, 2016

Yeah, I'm happy with this PR

@rubenwardy

This comment has been minimized.

Copy link
Member Author

commented Aug 27, 2016

Should I squash the commits on merge? They're two separate features, so I'm leaning towards no

@ExeterDad

This comment has been minimized.

Copy link

commented Aug 27, 2016

@rubenwardy I hope you add this to your book as well.

@rubenwardy

This comment has been minimized.

Copy link
Member Author

commented Aug 27, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.