| File src/hstr.c changed (mode: 100644) (index 6c501ca..c2fa25c) |
| 127 |
127 |
#define LOGUTF8(Y,P) |
#define LOGUTF8(Y,P) |
| 128 |
128 |
#endif |
#endif |
| 129 |
129 |
|
|
|
130 |
|
#ifdef DEBUG_SELECTION |
|
131 |
|
#define LOGSELECTION(Y,SCREEN,MODEL) mvprintw(Y, 0, "Selection: screen %3d, model %3d", SCREEN, MODEL); clrtoeol() |
|
132 |
|
#else |
|
133 |
|
#define LOGSELECTION(Y,SCREEN,MODEL) |
|
134 |
|
#endif |
|
135 |
|
|
| 130 |
136 |
void logstring(char* str){ |
void logstring(char* str){ |
| 131 |
137 |
FILE *f = fopen("/home/tbabej/hh.log", "a"); |
FILE *f = fopen("/home/tbabej/hh.log", "a"); |
| 132 |
138 |
if (f == NULL) |
if (f == NULL) |
| |
| ... |
... |
typedef struct { |
| 219 |
225 |
FavoriteItems *favorites; |
FavoriteItems *favorites; |
| 220 |
226 |
|
|
| 221 |
227 |
char **selection; |
char **selection; |
| 222 |
|
regmatch_t *selectionRegexpMatch; |
|
| 223 |
228 |
unsigned selectionSize; |
unsigned selectionSize; |
|
229 |
|
regmatch_t *selectionRegexpMatch; |
| 224 |
230 |
|
|
| 225 |
231 |
int historyMatch; // TODO patternMatching: exact, regexp |
int historyMatch; // TODO patternMatching: exact, regexp |
| 226 |
232 |
int historyView; // TODO view: favs, ... |
int historyView; // TODO view: favs, ... |
| |
| ... |
... |
void loop_to_select(Hstr *hstr) |
| 838 |
844 |
|
|
| 839 |
845 |
switch (c) { |
switch (c) { |
| 840 |
846 |
case KEY_DC: // DEL |
case KEY_DC: // DEL |
| 841 |
|
// TODO verification - still broken: |
|
| 842 |
|
// > use 3 items history configuration |
|
| 843 |
|
// > delete 2nd item in raw view > blank line |
|
| 844 |
|
// > delete one of items in raw view > garbage |
|
| 845 |
847 |
if(selectionCursorPosition!=SELECTION_CURSOR_IN_PROMPT) { |
if(selectionCursorPosition!=SELECTION_CURSOR_IN_PROMPT) { |
| 846 |
848 |
delete=hstr->selection[selectionCursorPosition]; |
delete=hstr->selection[selectionCursorPosition]; |
| 847 |
849 |
msg=malloc(strlen(delete)+1); |
msg=malloc(strlen(delete)+1); |
| |
| ... |
... |
void loop_to_select(Hstr *hstr) |
| 852 |
854 |
move(y, basex+strlen(pattern)); |
move(y, basex+strlen(pattern)); |
| 853 |
855 |
printDefaultLabel=TRUE; |
printDefaultLabel=TRUE; |
| 854 |
856 |
print_history_label(hstr); |
print_history_label(hstr); |
|
857 |
|
|
|
858 |
|
if(selectionCursorPosition>0) { |
|
859 |
|
selectionCursorPosition--; |
|
860 |
|
} else { |
|
861 |
|
selectionCursorPosition=hstr->selectionSize-1; |
|
862 |
|
} |
|
863 |
|
highlight_selection(selectionCursorPosition, SELECTION_CURSOR_IN_PROMPT, pattern, hstr); |
|
864 |
|
move(y, basex+strlen(pattern)); |
| 855 |
865 |
} |
} |
| 856 |
|
// TODO new code - coredump on view rotation |
|
| 857 |
|
// highlight_selection(selectionCursorPosition, previousSelectionCursorPosition, pattern, hstr); |
|
| 858 |
|
// move(y, basex+strlen(pattern)); |
|
| 859 |
|
// TODO end new code |
|
| 860 |
866 |
break; |
break; |
| 861 |
867 |
case K_CTRL_E: |
case K_CTRL_E: |
| 862 |
868 |
hstr->historyMatch++; |
hstr->historyMatch++; |
| |
| ... |
... |
void loop_to_select(Hstr *hstr) |
| 1027 |
1033 |
LOGKEYS(Y_OFFSET_HELP, c); |
LOGKEYS(Y_OFFSET_HELP, c); |
| 1028 |
1034 |
LOGCURSOR(Y_OFFSET_HELP); |
LOGCURSOR(Y_OFFSET_HELP); |
| 1029 |
1035 |
LOGUTF8(Y_OFFSET_HELP,pattern); |
LOGUTF8(Y_OFFSET_HELP,pattern); |
|
1036 |
|
LOGSELECTION(Y_OFFSET_HELP,getmaxy(stdscr),hstr->selectionSize); |
| 1030 |
1037 |
|
|
| 1031 |
1038 |
if(c>K_CTRL_Z) { |
if(c>K_CTRL_Z) { |
| 1032 |
1039 |
selectionCursorPosition=SELECTION_CURSOR_IN_PROMPT; |
selectionCursorPosition=SELECTION_CURSOR_IN_PROMPT; |