|
@@ -26,10 +26,9 @@
|
|
// Needed when ded is ran without any file so it does not know where to save.
|
|
// Needed when ded is ran without any file so it does not know where to save.
|
|
|
|
|
|
// TODO: An ability to create a new file
|
|
// TODO: An ability to create a new file
|
|
-// TODO: Jump up/down by paragraph
|
|
|
|
// TODO: Delete a word
|
|
// TODO: Delete a word
|
|
// TODO: Delete selection
|
|
// TODO: Delete selection
|
|
-// TODO: Jump to the beginning/end of the line
|
|
|
|
|
|
+// TODO: Undo/redo system
|
|
|
|
|
|
void MessageCallback(GLenum source,
|
|
void MessageCallback(GLenum source,
|
|
GLenum type,
|
|
GLenum type,
|
|
@@ -84,8 +83,6 @@ int main(int argc, char **argv)
|
|
}
|
|
}
|
|
|
|
|
|
FT_UInt pixel_size = FREE_GLYPH_FONT_SIZE;
|
|
FT_UInt pixel_size = FREE_GLYPH_FONT_SIZE;
|
|
- // TODO: FT_Set_Pixel_Sizes does not produce good looking results
|
|
|
|
- // We need to use something like FT_Set_Char_Size and properly set the device resolution
|
|
|
|
error = FT_Set_Pixel_Sizes(face, 0, pixel_size);
|
|
error = FT_Set_Pixel_Sizes(face, 0, pixel_size);
|
|
if (error) {
|
|
if (error) {
|
|
fprintf(stderr, "ERROR: Could not set pixel size to %u\n", pixel_size);
|
|
fprintf(stderr, "ERROR: Could not set pixel size to %u\n", pixel_size);
|
|
@@ -235,6 +232,26 @@ int main(int argc, char **argv)
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
switch (event.key.keysym.sym) {
|
|
switch (event.key.keysym.sym) {
|
|
|
|
+ case SDLK_HOME: {
|
|
|
|
+ editor_update_selection(&editor, event.key.keysym.mod & KMOD_SHIFT);
|
|
|
|
+ if (event.key.keysym.mod & KMOD_CTRL) {
|
|
|
|
+ editor_move_to_begin(&editor);
|
|
|
|
+ } else {
|
|
|
|
+ editor_move_to_line_begin(&editor);
|
|
|
|
+ }
|
|
|
|
+ editor.last_stroke = SDL_GetTicks();
|
|
|
|
+ } break;
|
|
|
|
+
|
|
|
|
+ case SDLK_END: {
|
|
|
|
+ editor_update_selection(&editor, event.key.keysym.mod & KMOD_SHIFT);
|
|
|
|
+ if (event.key.keysym.mod & KMOD_CTRL) {
|
|
|
|
+ editor_move_to_end(&editor);
|
|
|
|
+ } else {
|
|
|
|
+ editor_move_to_line_end(&editor);
|
|
|
|
+ }
|
|
|
|
+ editor.last_stroke = SDL_GetTicks();
|
|
|
|
+ } break;
|
|
|
|
+
|
|
case SDLK_BACKSPACE: {
|
|
case SDLK_BACKSPACE: {
|
|
editor_backspace(&editor);
|
|
editor_backspace(&editor);
|
|
editor.last_stroke = SDL_GetTicks();
|
|
editor.last_stroke = SDL_GetTicks();
|
|
@@ -284,11 +301,14 @@ int main(int argc, char **argv)
|
|
if (event.key.keysym.mod & KMOD_CTRL) {
|
|
if (event.key.keysym.mod & KMOD_CTRL) {
|
|
editor_start_search(&editor);
|
|
editor_start_search(&editor);
|
|
}
|
|
}
|
|
- } break;
|
|
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
|
|
case SDLK_ESCAPE: {
|
|
case SDLK_ESCAPE: {
|
|
editor_stop_search(&editor);
|
|
editor_stop_search(&editor);
|
|
- } break;
|
|
|
|
|
|
+ editor_update_selection(&editor, event.key.keysym.mod & KMOD_SHIFT);
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
|
|
case SDLK_a: {
|
|
case SDLK_a: {
|
|
if (event.key.keysym.mod & KMOD_CTRL) {
|
|
if (event.key.keysym.mod & KMOD_CTRL) {
|
|
@@ -329,14 +349,22 @@ int main(int argc, char **argv)
|
|
|
|
|
|
case SDLK_UP: {
|
|
case SDLK_UP: {
|
|
editor_update_selection(&editor, event.key.keysym.mod & KMOD_SHIFT);
|
|
editor_update_selection(&editor, event.key.keysym.mod & KMOD_SHIFT);
|
|
- editor_move_line_up(&editor);
|
|
|
|
|
|
+ if (event.key.keysym.mod & KMOD_CTRL) {
|
|
|
|
+ editor_move_paragraph_up(&editor);
|
|
|
|
+ } else {
|
|
|
|
+ editor_move_line_up(&editor);
|
|
|
|
+ }
|
|
editor.last_stroke = SDL_GetTicks();
|
|
editor.last_stroke = SDL_GetTicks();
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
case SDLK_DOWN: {
|
|
case SDLK_DOWN: {
|
|
editor_update_selection(&editor, event.key.keysym.mod & KMOD_SHIFT);
|
|
editor_update_selection(&editor, event.key.keysym.mod & KMOD_SHIFT);
|
|
- editor_move_line_down(&editor);
|
|
|
|
|
|
+ if (event.key.keysym.mod & KMOD_CTRL) {
|
|
|
|
+ editor_move_paragraph_down(&editor);
|
|
|
|
+ } else {
|
|
|
|
+ editor_move_line_down(&editor);
|
|
|
|
+ }
|
|
editor.last_stroke = SDL_GetTicks();
|
|
editor.last_stroke = SDL_GetTicks();
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
@@ -415,5 +443,4 @@ int main(int argc, char **argv)
|
|
|
|
|
|
// TODO: ability to search within file browser
|
|
// TODO: ability to search within file browser
|
|
// Very useful when you have a lot of files
|
|
// Very useful when you have a lot of files
|
|
-// TODO: ability to search with the text editor
|
|
|
|
// TODO: ability to remove trailing whitespaces
|
|
// TODO: ability to remove trailing whitespaces
|