Skip to content

Commit

Permalink
Fix commit 426a800
Browse files Browse the repository at this point in the history
The bell can't be eaten by TosWin2 plus there already was code handling
\007 characters, so let's just use that one.

This also partially reverts commit ab4d145.
  • Loading branch information
mikrosk committed Aug 29, 2024
1 parent 5da1c42 commit f0cfe96
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 29 deletions.
8 changes: 6 additions & 2 deletions console.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ static void close_con_fd(void)
}
}

void open_console(void)
void create_console(bool open)
{
WINCFG *cfg;
char str[30];
Expand Down Expand Up @@ -87,7 +87,8 @@ void open_console(void)
(*con_win->output)(con_win, '\033');
(*con_win->output)(con_win, 'e');

open_window(con_win->win, cfg->iconified);
if (open)
open_window(con_win->win, cfg->iconified);
}
else
{
Expand Down Expand Up @@ -134,6 +135,9 @@ void handle_console(char *txt, long len)

if (con_win != NULL)
{
WINCFG *cfg = get_wincfg(console_progname);
open_window(con_win->win, cfg->iconified);

if (con_win->win->flags == WICONIFIED)
{
is_dirty = TRUE;
Expand Down
2 changes: 1 addition & 1 deletion console.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ extern TEXTWIN *con_win; /* console window */
extern char const console_progname[];


void open_console (void);
void create_console (bool open);
bool log_console (bool on);
bool out_console (bool on);
void handle_console (char *txt, long len);
Expand Down
2 changes: 1 addition & 1 deletion event.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ static void handle_menu(int title, int item, bool help)

/* Fenster */
case MCONSOLE :
open_console();
create_console(TRUE);
break;

case MCYCLE :
Expand Down
2 changes: 1 addition & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ int main(int argc, char *argv[])
event_init();

if (gl_con_auto)
open_console();
create_console(TRUE);

#if 0
if (gl_debug)
Expand Down
33 changes: 9 additions & 24 deletions proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -410,20 +410,8 @@ fd_input(void)
readfds = fdmask;
if ((r = Fselect(1, &readfds, 0L, 0L)) > 0)
{
bool consoleHandled = FALSE;
/* handle closed console separately so we can open it only if read_bytes >0 */
if (con_win == NULL && con_fd > 0 && (readfds & (1L << con_fd)))
{
long int read_bytes = Fread(con_fd, (long)READBUFSIZ, buf);
if (read_bytes > 0 && !(read_bytes == 1 && buf[0] == '\007')) {
if (gl_con_output) {
open_console();
write_text(con_win, buf, read_bytes);
consoleHandled = TRUE;
}
handle_console(buf, read_bytes);
}
}
if (gl_con_output && con_win == NULL && con_fd > 0 && (readfds & (1L << con_fd)))
create_console(FALSE);

for (w = gl_winlist; w; w = w->next)
{
Expand All @@ -436,18 +424,15 @@ fd_input(void)

if (readfds & (1L << t->fd))
{
if (t->fd != con_fd || !consoleHandled)
long int read_bytes = Fread(t->fd, (long)READBUFSIZ, buf);
if (read_bytes > 0)
{
long int read_bytes = Fread(t->fd, (long)READBUFSIZ, buf);
if (read_bytes > 0)
{
write_text(t, buf, read_bytes);
if (t->fd == con_fd)
handle_console(buf, read_bytes);
}
else
checkdead |= (1L << t->fd);
write_text(t, buf, read_bytes);
if (t->fd == con_fd)
handle_console(buf, read_bytes);
}
else
checkdead |= (1L << t->fd);
}
}
}
Expand Down

0 comments on commit f0cfe96

Please sign in to comment.