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
${CC} $< -o $@
install: ${OUTPUT}
cp ${OUTPUT} /usr/bin/
clean:
-rm ${CHDR}
-rm ${GENLEX}

View File

@ -224,6 +224,7 @@ void dispinit(void) {
refresh();
last_window = &winput;
current_window = &winput;
}
@ -260,6 +261,18 @@ void exitcurses(void) {
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() {
// XXX: this could be optimized by only overriding the buffer if theres an actual
// change

View File

@ -271,6 +271,7 @@ void editall(void);
void editref(int);
void entercurses(void);
void exitcurses(void);
void force_window(void);
void findcleanup(void);
void freesrclist(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");
break;
}
if(*current_window == wresult){ horswp_window(); }
if(*current_window == wmode){ verswp_window(); }
input_mode = INPUT_APPEND;
window_change |= CH_INPUT;
force_window();
break;
case '<': /* read lines from a file */
break; // XXX

View File

@ -325,7 +325,7 @@ static inline void linemode_event_loop(void) {
static inline void screenmode_event_loop(void) {
for(;;) {
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);
change = calloc(totallines, sizeof(*change));
input_mode = INPUT_CHANGE;
horswp_window();
force_window();
return;
case INPUT_APPEND: {
char filename[PATHLEN + 1];