home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / the25.zip / thesrc251.zip / show.c < prev    next >
C/C++ Source or Header  |  1998-05-06  |  100KB  |  2,524 lines

  1. /***********************************************************************/
  2. /* SHOW.C - Functions involving displaying the data.                   */
  3. /***********************************************************************/
  4. /*
  5.  * THE - The Hessling Editor. A text editor similar to VM/CMS xedit.
  6.  * Copyright (C) 1991-1997 Mark Hessling
  7.  *
  8.  * This program is free software; you can redistribute it and/or
  9.  * modify it under the terms of the GNU General Public License as
  10.  * published by the Free Software Foundation; either version 2 of
  11.  * the License, or any later version.
  12.  *
  13.  * This program is distributed in the hope that it will be useful,
  14.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16.  * General Public License for more details.
  17.  *
  18.  * You should have received a copy of the GNU General Public License
  19.  * along with this program; if not, write to:
  20.  *
  21.  *    The Free Software Foundation, Inc.
  22.  *    675 Mass Ave,
  23.  *    Cambridge, MA 02139 USA.
  24.  *
  25.  *
  26.  * If you make modifications to this software that you feel increases
  27.  * it usefulness for the rest of the community, please email the
  28.  * changes, enhancements, bug fixes as well as any and all ideas to me.
  29.  * This software is going to be maintained and enhanced as deemed
  30.  * necessary by the community.
  31.  *
  32.  * Mark Hessling                 Email:             M.Hessling@qut.edu.au
  33.  * PO Box 203                    Phone:                    +617 3802 0800
  34.  * Bellara                       http://www.gu.edu.au/gext/the/markh.html
  35.  * QLD 4507                      **** Maintainer PDCurses & REXX/SQL ****
  36.  * Australia                     ************* Author of THE ************
  37.  */
  38.  
  39. /*
  40. $Id: show.c 2.1 1995/06/24 16:31:13 MH Rel MH $
  41. */
  42.  
  43. #include <the.h>
  44. #include <proto.h>
  45.  
  46. #if defined(USE_EXTCURSES)
  47. # include <cur04.h>
  48. #endif
  49.  
  50. #include <time.h>
  51.  
  52. /*------------------------ function definitions -----------------------*/
  53. #ifdef HAVE_PROTO
  54. static void build_lines(CHARTYPE,short,LINE *,short,short);
  55. static void show_lines(CHARTYPE);
  56. static void show_a_line(CHARTYPE,short);
  57. static void set_prefix_contents(CHARTYPE,LINE *,short,LINETYPE);
  58. static void show_hex_line(CHARTYPE,short);
  59. #else
  60. static void build_lines();
  61. static void show_lines();
  62. static void show_a_line();
  63. static void set_prefix_contents();
  64. static void show_hex_line();
  65. #endif
  66.  
  67. static LINE *hexshow_curr=NULL;
  68.  
  69. /***********************************************************************/
  70. #ifdef HAVE_PROTO
  71. void show_heading(CHARTYPE scrno)
  72. #else
  73. void show_heading(scrno)
  74. CHARTYPE scrno;
  75. #endif
  76. /***********************************************************************/
  77. {
  78. /*-------------------------- external data ----------------------------*/
  79. #if !defined(MULTIPLE_PSEUDO_FILES)
  80.  extern CHARTYPE dir_path[MAX_FILE_NAME+1];
  81.  extern CHARTYPE dir_files[MAX_FILE_NAME+1];
  82.  extern CHARTYPE rexx_macro_name[MAX_FILE_NAME+1];
  83. #endif
  84.  extern bool curses_started;
  85.  extern bool horizontal;
  86.  extern CHARTYPE display_screens;
  87.  extern short compatible_look;
  88.  extern CHARTYPE *the_version;
  89. /*--------------------------- local data ------------------------------*/
  90.  short fpath_len=0,max_name=0;
  91.  LENGTHTYPE x=0;
  92.  LINETYPE line_number=0L;
  93.  CHARTYPE buffer[60];
  94.  CHARTYPE display_path[MAX_FILE_NAME+1];
  95. #ifdef __PDCURSES__
  96.  CHARTYPE title[MAX_FILE_NAME+1];
  97.  static CHARTYPE old_title[MAX_FILE_NAME+1];
  98. #endif
  99.  CHARTYPE *fpath = display_path;
  100.  short num_to_delete=0,num_to_start=0,col=0;
  101.  short size_col=0,line_col=0;
  102.  register short i=0;
  103. /*--------------------------- processing ------------------------------*/
  104. #ifdef TRACE
  105.  trace_function("show.c:    show_heading");
  106. #endif
  107. /*---------------------------------------------------------------------*/
  108. /* If IDLINE is not to be displayed, exit now.                         */
  109. /*---------------------------------------------------------------------*/
  110.  if (!SCREEN_VIEW(scrno)->id_line)
  111.    {
  112. #ifdef TRACE
  113.     trace_return();
  114. #endif
  115.     return;
  116.    }
  117. /*---------------------------------------------------------------------*/
  118. /* Reset idline to blank.                                              */
  119. /*---------------------------------------------------------------------*/
  120.  wattrset(SCREEN_WINDOW_IDLINE(scrno),set_colour(SCREEN_FILE(scrno)->attr+ATTR_IDLINE));
  121.  wmove(SCREEN_WINDOW_IDLINE(scrno),0,0);
  122.  my_wclrtoeol(SCREEN_WINDOW_IDLINE(scrno));
  123. /*---------------------------------------------------------------------*/
  124. /* Get line,col values only if POSITION is ON...                       */
  125. /*---------------------------------------------------------------------*/
  126.  if (SCREEN_VIEW(scrno)->position_status)
  127.     (void)get_current_position(scrno,&line_number,&x);
  128. /*---------------------------------------------------------------------*/
  129. /* Set up buffer for line,col,size and alt values for vertical screens.*/
  130. /*---------------------------------------------------------------------*/
  131.  if (display_screens != 1 && !horizontal)
  132.    {
  133.     if (SCREEN_VIEW(scrno)->position_status)
  134.       {
  135.        if (compatible_look == COMPAT_XEDIT)
  136.          {
  137.           sprintf((DEFCHAR *)buffer,"S=%-.1ld L=%-.1ld C=%-.1d A=%d,%d",
  138.                       SCREEN_FILE(scrno)->number_lines,
  139.                       line_number,x,
  140.                       SCREEN_FILE(scrno)->autosave_alt,
  141.                       SCREEN_FILE(scrno)->save_alt);
  142.          }
  143.        else
  144.          {
  145.           sprintf((DEFCHAR *)buffer,"L=%-.1ld C=%-.1d S=%-.1ld A=%d,%d",
  146.                       line_number,x,
  147.                       SCREEN_FILE(scrno)->number_lines,
  148.                       SCREEN_FILE(scrno)->autosave_alt,
  149.                       SCREEN_FILE(scrno)->save_alt);
  150.          }
  151.       }
  152.     else
  153.       {
  154.        sprintf((DEFCHAR *)buffer,"S=%-.1ld A=%d,%d",
  155.                       SCREEN_FILE(scrno)->number_lines,
  156.                       SCREEN_FILE(scrno)->autosave_alt,
  157.                       SCREEN_FILE(scrno)->save_alt);
  158.       }
  159.     max_name = (screen[scrno].screen_cols-1) - strlen((DEFCHAR *)buffer);
  160.    }
  161.  else
  162.    {
  163.     if (SCREEN_VIEW(scrno)->position_status)
  164.        max_name = (screen[scrno].screen_cols-48);
  165.     else
  166.        max_name = (screen[scrno].screen_cols-27);
  167.     if (compatible_look == COMPAT_XEDIT)
  168.       {
  169.        size_col = screen[scrno].screen_cols-46;
  170.        line_col = screen[scrno].screen_cols-46+12;
  171.       }
  172.     else
  173.       {
  174.        size_col = screen[scrno].screen_cols-46+21;
  175.        line_col = screen[scrno].screen_cols-46;
  176.       }
  177.    }
  178. /*---------------------------------------------------------------------*/
  179. /* Determine which portion of filename can be displayed.               */
  180. /*---------------------------------------------------------------------*/
  181. #if defined(MULTIPLE_PSEUDO_FILES)
  182.  strcpy((DEFCHAR *)display_path,(DEFCHAR *)SCREEN_FILE(scrno)->fpath);
  183.  strcat((DEFCHAR *)display_path,(DEFCHAR *)SCREEN_FILE(scrno)->fname);
  184. #else
  185.  switch(SCREEN_FILE(scrno)->pseudo_file)
  186.    {
  187.     case PSEUDO_DIR:
  188.          strcpy((DEFCHAR *)display_path,"DIR: ");
  189.          strcat((DEFCHAR *)display_path,(DEFCHAR *)dir_path);
  190.          strcat((DEFCHAR *)display_path,(DEFCHAR *)dir_files);
  191.          break;
  192.     case PSEUDO_REXX:
  193.          strcpy((DEFCHAR *)display_path,"Output from: ");
  194.          strcat((DEFCHAR *)display_path,(DEFCHAR *)rexx_macro_name);
  195.          break;
  196.     case PSEUDO_KEY:
  197.          strcpy((DEFCHAR *)display_path,"Key definitions:");
  198.          break;
  199.     default:
  200.          if (SCREEN_FILE(scrno)->display_actual_filename)
  201.            {
  202.             strcpy((DEFCHAR *)display_path,(DEFCHAR *)SCREEN_FILE(scrno)->fpath);
  203.             strcat((DEFCHAR *)display_path,(DEFCHAR *)SCREEN_FILE(scrno)->fname);
  204.            }
  205.          else
  206.            {
  207.             strcpy((DEFCHAR *)display_path,(DEFCHAR *)SCREEN_FILE(scrno)->actualfname);
  208.            }
  209.          break;
  210.    }
  211. #endif
  212. #ifdef __PDCURSES__
  213.  sprintf((DEFCHAR *)title, "THE %s - %s", the_version, (DEFCHAR *)display_path );
  214.  /* only display the title if different from previous one */
  215.  if (strcmp((DEFCHAR *)title,(DEFCHAR *)old_title) != 0)
  216.    {
  217.     PDC_set_title( (DEFCHAR *)title );
  218.     strcpy((DEFCHAR *)old_title,(DEFCHAR *)title);
  219.    }
  220. #endif
  221.  
  222.  fpath = strrmdup(strtrans(display_path,ISLASH,ESLASH),ESLASH);
  223.  fpath_len = strlen((DEFCHAR *)fpath);
  224.  if (fpath_len > max_name)
  225.    {
  226.     num_to_delete = fpath_len - max_name + 2;
  227.     num_to_start = (strlen((DEFCHAR *)fpath)/2)-(num_to_delete/2);
  228.     for (i=0;i<num_to_start;i++)
  229.       {
  230.        mvwaddch(SCREEN_WINDOW_IDLINE(scrno),0,i,display_path[i]);
  231.       }
  232.     col = i+2;
  233.     waddstr(SCREEN_WINDOW_IDLINE(scrno),"<>");
  234.     for (i=num_to_start+num_to_delete;i<strlen((DEFCHAR *)fpath);i++,col++)
  235.       {
  236.        mvwaddch(SCREEN_WINDOW_IDLINE(scrno),0,col,display_path[i]);
  237.       }
  238.    }
  239.  else
  240.   {
  241.    wmove(SCREEN_WINDOW_IDLINE(scrno),0,0);
  242.    wprintw(SCREEN_WINDOW_IDLINE(scrno),"%s",fpath);
  243.   }
  244.  if (display_screens != 1 && !horizontal)
  245.    {
  246.     wmove(SCREEN_WINDOW_IDLINE(scrno),0,max_name+1);
  247.     wprintw(SCREEN_WINDOW_IDLINE(scrno),"%-s",buffer);
  248.    }
  249.  else
  250.    {
  251.     if (SCREEN_VIEW(scrno)->position_status)
  252.       {
  253.        wmove(SCREEN_WINDOW_IDLINE(scrno),0,line_col);
  254.        wprintw(SCREEN_WINDOW_IDLINE(scrno),"Line=%-6.1ld Col=%-5.1d",line_number,x);
  255.       }
  256.     wmove(SCREEN_WINDOW_IDLINE(scrno),0,size_col);
  257.     wprintw(SCREEN_WINDOW_IDLINE(scrno),"Size=%-6.1ld",SCREEN_FILE(scrno)->number_lines);
  258.     wmove(SCREEN_WINDOW_IDLINE(scrno),0,screen[scrno].screen_cols-46+32);
  259.     wprintw(SCREEN_WINDOW_IDLINE(scrno),"Alt=          ");
  260.     wmove(SCREEN_WINDOW_IDLINE(scrno),0,screen[scrno].screen_cols-46+36);
  261.     wprintw(SCREEN_WINDOW_IDLINE(scrno),"%d,%d",SCREEN_FILE(scrno)->autosave_alt,
  262.                              SCREEN_FILE(scrno)->save_alt);
  263.    }
  264. #ifdef MSWIN
  265.  Win31Scroll(x,line_number,SCREEN_FILE(scrno)->number_lines,SCREEN_FILE(scrno)->max_line_length);
  266. #endif
  267.  wnoutrefresh(SCREEN_WINDOW_IDLINE(scrno));
  268. #ifdef TRACE
  269.  trace_return();
  270. #endif
  271.  return;
  272. }
  273. /***********************************************************************/
  274. #ifdef HAVE_PROTO
  275. void show_statarea(void)
  276. #else
  277. void show_statarea()
  278. #endif
  279. /***********************************************************************/
  280. {
  281. /*------------------------- external data -----------------------------*/
  282.  extern CHARTYPE *rec;
  283.  extern CHARTYPE *cmd_rec;
  284.  extern CHARTYPE *pre_rec;
  285.  extern CHARTYPE *the_version;
  286.  extern CHARTYPE *the_copyright;
  287.  extern bool CLOCKx;
  288.  extern bool HEXDISPLAYx;
  289.  extern bool INSERTMODEx;
  290.  extern CHARTYPE number_of_files;
  291.  extern WINDOW *statarea;
  292.  extern bool colour_support;
  293.  extern bool initial;
  294.  extern bool rexx_support;
  295.  extern ROWTYPE STATUSLINEx;
  296. /*--------------------------- local data ------------------------------*/
  297.  register int i=0;
  298.  short y=0,x=0;
  299.  short key=0;
  300.  WINDOW *w=NULL;
  301.  time_t timer;
  302.  struct tm *tblock=NULL;
  303.  char rel[10];                                 /* not initialised - OK */
  304. /*--------------------------- processing ------------------------------*/
  305. #ifdef TRACE
  306.  trace_function("show.c:    show_statarea");
  307. #endif
  308. /*---------------------------------------------------------------------*/
  309. /* If the status line is off, just exit...                             */
  310. /*---------------------------------------------------------------------*/
  311.  if (STATUSLINEx == 'O')
  312.    {
  313. #ifdef TRACE
  314.     trace_return();
  315. #endif
  316.     return;
  317.    }
  318. /*---------------------------------------------------------------------*/
  319. /* If GUI option set for status line...                                */
  320. /*---------------------------------------------------------------------*/
  321.  if (STATUSLINEx == 'G')
  322.    {
  323. #ifdef MSWIN
  324.    Show_GUI_footing();
  325. # ifdef TRACE
  326.     trace_return();
  327. # endif
  328.     return;
  329. #endif
  330.  
  331. #ifdef TRACE
  332.     trace_return();
  333. #endif
  334.     return;
  335.    }
  336.  w = CURRENT_WINDOW;
  337. /*---------------------------------------------------------------------*/
  338. /* Display THE version.                                                */
  339. /*---------------------------------------------------------------------*/
  340.  strcpy(rel,"THE ");
  341.  strcat(rel,(DEFCHAR *)the_version);
  342. /* strcat(rel,the_release+10);*/
  343.  mvwaddstr(statarea,0,0,rel);
  344. /*---------------------------------------------------------------------*/
  345. /* Clear from files to clock position...                               */
  346. /*---------------------------------------------------------------------*/
  347.  for (i=12;i<53;i++)
  348.    {
  349.     wmove(statarea,0,i);
  350.     waddch(statarea,' ');
  351.    }
  352. /*---------------------------------------------------------------------*/
  353. /* Display number of files or copyright on startup.                    */
  354. /*---------------------------------------------------------------------*/
  355.  wmove(statarea,0,12);
  356.  if (initial)
  357.     waddstr(statarea,(DEFCHAR *)the_copyright);
  358.  else
  359.     wprintw(statarea,"Files=%d   Width=%d",number_of_files,max_line_length);
  360. /*---------------------------------------------------------------------*/
  361. /* Display any pending prefix command warning                          */
  362. /*---------------------------------------------------------------------*/
  363.  if (CURRENT_FILE->first_ppc != NULL
  364.  &&  CURRENT_FILE->first_ppc->ppc_cmd_idx != (-1)
  365.  &&  CURRENT_FILE->first_ppc->ppc_cmd_idx != (-2))
  366.    {
  367.     wmove(statarea,0,20);
  368.     wprintw(statarea,"'%s' pending...",get_prefix_command(CURRENT_FILE->first_ppc->ppc_cmd_idx));
  369.    }
  370. /*---------------------------------------------------------------------*/
  371. /* Display CLOCK.                                                      */
  372. /*---------------------------------------------------------------------*/
  373.  if (CLOCKx)
  374.    {
  375.     timer = time(NULL);
  376.     tblock = localtime(&timer);
  377.     wmove(statarea,0,53);
  378.  
  379.     wprintw(statarea,"%2d:%02.2d%s",
  380.            (tblock->tm_hour > 12) ? (tblock->tm_hour-12) : (tblock->tm_hour),
  381.             tblock->tm_min,
  382.            (tblock->tm_hour >= 12) ? ("pm") : ("am"));
  383.    }
  384. /*---------------------------------------------------------------------*/
  385. /* Display HEXDISPLAY.                                                 */
  386. /*---------------------------------------------------------------------*/
  387.  if (HEXDISPLAYx)
  388.    {
  389.     getyx(CURRENT_WINDOW,y,x);
  390.     switch(CURRENT_VIEW->current_window)
  391.       {
  392.        case WINDOW_FILEAREA:
  393.             key = (short)(*(rec+CURRENT_VIEW->verify_col-1+x) & A_CHARTEXT);
  394.             break;
  395.        case WINDOW_COMMAND:
  396.             key = (short)(*(cmd_rec+x) & A_CHARTEXT);
  397.             break;
  398.        case WINDOW_PREFIX:
  399.             key = (short)(*(pre_rec+x) & A_CHARTEXT);
  400.             break;
  401.       }
  402.     wmove(statarea,0,61);
  403.     wprintw(statarea,"' '=%2.2X/%3.3d  ",key,key);
  404.     wmove(statarea,0,62);
  405.     put_char(statarea,key,ADDCHAR);
  406.    }
  407. /*---------------------------------------------------------------------*/
  408. /* Display colour setting.                                             */
  409. /*---------------------------------------------------------------------*/
  410.  wmove(statarea,0,73);
  411. #ifdef A_COLOR
  412.  if (colour_support)
  413.     waddch(statarea,'C');
  414.  else
  415.     waddch(statarea,'c');
  416. #else
  417.  waddch(statarea,'M');
  418. #endif
  419. /*---------------------------------------------------------------------*/
  420. /* Display REXX support character.                                     */
  421. /*---------------------------------------------------------------------*/
  422.  wmove(statarea,0,74);
  423.  if (rexx_support)
  424.     waddch(statarea,'R');
  425.  else
  426.     waddch(statarea,' ');
  427. /*---------------------------------------------------------------------*/
  428. /* Display INSERTMODE toggle.                                          */
  429. /*---------------------------------------------------------------------*/
  430.  wmove(statarea,0,76);
  431.  if (INSERTMODEx)
  432.     waddstr(statarea,"Ins");
  433.  else
  434.     waddstr(statarea,"   ");
  435. /*---------------------------------------------------------------------*/
  436. /* Refresh the STATUS LINE.                                            */
  437. /*---------------------------------------------------------------------*/
  438.  wnoutrefresh(statarea);
  439. #ifdef TRACE
  440.  trace_return();
  441. #endif
  442.  return;
  443. }
  444. /***********************************************************************/
  445. #ifdef HAVE_PROTO
  446. void clear_statarea(void)
  447. #else
  448. void clear_statarea()
  449. #endif
  450. /***********************************************************************/
  451. {
  452. /*------------------------- external data -----------------------------*/
  453.  extern WINDOW *statarea;
  454.  extern ROWTYPE STATUSLINEx;
  455. /*--------------------------- local data ------------------------------*/
  456. /*--------------------------- processing ------------------------------*/
  457. #ifdef TRACE
  458.  trace_function("show.c:    clear_statarea");
  459. #endif
  460. /*---------------------------------------------------------------------*/
  461. /* If the status line is not displayed, don't do anything.             */
  462. /*---------------------------------------------------------------------*/
  463.  switch(STATUSLINEx)
  464.    {
  465.     case 'T':
  466.     case 'B':
  467.          wmove(statarea,0,0);
  468.          my_wclrtoeol(statarea);
  469.          break;
  470.     default:
  471.          break;
  472.    }
  473. #ifdef TRACE
  474.  trace_return();
  475. #endif
  476.  return;
  477. }
  478. /***********************************************************************/
  479. #ifdef HAVE_PROTO
  480. void redraw_window(WINDOW *win)
  481. #else
  482. void redraw_window(win)
  483. WINDOW *win;
  484. #endif
  485. /***********************************************************************/
  486. {
  487. /*------------------------- external data -----------------------------*/
  488. /*--------------------------- local data ------------------------------*/
  489.  register short i=0,j=0;
  490.  chtype ch=0;
  491.  short y=0,x=0;
  492. /*--------------------------- processing ------------------------------*/
  493. #ifdef TRACE
  494.  trace_function("show.c:    redraw_window");
  495. #endif
  496.  getyx(win,y,x);
  497.  for (i=0;i<getmaxx(win);i++)
  498.      for (j=0;j<getmaxy(win);j++)
  499.         {
  500.          wmove(win,j,i);
  501.          ch = (chtype)(winch(win) & A_CHARTEXT);
  502.          put_char(win,ch,ADDCHAR);
  503.         }
  504.  wmove(win,y,x);
  505. #ifdef TRACE
  506.  trace_return();
  507. #endif
  508.  return;
  509. }
  510. #if NOT_USED
  511. /***********************************************************************/
  512. #ifdef HAVE_PROTO
  513. void repaint_screen(void)
  514. #else
  515. void repaint_screen()
  516. #endif
  517. /***********************************************************************/
  518. {
  519. /*-------------------------- external data ----------------------------*/
  520. /*--------------------------- local data ------------------------------*/
  521.  short y=0,x=0;
  522. /*--------------------------- processing ------------------------------*/
  523. #ifdef TRACE
  524.  trace_function("show.c:    repaint_screen");
  525. #endif
  526.  
  527.  getyx(CURRENT_WINDOW,y,x);
  528.  y = get_row_for_focus_line(current_screen,CURRENT_VIEW->focus_line,
  529.                             CURRENT_VIEW->current_row);
  530.  if (x > CURRENT_SCREEN.cols[WINDOW_FILEAREA])
  531.     x = 0;
  532.  pre_process_line(CURRENT_VIEW,CURRENT_VIEW->focus_line,(LINE *)NULL);
  533.  build_screen(current_screen);
  534.  display_screen(current_screen);
  535.  cleanup_command_line();
  536. /* show_heading();*/
  537.  wmove(CURRENT_WINDOW,y,x);
  538.  
  539. #ifdef TRACE
  540.  trace_return();
  541. #endif
  542.  return;
  543. }
  544. #endif
  545.  
  546. /***********************************************************************/
  547. #ifdef HAVE_PROTO
  548. void build_screen(CHARTYPE scrno)
  549. #else
  550. void build_screen(scrno)
  551. CHARTYPE scrno;
  552. #endif
  553. /***********************************************************************/
  554. {
  555. /*-------------------------- external data ----------------------------*/
  556. extern bool SBx;
  557. /*--------------------------- local data ------------------------------*/
  558.  LINE *curr=NULL;
  559.  LINE *save_curr=NULL;
  560.  short crow = SCREEN_VIEW(scrno)->current_row;
  561.  LINETYPE cline = SCREEN_VIEW(scrno)->current_line;
  562. /*--------------------------- processing ------------------------------*/
  563. #ifdef TRACE
  564.  trace_function("show.c:    build_screen");
  565. #endif
  566.  hexshow_curr = save_curr = curr = lll_find(SCREEN_FILE(scrno)->first_line,SCREEN_FILE(scrno)->last_line,
  567.                                             cline,SCREEN_FILE(scrno)->number_lines);
  568. /*---------------------------------------------------------------------*/
  569. /* Build   the file contents from the current line to the bottom of the*/
  570. /* window.                                                             */
  571. /*---------------------------------------------------------------------*/
  572.  build_lines(scrno,DIRECTION_FORWARD,curr,screen[scrno].rows[WINDOW_FILEAREA]-crow,crow);
  573. /*---------------------------------------------------------------------*/
  574. /* Build   the file contents from the current line to the top of the   */
  575. /* window.                                                             */
  576. /*---------------------------------------------------------------------*/
  577.  curr = save_curr->prev;
  578.  build_lines(scrno,DIRECTION_BACKWARD,curr,crow,crow-1);
  579. #if defined(HAVE_SB_INIT)
  580.  if (SBx 
  581.  && scrno == current_screen)
  582.    {
  583.     sb_set_vert(2+CURRENT_FILE->number_lines +CURRENT_SCREEN.rows[WINDOW_FILEAREA],
  584.                 CURRENT_SCREEN.rows[WINDOW_FILEAREA],
  585.                 CURRENT_VIEW->current_line);
  586.     sb_set_horz(max_line_length+CURRENT_SCREEN.cols[WINDOW_FILEAREA],
  587.                 CURRENT_SCREEN.cols[WINDOW_FILEAREA],
  588.                 CURRENT_VIEW->verify_col);
  589.     sb_refresh();
  590.    }
  591. #endif
  592. #ifdef TRACE
  593.  trace_return();
  594. #endif
  595.  return;
  596. }
  597. /***********************************************************************/
  598. #ifdef HAVE_PROTO
  599. void display_screen(CHARTYPE scrno)
  600. #else
  601. void display_screen(scrno)
  602. CHARTYPE scrno;
  603. #endif
  604. /***********************************************************************/
  605. {
  606. /*-------------------------- external data ----------------------------*/
  607.  extern bool in_macro;
  608.  extern bool in_repeat;
  609.  extern bool batch_only;
  610.  extern bool curses_started;
  611.  extern bool first_screen_display;
  612. /*--------------------------- local data ------------------------------*/
  613.  unsigned short x=0,y=0;
  614.  unsigned short savex=0,savey=0;
  615. /*--------------------------- processing ------------------------------*/
  616. #ifdef TRACE
  617.  trace_function("show.c:    display_screen");
  618. #endif
  619. /*---------------------------------------------------------------------*/
  620. /* We don't display the screen if we are in a macro, running in batch, */
  621. /* runninf REPEAT command, or curses hasn't started yet...             */
  622. /*---------------------------------------------------------------------*/
  623.  if (batch_only
  624.  ||  in_macro
  625.  ||  in_repeat
  626.  || !curses_started)
  627.    {
  628. #ifdef TRACE
  629.     trace_return();
  630. #endif
  631.     return;
  632.    }
  633.  first_screen_display = TRUE;
  634. /*---------------------------------------------------------------------*/
  635. /* Turn off the cursor.                                                */
  636. /*---------------------------------------------------------------------*/
  637.  draw_cursor(FALSE);
  638. /*---------------------------------------------------------------------*/
  639. /* Display the IDLINE window...                                        */
  640. /*---------------------------------------------------------------------*/
  641.  show_heading(scrno);
  642. /*---------------------------------------------------------------------*/
  643. /* Display the ARROW and CMDLINE if on...                              */
  644. /*---------------------------------------------------------------------*/
  645.  if (SCREEN_WINDOW_ARROW(scrno) != NULL)
  646.    {
  647.     wattrset(SCREEN_WINDOW_ARROW(scrno),set_colour(SCREEN_FILE(scrno)->attr+ATTR_ARROW));
  648.     redraw_window(SCREEN_WINDOW_ARROW(scrno));
  649.     touchwin(SCREEN_WINDOW_ARROW(scrno));
  650.     wnoutrefresh(SCREEN_WINDOW_ARROW(scrno));
  651.    }
  652.  if (SCREEN_WINDOW_COMMAND(scrno) != NULL)
  653.    {
  654.     wattrset(SCREEN_WINDOW_COMMAND(scrno),set_colour(SCREEN_FILE(scrno)->attr+ATTR_CMDLINE));
  655.     redraw_window(SCREEN_WINDOW_COMMAND(scrno));
  656.     touchwin(SCREEN_WINDOW_COMMAND(scrno));
  657.     wnoutrefresh(SCREEN_WINDOW_COMMAND(scrno));
  658.    }
  659. /*---------------------------------------------------------------------*/
  660. /* Save the position of previous window if on command line.            */
  661. /*---------------------------------------------------------------------*/
  662.  if (SCREEN_VIEW(scrno)->current_window == WINDOW_COMMAND)
  663.     getyx(SCREEN_PREV_WINDOW(scrno),savey,savex);
  664.  getyx(SCREEN_WINDOW(scrno),y,x);
  665. /*---------------------------------------------------------------------*/
  666. /* Display the built lines...                                          */
  667. /*---------------------------------------------------------------------*/
  668.  show_lines(scrno);
  669. /*---------------------------------------------------------------------*/
  670. /* Refresh the windows.                                                */
  671. /*---------------------------------------------------------------------*/
  672.  if (SCREEN_WINDOW_PREFIX(scrno) != NULL)
  673.      wnoutrefresh(SCREEN_WINDOW_PREFIX(scrno));
  674.  if (SCREEN_WINDOW_GAP(scrno) != NULL)
  675.      wnoutrefresh(SCREEN_WINDOW_GAP(scrno));
  676.  wrefresh(SCREEN_WINDOW_FILEAREA(scrno));
  677. /*---------------------------------------------------------------------*/
  678. /* Lastly, turn the cursor back on again.                              */
  679. /*---------------------------------------------------------------------*/
  680.  draw_cursor(TRUE);
  681. /*---------------------------------------------------------------------*/
  682. /* Restore the position of previous window if on command line.         */
  683. /*---------------------------------------------------------------------*/
  684.  if (SCREEN_VIEW(scrno)->current_window == WINDOW_COMMAND)
  685.     wmove(SCREEN_PREV_WINDOW(scrno),savey,savex);
  686.  wmove(SCREEN_WINDOW(scrno),y,x);
  687. #ifdef TRACE
  688.  trace_return();
  689. #endif
  690.  return;
  691. }
  692. /***********************************************************************/
  693. #ifdef HAVE_PROTO
  694. static void build_lines(CHARTYPE scrno,short direction,LINE *curr,
  695.                          short rows,short start_row)
  696. #else
  697. static void build_lines(scrno,direction,curr,rows,start_row)
  698. CHARTYPE scrno;
  699. short direction;
  700. LINE *curr;
  701. short rows,start_row;
  702. #endif
  703. /***********************************************************************/
  704. {
  705. /*-------------------------- external data ----------------------------*/
  706.  extern CHARTYPE *rec;
  707.  extern LENGTHTYPE rec_len;
  708.  extern VIEW_DETAILS *vd_mark;
  709.  extern short compatible_feel;
  710.  extern CHARTYPE display_screens;
  711. /*--------------------------- local data ------------------------------*/
  712.  LINETYPE cline = SCREEN_VIEW(scrno)->current_line;
  713.  RESERVED *curr_rsrvd=NULL;
  714.  short num_shadow_lines=0;
  715.  bool marked=FALSE,current=FALSE;
  716.  short tab_actual_row=0;
  717.  short scale_actual_row=0;
  718.  short hexshow_actual_start_row=0;
  719.  bool display_rec=FALSE;
  720. /*--------------------------- processing ------------------------------*/
  721. #ifdef TRACE
  722.  trace_function("show.c:    build_lines");
  723. #endif
  724. /*---------------------------------------------------------------------*/
  725. /* Determine if the contents of "rec" should be used to display the    */
  726. /* focus line.                                                         */
  727. /*---------------------------------------------------------------------*/
  728.  if (display_screens > 1)
  729.    {
  730.     if (scrno == current_screen
  731.     ||  SCREEN_FILE(current_screen) == SCREEN_FILE(other_screen))
  732.        display_rec = TRUE;
  733.     else
  734.        display_rec = FALSE;
  735.    }
  736.  else
  737.     display_rec = TRUE;
  738. /*---------------------------------------------------------------------*/
  739. /* Determine the row that is the focus line.                           */
  740. /*---------------------------------------------------------------------*/
  741.  if (direction == DIRECTION_BACKWARD)
  742.     cline--;
  743.  num_shadow_lines = 0;
  744. /*---------------------------------------------------------------------*/
  745. /* These only need to be calculated once.                              */
  746. /*---------------------------------------------------------------------*/
  747.  tab_actual_row=calculate_actual_row(SCREEN_VIEW(scrno)->tab_base,SCREEN_VIEW(scrno)->tab_off,screen[scrno].rows[WINDOW_FILEAREA],TRUE);
  748.  scale_actual_row=calculate_actual_row(SCREEN_VIEW(scrno)->scale_base,SCREEN_VIEW(scrno)->scale_off,screen[scrno].rows[WINDOW_FILEAREA],TRUE);
  749. /*---------------------------------------------------------------------*/
  750. /* Now, for each row to be displayed...                                */
  751. /*---------------------------------------------------------------------*/
  752.  while(rows)
  753.    {
  754.     screen[scrno].sl[start_row].full_length = FALSE;
  755.     screen[scrno].sl[start_row].number_lines_excluded = 0;
  756.     screen[scrno].sl[start_row].other_start_col = 0;
  757.     screen[scrno].sl[start_row].other_end_col = 0;
  758.     screen[scrno].sl[start_row].line_type = LINE_LINE;
  759.     screen[scrno].sl[start_row].main_enterable = TRUE;
  760.     screen[scrno].sl[start_row].prefix_enterable = TRUE;
  761.     screen[scrno].sl[start_row].highlight = FALSE;
  762. /*---------------------------------------------------------------------*/
  763. /* If HEXSHOW is ON...                                                 */
  764. /*---------------------------------------------------------------------*/
  765.     if (SCREEN_VIEW(scrno)->hexshow_on)
  766.       {
  767.        hexshow_actual_start_row=calculate_actual_row(SCREEN_VIEW(scrno)->hexshow_base,SCREEN_VIEW(scrno)->hexshow_off,screen[scrno].rows[WINDOW_FILEAREA],TRUE);
  768.        if (hexshow_actual_start_row == start_row
  769.        ||  hexshow_actual_start_row+1 == start_row)
  770.          {
  771.           screen[scrno].sl[start_row].line_type = LINE_HEXSHOW;
  772.           screen[scrno].sl[start_row].full_length = TRUE;
  773.           screen[scrno].sl[start_row].line_number = (-1L);
  774.           screen[scrno].sl[start_row].main_enterable = FALSE;
  775.           screen[scrno].sl[start_row].prefix_enterable = FALSE;
  776.           screen[scrno].sl[start_row].normal_colour = set_colour(SCREEN_FILE(scrno)->attr+ATTR_SHADOW);
  777.           if (scrno == current_screen)
  778.             {
  779.              if (SCREEN_VIEW(scrno)->current_line == SCREEN_VIEW(scrno)->focus_line)
  780.                {
  781.                 screen[scrno].sl[start_row].contents = rec;
  782.                 screen[scrno].sl[start_row].length = rec_len;
  783.                }
  784.              else
  785.                {
  786.                 screen[scrno].sl[start_row].contents = hexshow_curr->line;
  787.                 screen[scrno].sl[start_row].length = hexshow_curr->length;
  788.                }
  789.             }
  790.           else
  791.             {
  792.              if (SCREEN_VIEW(scrno)->current_line == SCREEN_VIEW(current_screen)->focus_line
  793.              &&  display_rec)
  794.                {
  795.                 screen[scrno].sl[start_row].contents = rec;
  796.                 screen[scrno].sl[start_row].length = rec_len;
  797.                }
  798.              else
  799.                {
  800.                 screen[scrno].sl[start_row].contents = hexshow_curr->line;
  801.                 screen[scrno].sl[start_row].length = hexshow_curr->length;
  802.                }
  803.             }
  804.           if (hexshow_actual_start_row == start_row)
  805.              screen[scrno].sl[start_row].other_start_col = 0;
  806.           else
  807.              screen[scrno].sl[start_row].other_start_col = 1;
  808.           if (SCREEN_VIEW(scrno)->prefix) /* display prefix if on */
  809.             {
  810.              memset(screen[scrno].sl[start_row].prefix,' ',SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap);
  811.              screen[scrno].sl[start_row].prefix[SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap] = '\0';
  812.              screen[scrno].sl[start_row].prefix_colour = set_colour(SCREEN_FILE(scrno)->attr+ATTR_PREFIX);
  813.              if (SCREEN_VIEW(scrno)->prefix_gap)
  814.                {
  815.                 screen[scrno].sl[start_row].gap_colour = set_colour(SCREEN_FILE(scrno)->attr+ATTR_GAP);
  816.                 strcpy((DEFCHAR*)screen[scrno].sl[start_row].gap,"");
  817.                }
  818.             }
  819.           start_row += direction;
  820.           rows--;
  821.           continue;
  822.          }
  823.       }
  824. /*---------------------------------------------------------------------*/
  825. /* If the current line is a reserved line...                           */
  826. /*---------------------------------------------------------------------*/
  827.     if (SCREEN_FILE(scrno)->first_reserved)    /* at least one reserved line */
  828.       {
  829.        if ((curr_rsrvd = find_reserved_line(scrno,TRUE,start_row,0,0)) != NULL)
  830.          {
  831.           screen[scrno].sl[start_row].line_type = LINE_RESERVED;
  832.           screen[scrno].sl[start_row].full_length = TRUE;
  833.           screen[scrno].sl[start_row].line_number = (-1L);
  834.           screen[scrno].sl[start_row].current = (LINE *)NULL;
  835.           screen[scrno].sl[start_row].main_enterable = FALSE;
  836.           screen[scrno].sl[start_row].prefix_enterable = FALSE;
  837.           if (SCREEN_VIEW(scrno)->prefix)               /* display prefix if on */
  838.             {
  839.              screen[scrno].sl[start_row].prefix_colour = set_colour(curr_rsrvd->attr);
  840.              screen[scrno].sl[start_row].gap_colour = set_colour(curr_rsrvd->attr);
  841.              if ((SCREEN_VIEW(scrno)->prefix&PREFIX_LOCATION_MASK) == PREFIX_LEFT)
  842.                {
  843.                 memset(screen[scrno].sl[start_row].prefix,' ',SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap);
  844.                 memcpy(screen[scrno].sl[start_row].prefix,curr_rsrvd->line,min(curr_rsrvd->length,SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap));
  845.                 screen[scrno].sl[start_row].prefix[SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap] = '\0';
  846.                 strcpy((DEFCHAR*)screen[scrno].sl[start_row].gap,"");
  847.                 if (curr_rsrvd->length <= SCREEN_VIEW(scrno)->prefix_width)
  848.                   {
  849.                    screen[scrno].sl[start_row].contents = NULL;
  850.                    screen[scrno].sl[start_row].length = 0;
  851.                   }
  852.                 else
  853.                   {
  854.                    screen[scrno].sl[start_row].contents = curr_rsrvd->line+SCREEN_VIEW(scrno)->prefix_width;
  855.                    screen[scrno].sl[start_row].length = curr_rsrvd->length-SCREEN_VIEW(scrno)->prefix_width;
  856.                   }
  857.                 if (curr_rsrvd->length > SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap)
  858.                   {
  859.                    memcpy(screen[scrno].sl[start_row].gap,
  860.                           curr_rsrvd->line+(SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap),
  861.                           min(SCREEN_VIEW(scrno)->prefix_gap,
  862.                               curr_rsrvd->length-(SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap)));
  863.                    screen[scrno].sl[start_row].gap[min(SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap,curr_rsrvd->length-(SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap))] = '\0';
  864.                   }
  865.                }
  866.              else
  867.                {
  868.                 screen[scrno].sl[start_row].contents = curr_rsrvd->line;
  869.                 screen[scrno].sl[start_row].length = min(curr_rsrvd->length,screen[scrno].cols[WINDOW_FILEAREA]);
  870.                 memset(screen[scrno].sl[start_row].prefix,' ',SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap);
  871.                 screen[scrno].sl[start_row].prefix[SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap] = '\0';
  872.                 strcpy((DEFCHAR*)screen[scrno].sl[start_row].gap,"");
  873.                 if (curr_rsrvd->length > screen[scrno].cols[WINDOW_FILEAREA])
  874.                   {
  875.                    /*
  876.                     * Reserved line contents may be in prefix area or gap or both
  877.                     * Add to gap if there is one
  878.                     */
  879.                    if (SCREEN_VIEW(scrno)->prefix_gap)
  880.                      {
  881.                       memcpy(screen[scrno].sl[start_row].gap,
  882.                              curr_rsrvd->line+screen[scrno].cols[WINDOW_FILEAREA],
  883.                              min(curr_rsrvd->length-screen[scrno].cols[WINDOW_FILEAREA],
  884.                                  SCREEN_VIEW(scrno)->prefix_gap));
  885.                       screen[scrno].sl[start_row].gap[min(curr_rsrvd->length-screen[scrno].cols[WINDOW_FILEAREA],SCREEN_VIEW(scrno)->prefix_gap)] = '\0';
  886.                      }
  887.                    if (curr_rsrvd->length > screen[scrno].cols[WINDOW_FILEAREA]+(SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap))
  888.                      {
  889.                      /*
  890.                       * Add to prefix area
  891.                       */
  892.                       memcpy(screen[scrno].sl[start_row].prefix,
  893.                              curr_rsrvd->line+screen[scrno].cols[WINDOW_FILEAREA]+(SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap),
  894.                              min(curr_rsrvd->length-screen[scrno].cols[WINDOW_FILEAREA]+(SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap),
  895.                                  SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap));
  896.                       screen[scrno].sl[start_row].prefix[min(curr_rsrvd->length-screen[scrno].cols[WINDOW_FILEAREA]+(SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap),SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap)] = '\0';
  897.                      }
  898.                   }
  899.                }
  900.             }
  901.           else
  902.             {
  903.              screen[scrno].sl[start_row].contents = curr_rsrvd->line;
  904.              screen[scrno].sl[start_row].length = curr_rsrvd->length;
  905.             }
  906.           screen[scrno].sl[start_row].normal_colour = set_colour(curr_rsrvd->attr);
  907.           screen[scrno].sl[start_row].other_colour = set_colour(curr_rsrvd->attr);
  908.           start_row += direction;
  909.           rows--;
  910.           continue;
  911.          }
  912.       }
  913. /*---------------------------------------------------------------------*/
  914. /* If the current line is the scale or tab line...                     */
  915. /*---------------------------------------------------------------------*/
  916.     if ((SCREEN_VIEW(scrno)->scale_on && scale_actual_row == start_row)
  917.     || (SCREEN_VIEW(scrno)->tab_on && tab_actual_row == start_row))
  918.       {
  919.        screen[scrno].sl[start_row].contents = NULL;
  920.        screen[scrno].sl[start_row].length = 0;
  921.        screen[scrno].sl[start_row].line_number = (-1L);
  922.        screen[scrno].sl[start_row].current = (LINE *)NULL;
  923.        screen[scrno].sl[start_row].main_enterable = FALSE;
  924.        screen[scrno].sl[start_row].prefix_enterable = FALSE;
  925.        if (SCREEN_VIEW(scrno)->prefix) /* display prefix if on */
  926.          {
  927.           memset(screen[scrno].sl[start_row].prefix,' ',SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap);
  928.           screen[scrno].sl[start_row].prefix[SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap] = '\0';
  929.           screen[scrno].sl[start_row].prefix_colour = set_colour(SCREEN_FILE(scrno)->attr+ATTR_PREFIX);
  930.           screen[scrno].sl[start_row].gap_colour = set_colour(SCREEN_FILE(scrno)->attr+ATTR_GAP);
  931.           strcpy((DEFCHAR*)screen[scrno].sl[start_row].gap,"");
  932.          }
  933.        if (SCREEN_VIEW(scrno)->tab_on && tab_actual_row == start_row)
  934.          {
  935.           screen[scrno].sl[start_row].line_type |= LINE_TABLINE;
  936.           screen[scrno].sl[start_row].normal_colour = set_colour(SCREEN_FILE(scrno)->attr+ATTR_TABLINE);
  937.          }
  938.        if (SCREEN_VIEW(scrno)->scale_on && scale_actual_row == start_row)
  939.          {
  940.           screen[scrno].sl[start_row].line_type |= LINE_SCALE;
  941.           screen[scrno].sl[start_row].normal_colour = set_colour(SCREEN_FILE(scrno)->attr+ATTR_SCALE);
  942.          }
  943.        start_row += direction;
  944.        rows--;
  945.        continue;
  946.       }
  947. /*---------------------------------------------------------------------*/
  948. /* If the current line is above or below TOF or EOF, set all to blank. */
  949. /*---------------------------------------------------------------------*/
  950.     if (curr == NULL)
  951.       {
  952.        screen[scrno].sl[start_row].contents = NULL;
  953.        screen[scrno].sl[start_row].length = 0;
  954.        screen[scrno].sl[start_row].normal_colour = set_colour(SCREEN_FILE(scrno)->attr+ATTR_FILEAREA);
  955.        screen[scrno].sl[start_row].line_type = (direction == DIRECTION_BACKWARD) ? LINE_OUT_OF_BOUNDS_ABOVE : LINE_OUT_OF_BOUNDS_BELOW;
  956.        screen[scrno].sl[start_row].line_number = (-1L);
  957.        screen[scrno].sl[start_row].current = (LINE *)NULL;
  958.        screen[scrno].sl[start_row].main_enterable = FALSE;
  959.        screen[scrno].sl[start_row].prefix_enterable = FALSE;
  960.        if (SCREEN_VIEW(scrno)->prefix) /* display prefix if on */
  961.          {
  962.           memset(screen[scrno].sl[start_row].prefix,' ',SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap);
  963.           screen[scrno].sl[start_row].prefix[SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap] = '\0';
  964.           screen[scrno].sl[start_row].prefix_colour = set_colour(SCREEN_FILE(scrno)->attr+ATTR_PREFIX);
  965.           screen[scrno].sl[start_row].gap_colour = set_colour(SCREEN_FILE(scrno)->attr+ATTR_GAP);
  966.           strcpy((DEFCHAR*)screen[scrno].sl[start_row].gap,"");
  967.          }
  968.        start_row += direction;
  969.        rows--;
  970.        continue;
  971.       }
  972. /*---------------------------------------------------------------------*/
  973. /* If the current line is excluded, increment a running total.         */
  974. /* Ignore the line if on TOF or BOF.                                   */
  975. /*---------------------------------------------------------------------*/
  976.     if (curr->next != NULL                           /* Bottom of file */
  977.     &&  curr->prev != NULL)                             /* Top of file */
  978.       {
  979.        if (in_scope(SCREEN_VIEW(scrno),curr)
  980.        || cline == SCREEN_VIEW(scrno)->current_line
  981.        || curr->pre != NULL)
  982.           ;
  983.        else
  984.          {
  985.           if (num_shadow_lines == 0
  986.           && direction == DIRECTION_FORWARD)
  987.             {
  988.              set_prefix_contents(scrno,curr,start_row,cline);
  989.              screen[scrno].sl[start_row].line_number = cline;
  990.              screen[scrno].sl[start_row].current = curr;
  991.             }
  992.           num_shadow_lines++;
  993.           cline += (LINETYPE)direction;
  994.           if (direction == DIRECTION_FORWARD)
  995.              curr = curr->next;
  996.           else
  997.              curr = curr->prev;
  998.           continue;
  999.          }
  1000.       }
  1001. /*---------------------------------------------------------------------*/
  1002. /* If we get here, we have to determine if a shadow line is to be      */
  1003. /* displayed or not.                                                   */
  1004. /*---------------------------------------------------------------------*/
  1005.     if (SCREEN_VIEW(scrno)->shadow
  1006.     && num_shadow_lines > 0)
  1007.       {
  1008.        screen[scrno].sl[start_row].length = 0;
  1009.        if (direction != DIRECTION_FORWARD)
  1010.          {
  1011.           set_prefix_contents(scrno,curr->next,start_row,cline+1);
  1012.           screen[scrno].sl[start_row].line_number = cline+1;
  1013.           screen[scrno].sl[start_row].current = curr;
  1014.          }
  1015.        screen[scrno].sl[start_row].normal_colour = set_colour(SCREEN_FILE(scrno)->attr+ATTR_SHADOW);
  1016.        screen[scrno].sl[start_row].full_length = TRUE;
  1017.        screen[scrno].sl[start_row].number_lines_excluded = num_shadow_lines;
  1018.        screen[scrno].sl[start_row].line_type = LINE_SHADOW;
  1019.        if (compatible_feel == COMPAT_XEDIT)
  1020.           screen[scrno].sl[start_row].main_enterable = FALSE;
  1021.        num_shadow_lines = 0;
  1022.        start_row += direction;
  1023.        rows--;
  1024.        continue;
  1025.       }
  1026. /*---------------------------------------------------------------------*/
  1027. /* Determine if line being processed is the current line.              */
  1028. /*---------------------------------------------------------------------*/
  1029.     if (cline == SCREEN_VIEW(scrno)->current_line)
  1030.        current = TRUE;
  1031.     else
  1032.        current = FALSE;
  1033. /*---------------------------------------------------------------------*/
  1034. /* Determine if line being processed is in a marked block.             */
  1035. /*---------------------------------------------------------------------*/
  1036.     if (MARK_VIEW != (VIEW_DETAILS *)NULL
  1037.     &&  MARK_VIEW == SCREEN_VIEW(scrno))
  1038.       {
  1039.        if (cline >= MARK_VIEW->mark_start_line
  1040.        &&  cline <= MARK_VIEW->mark_end_line)
  1041.           marked = TRUE;
  1042.        else
  1043.           marked = FALSE;
  1044.       }
  1045. /*---------------------------------------------------------------------*/
  1046. /* The remainder is for lines that are to be displayed.                */
  1047. /*---------------------------------------------------------------------*/
  1048.     screen[scrno].sl[start_row].line_number = cline;
  1049.     screen[scrno].sl[start_row].current = curr;
  1050. /*---------------------------------------------------------------------*/
  1051. /* If the current row to be displayed is the focus line, display       */
  1052. /* the working area, rec and rec_len instead of the entry in the LL.   */
  1053. /*---------------------------------------------------------------------*/
  1054. #if 1
  1055.     if (scrno == current_screen)
  1056.       {
  1057.        if (cline == SCREEN_VIEW(scrno)->focus_line
  1058.        &&  display_rec)
  1059.          {
  1060.           screen[scrno].sl[start_row].contents = rec;
  1061.           screen[scrno].sl[start_row].length = rec_len;
  1062.          }
  1063.        else
  1064.          {
  1065.           screen[scrno].sl[start_row].contents = curr->line;
  1066.           screen[scrno].sl[start_row].length = curr->length;
  1067.          }
  1068.       }
  1069.     else
  1070.       {
  1071.        if (cline == SCREEN_VIEW(current_screen)->focus_line
  1072.        &&  display_rec)
  1073.          {
  1074.           screen[scrno].sl[start_row].contents = rec;
  1075.           screen[scrno].sl[start_row].length = rec_len;
  1076.          }
  1077.        else
  1078.          {
  1079.           screen[scrno].sl[start_row].contents = curr->line;
  1080.           screen[scrno].sl[start_row].length = curr->length;
  1081.          }
  1082.       }
  1083. #else
  1084.     if (cline == SCREEN_VIEW(scrno)->focus_line
  1085.     &&  display_rec)
  1086.       {
  1087.        screen[scrno].sl[start_row].contents = rec;
  1088.        screen[scrno].sl[start_row].length = rec_len;
  1089.       }
  1090.     else
  1091.       {
  1092.        screen[scrno].sl[start_row].contents = curr->line;
  1093.        screen[scrno].sl[start_row].length = curr->length;
  1094.       }
  1095. #endif
  1096.     set_prefix_contents(scrno,curr,start_row,cline);
  1097. /*---------------------------------------------------------------------*/
  1098. /* Set up TOF and EOF lines...                                         */
  1099. /*---------------------------------------------------------------------*/
  1100.     if (curr->next == NULL                           /* Bottom of file */
  1101.     ||  curr->prev == NULL)                             /* Top of file */
  1102.       {
  1103.        screen[scrno].sl[start_row].normal_colour = (current) ? set_colour(SCREEN_FILE(scrno)->attr+ATTR_CTOFEOF) :
  1104.                                                    set_colour(SCREEN_FILE(scrno)->attr+ATTR_TOFEOF);
  1105. #ifndef REMOVED_FOR_CONSISTANCY
  1106.        if (compatible_feel == COMPAT_XEDIT)
  1107.           screen[scrno].sl[start_row].main_enterable = FALSE;
  1108. #endif
  1109.        screen[scrno].sl[start_row].line_type = (curr->next==NULL)?LINE_EOF:LINE_TOF; /* MH12 */
  1110.       }
  1111.     else
  1112.       {
  1113.        if (SCREEN_VIEW(scrno)->highlight)
  1114.          {
  1115.           switch(SCREEN_VIEW(scrno)->highlight)
  1116.             {
  1117.              case HIGHLIGHT_TAG:
  1118.                   if (curr->tag_flag)
  1119.                      screen[scrno].sl[start_row].highlight = TRUE;
  1120.                   break;
  1121.              case HIGHLIGHT_ALT:
  1122.                   if (curr->new_flag
  1123.                   ||  curr->changed_flag)
  1124.                      screen[scrno].sl[start_row].highlight = TRUE;
  1125.                   break;
  1126.              case HIGHLIGHT_SELECT:
  1127.                   if (curr->select >= SCREEN_VIEW(scrno)->highlight_low
  1128.                   &&  curr->select <= SCREEN_VIEW(scrno)->highlight_high)
  1129.                      screen[scrno].sl[start_row].highlight = TRUE;
  1130.                   break;
  1131.              default:
  1132.                   break;
  1133.             }
  1134.          }
  1135.        if (marked)
  1136.          {
  1137.           switch(MARK_VIEW->mark_type)
  1138.             {
  1139.              case M_LINE:
  1140.                   screen[scrno].sl[start_row].other_start_col = (-1);
  1141.                   screen[scrno].sl[start_row].other_end_col = (-1);
  1142.                   screen[scrno].sl[start_row].normal_colour = (current) ? set_colour(SCREEN_FILE(scrno)->attr+ATTR_CBLOCK) :
  1143.                                                                set_colour(SCREEN_FILE(scrno)->attr+ATTR_BLOCK);
  1144.                   screen[scrno].sl[start_row].full_length = TRUE;
  1145.                   break;
  1146.              case M_BOX:
  1147.              case M_COLUMN:
  1148.              case M_WORD:
  1149.                   screen[scrno].sl[start_row].other_start_col = MARK_VIEW->mark_start_col - 1;
  1150.                   screen[scrno].sl[start_row].other_end_col = MARK_VIEW->mark_end_col - 1;
  1151.                   if (screen[scrno].sl[start_row].highlight)
  1152.                      screen[scrno].sl[start_row].normal_colour = (current) ? set_colour(SCREEN_FILE(scrno)->attr+ATTR_CHIGHLIGHT) :
  1153.                                                       set_colour(SCREEN_FILE(scrno)->attr+ATTR_HIGHLIGHT);
  1154.                   else
  1155.                      screen[scrno].sl[start_row].normal_colour = (current) ? set_colour(SCREEN_FILE(scrno)->attr+ATTR_CURLINE) :
  1156.                                                                set_colour(SCREEN_FILE(scrno)->attr+ATTR_FILEAREA);
  1157.                   screen[scrno].sl[start_row].other_colour = (current) ? set_colour(SCREEN_FILE(scrno)->attr+ATTR_CBLOCK) :
  1158.                                                               set_colour(SCREEN_FILE(scrno)->attr+ATTR_BLOCK);
  1159.                   break;
  1160.              case M_STREAM:
  1161.                   if (screen[scrno].sl[start_row].highlight)
  1162.                      screen[scrno].sl[start_row].normal_colour = (current) ? set_colour(SCREEN_FILE(scrno)->attr+ATTR_CHIGHLIGHT) :
  1163.                                                       set_colour(SCREEN_FILE(scrno)->attr+ATTR_HIGHLIGHT);
  1164.                   else
  1165.                      screen[scrno].sl[start_row].normal_colour = (current) ? set_colour(SCREEN_FILE(scrno)->attr+ATTR_CURLINE) :
  1166.                                                                set_colour(SCREEN_FILE(scrno)->attr+ATTR_FILEAREA);
  1167.                   screen[scrno].sl[start_row].other_colour = (current) ? set_colour(SCREEN_FILE(scrno)->attr+ATTR_CBLOCK) :
  1168.                                                               set_colour(SCREEN_FILE(scrno)->attr+ATTR_BLOCK);
  1169.                   screen[scrno].sl[start_row].other_end_col = MAX_INT;
  1170.                   screen[scrno].sl[start_row].other_start_col = 0;
  1171.                   if (cline == MARK_VIEW->mark_start_line)
  1172.                      screen[scrno].sl[start_row].other_start_col = MARK_VIEW->mark_start_col - 1;
  1173.                   if (cline == MARK_VIEW->mark_end_line)
  1174.                      screen[scrno].sl[start_row].other_end_col = MARK_VIEW->mark_end_col - 1;
  1175.                   if (cline > MARK_VIEW->mark_start_line
  1176.                   &&  cline < MARK_VIEW->mark_end_line)
  1177.                     {
  1178.                      screen[scrno].sl[start_row].normal_colour = (current) ? set_colour(SCREEN_FILE(scrno)->attr+ATTR_CBLOCK) :
  1179.                                                                set_colour(SCREEN_FILE(scrno)->attr+ATTR_BLOCK);
  1180.                      screen[scrno].sl[start_row].full_length = TRUE;
  1181.                     }
  1182.                   break;
  1183.             }
  1184.          }
  1185.        else
  1186.          {
  1187.           if (screen[scrno].sl[start_row].highlight)
  1188.             {
  1189.              screen[scrno].sl[start_row].normal_colour = (current) ? set_colour(SCREEN_FILE(scrno)->attr+ATTR_CHIGHLIGHT) :
  1190.                                                       set_colour(SCREEN_FILE(scrno)->attr+ATTR_HIGHLIGHT);
  1191.              screen[scrno].sl[start_row].other_colour = screen[scrno].sl[start_row].normal_colour;
  1192.             }
  1193.           else
  1194.             {
  1195.              screen[scrno].sl[start_row].normal_colour = (current) ? set_colour(SCREEN_FILE(scrno)->attr+ATTR_CURLINE) :
  1196.                                                       set_colour(SCREEN_FILE(scrno)->attr+ATTR_FILEAREA);
  1197.              screen[scrno].sl[start_row].other_colour = screen[scrno].sl[start_row].normal_colour;
  1198.             }
  1199.          }
  1200.       }
  1201.     start_row += direction;
  1202.     rows--;
  1203.  
  1204.     cline += (LINETYPE)direction;
  1205.     if (direction == DIRECTION_FORWARD)
  1206.        curr = curr->next;
  1207.     else
  1208.        curr = curr->prev;
  1209.    }
  1210. #ifdef TRACE
  1211.  trace_return();
  1212. #endif
  1213.  return;
  1214. }
  1215. /***********************************************************************/
  1216. #ifdef HAVE_PROTO
  1217. static void show_lines(CHARTYPE scrno)
  1218. #else
  1219. static void show_lines(scrno)
  1220. CHARTYPE scrno;
  1221. #endif
  1222. /***********************************************************************/
  1223. {
  1224. /*------------------------- external data -----------------------------*/
  1225. /*--------------------------- local data ------------------------------*/
  1226.  register short i=0,j=0;
  1227.  short true_col=0;
  1228.  short max_cols = min(screen[scrno].cols[WINDOW_FILEAREA],SCREEN_VIEW(scrno)->verify_end-SCREEN_VIEW(scrno)->verify_start+1);
  1229.  short off=0,num_tens=0;
  1230.  unsigned short y=0,x=0;
  1231.  CHARTYPE tens[5];
  1232. /*--------------------------- processing ------------------------------*/
  1233. #ifdef TRACE
  1234.  trace_function("show.c:    show_lines");
  1235. #endif
  1236.  for (i=0;i<screen[scrno].rows[WINDOW_FILEAREA];i++)
  1237.    {
  1238. /*---------------------------------------------------------------------*/
  1239. /* Display the contents of the prefix area (if on).                    */
  1240. /*---------------------------------------------------------------------*/
  1241.     if (SCREEN_VIEW(scrno)->prefix)
  1242.       {
  1243.        wattrset(SCREEN_WINDOW_PREFIX(scrno),screen[scrno].sl[i].prefix_colour);
  1244.        wmove(SCREEN_WINDOW_PREFIX(scrno),i,0);
  1245.        my_wclrtoeol(SCREEN_WINDOW_PREFIX(scrno));
  1246.        put_string(SCREEN_WINDOW_PREFIX(scrno),i,0,screen[scrno].sl[i].prefix,strlen((DEFCHAR *)screen[scrno].sl[i].prefix));
  1247.        if (SCREEN_VIEW(scrno)->prefix_gap)
  1248.          {
  1249.           wattrset(SCREEN_WINDOW_GAP(scrno),screen[scrno].sl[i].gap_colour);
  1250.           wmove(SCREEN_WINDOW_GAP(scrno),i,0);
  1251.           my_wclrtoeol(SCREEN_WINDOW_GAP(scrno));
  1252.           put_string(SCREEN_WINDOW_GAP(scrno),i,0,screen[scrno].sl[i].gap,strlen((DEFCHAR *)screen[scrno].sl[i].gap));
  1253.          }
  1254.       }
  1255.     wmove(SCREEN_WINDOW_FILEAREA(scrno),i,0);
  1256.     wattrset(SCREEN_WINDOW_FILEAREA(scrno),screen[scrno].sl[i].normal_colour);
  1257. /*---------------------------------------------------------------------*/
  1258. /* Display any shadow line. No need to test to see if SHADOW is ON as  */
  1259. /* number_excluded_lines would not be > 0 if SHADOW OFF.               */
  1260. /*---------------------------------------------------------------------*/
  1261.     if (screen[scrno].sl[i].number_lines_excluded > 0)
  1262.       {
  1263.        for (j=0;j<screen[scrno].cols[WINDOW_FILEAREA];j++)
  1264.           mvwaddch(SCREEN_WINDOW_FILEAREA(scrno),i,j,'-');
  1265.        wmove(SCREEN_WINDOW_FILEAREA(scrno),i,max(0,(screen[scrno].cols[WINDOW_FILEAREA]/2)-14));
  1266.        wprintw(SCREEN_WINDOW_FILEAREA(scrno),"%4d line(s) not displayed ",screen[scrno].sl[i].number_lines_excluded);
  1267.        continue;
  1268.       }
  1269. /*---------------------------------------------------------------------*/
  1270. /* Display SCALE and/or TABLINE...                                     */
  1271. /*---------------------------------------------------------------------*/
  1272.     if (screen[scrno].sl[i].line_type & LINE_SCALE
  1273.     ||  screen[scrno].sl[i].line_type & LINE_TABLINE)
  1274.       {
  1275.        my_wclrtoeol(SCREEN_WINDOW_FILEAREA(scrno));
  1276.        for (j=0;j<max_cols;j++)
  1277.          {
  1278.           wmove(SCREEN_WINDOW_FILEAREA(scrno),i,j);
  1279.           true_col = j + SCREEN_VIEW(scrno)->verify_col-1;
  1280. /*---------------------------------------------------------------------*/
  1281. /* Display '|' in current column position if this is the scale line.   */
  1282. /*---------------------------------------------------------------------*/
  1283.           if (screen[scrno].sl[i].line_type & LINE_SCALE
  1284.           &&  SCREEN_VIEW(scrno)->current_column == true_col+1)
  1285.             {
  1286.              waddch(SCREEN_WINDOW_FILEAREA(scrno),'|');
  1287.              continue;
  1288.             }
  1289. /*---------------------------------------------------------------------*/
  1290. /* Display 'T' in each tab column. This overrides all other characters */
  1291. /* except column position.                                             */
  1292. /*---------------------------------------------------------------------*/
  1293.           if (screen[scrno].sl[i].line_type & LINE_TABLINE)
  1294.             {
  1295.              if (is_tab_col(true_col+1))
  1296.                {
  1297.                 waddch(SCREEN_WINDOW_FILEAREA(scrno),'T');
  1298.                 continue;
  1299.                }
  1300.             }
  1301. /*---------------------------------------------------------------------*/
  1302. /* Only display the following if it is a scale line...                 */
  1303. /*---------------------------------------------------------------------*/
  1304.           if (screen[scrno].sl[i].line_type & LINE_SCALE)
  1305.             {
  1306.              if (SCREEN_VIEW(scrno)->margin_left-1 == true_col)
  1307.                {
  1308.                 waddch(SCREEN_WINDOW_FILEAREA(scrno),'[');
  1309.                 continue;
  1310.                }
  1311.              if (SCREEN_VIEW(scrno)->margin_right-1 == true_col)
  1312.                {
  1313.                 waddch(SCREEN_WINDOW_FILEAREA(scrno),']');
  1314.                 continue;
  1315.                }
  1316.              if (SCREEN_VIEW(scrno)->margin_indent_offset_status
  1317.              &&  SCREEN_VIEW(scrno)->margin_left+SCREEN_VIEW(scrno)->margin_indent-1 == true_col)
  1318.                {
  1319.                 waddch(SCREEN_WINDOW_FILEAREA(scrno),'p');
  1320.                 continue;
  1321.                }
  1322.              if (!SCREEN_VIEW(scrno)->margin_indent_offset_status
  1323.              &&  SCREEN_VIEW(scrno)->margin_indent-1 == true_col)
  1324.                {
  1325.                 waddch(SCREEN_WINDOW_FILEAREA(scrno),'p');
  1326.                 continue;
  1327.                }
  1328.              if (SCREEN_VIEW(scrno)->zone_start-1 == true_col)
  1329.                {
  1330.                 waddch(SCREEN_WINDOW_FILEAREA(scrno),'<');
  1331.                 continue;
  1332.                }
  1333.              if (SCREEN_VIEW(scrno)->zone_end-1 == true_col)
  1334.                {
  1335.                 waddch(SCREEN_WINDOW_FILEAREA(scrno),'>');
  1336. /*              break;*/
  1337.                 continue;
  1338.                }
  1339.              if (true_col % 10 == 9)
  1340.                {
  1341.                 sprintf((DEFCHAR *)tens,"%d",(true_col / 10) + 1);
  1342.                 num_tens = strlen((DEFCHAR *)tens);
  1343.                 getyx(SCREEN_WINDOW_FILEAREA(scrno),y,x);
  1344.                 if ((short)x-(num_tens-1) < 0)
  1345.                   {
  1346.                    off = -((short)x-(num_tens-1));
  1347.                    x = 0;
  1348.                   }
  1349.                 else
  1350.                   {
  1351.                    off = 0;
  1352.                    x -= (num_tens-1);
  1353.                   }
  1354.                 wmove(SCREEN_WINDOW_FILEAREA(scrno),y,x);
  1355.                 waddstr(SCREEN_WINDOW_FILEAREA(scrno),(DEFCHAR *)tens+off);
  1356.                 continue;
  1357.                }
  1358.              if (true_col % 5 == 4)
  1359.                {
  1360.                 waddch(SCREEN_WINDOW_FILEAREA(scrno),'+');
  1361.                 continue;
  1362.                }
  1363.              waddch(SCREEN_WINDOW_FILEAREA(scrno),'.');
  1364.             }
  1365.          }
  1366.        continue;
  1367.       }
  1368. /*---------------------------------------------------------------------*/
  1369. /* Display HEXSHOW line...                                             */
  1370. /*---------------------------------------------------------------------*/
  1371.     if (screen[scrno].sl[i].line_type & LINE_HEXSHOW)
  1372.       {
  1373.        my_wclrtoeol(SCREEN_WINDOW_FILEAREA(scrno));
  1374.        show_hex_line(scrno,i);
  1375.        continue;
  1376.       }
  1377. /*---------------------------------------------------------------------*/
  1378. /* Display TOF or EOF line.                                            */
  1379. /*---------------------------------------------------------------------*/
  1380.     if (screen[scrno].sl[i].line_type == LINE_TOF)
  1381.       {
  1382.        my_wclrtoeol(SCREEN_WINDOW_FILEAREA(scrno));
  1383.        waddstr(SCREEN_WINDOW_FILEAREA(scrno),(DEFCHAR *)TOP_OF_FILE);
  1384.        continue;
  1385.       }
  1386.     if (screen[scrno].sl[i].line_type == LINE_EOF)
  1387.       {
  1388.        my_wclrtoeol(SCREEN_WINDOW_FILEAREA(scrno));
  1389.        waddstr(SCREEN_WINDOW_FILEAREA(scrno),(DEFCHAR *)BOTTOM_OF_FILE);
  1390.        continue;
  1391.       }
  1392. /*---------------------------------------------------------------------*/
  1393. /* Display marked LINE block line(s).                                  */
  1394. /*---------------------------------------------------------------------*/
  1395.     show_a_line(scrno,i);
  1396.    }
  1397.  if (SCREEN_WINDOW_PREFIX(scrno) != NULL)
  1398.     wattrset(SCREEN_WINDOW_PREFIX(scrno),set_colour(SCREEN_FILE(scrno)->attr+ATTR_PENDING));
  1399.  if (SCREEN_WINDOW_GAP(scrno) != NULL)
  1400.     wattrset(SCREEN_WINDOW_GAP(scrno),set_colour(SCREEN_FILE(scrno)->attr+ATTR_GAP));
  1401.  wattrset(SCREEN_WINDOW_FILEAREA(scrno),set_colour(SCREEN_FILE(scrno)->attr+ATTR_FILEAREA));
  1402. #ifdef TRACE
  1403.  trace_return();
  1404. #endif
  1405.  return;
  1406. }
  1407. /***********************************************************************/
  1408. #ifdef HAVE_PROTO
  1409. static void show_a_line(CHARTYPE scrno,short row)
  1410. #else
  1411. static void show_a_line(scrno,row)
  1412. CHARTYPE scrno;
  1413. short row;
  1414. #endif
  1415. /***********************************************************************/
  1416. {
  1417. /*------------------------- external data -----------------------------*/
  1418. /*--------------------------- local data ------------------------------*/
  1419.  register short i=0;
  1420.  chtype ch=0;
  1421.  LENGTHTYPE vcol=0,vend=0,vlen=0;
  1422.  LENGTHTYPE length=0;
  1423.  CHARTYPE *line=NULL;
  1424. #if defined(USE_EXTCURSES) || defined(HAVE_BSD_CURSES)
  1425.  chtype attr=0,old_attr=0;
  1426. #endif
  1427. /*--------------------------- processing ------------------------------*/
  1428. #ifdef TRACE
  1429.  trace_function("show.c:    show_a_line");
  1430. #endif
  1431. /*---------------------------------------------------------------------*/
  1432. /* If the line to be displayed is a reserved line, set the columns to  */
  1433. /* be displayed so that the full line is displayed.                    */
  1434. /*---------------------------------------------------------------------*/
  1435.  if (screen[scrno].sl[row].line_type == LINE_RESERVED)
  1436.    {
  1437.     vcol = 0;
  1438.     vend = screen[scrno].cols[WINDOW_FILEAREA];
  1439.     vlen = screen[scrno].cols[WINDOW_FILEAREA];
  1440.    }
  1441.  else
  1442.    {
  1443.     vcol = SCREEN_VIEW(scrno)->verify_col - 1;
  1444.     vend = SCREEN_VIEW(scrno)->verify_end - 1;
  1445.     vlen = SCREEN_VIEW(scrno)->verify_end - SCREEN_VIEW(scrno)->verify_start + 1;
  1446.    }
  1447.  length = screen[scrno].sl[row].length;
  1448.  line = screen[scrno].sl[row].contents;
  1449. /*---------------------------------------------------------------------*/
  1450. /* If the contents are NULL then clear to eol in normal colour.        */
  1451. /*---------------------------------------------------------------------*/
  1452.  if (line == NULL)
  1453.    {
  1454.     my_wclrtoeol(SCREEN_WINDOW_FILEAREA(scrno));
  1455. #ifdef TRACE
  1456.     trace_return();
  1457. #endif
  1458.     return;
  1459.    }
  1460.  wmove(SCREEN_WINDOW_FILEAREA(scrno),row,0);
  1461.  for (i=0;i<screen[scrno].cols[WINDOW_FILEAREA];i++)
  1462.    {
  1463. /*---------------------------------------------------------------------*/
  1464. /* If the last character in the line has been displayed, display blank.*/
  1465. /*---------------------------------------------------------------------*/
  1466.     if (i+vcol < length)
  1467.        ch = *(line+i+vcol);
  1468.     else
  1469.        ch = ' ';
  1470. /*---------------------------------------------------------------------*/
  1471. /* Determine colour of character to be displayed. BOX blocks are sorted*/
  1472. /* out here.                                                           */
  1473. /*---------------------------------------------------------------------*/
  1474.     if (vcol+i >= screen[scrno].sl[row].other_start_col
  1475.     &&  vcol+i <= screen[scrno].sl[row].other_end_col)
  1476. #if defined(USE_EXTCURSES) || defined(HAVE_BSD_CURSES)
  1477.        attr = screen[scrno].sl[row].other_colour;
  1478. #else
  1479.        ch = ch | screen[scrno].sl[row].other_colour;
  1480. #endif
  1481.     else
  1482. #if defined(USE_EXTCURSES) || defined(HAVE_BSD_CURSES)
  1483.        attr = screen[scrno].sl[row].normal_colour;
  1484. #else
  1485.        ch = ch | screen[scrno].sl[row].normal_colour;
  1486. #endif
  1487. /*---------------------------------------------------------------------*/
  1488. /* If we have gone past the VERIFY END column, display a blank in the  */
  1489. /* normal colour.                                                      */
  1490. /*---------------------------------------------------------------------*/
  1491.     if (i >= vlen)
  1492.       {
  1493. #if defined(USE_EXTCURSES) || defined(HAVE_BSD_CURSES)
  1494.        ch = ' ';
  1495.        attr = screen[scrno].sl[row].normal_colour;
  1496. #else
  1497.        ch = ' ' | screen[scrno].sl[row].normal_colour;
  1498. #endif
  1499.       }
  1500. /*---------------------------------------------------------------------*/
  1501. /* Go and display the character...                                     */
  1502. /*---------------------------------------------------------------------*/
  1503. #if defined(USE_EXTCURSES) || defined(HAVE_BSD_CURSES)
  1504.     if (attr != old_attr)
  1505.       {
  1506.        wattrset(SCREEN_WINDOW_FILEAREA(scrno),attr);
  1507.        old_attr = attr;
  1508.       }
  1509. #endif
  1510.     put_char(SCREEN_WINDOW_FILEAREA(scrno),ch,ADDCHAR);
  1511.    }
  1512. #ifdef TRACE
  1513.  trace_return();
  1514. #endif
  1515.  return;
  1516. }
  1517. /***********************************************************************/
  1518. #ifdef HAVE_PROTO
  1519. static void set_prefix_contents(CHARTYPE scrno,LINE *curr,short start_row,LINETYPE cline)
  1520. #else
  1521. static void set_prefix_contents(scrno,curr,start_row,cline)
  1522. CHARTYPE scrno;
  1523. LINE *curr;
  1524. short start_row;
  1525. LINETYPE cline;
  1526. #endif
  1527. /***********************************************************************/
  1528. {
  1529. /*-------------------------- external data ----------------------------*/
  1530. /*--------------------------- local data ------------------------------*/
  1531.  CHARTYPE *ptr=NULL;
  1532. /*--------------------------- processing ------------------------------*/
  1533. #ifdef TRACE
  1534.  trace_function("show.c:    set_prefix_contents");
  1535. #endif
  1536.  ptr = screen[scrno].sl[start_row].prefix;
  1537.  
  1538.  if (SCREEN_VIEW(scrno)->prefix)
  1539.    {
  1540.     if (curr->pre != NULL)                /* prefix command pending... */
  1541. /*  && !blank_field(curr->pre->ppc_command))*/    /* ... and not blank */
  1542.       {
  1543.        strcpy((DEFCHAR *)ptr,(DEFCHAR *)curr->pre->ppc_command);
  1544.        screen[scrno].sl[start_row].prefix_colour = set_colour(SCREEN_FILE(scrno)->attr+ATTR_PENDING);
  1545.       }
  1546.     else                             /* no prefix command on this line */
  1547.       {
  1548.        memset(ptr,' ',SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap);
  1549.        screen[scrno].sl[start_row].prefix[SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap] = '\0';
  1550.        screen[scrno].sl[start_row].prefix_colour = set_colour(SCREEN_FILE(scrno)->attr+ATTR_PREFIX);
  1551.        if (SCREEN_VIEW(scrno)->number)
  1552.          {
  1553.           if ((SCREEN_VIEW(scrno)->prefix&PREFIX_STATUS_MASK) == PREFIX_ON)
  1554.              sprintf((DEFCHAR *)ptr,"%*.*ld",
  1555.                     SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap,
  1556.                     SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap,
  1557.                     cline);
  1558.           else
  1559.              sprintf((DEFCHAR *)ptr,"%*ld",
  1560.                     SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap,
  1561.                     cline);
  1562.          }
  1563.        else
  1564.          {
  1565.           if ((SCREEN_VIEW(scrno)->prefix&PREFIX_STATUS_MASK) == PREFIX_ON)
  1566.              memset(ptr,'=',
  1567.                     SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap);
  1568.          }
  1569.       }
  1570.    /*
  1571.     * clear the gap
  1572.     */
  1573.     strcpy((DEFCHAR*)screen[scrno].sl[start_row].gap,"");
  1574.     screen[scrno].sl[start_row].gap_colour = set_colour(SCREEN_FILE(scrno)->attr+ATTR_GAP);
  1575.    }
  1576. #ifdef TRACE
  1577.  trace_return();
  1578. #endif
  1579.  return;
  1580. }
  1581. /***********************************************************************/
  1582. #ifdef HAVE_PROTO
  1583. static void show_hex_line(CHARTYPE scrno,short row)
  1584. #else
  1585. static void show_hex_line(scrno,row)
  1586. CHARTYPE scrno;
  1587. short row;
  1588. #endif
  1589. /***********************************************************************/
  1590. {
  1591. /*-------------------------- external data ----------------------------*/
  1592. /*--------------------------- local data ------------------------------*/
  1593.  register short i=0;
  1594.  chtype ch=0;
  1595.  LENGTHTYPE vcol=0,vend=0,vlen=0;
  1596.  LENGTHTYPE length=0;
  1597.  CHARTYPE *line=NULL;
  1598.  int num=0;
  1599. /*--------------------------- processing ------------------------------*/
  1600. #ifdef TRACE
  1601.  trace_function("show.c:    show_hex_line");
  1602. #endif
  1603. /*---------------------------------------------------------------------*/
  1604. /* Set up columns to display...                                        */
  1605. /*---------------------------------------------------------------------*/
  1606.  vcol = SCREEN_VIEW(scrno)->verify_col - 1;
  1607.  vend = SCREEN_VIEW(scrno)->verify_end - 1;
  1608.  vlen = SCREEN_VIEW(scrno)->verify_end - SCREEN_VIEW(scrno)->verify_start + 1;
  1609.  length = screen[scrno].sl[row].length;
  1610.  line = screen[scrno].sl[row].contents;
  1611. #if defined(USE_EXTCURSES) || defined(HAVE_BSD_CURSES)
  1612.  wattrset(SCREEN_WINDOW_FILEAREA(scrno),screen[scrno].sl[row].normal_colour);
  1613. #endif
  1614.  wmove(SCREEN_WINDOW_FILEAREA(scrno),row,0);
  1615.  for (i=0;i<screen[scrno].cols[WINDOW_FILEAREA];i++)
  1616.    {
  1617. /*---------------------------------------------------------------------*/
  1618. /* If the last character in the line has been displayed, display blank.*/
  1619. /*---------------------------------------------------------------------*/
  1620.     if (i+vcol < length)
  1621.        ch = *(line+i+vcol);
  1622.     else
  1623.        ch = ' ';
  1624. /*---------------------------------------------------------------------*/
  1625. /* If we have gone past the VERIFY END column, display a blank.        */
  1626. /*---------------------------------------------------------------------*/
  1627.     if (i >= vlen)
  1628.        ch = ' ';
  1629. /*---------------------------------------------------------------------*/
  1630. /* Calculate the HEX character to display based on which HEXSHOW line  */
  1631. /* is being displayed.                                                 */
  1632. /*---------------------------------------------------------------------*/
  1633.     if (screen[scrno].sl[row].other_start_col == 0)
  1634.        num = (int)((ch / 16) + (int)'0');
  1635.     else
  1636.        num = (int)((ch % 16) + (int)'0');
  1637.     num = (num > (int)'9') ? num + 7 : num;
  1638. #if defined(USE_EXTCURSES) || defined(HAVE_BSD_CURSES)
  1639.     ch = (chtype)num;
  1640. #else
  1641.     ch = (chtype)num | screen[scrno].sl[row].normal_colour;
  1642. #endif
  1643. /*---------------------------------------------------------------------*/
  1644. /* Go and display the character...                                     */
  1645. /*---------------------------------------------------------------------*/
  1646.     put_char(SCREEN_WINDOW_FILEAREA(scrno),ch,ADDCHAR);
  1647.    }
  1648. #ifdef TRACE
  1649.  trace_return();
  1650. #endif
  1651.  return;
  1652. }
  1653.  
  1654. /***********************************************************************/
  1655. #ifdef HAVE_PROTO
  1656. void touch_screen(CHARTYPE scrno)
  1657. #else
  1658. void touch_screen(scrno)
  1659. CHARTYPE scrno;
  1660. #endif
  1661. /***********************************************************************/
  1662. {
  1663. /*-------------------------- external data ----------------------------*/
  1664. /*--------------------------- local data ------------------------------*/
  1665.  register int i=0;
  1666. /*--------------------------- processing ------------------------------*/
  1667. #ifdef TRACE
  1668.  trace_function("commutil.c:touch_screen");
  1669. #endif
  1670.  for (i=0;i<VIEW_WINDOWS;i++)
  1671.    {
  1672.     if (screen[scrno].win[i] != (WINDOW *)NULL)
  1673.        touchwin(screen[scrno].win[i]);
  1674.    }
  1675. #if 0
  1676.  touchwin(CURRENT_WINDOW_FILEAREA);
  1677.  if (CURRENT_WINDOW_PREFIX != (WINDOW *)NULL)
  1678.     touchwin(CURRENT_WINDOW_PREFIX);
  1679.  if (CURRENT_WINDOW_GAP != (WINDOW *)NULL)
  1680.     touchwin(CURRENT_WINDOW_GAP);
  1681.  if (CURRENT_WINDOW_IDLINE != (WINDOW *)NULL)
  1682.     touchwin(CURRENT_WINDOW_IDLINE);
  1683.  if (CURRENT_WINDOW_ARROW != (WINDOW *)NULL)
  1684.     touchwin(CURRENT_WINDOW_ARROW);
  1685.  if (CURRENT_WINDOW_COMMAND != (WINDOW *)NULL)
  1686.     touchwin(CURRENT_WINDOW_COMMAND);
  1687. #endif
  1688.  
  1689. #ifdef TRACE
  1690.  trace_return();
  1691. #endif
  1692.  return;
  1693. }
  1694. /***********************************************************************/
  1695. #ifdef HAVE_PROTO
  1696. void refresh_screen(CHARTYPE scrno)
  1697. #else
  1698. void refresh_screen(scrno)
  1699. CHARTYPE scrno;
  1700. #endif
  1701. /***********************************************************************/
  1702. {
  1703. /*-------------------------- external data ----------------------------*/
  1704. /*--------------------------- local data ------------------------------*/
  1705. /*--------------------------- processing ------------------------------*/
  1706. #ifdef TRACE
  1707.  trace_function("commutil.c:refresh_screen");
  1708. #endif
  1709. /*---------------------------------------------------------------------*/
  1710. /* Turn off the cursor.                                                */
  1711. /*---------------------------------------------------------------------*/
  1712. /* MH  draw_cursor(FALSE); */
  1713.  show_heading(scrno);
  1714.  wnoutrefresh(SCREEN_WINDOW_FILEAREA(scrno));
  1715.  if (SCREEN_WINDOW_PREFIX(scrno) != (WINDOW *)NULL)
  1716.     wnoutrefresh(SCREEN_WINDOW_PREFIX(scrno));
  1717.  if (SCREEN_WINDOW_GAP(scrno) != (WINDOW *)NULL)
  1718.     wnoutrefresh(SCREEN_WINDOW_GAP(scrno));
  1719.  if (SCREEN_WINDOW_ARROW(scrno) != (WINDOW *)NULL)
  1720.    {
  1721.     touchwin(SCREEN_WINDOW_ARROW(scrno));
  1722.     wnoutrefresh(SCREEN_WINDOW_ARROW(scrno));
  1723.    }
  1724.  if (SCREEN_WINDOW_COMMAND(scrno) != (WINDOW *)NULL)
  1725.     wnoutrefresh(SCREEN_WINDOW_COMMAND(scrno));
  1726.  wnoutrefresh(SCREEN_WINDOW(scrno));
  1727. /*---------------------------------------------------------------------*/
  1728. /* Turn on the cursor.                                                 */
  1729. /*---------------------------------------------------------------------*/
  1730. /*    draw_cursor(TRUE);*/
  1731. #ifdef TRACE
  1732.  trace_return();
  1733. #endif
  1734.  return;
  1735. }
  1736. /***********************************************************************/
  1737. #ifdef HAVE_PROTO
  1738. void redraw_screen(CHARTYPE scrno)
  1739. #else
  1740. void redraw_screen(scrno)
  1741. CHARTYPE scrno;
  1742. #endif
  1743. /***********************************************************************/
  1744. {
  1745. /*-------------------------- external data ----------------------------*/
  1746.  extern bool curses_started;
  1747. /*--------------------------- local data ------------------------------*/
  1748. /*--------------------------- processing ------------------------------*/
  1749. #ifdef TRACE
  1750.  trace_function("commutil.c:redraw_screen");
  1751. #endif
  1752.  if (curses_started)
  1753.    {
  1754. /*---------------------------------------------------------------------*/
  1755. /* Turn off the cursor.                                                */
  1756. /*---------------------------------------------------------------------*/
  1757. /* MH    draw_cursor(FALSE); */
  1758.     if (SCREEN_WINDOW_COMMAND(scrno) != NULL)
  1759.       {
  1760.        wattrset(SCREEN_WINDOW_COMMAND(scrno),set_colour(SCREEN_FILE(scrno)->attr+ATTR_CMDLINE));
  1761.        touchwin(SCREEN_WINDOW_COMMAND(scrno));
  1762.        wnoutrefresh(SCREEN_WINDOW_COMMAND(scrno));
  1763.       }
  1764.     if (SCREEN_WINDOW_ARROW(scrno) != NULL)
  1765.       {
  1766.        wattrset(SCREEN_WINDOW_ARROW(scrno),set_colour(SCREEN_FILE(scrno)->attr+ATTR_ARROW));
  1767.        redraw_window(SCREEN_WINDOW_ARROW(scrno));
  1768.        wnoutrefresh(SCREEN_WINDOW_ARROW(scrno));
  1769.       }
  1770.     if (SCREEN_WINDOW_IDLINE(scrno) != NULL)
  1771.       {
  1772.        wattrset(SCREEN_WINDOW_IDLINE(scrno),set_colour(SCREEN_FILE(scrno)->attr+ATTR_IDLINE));
  1773.        redraw_window(SCREEN_WINDOW_IDLINE(scrno));
  1774.       }
  1775.     if (SCREEN_WINDOW_PREFIX(scrno) != NULL)
  1776.        touchwin(SCREEN_WINDOW_PREFIX(scrno));
  1777.     if (SCREEN_WINDOW_GAP(scrno) != NULL)
  1778.        touchwin(SCREEN_WINDOW_GAP(scrno));
  1779.     touchwin(SCREEN_WINDOW_FILEAREA(scrno));
  1780. /*---------------------------------------------------------------------*/
  1781. /* Turn on the cursor.                                                 */
  1782. /*---------------------------------------------------------------------*/
  1783. /* MH    draw_cursor(TRUE); */
  1784.    }
  1785. #ifdef TRACE
  1786.  trace_return();
  1787. #endif
  1788.  return;
  1789. }
  1790.  
  1791. /***********************************************************************/
  1792. #ifdef HAVE_PROTO
  1793. bool line_in_view(CHARTYPE scrno,LINETYPE line_number)
  1794. #else
  1795. bool line_in_view(scrno,line_number)
  1796. CHARTYPE scrno;
  1797. LINETYPE line_number;
  1798. #endif
  1799. /***********************************************************************/
  1800. {
  1801. /*-------------------------- external data ----------------------------*/
  1802. /*--------------------------- local data ------------------------------*/
  1803.  register short i=0;
  1804.  bool result=FALSE;
  1805. /*--------------------------- processing ------------------------------*/
  1806. #ifdef TRACE
  1807.  trace_function("show.c:    line_in_view");
  1808. #endif
  1809.  for (i=0;i<screen[scrno].rows[WINDOW_FILEAREA];i++)
  1810.    {
  1811.     if (screen[scrno].sl[i].line_number == line_number)
  1812.       {
  1813.        result = TRUE;
  1814.        break;
  1815.       }
  1816.    }
  1817. #ifdef TRACE
  1818.  trace_return();
  1819. #endif
  1820.  return(result);
  1821. }
  1822. /***********************************************************************/
  1823. #ifdef HAVE_PROTO
  1824. bool column_in_view(CHARTYPE scrno,LENGTHTYPE column_number)
  1825. #else
  1826. bool column_in_view(scrno,column_number)
  1827. CHARTYPE scrno;
  1828. LENGTHTYPE column_number;
  1829. #endif
  1830. /***********************************************************************/
  1831. {
  1832. /*-------------------------- external data ----------------------------*/
  1833. /*--------------------------- local data ------------------------------*/
  1834.  bool result=FALSE;
  1835.  LENGTHTYPE min_file_col=0,max_file_col=0;
  1836. /*--------------------------- processing ------------------------------*/
  1837. #ifdef TRACE
  1838.  trace_function("show.c:    column_in_view");
  1839. #endif
  1840.  min_file_col = screen[scrno].screen_view->verify_col - 1;
  1841.  max_file_col = screen[scrno].screen_view->verify_col + screen[scrno].cols[WINDOW_FILEAREA] - 2;
  1842.  
  1843.  if (column_number >= min_file_col
  1844.  &&  column_number <= max_file_col)            /* new column in display */
  1845.     result = TRUE;
  1846. #ifdef TRACE
  1847.  trace_return();
  1848. #endif
  1849.  return(result);
  1850. }
  1851. /***********************************************************************/
  1852. #ifdef HAVE_PROTO
  1853. LINETYPE find_next_current_line(LINETYPE num_pages,short direction)
  1854. #else
  1855. LINETYPE find_next_current_line(num_pages,direction)
  1856. LINETYPE num_pages;
  1857. short direction;
  1858. #endif
  1859. /***********************************************************************/
  1860. {
  1861. /*-------------------------- external data ----------------------------*/
  1862. /*--------------------------- local data ------------------------------*/
  1863.  register short i=0;
  1864.  LINETYPE cline = CURRENT_VIEW->current_line;
  1865.  short rows=0,num_display_lines=0,num_shadow_lines=0;
  1866.  LINE *curr=NULL;
  1867.  RESERVED *curr_reserved=CURRENT_FILE->first_reserved;
  1868.  short tab_actual_row=calculate_actual_row(CURRENT_VIEW->tab_base,CURRENT_VIEW->tab_off,CURRENT_SCREEN.rows[WINDOW_FILEAREA],TRUE);
  1869.  short scale_actual_row=calculate_actual_row(CURRENT_VIEW->scale_base,CURRENT_VIEW->scale_off,CURRENT_SCREEN.rows[WINDOW_FILEAREA],TRUE);
  1870. /*--------------------------- processing ------------------------------*/
  1871. #ifdef TRACE
  1872.  trace_function("show.c:    find_next_current_line");
  1873. #endif
  1874. /*---------------------------------------------------------------------*/
  1875. /* Determine the number of file lines displayed...                     */
  1876. /*---------------------------------------------------------------------*/
  1877.  num_display_lines = (CURRENT_SCREEN.rows[WINDOW_FILEAREA]) - 1;
  1878.  for (i=0;curr_reserved!=NULL;i++)
  1879.      curr_reserved = curr_reserved->next;
  1880.  num_display_lines -= i;
  1881.  if (CURRENT_VIEW->scale_on)
  1882.     num_display_lines--;
  1883.  if (CURRENT_VIEW->tab_on)
  1884.     num_display_lines--;
  1885.  if (CURRENT_VIEW->hexshow_on)
  1886.     num_display_lines = num_display_lines - 2;
  1887.  if (CURRENT_VIEW->scale_on
  1888.  &&  CURRENT_VIEW->tab_on
  1889.  &&  tab_actual_row == scale_actual_row)
  1890.     num_display_lines++;
  1891.  
  1892.  curr = lll_find(CURRENT_FILE->first_line,CURRENT_FILE->last_line,cline,CURRENT_FILE->number_lines);
  1893.  while(num_pages)
  1894.    {
  1895.     rows = num_display_lines;
  1896.     while(rows)
  1897.       {
  1898. /*---------------------------------------------------------------------*/
  1899. /* If the current line is above or below TOF or EOF, set all to blank. */
  1900. /*---------------------------------------------------------------------*/
  1901.        if (curr == NULL)
  1902.          {
  1903.           cline = (direction == DIRECTION_FORWARD) ? CURRENT_FILE->number_lines + 1L : 0L;
  1904.           num_pages = 1L;
  1905.           break;
  1906.          }
  1907. /*---------------------------------------------------------------------*/
  1908. /* If the current line is excluded, increment a running total.         */
  1909. /* Ignore the line if on TOF or BOF.                                   */
  1910. /*---------------------------------------------------------------------*/
  1911.        if (curr->next != NULL                           /* Bottom of file */
  1912.        &&  curr->prev != NULL)                             /* Top of file */
  1913.          {
  1914.           if (!in_scope(CURRENT_VIEW,curr))
  1915.             {
  1916.              num_shadow_lines++;
  1917.              cline += (LINETYPE)direction;
  1918.              if (direction == DIRECTION_FORWARD)
  1919.                 curr = curr->next;
  1920.              else
  1921.                 curr = curr->prev;
  1922.              continue;
  1923.             }
  1924.          }
  1925. /*---------------------------------------------------------------------*/
  1926. /* If we get here, we have to determine if a shadow line is to be      */
  1927. /* displayed or not.                                                   */
  1928. /*---------------------------------------------------------------------*/
  1929.        if (CURRENT_VIEW->shadow
  1930.        && num_shadow_lines > 0)
  1931.          {
  1932.           num_shadow_lines = 0;
  1933.           rows--;
  1934.           continue;
  1935.          }
  1936.        rows--;
  1937.        cline += (LINETYPE)direction;
  1938.        if (direction == DIRECTION_FORWARD)
  1939.           curr = curr->next;
  1940.        else
  1941.           curr = curr->prev;
  1942.       }
  1943.     num_pages--;
  1944.    }
  1945.  if (direction == DIRECTION_FORWARD
  1946.  &&  cline > CURRENT_FILE->number_lines+1L)
  1947.     cline = CURRENT_FILE->number_lines+1L;
  1948.  if (direction == DIRECTION_BACKWARD
  1949.  &&  cline < 0L)
  1950.     cline = 0L;
  1951.  cline = find_next_in_scope(CURRENT_VIEW,(LINE *)NULL,cline,direction);
  1952. #ifdef TRACE
  1953.  trace_return();
  1954. #endif
  1955.  return(cline);
  1956. }
  1957. /***********************************************************************/
  1958. #ifdef HAVE_PROTO
  1959. short get_row_for_focus_line(CHARTYPE scrno,LINETYPE fl,short cr)
  1960. #else
  1961. short get_row_for_focus_line(scrno,fl,cr)
  1962. CHARTYPE scrno;
  1963. LINETYPE fl;
  1964. short cr;
  1965. #endif
  1966. /***********************************************************************/
  1967. /*---------------------------------------------------------------------*/
  1968. /* Returns the row within the main window where the focus line is      */
  1969. /* placed. If the focus line is off the screen, or out of bounds of the*/
  1970. /* current size of the file; <0 or >number_lines, this returns the     */
  1971. /* current row.                                                        */
  1972. /*---------------------------------------------------------------------*/
  1973. {
  1974. /*-------------------------- external data ----------------------------*/
  1975. /*--------------------------- local data ------------------------------*/
  1976.  register short i=0;
  1977. /*--------------------------- processing ------------------------------*/
  1978. #ifdef TRACE
  1979.  trace_function("show.c:    get_row_for_focus_line");
  1980. #endif
  1981.  for (i=0;i<screen[scrno].rows[WINDOW_FILEAREA];i++)
  1982.    {
  1983.     if (screen[scrno].sl[i].line_number == fl)
  1984.       {
  1985. #ifdef TRACE
  1986.        trace_return();
  1987. #endif
  1988.        return(i);
  1989.       }
  1990.    }
  1991. #ifdef TRACE
  1992.  trace_return();
  1993. #endif
  1994.  return(cr);
  1995. }
  1996. /***********************************************************************/
  1997. #ifdef HAVE_PROTO
  1998. LINETYPE get_focus_line_in_view(CHARTYPE scrno,LINETYPE fl,unsigned short row)
  1999. #else
  2000. LINETYPE get_focus_line_in_view(scrno,fl,row)
  2001. CHARTYPE scrno;
  2002. LINETYPE fl;
  2003. unsigned short row;
  2004. #endif
  2005. /***********************************************************************/
  2006. /*---------------------------------------------------------------------*/
  2007. /* Returns a new focus line if the specified focus line is no longer   */
  2008. /* in view, or the same line number if that line is still in view.     */
  2009. /*---------------------------------------------------------------------*/
  2010. {
  2011. /*-------------------------- external data ----------------------------*/
  2012. /*--------------------------- local data ------------------------------*/
  2013.  register unsigned short i=0;
  2014. /*--------------------------- processing ------------------------------*/
  2015. #ifdef TRACE
  2016.  trace_function("show.c:    get_focus_line_in_view");
  2017. #endif
  2018.  for (i=row;i<screen[scrno].rows[WINDOW_FILEAREA];i++)
  2019.    {
  2020.     if (screen[scrno].sl[i].line_number != (-1L))
  2021.       {
  2022. #ifdef TRACE
  2023.        trace_return();
  2024. #endif
  2025.        return(screen[scrno].sl[i].line_number);
  2026.       }
  2027.    }
  2028.  for (i=row;i>0;i--)
  2029.    {
  2030.     if (screen[scrno].sl[i].line_number != (-1L))
  2031.       {
  2032. #ifdef TRACE
  2033.        trace_return();
  2034. #endif
  2035.        return(screen[scrno].sl[i].line_number);
  2036.       }
  2037.    }
  2038. /*---------------------------------------------------------------------*/
  2039. /* We should never get here as there would be no editable lines in view*/
  2040. /*---------------------------------------------------------------------*/
  2041. #ifdef TRACE
  2042.  trace_return();
  2043. #endif
  2044.  return(fl);
  2045. }
  2046. /***********************************************************************/
  2047. #ifdef HAVE_PROTO
  2048. LINETYPE calculate_focus_line(LINETYPE fl,LINETYPE cl)
  2049. #else
  2050. LINETYPE calculate_focus_line(fl,cl)
  2051. LINETYPE fl,cl;
  2052. #endif
  2053. /***********************************************************************/
  2054. /*---------------------------------------------------------------------*/
  2055. /* Returns the new focus line. If the focus line is still in the       */
  2056. /* window, it stays as is. If not,the focus   line becomes the current */
  2057. /* line.                                                               */
  2058. /*---------------------------------------------------------------------*/
  2059. {
  2060. /*-------------------------- external data ----------------------------*/
  2061. /*--------------------------- local data ------------------------------*/
  2062.  LINETYPE new_fl=(-1L);
  2063.  register short i=0;
  2064. /*--------------------------- processing ------------------------------*/
  2065. #ifdef TRACE
  2066.  trace_function("show.c:    calculate_focus_line");
  2067. #endif
  2068.  for (i=0;i<CURRENT_SCREEN.rows[WINDOW_FILEAREA];i++)
  2069.   {
  2070.    if (CURRENT_SCREEN.sl[i].line_number == fl
  2071.    &&  (CURRENT_SCREEN.sl[i].line_type == LINE_LINE
  2072.      || CURRENT_SCREEN.sl[i].line_type == LINE_TOF   /* MH12 */
  2073.      || CURRENT_SCREEN.sl[i].line_type == LINE_EOF)) /* MH12 */
  2074.      {
  2075.       new_fl = fl;
  2076.       break;
  2077.      }
  2078.   }
  2079.  if (new_fl == (-1L))
  2080.     new_fl = cl;
  2081. #ifdef TRACE
  2082.  trace_return();
  2083. #endif
  2084.  return(new_fl);
  2085. }
  2086. /***********************************************************************/
  2087. #ifdef HAVE_PROTO
  2088. void get_current_position(CHARTYPE scrno,LINETYPE *line,LENGTHTYPE *col)
  2089. #else
  2090. void get_current_position(scrno,line,col)
  2091. CHARTYPE scrno;
  2092. LINETYPE *line;
  2093. LENGTHTYPE *col;
  2094. #endif
  2095. /***********************************************************************/
  2096. {
  2097. /*-------------------------- external data ----------------------------*/
  2098. /*--------------------------- local data ------------------------------*/
  2099.  short y=0,x=0;
  2100. /*--------------------------- processing ------------------------------*/
  2101. #ifdef TRACE
  2102.  trace_function("show.c:    get_current_position");
  2103. #endif
  2104.  getyx(SCREEN_WINDOW(scrno),y,x);
  2105.  switch(SCREEN_VIEW(scrno)->current_window)
  2106.    {
  2107.     case WINDOW_COMMAND:
  2108.          *line = SCREEN_VIEW(scrno)->current_line;
  2109.          *col = (LENGTHTYPE)(x+1);
  2110.          break;
  2111.     case WINDOW_FILEAREA:
  2112.          *line = SCREEN_VIEW(scrno)->focus_line;
  2113.          *col = (LENGTHTYPE)x + SCREEN_VIEW(scrno)->verify_col;
  2114.          break;
  2115.     case WINDOW_PREFIX:
  2116.          *line = SCREEN_VIEW(scrno)->focus_line;
  2117.          *col = (LENGTHTYPE)(x+1);
  2118.          break;
  2119.    }
  2120. #ifdef TRACE
  2121.  trace_return();
  2122. #endif
  2123.  return;
  2124. }
  2125. /***********************************************************************/
  2126. #ifdef HAVE_PROTO
  2127. void calculate_new_column(COLTYPE current_screen_col,LENGTHTYPE current_verify_col,
  2128.                           LENGTHTYPE new_file_col,COLTYPE *new_screen_col, LENGTHTYPE *new_verify_col)
  2129. #else
  2130. void calculate_new_column(current_screen_col,current_verify_col,new_file_col,new_screen_col,new_verify_col)
  2131. COLTYPE current_screen_col;
  2132. LENGTHTYPE current_verify_col,new_file_col;
  2133. COLTYPE *new_screen_col;
  2134. LENGTHTYPE *new_verify_col;
  2135. #endif
  2136. /***********************************************************************/
  2137. {
  2138. /*-------------------------- external data ----------------------------*/
  2139. /*--------------------------- local data ------------------------------*/
  2140.  LINETYPE x=0;
  2141. /*--------------------------- processing ------------------------------*/
  2142. #ifdef TRACE
  2143.  trace_function("show.c:    calculate_new_column");
  2144. #endif
  2145.  if (CURRENT_VIEW->current_window == WINDOW_COMMAND)
  2146.    {
  2147.     *new_screen_col = (LENGTHTYPE)(new_file_col);
  2148. #ifdef TRACE
  2149.     trace_return();
  2150. #endif
  2151.     return;
  2152.    }
  2153. #if 0
  2154.  min_file_col = CURRENT_VIEW->verify_col - 1;
  2155.  max_file_col = CURRENT_VIEW->verify_col + CURRENT_SCREEN.cols[WINDOW_FILEAREA] - 2;
  2156.  
  2157.  if (new_file_col >= min_file_col
  2158.  &&  new_file_col <= max_file_col)            /* new column in display */
  2159. #else
  2160.  if (column_in_view(current_screen,new_file_col))
  2161. #endif
  2162.    {
  2163.     *new_screen_col = (LENGTHTYPE)(new_file_col - (current_verify_col - 1));
  2164.     *new_verify_col = current_verify_col;
  2165. #ifdef TRACE
  2166.     trace_return();
  2167. #endif
  2168.     return;
  2169.    }
  2170. /*---------------------------------------------------------------------*/
  2171. /* To get here, we have new verify column...                           */
  2172. /*---------------------------------------------------------------------*/
  2173.  x = CURRENT_SCREEN.cols[WINDOW_FILEAREA] / 2;
  2174.  *new_verify_col = (LENGTHTYPE)max(1L,(LINETYPE)new_file_col - x + 2L);
  2175.  *new_screen_col = (LENGTHTYPE)((*new_verify_col == 1) ? new_file_col : x - 1);
  2176. #ifdef TRACE
  2177.  trace_return();
  2178. #endif
  2179.  return;
  2180. }
  2181. /***********************************************************************/
  2182. #ifdef HAVE_PROTO
  2183. short prepare_view(CHARTYPE scrn)
  2184. #else
  2185. short prepare_view(scrn)
  2186. CHARTYPE scrn;
  2187. #endif
  2188. /***********************************************************************/
  2189. {
  2190. /*-------------------------- external data ----------------------------*/
  2191.  extern bool curses_started;
  2192. /*--------------------------- local data ------------------------------*/
  2193.  int y=0,x=0;
  2194. /*--------------------------- processing ------------------------------*/
  2195. #ifdef TRACE
  2196.  trace_function("show.c:    prepare_view");
  2197. #endif
  2198.  SCREEN_VIEW(scrn)->current_row = calculate_actual_row(SCREEN_VIEW(scrn)->current_base,
  2199.                                   SCREEN_VIEW(scrn)->current_off,
  2200.                                   screen[scrn].rows[WINDOW_FILEAREA],TRUE);
  2201.  build_screen(scrn);
  2202.  if (!line_in_view(scrn,SCREEN_VIEW(scrn)->focus_line))
  2203.    {
  2204.     SCREEN_VIEW(scrn)->focus_line = SCREEN_VIEW(scrn)->current_line;
  2205.     pre_process_line(SCREEN_VIEW(scrn),SCREEN_VIEW(scrn)->focus_line,(LINE *)NULL);
  2206.     build_screen(scrn);
  2207.    }
  2208.  if (curses_started)
  2209.    {
  2210.     getyx(SCREEN_WINDOW_FILEAREA(scrn),y,x);
  2211.     y = get_row_for_focus_line(scrn,SCREEN_VIEW(scrn)->focus_line,
  2212.                                SCREEN_VIEW(scrn)->current_row);
  2213.  /* ensure column from WINDOW is in view */
  2214.     wmove(SCREEN_WINDOW_FILEAREA(scrn),y,x);
  2215.    }
  2216.  
  2217. #ifdef TRACE
  2218.  trace_return();
  2219. #endif
  2220.  return(RC_OK);
  2221. }
  2222. /***********************************************************************/
  2223. #ifdef HAVE_PROTO
  2224. short advance_view(VIEW_DETAILS *next_view,short direction)
  2225. #else
  2226. short advance_view(next_view,direction)
  2227. VIEW_DETAILS *next_view;
  2228. short direction;
  2229. #endif
  2230. /***********************************************************************/
  2231. {
  2232. /*-------------------------- external data ----------------------------*/
  2233.  extern CHARTYPE number_of_files;
  2234.  extern CHARTYPE *cmd_rec;
  2235.  extern unsigned short cmd_rec_len;
  2236.  extern VIEW_DETAILS *vd_first;
  2237.  extern VIEW_DETAILS *vd_last;
  2238.  extern bool curses_started;
  2239.  extern CHARTYPE display_screens;
  2240.  extern WINDOW *statarea;
  2241.  extern WINDOW *divider;
  2242.  extern bool horizontal;
  2243. /*--------------------------- local data ------------------------------*/
  2244.  VIEW_DETAILS *save_current_view=next_view; /* point to passed view */
  2245.  CHARTYPE save_prefix=0;
  2246.  ROWTYPE save_cmd_line=0;
  2247.  short save_gap=0;
  2248.  bool save_id_line=0;
  2249.  int y=0,x=0;
  2250.  short rc=RC_OK;
  2251. /*--------------------------- processing ------------------------------*/
  2252. #ifdef TRACE
  2253.  trace_function("show.c:    advance_view");
  2254. #endif
  2255. /*---------------------------------------------------------------------*/
  2256. /* If this is the only file, ignore the command...                     */
  2257. /*---------------------------------------------------------------------*/
  2258.  if (number_of_files < 2)
  2259.    {
  2260. #ifdef TRACE
  2261.     trace_return();
  2262. #endif
  2263.     return(RC_OK);
  2264.    }
  2265. /*---------------------------------------------------------------------*/
  2266. /* If we already have a current view, save some details of it...       */
  2267. /*---------------------------------------------------------------------*/
  2268.  if (CURRENT_VIEW)
  2269.    {
  2270.     save_prefix=CURRENT_VIEW->prefix;
  2271.     save_gap=CURRENT_VIEW->prefix_gap;
  2272.     save_cmd_line=CURRENT_VIEW->cmd_line;
  2273.     save_id_line=CURRENT_VIEW->id_line;
  2274.    }
  2275.  memset(cmd_rec,' ',max_line_length);
  2276.  cmd_rec_len = 0;
  2277. /*---------------------------------------------------------------------*/
  2278. /* If we have not passed a "next" view determine what the next view    */
  2279. /* will be...                                                          */
  2280. /*---------------------------------------------------------------------*/
  2281.  if (!save_current_view)
  2282.    {
  2283.     post_process_line(CURRENT_VIEW,CURRENT_VIEW->focus_line,(LINE *)NULL,TRUE);
  2284. /*---------------------------------------------------------------------*/
  2285. /* Get a temporary pointer to the "next" view in the linked list.      */
  2286. /*---------------------------------------------------------------------*/
  2287.     if (direction == DIRECTION_FORWARD)
  2288.       {
  2289.        if (CURRENT_VIEW->next == (VIEW_DETAILS *)NULL)
  2290.           save_current_view = vd_first;
  2291.        else
  2292.           save_current_view = CURRENT_VIEW->next;
  2293.       }
  2294.     else
  2295.       {
  2296.        if (CURRENT_VIEW->prev == (VIEW_DETAILS *)NULL)
  2297.           save_current_view = vd_last;
  2298.        else
  2299.           save_current_view = CURRENT_VIEW->prev;
  2300.       }
  2301.    }
  2302. /*---------------------------------------------------------------------*/
  2303. /* Save the position of the cursor for the current view before getting */
  2304. /* the contents of the new file...                                     */
  2305. /*---------------------------------------------------------------------*/
  2306.  if (curses_started)
  2307.    {
  2308.     if (CURRENT_WINDOW_COMMAND != NULL)
  2309.       {
  2310.        wmove(CURRENT_WINDOW_COMMAND,0,0);
  2311.        my_wclrtoeol(CURRENT_WINDOW_COMMAND);
  2312.       }
  2313.     getyx(CURRENT_WINDOW_FILEAREA,CURRENT_VIEW->y[WINDOW_FILEAREA],CURRENT_VIEW->x[WINDOW_FILEAREA]);
  2314.     if (CURRENT_WINDOW_PREFIX != NULL)
  2315.        getyx(CURRENT_WINDOW_PREFIX,CURRENT_VIEW->y[WINDOW_PREFIX],CURRENT_VIEW->x[WINDOW_PREFIX]);
  2316.    }
  2317. /*---------------------------------------------------------------------*/
  2318. /* If more than one screen is displayed and the file displayed in each */
  2319. /* screen is the same, remove the 'current' view from the linked list, */
  2320. /* making the next view the current one. Only do this is the "next"    */
  2321. /* view is not the view in the other screen.                           */
  2322. /*---------------------------------------------------------------------*/
  2323.  if (display_screens > 1)
  2324.    {
  2325.     if (CURRENT_SCREEN.screen_view->file_for_view == OTHER_SCREEN.screen_view->file_for_view)
  2326.       {
  2327.        if (CURRENT_VIEW->file_for_view == save_current_view->file_for_view)
  2328.          {
  2329.           if (direction == DIRECTION_FORWARD)
  2330.             {
  2331.              if (save_current_view->next == (VIEW_DETAILS *)NULL)
  2332.                 save_current_view = vd_first;
  2333.              else
  2334.                 save_current_view = save_current_view->next;
  2335.             }
  2336.           else
  2337.             {
  2338.              if (save_current_view->prev == (VIEW_DETAILS *)NULL)
  2339.                 save_current_view = vd_last;
  2340.              else
  2341.                 save_current_view = save_current_view->prev;
  2342.             }
  2343.          }
  2344.        free_a_view();
  2345.        CURRENT_VIEW = CURRENT_SCREEN.screen_view = save_current_view;
  2346.        OTHER_FILE->file_views--;
  2347.       }
  2348.     else
  2349. /*---------------------------------------------------------------------*/
  2350. /* First check if the file in the next view is the same as the file    */
  2351. /* being displayed in the other screen...                              */
  2352. /*---------------------------------------------------------------------*/
  2353.       {
  2354.        if (save_current_view->file_for_view == OTHER_FILE)
  2355.          {
  2356.           CURRENT_VIEW = CURRENT_SCREEN.screen_view = save_current_view;
  2357.           if ((rc = defaults_for_other_files(OTHER_VIEW)) != RC_OK)
  2358.             {
  2359. #ifdef TRACE
  2360.              trace_return();
  2361. #endif
  2362.              return(rc);
  2363.             }
  2364.           CURRENT_SCREEN.screen_view = CURRENT_VIEW;
  2365.           CURRENT_FILE = CURRENT_SCREEN.screen_view->file_for_view = OTHER_FILE;
  2366.           CURRENT_FILE->file_views++;
  2367.          }
  2368.        else
  2369.           CURRENT_VIEW = CURRENT_SCREEN.screen_view = save_current_view;
  2370.       }
  2371.    }
  2372.  else  /* only one screen being displayed...less hassle */
  2373.    {
  2374. /*---------------------------------------------------------------------*/
  2375. /* Make the current view the "next" one determined above.              */
  2376. /*---------------------------------------------------------------------*/
  2377.     CURRENT_VIEW = CURRENT_SCREEN.screen_view = save_current_view;
  2378.    }
  2379. /*---------------------------------------------------------------------*/
  2380. /* If the position of the prefix or command line for the new view is   */
  2381. /* different from the previous view, rebuild the windows...            */
  2382. /*---------------------------------------------------------------------*/
  2383.  if ((save_prefix&PREFIX_LOCATION_MASK) != (CURRENT_VIEW->prefix&PREFIX_LOCATION_MASK)
  2384.  ||  save_gap != CURRENT_VIEW->prefix_gap
  2385.  ||  save_cmd_line != CURRENT_VIEW->cmd_line
  2386.  ||  save_id_line != CURRENT_VIEW->id_line)
  2387.    {
  2388.     set_screen_defaults();
  2389.     if (curses_started)
  2390.       {
  2391.        if (set_up_windows(current_screen) != RC_OK)
  2392.          {
  2393. #ifdef TRACE
  2394.          trace_return();
  2395. #endif
  2396.          return(RC_OK);
  2397.         }
  2398.       }
  2399.    }
  2400. /*---------------------------------------------------------------------*/
  2401. /* Re-calculate CURLINE for the new view in case the CURLINE is no     */
  2402. /* longer in the display area.                                         */
  2403. /*---------------------------------------------------------------------*/
  2404.  prepare_view(current_screen);
  2405.  
  2406.  pre_process_line(CURRENT_VIEW,CURRENT_VIEW->focus_line,(LINE *)NULL);
  2407.  build_screen(current_screen); 
  2408.  display_screen(current_screen);
  2409.  if (curses_started)
  2410.    {
  2411.     if (statarea != NULL)
  2412.       {
  2413.        wattrset(statarea,set_colour(CURRENT_FILE->attr+ATTR_STATAREA));
  2414.        redraw_window(statarea);
  2415.        touchwin(statarea);
  2416.       }
  2417.     if (divider != NULL)
  2418.       {
  2419.        if (display_screens > 1
  2420.        && !horizontal)
  2421.           wattrset(divider,set_colour(CURRENT_FILE->attr+ATTR_DIVIDER));
  2422.        touchwin(divider);
  2423.        wnoutrefresh(divider);
  2424.       }
  2425.     wmove(CURRENT_WINDOW_FILEAREA,CURRENT_VIEW->y[WINDOW_FILEAREA],CURRENT_VIEW->x[WINDOW_FILEAREA]);
  2426.     if (CURRENT_WINDOW_PREFIX != NULL)
  2427.        wmove(CURRENT_WINDOW_PREFIX,CURRENT_VIEW->y[WINDOW_PREFIX],CURRENT_VIEW->x[WINDOW_PREFIX]);
  2428.     getyx(CURRENT_WINDOW,y,x);
  2429.     wmove(CURRENT_WINDOW,y,x);
  2430.    }
  2431. #ifdef TRACE
  2432.  trace_return();
  2433. #endif
  2434.  return(RC_OK);
  2435. }
  2436.  
  2437. #if defined(CAN_RESIZE) || defined(OS2) || defined(WIN32)
  2438. /***********************************************************************/
  2439. #ifdef HAVE_PROTO
  2440. short THE_Resize(int rows, int cols)
  2441. #else
  2442. short THE_Resize(rows,cols)
  2443. int rows,cols;
  2444. #endif
  2445. /***********************************************************************/
  2446. {
  2447. /*-------------------------- external data ----------------------------*/
  2448.  extern CHARTYPE display_screens;
  2449.  extern short terminal_lines;
  2450.  extern short terminal_cols;
  2451.  extern bool curses_started;
  2452. /*--------------------------- local data ------------------------------*/
  2453.  register int i=0;
  2454.  int rc=RC_OK;
  2455. /*--------------------------- processing ------------------------------*/
  2456. #ifdef TRACE
  2457.  trace_function("show.c:    THE_Resize");
  2458. #endif
  2459. /*---------------------------------------------------------------------*/
  2460. /* This function is called as the result of a screen resize.           */
  2461. /*---------------------------------------------------------------------*/
  2462.  resize_term(rows,cols);     /* LINES and COLS are NOT used in XCURSES */
  2463.  terminal_lines = LINES;
  2464.  terminal_cols = COLS;
  2465. #ifdef HAVE_BSD_CURSES
  2466.  terminal_lines--;
  2467. #endif
  2468.  set_screen_defaults();
  2469.  if (curses_started)
  2470.    {
  2471.     for (i=0;i<display_screens;i++)
  2472.       {
  2473.        if ((rc = set_up_windows(i)) != RC_OK)
  2474.          {
  2475. #ifdef TRACE
  2476.           trace_return();
  2477. #endif
  2478.           return(rc);
  2479.          }
  2480.       }
  2481.    }
  2482.  create_statusline_window();
  2483.  return (RC_OK);
  2484. }
  2485. #endif
  2486.  
  2487. #if defined(HAVE_BROKEN_SYSVR4_CURSES)
  2488. /***********************************************************************/
  2489. #ifdef HAVE_PROTO
  2490. short force_curses_background(void)
  2491. #else
  2492. short force_curses_background()
  2493. int rows,cols;
  2494. #endif
  2495. /***********************************************************************/
  2496. {
  2497. /*-------------------------- external data ----------------------------*/
  2498.  extern bool colour_support;
  2499. /*--------------------------- local data ------------------------------*/
  2500.  int rc=RC_OK;
  2501.  short fg=0,bg=0;
  2502. /*--------------------------- processing ------------------------------*/
  2503. #ifdef TRACE
  2504.  trace_function("show.c:    force_curses_background");
  2505. #endif
  2506. /*---------------------------------------------------------------------*/
  2507. /* This function is called to ensure that the background colour of the */
  2508. /* first line on the screen is set to that which THE requests.  Some   */
  2509. /* curses implementations, notably Solaris 2.5, fail to set the        */
  2510. /* background to black.                                                */
  2511. /*---------------------------------------------------------------------*/
  2512.  if (colour_support)
  2513.    {
  2514.     pair_content(1,&fg,&bg);
  2515.     init_pair(1,COLOR_BLACK,COLOR_WHITE);
  2516.     move(0,0);
  2517.     attrset(COLOR_PAIR(1));
  2518.     addch(' ');
  2519.     init_pair(1,fg,bg);
  2520.    }
  2521.  return (RC_OK);
  2522. }
  2523. #endif
  2524.