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

Add select-all text handling in demo #762

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions demo/glfw_opengl2/nuklear_glfw_gl2.h
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ nk_glfw3_new_frame(void)
nk_input_key(ctx, NK_KEY_TEXT_WORD_RIGHT, glfwGetKey(win, GLFW_KEY_RIGHT) == GLFW_PRESS);
nk_input_key(ctx, NK_KEY_TEXT_LINE_START, glfwGetKey(win, GLFW_KEY_B) == GLFW_PRESS);
nk_input_key(ctx, NK_KEY_TEXT_LINE_END, glfwGetKey(win, GLFW_KEY_E) == GLFW_PRESS);
nk_input_key(ctx, NK_KEY_TEXT_SELECT_ALL, glfwGetKey(win, GLFW_KEY_A) == GLFW_PRESS);
} else {
nk_input_key(ctx, NK_KEY_LEFT, glfwGetKey(win, GLFW_KEY_LEFT) == GLFW_PRESS);
nk_input_key(ctx, NK_KEY_RIGHT, glfwGetKey(win, GLFW_KEY_RIGHT) == GLFW_PRESS);
Expand Down
1 change: 1 addition & 0 deletions demo/glfw_opengl3/nuklear_glfw_gl3.h
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,7 @@ nk_glfw3_new_frame(struct nk_glfw* glfw)
nk_input_key(ctx, NK_KEY_TEXT_WORD_RIGHT, glfwGetKey(win, GLFW_KEY_RIGHT) == GLFW_PRESS);
nk_input_key(ctx, NK_KEY_TEXT_LINE_START, glfwGetKey(win, GLFW_KEY_B) == GLFW_PRESS);
nk_input_key(ctx, NK_KEY_TEXT_LINE_END, glfwGetKey(win, GLFW_KEY_E) == GLFW_PRESS);
nk_input_key(ctx, NK_KEY_TEXT_SELECT_ALL, glfwGetKey(win, GLFW_KEY_A) == GLFW_PRESS);
} else {
nk_input_key(ctx, NK_KEY_LEFT, glfwGetKey(win, GLFW_KEY_LEFT) == GLFW_PRESS);
nk_input_key(ctx, NK_KEY_RIGHT, glfwGetKey(win, GLFW_KEY_RIGHT) == GLFW_PRESS);
Expand Down
4 changes: 4 additions & 0 deletions demo/sdl_opengl2/nuklear_sdl_gl2.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,10 @@ nk_sdl_handle_event(SDL_Event *evt)
case SDLK_e: nk_input_key(ctx, NK_KEY_TEXT_LINE_END, down && state[SDL_SCANCODE_LCTRL]); break;
case SDLK_UP: nk_input_key(ctx, NK_KEY_UP, down); break;
case SDLK_DOWN: nk_input_key(ctx, NK_KEY_DOWN, down); break;
case SDLK_a:
if(state[SDL_SCANCODE_LCTRL])
nk_input_key(ctx,NK_KEY_TEXT_SELECT_ALL, down);
break;
case SDLK_LEFT:
if (state[SDL_SCANCODE_LCTRL])
nk_input_key(ctx, NK_KEY_TEXT_WORD_LEFT, down);
Expand Down
4 changes: 4 additions & 0 deletions demo/sdl_opengl3/nuklear_sdl_gl3.h
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,10 @@ nk_sdl_handle_event(SDL_Event *evt)
case SDLK_e: nk_input_key(ctx, NK_KEY_TEXT_LINE_END, down && state[SDL_SCANCODE_LCTRL]); break;
case SDLK_UP: nk_input_key(ctx, NK_KEY_UP, down); break;
case SDLK_DOWN: nk_input_key(ctx, NK_KEY_DOWN, down); break;
case SDLK_a:
if(state[SDL_SCANCODE_LCTRL])
nk_input_key(ctx,NK_KEY_TEXT_SELECT_ALL, down);
break;
case SDLK_LEFT:
if (state[SDL_SCANCODE_LCTRL])
nk_input_key(ctx, NK_KEY_TEXT_WORD_LEFT, down);
Expand Down
4 changes: 4 additions & 0 deletions demo/sdl_opengles2/nuklear_sdl_gles2.h
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,10 @@ nk_sdl_handle_event(SDL_Event *evt)
case SDLK_e: nk_input_key(ctx, NK_KEY_TEXT_LINE_END, down && state[SDL_SCANCODE_LCTRL]); break;
case SDLK_UP: nk_input_key(ctx, NK_KEY_UP, down); break;
case SDLK_DOWN: nk_input_key(ctx, NK_KEY_DOWN, down); break;
case SDLK_a:
if(state[SDL_SCANCODE_LCTRL])
nk_input_key(ctx,NK_KEY_TEXT_SELECT_ALL, down);
break;
case SDLK_LEFT:
if (state[SDL_SCANCODE_LCTRL])
nk_input_key(ctx, NK_KEY_TEXT_WORD_LEFT, down);
Expand Down
4 changes: 4 additions & 0 deletions demo/sdl_renderer/nuklear_sdl_renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ nk_sdl_handle_event(SDL_Event *evt)
case SDLK_e: nk_input_key(ctx, NK_KEY_TEXT_LINE_END, down && state[SDL_SCANCODE_LCTRL]); break;
case SDLK_UP: nk_input_key(ctx, NK_KEY_UP, down); break;
case SDLK_DOWN: nk_input_key(ctx, NK_KEY_DOWN, down); break;
case SDLK_a:
if(state[SDL_SCANCODE_LCTRL])
nk_input_key(ctx,NK_KEY_TEXT_SELECT_ALL, down);
break;
case SDLK_LEFT:
if (state[SDL_SCANCODE_LCTRL])
nk_input_key(ctx, NK_KEY_TEXT_WORD_LEFT, down);
Expand Down
4 changes: 4 additions & 0 deletions demo/sdl_vulkan/nuklear_sdl_vulkan.h
Original file line number Diff line number Diff line change
Expand Up @@ -1322,6 +1322,10 @@ NK_API int nk_sdl_handle_event(SDL_Event *evt) {
case SDLK_DOWN:
nk_input_key(ctx, NK_KEY_DOWN, down);
break;
case SDLK_a:
if(state[SDL_SCANCODE_LCTRL])
nk_input_key(ctx,NK_KEY_TEXT_SELECT_ALL, down);
break;
case SDLK_LEFT:
if (state[SDL_SCANCODE_LCTRL])
nk_input_key(ctx, NK_KEY_TEXT_WORD_LEFT, down);
Expand Down
2 changes: 2 additions & 0 deletions demo/x11/nuklear_xlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,8 @@ nk_xlib_handle_event(Display *dpy, int screen, Window win, XEvent *evt)
nk_input_key(ctx, NK_KEY_TEXT_LINE_START, down);
else if (*code == 'e' && (evt->xkey.state & ControlMask))
nk_input_key(ctx, NK_KEY_TEXT_LINE_END, down);
else if (*code == 'a' && (evt->xkey.state & ControlMask))
nk_input_key(ctx,NK_KEY_TEXT_SELECT_ALL, down);
else {
if (*code == 'i')
nk_input_key(ctx, NK_KEY_TEXT_INSERT_MODE, down);
Expand Down
2 changes: 2 additions & 0 deletions demo/x11_xft/nuklear_xlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,8 @@ nk_xlib_handle_event(Display *dpy, int screen, Window win, XEvent *evt)
nk_input_key(ctx, NK_KEY_TEXT_LINE_START, down);
else if (*code == 'e' && (evt->xkey.state & ControlMask))
nk_input_key(ctx, NK_KEY_TEXT_LINE_END, down);
else if (*code == 'a' && (evt->xkey.state & ControlMask))
nk_input_key(ctx,NK_KEY_TEXT_SELECT_ALL, down);
else {
if (*code == 'i')
nk_input_key(ctx, NK_KEY_TEXT_INSERT_MODE, down);
Expand Down