X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fphosphor.c;h=8298cf2551ee67f265563eee839493923b346fbc;hb=4cecfc89e5e889c7232693897c06168fb378bd5c;hp=105f9b5bcf7f0146d983c6e26b9d581bc933018f;hpb=df7adbee81405e2849728a24b498ad2117784b1f;p=xscreensaver diff --git a/hacks/phosphor.c b/hacks/phosphor.c index 105f9b5b..8298cf25 100644 --- a/hacks/phosphor.c +++ b/hacks/phosphor.c @@ -1,4 +1,4 @@ -/* xscreensaver, Copyright (c) 1999 Jamie Zawinski +/* xscreensaver, Copyright (c) 1999, 2000 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -300,7 +300,7 @@ capture_font_bits (p_state *state) continue; XDrawString (state->dpy, p, state->gc1, i * safe_width, font->ascent, - string + i, 1); + (char *) (string + i), 1); } /* Draw the cursor. */ @@ -529,6 +529,7 @@ static void scroll (p_state *state) { int x, y; + for (x = 0; x < state->grid_width; x++) { p_cell *from = 0, *to = 0; @@ -553,7 +554,7 @@ scroll (p_state *state) } to = from; - if (to->state == FLARE || to->state == NORMAL) + if (to && (to->state == FLARE || to->state == NORMAL)) { to->state = FADE; to->changed = True; @@ -566,6 +567,8 @@ scroll (p_state *state) static void print_char (p_state *state, int c) { + static char last_c = 0; + p_cell *cell = &state->cells[state->grid_width * state->cursor_y + state->cursor_x]; @@ -580,11 +583,16 @@ print_char (p_state *state, int c) if (c == '\r' || c == '\n') { - state->cursor_x = 0; - if (state->cursor_y == state->grid_height - 1) - scroll (state); + if (c == '\n' && last_c == '\r') + ; /* CRLF -- do nothing */ else - state->cursor_y++; + { + state->cursor_x = 0; + if (state->cursor_y == state->grid_height - 1) + scroll (state); + else + state->cursor_y++; + } } else if (c == '\014') { @@ -610,6 +618,8 @@ print_char (p_state *state, int c) } } set_cursor (state, True); + + last_c = c; } @@ -769,7 +779,7 @@ char *defaults [] = { "*ticks: 20", "*delay: 50000", "*cursor: 333", - "*program: " ZIPPY_PROGRAM, + "*program: " FORTUNE_PROGRAM, "*relaunch: 5", 0 };