adding goCodeHome and goCodeEnd to use ctrl+home and ctrl+end in the code editor

This commit is contained in:
Matheus Lessa 2017-10-13 13:25:10 -03:00
parent f00221705b
commit 29abca5e3f
2 changed files with 73 additions and 55 deletions

2
.gitignore vendored
View File

@ -2,6 +2,8 @@
*.ipch *.ipch
*.opendb *.opendb
*.suo *.suo
sexit
.vscode/
build/uwp/tic/Debug/ build/uwp/tic/Debug/
build/uwp/tic/Release/ build/uwp/tic/Release/
build/uwp/tic/x64/ build/uwp/tic/x64/

View File

@ -619,6 +619,20 @@ static void goEnd(Code* code)
updateColumn(code); updateColumn(code);
} }
static void goCodeHome(Code *code)
{
code->cursor.position = code->data;
updateColumn(code);
}
static void goCodeEnd(Code *code)
{
code->cursor.position = code->data + strlen(code->data);
updateColumn(code);
}
static void pageUp(Code* code) static void pageUp(Code* code)
{ {
s32 column = 0; s32 column = 0;
@ -1228,6 +1242,8 @@ static void processKeydown(Code* code, SDL_Keycode keycode)
case SDLK_g: setCodeMode(code, TEXT_GOTO_MODE); break; case SDLK_g: setCodeMode(code, TEXT_GOTO_MODE); break;
case SDLK_o: setCodeMode(code, TEXT_OUTLINE_MODE); break; case SDLK_o: setCodeMode(code, TEXT_OUTLINE_MODE); break;
case SDLK_SLASH: commentLine(code); break; case SDLK_SLASH: commentLine(code); break;
case SDLK_HOME: goCodeHome(code); break;
case SDLK_END: goCodeEnd(code); break;
} }
} }
else if(keymod & KMOD_ALT) else if(keymod & KMOD_ALT)