From e48ee9b741a752e774fe9cfb249069ea03e5f1be Mon Sep 17 00:00:00 2001 From: Raphael Pour Date: Thu, 13 May 2021 08:22:26 +0200 Subject: [PATCH 1/6] Terminal: Add ctrl+f and ctrl+r keycode --- include/terminal.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/terminal.h b/include/terminal.h index 541bda4..2bed087 100644 --- a/include/terminal.h +++ b/include/terminal.h @@ -130,9 +130,11 @@ int fe_get_user_input(); enum KEYS { UNKNOWN = -1, + CTRL_F = 6, TAB = 9, ENTER_MAC = 10, ENTER = 13, + CTRL_R = 18, CTRL_S = 19, ESCAPE = 27, BACKSPACE = 127, From cf275ce785081440e20aee934410c8fe5313b1cb Mon Sep 17 00:00:00 2001 From: Raphael Pour Date: Tue, 15 Jun 2021 23:40:10 +0200 Subject: [PATCH 2/6] Session: Add needle for repeated searches --- include/session.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/session.h b/include/session.h index 054d711..f17e8a7 100644 --- a/include/session.h +++ b/include/session.h @@ -30,6 +30,9 @@ typedef struct { /* Dirty flag */ bool dirty; + + /* Search needle, NULL if no search is going on */ + char* needle; } Session; Session* fe_init_session( char* filename ); From ad594e106f166a44ba9d05b494ad30ace0003ab1 Mon Sep 17 00:00:00 2001 From: Raphael Pour Date: Tue, 15 Jun 2021 23:40:47 +0200 Subject: [PATCH 3/6] Session: Initialize --- source/session.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/session.c b/source/session.c index a95ff75..7a7ba4c 100644 --- a/source/session.c +++ b/source/session.c @@ -23,6 +23,7 @@ Session* fe_init_session( char* filename ) s->content_length = 0; s->line_count = 0; s->dirty = false; + s->needle = NULL; /* Determine terminal properties */ From 7a2eabf4b371f38c69bd83ea237670bf3cc98702 Mon Sep 17 00:00:00 2001 From: Raphael Pour Date: Tue, 15 Jun 2021 23:47:47 +0200 Subject: [PATCH 4/6] Repo: add Dialog --- include/ui.h | 1 + source/femto.c | 1 + source/ui.c | 14 +++++++++++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/include/ui.h b/include/ui.h index f98f7fe..b118f75 100644 --- a/include/ui.h +++ b/include/ui.h @@ -4,5 +4,6 @@ #include bool fe_safe_file_dialog( Session *s ); +bool fe_search_fwd_dialog( Session *s ); bool fe_quit_dialog( Session *s ); #endif diff --git a/source/femto.c b/source/femto.c index 8154f97..0fb4eac 100644 --- a/source/femto.c +++ b/source/femto.c @@ -129,6 +129,7 @@ int main(int argc, char *argv[]) case PAGE_UP: fe_move_page_up( session ); break; case PAGE_DOWN: fe_move_page_down( session ); break; case CTRL_S: fe_safe_file_dialog( session ); break; + case CTRL_F: fe_search_fwd_dialog( session ); break; case UNKNOWN: /* * Do nothing if there wasn't anything useful to read like diff --git a/source/ui.c b/source/ui.c index 586bea8..641aa59 100644 --- a/source/ui.c +++ b/source/ui.c @@ -32,6 +32,14 @@ bool fe_safe_file_dialog( Session *s ) return true; } +bool fe_search_fwd_dialog( Session *s ) +{ + /* Check if a previous search is going on/ needle is already set */ + char * needle = fe_user_prompt( s, "Needle:" ); + + +} + bool fe_quit_dialog( Session *s ) { if( ! s->dirty ) return true; @@ -49,8 +57,12 @@ bool fe_quit_dialog( Session *s ) } } -static char* fe_user_prompt( Session *s, char* prompt ) +static char* fe_user_prompt( Session *s, char* prompt) { + /* + * Add pre-answer to the parameter list in order to have search dialogs + * with predefined needles. + */ char c = 0; char *answer = (char*) malloc(1); answer[0] = '\0'; From 20bfd46e7d5dab57747e2eb159dfb46b93567a17 Mon Sep 17 00:00:00 2001 From: Raphael Pour Date: Sun, 16 Jul 2023 15:45:03 +0200 Subject: [PATCH 5/6] changelog: update --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 37005cf..7836130 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * **bugfix** terminal: Ignore unsupported special keys * session/terminal: add HOME+END key-binding * screen: add line numbers + * add highlighting *Not released yet* From df02e38c84ed5dda01428827afe605273eec9cdb Mon Sep 17 00:00:00 2001 From: Raphael Pour Date: Sun, 16 Jul 2023 15:45:30 +0200 Subject: [PATCH 6/6] Bump version to v0.5.0 # Minor Release v0.5.0 (2023-07-16) * **Raphael Pour** * logging: document feature * **bugfix** terminal: Ignore unsupported special keys * session/terminal: add HOME+END key-binding * screen: add line numbers * add highlighting *Released by Raphael Pour * --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7836130..681fa7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# For next release +# Minor Release v0.5.0 (2023-07-16) * **Raphael Pour** * logging: document feature * **bugfix** terminal: Ignore unsupported special keys @@ -6,7 +6,7 @@ * screen: add line numbers * add highlighting -*Not released yet* +*Released by Raphael Pour * # Patch Release v0.4.2 (2021-01-28) * **Raphael Pour**