Skip to content

Commit

Permalink
Merge pull request #1220 from stefanrueger/terminal-prompt
Browse files Browse the repository at this point in the history
Remove extraneous avrdude> prompt at end of terminal session
  • Loading branch information
stefanrueger authored Dec 21, 2022
2 parents b29dfb7 + 412eb95 commit a696c94
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/term.c
Original file line number Diff line number Diff line change
Expand Up @@ -1361,7 +1361,7 @@ void term_gotline(char *cmdstr) {
if(cmdstr) {
if(*cmdstr) {
add_history(cmdstr);
// only quit/abort returns a value > 0
// Only quit returns a value > 0
if(process_line(cmdstr, term_pgm, term_p) > 0)
term_running = 0;
}
Expand All @@ -1373,14 +1373,18 @@ void term_gotline(char *cmdstr) {
*
* see https://github.com/avrdudes/avrdude/issues/1173
*/
rl_callback_handler_remove();
rl_callback_handler_install("avrdude> ", term_gotline);
if(term_running) {
rl_callback_handler_remove();
rl_callback_handler_install("avrdude> ", term_gotline);
}
} else {
// call quit at end of file or terminal ^D
// End of file or terminal ^D
term_out("\n");
cmd_quit(term_pgm, term_p, 0, NULL);
term_running = 0;
}
if(!term_running)
rl_callback_handler_remove();
}


Expand All @@ -1401,8 +1405,6 @@ int terminal_mode_interactive(PROGRAMMER *pgm, struct avrpart *p) {
rl_callback_read_char();
}

rl_callback_handler_remove();

return pgm->flush_cache(pgm, p);
}

Expand Down

0 comments on commit a696c94

Please sign in to comment.