This commit is contained in:
anon 2023-08-16 15:00:06 +02:00
parent 125826ac1a
commit cad9125837
6 changed files with 20 additions and 4 deletions

View File

@ -43,6 +43,9 @@ obj/%.h.gch: src/%.h
obj/%.h.gch: config/%.h obj/%.h.gch: config/%.h
${CC} $< -o $@ ${CC} $< -o $@
install: ${OUTPUT}
cp ${OUTPUT} /usr/bin/
clean: clean:
-rm ${CHDR} -rm ${CHDR}
-rm ${GENLEX} -rm ${GENLEX}

View File

@ -224,6 +224,7 @@ void dispinit(void) {
refresh(); refresh();
last_window = &winput;
current_window = &winput; current_window = &winput;
} }
@ -260,6 +261,18 @@ void exitcurses(void) {
fflush(stdout); fflush(stdout);
} }
void force_window(){
switch(input_mode){
case INPUT_CHANGE:
current_window = &wresult;
break;
case INPUT_CHANGE_TO:
case INPUT_APPEND:
current_window = &winput;
break;
}
}
static inline void display_help() { static inline void display_help() {
// XXX: this could be optimized by only overriding the buffer if theres an actual // XXX: this could be optimized by only overriding the buffer if theres an actual
// change // change

View File

@ -271,6 +271,7 @@ void editall(void);
void editref(int); void editref(int);
void entercurses(void); void entercurses(void);
void exitcurses(void); void exitcurses(void);
void force_window(void);
void findcleanup(void); void findcleanup(void);
void freesrclist(void); void freesrclist(void);
void freeinclist(void); void freeinclist(void);

View File

@ -260,10 +260,9 @@ static int global_input(const int c) {
postmsg("There are no lines to write to a file"); postmsg("There are no lines to write to a file");
break; break;
} }
if(*current_window == wresult){ horswp_window(); }
if(*current_window == wmode){ verswp_window(); }
input_mode = INPUT_APPEND; input_mode = INPUT_APPEND;
window_change |= CH_INPUT; window_change |= CH_INPUT;
force_window();
break; break;
case '<': /* read lines from a file */ case '<': /* read lines from a file */
break; // XXX break; // XXX

View File

@ -325,7 +325,7 @@ static inline void linemode_event_loop(void) {
static inline void screenmode_event_loop(void) { static inline void screenmode_event_loop(void) {
for(;;) { for(;;) {
display(); display();
handle_input(wgetch(stdscr)); // NOTE: getch() does not return key codes handle_input(wgetch(stdscr)); // NOTE: getch() does not return KEY_* codes
} }
} }

View File

@ -97,7 +97,7 @@ static void callback_handler(char *line) {
strncpy(newpat, line, PATLEN); strncpy(newpat, line, PATLEN);
change = calloc(totallines, sizeof(*change)); change = calloc(totallines, sizeof(*change));
input_mode = INPUT_CHANGE; input_mode = INPUT_CHANGE;
horswp_window(); force_window();
return; return;
case INPUT_APPEND: { case INPUT_APPEND: {
char filename[PATHLEN + 1]; char filename[PATHLEN + 1];