ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/command.C
(Generate patch)

Comparing rxvt-unicode/src/command.C (file contents):
Revision 1.11 by pcg, Tue Dec 2 21:49:46 2003 UTC vs.
Revision 1.12 by pcg, Fri Dec 5 04:05:13 2003 UTC

1/*--------------------------------*-C-*---------------------------------* 1/*--------------------------------*-C-*---------------------------------*
2 * File: command.c 2 * File: command.c
3 *----------------------------------------------------------------------* 3 *----------------------------------------------------------------------*
4 * $Id: command.C,v 1.11 2003/12/02 21:49:46 pcg Exp $ 4 * $Id: command.C,v 1.12 2003/12/05 04:05:13 pcg Exp $
5 * 5 *
6 * All portions of code are copyright by their respective author/s. 6 * All portions of code are copyright by their respective author/s.
7 * Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk> 7 * Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk>
8 * - original version 8 * - original version
9 * Copyright (c) 1994 Robert Nation <nation@rocket.sanders.lockheed.com> 9 * Copyright (c) 1994 Robert Nation <nation@rocket.sanders.lockheed.com>
786 SET_R (this); 786 SET_R (this);
787 787
788 if (revents & EVENT_WRITE) 788 if (revents & EVENT_WRITE)
789 tt_write (0, 0); 789 tt_write (0, 0);
790 else if (revents & EVENT_READ) 790 else if (revents & EVENT_READ)
791 {
792 bool flag = true;
793
791 // loop, but don't allow a single term to monopolize us 794 // loop, but don't allow a single term to monopolize us
792 // the number of loops is fully arbitrary, and thus wrong 795 // the number of loops is fully arbitrary, and thus wrong
793 for (int i = 1; i-- && pty_fill (); ) 796 while (flag && pty_fill ())
794 { 797 {
795 if (!seen_input) 798 if (!seen_input)
796 { 799 {
797 seen_input = 1; 800 seen_input = 1;
798 /* once we know the shell is running, send the screen size. Again! */ 801 /* once we know the shell is running, send the screen size. Again! */
799 tt_winch (); 802 tt_winch ();
800 } 803 }
801 804
802 uint32_t ch = NOCHAR; 805 uint32_t ch = NOCHAR;
803 806
804 for (;;) 807 for (;;)
805 { 808 {
806 if (ch == NOCHAR) 809 if (ch == NOCHAR)
807 ch = next_char (); 810 ch = next_char ();
808 811
809 if (ch == NOCHAR) // TODO: improve 812 if (ch == NOCHAR) // TODO: improve
810 break; 813 break;
811 814
812 if (ch >= ' ' || ch == '\t' || ch == '\n' || ch == '\r') 815 if (ch >= ' ' || ch == '\t' || ch == '\n' || ch == '\r')
813 { 816 {
814 /* Read a text string from the input buffer */ 817 /* Read a text string from the input buffer */
815 uint32_t buf[BUFSIZ]; 818 uint32_t buf[BUFSIZ];
816 bool refreshnow = false; 819 bool refreshnow = false;
817 int nlines = 0; 820 int nlines = 0;
818 uint32_t *str = buf; 821 uint32_t *str = buf;
819 822
820 *str++ = ch; 823 *str++ = ch;
821 824
822 for (;;) 825 for (;;)
823 { 826 {
824 ch = next_char (); 827 ch = next_char ();
825 828
826 if (ch == NOCHAR || (ch < ' ' && ch != '\t' && ch != '\n' && ch != '\r')) 829 if (ch == NOCHAR || (ch < ' ' && ch != '\t' && ch != '\n' && ch != '\r'))
827 break; 830 break;
828 else 831 else
829 { 832 {
830 *str++ = ch; 833 *str++ = ch;
831 834
832 if (ch == '\n') 835 if (ch == '\n')
833 { 836 {
834 nlines++; 837 nlines++;
835 refresh_count++; 838 refresh_count++;
836 839
837 if (!(Options & Opt_jumpScroll) 840 if (!(Options & Opt_jumpScroll)
838 || (refresh_count >= (refresh_limit * (TermWin.nrow - 1)))) 841 || (refresh_count >= (refresh_limit * (TermWin.nrow - 1))))
839 { 842 {
840 refreshnow = true; 843 refreshnow = true;
844 flag = false;
841 ch = NOCHAR; 845 ch = NOCHAR;
842 break; 846 break;
843 } 847 }
844 } 848 }
845 849
846 if (str >= buf + BUFSIZ) 850 if (str >= buf + BUFSIZ)
847 { 851 {
848 ch = NOCHAR; 852 ch = NOCHAR;
849 break; 853 break;
850 } 854 }
851 } 855 }
852 } 856 }
853 857
854 rxvt_scr_add_lines (this, buf, nlines, str - buf); 858 rxvt_scr_add_lines (this, buf, nlines, str - buf);
855 859
856 /* 860 /*
857 * If there have been a lot of new lines, then update the screen 861 * If there have been a lot of new lines, then update the screen
858 * What the heck I'll cheat and only refresh less than every page-full. 862 * What the heck I'll cheat and only refresh less than every page-full.
859 * the number of pages between refreshes is refresh_limit, which 863 * the number of pages between refreshes is refresh_limit, which
860 * is incremented here because we must be doing flat-out scrolling. 864 * is incremented here because we must be doing flat-out scrolling.
861 * 865 *
862 * refreshing should be correct for small scrolls, because of the 866 * refreshing should be correct for small scrolls, because of the
863 * time-out 867 * time-out
864 */ 868 */
865 if (refreshnow) 869 if (refreshnow)
866 { 870 {
867 if ((Options & Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) 871 if ((Options & Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD)
868 refresh_limit++; 872 refresh_limit++;
869 873
870 rxvt_scr_refresh (this, refresh_type); 874 rxvt_scr_refresh (this, refresh_type);
871 } 875 }
872 876
873 } 877 }
874 else 878 else
875 { 879 {
876 switch (ch) 880 switch (ch)
877 { 881 {
878 default: 882 default:
879 rxvt_process_nonprinting (this, ch); 883 rxvt_process_nonprinting (this, ch);
880 break; 884 break;
881 case C0_ESC: /* escape char */ 885 case C0_ESC: /* escape char */
882 rxvt_process_escape_seq (this); 886 rxvt_process_escape_seq (this);
883 break; 887 break;
884 /*case 0x9b: */ /* CSI */ 888 /*case 0x9b: */ /* CSI */
885 /* rxvt_process_csi_seq (this); */ 889 /* rxvt_process_csi_seq (this); */
886 } 890 }
887 891
888 ch = NOCHAR; 892 ch = NOCHAR;
889 } 893 }
890 } 894 }
891 } 895 }
896 }
892} 897}
893 898
894// read the next character, currently handles UTF-8 899// read the next character, currently handles UTF-8
895// will probably handle all sorts of other stuff in the future 900// will probably handle all sorts of other stuff in the future
896uint32_t 901uint32_t

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines