commands.cc
/*
** remove_listing_line - delete the current line in the DirList
**                       and update both the screen and data
**                       structures appropriately.  `y\' is the position
**                       in the window of the current line.
*/
delete the current line in the DirList
and update both the screen and data
structures appropriately.  `y\' is the position
in the window of the current line.
delete the current line in the DirList and update both the screen and data structures appropriately . ` y \ ' is the position in the window of the current line .
static void remove_listing_line(DirList *dl, int y)
{
    if (dl->lastLine() != dl->tail())
    {
         Last line in listing isn\'t in window, so we\'ll have to set
         a new one.  We can just scroll up one line.
        dl->setLast(dl->lastLine()->next());
        dl->deleteLine();
        if (CS || DL)
        {
            if (CS)
                delete_listing_line(y);
            else
            {
                clear_modeline();
                delete_screen_line(y);
                update_modeline();
            }
            move_cursor(rows()-3, 0);
            display_string(dl->lastLine()->line(), dl->lastLine()->length());
        }
        else
        {
            move_cursor(y, 0);
            DirLine *ln = dl->currLine();
            for (int i = y; i < rows()-2; i++, ln = ln->next())
	    {
	        clear_to_end_of_line();
                display_string(ln->line(), ln->length());
	    }
            update_modeline();
        }
        dl->saveYXPos(y, goal_column(dl));
    }
    else
    {
         Last line of listing is visible in window,
         so firstLIne\(\) and lastLine\(\) won\'t change.
        if (dl->atWindowTop() && dl->atWindowBot())
        {
             The last line in the window is also the first line.
             Since we don\'t allow deletion of `.\' or `..\', there
             must be more viewable lines.  Scroll down half
             a window to put more into view.
            scroll_down_half_window(dl, y, 0);
            dl->deleteLine();
            DirLine *ln = dl->firstLine();
            for (int pos = 0; ln != dl->tail(); pos++, ln = ln->next()) ;
            dl->saveYXPos(pos, goal_column(dl));
            move_cursor(pos+1, 0);
            clear_to_end_of_line();
            move_cursor(pos, dl->savedXPos());
        }
        else if (dl->atWindowBot())
        {
             We want to delete the last line in the window.
            dl->deleteLine();
            move_cursor(y, 0);
            clear_to_end_of_line();
            dl->saveYXPos(y-1, goal_column(dl));
            move_cursor(y-1, dl->savedXPos());
        }
        else
        {
             We are in the middle of the listing.
            dl->deleteLine();
            if (CS || DL)
            {
                if (CS)
                    delete_listing_line(y);
                else
                {
                    clear_modeline();
                    delete_screen_line(y);
                    update_modeline();
                }
            }
            else
            {
                clear_to_end_of_screen(y);
                move_cursor(y, 0);
                for (DirLine *ln = dl->currLine(); ln; ln = ln->next())
                    display_string(ln->line(), ln->length());
                update_modeline();
            }
            dl->saveYXPos(y, goal_column(dl));
         }
    }
    if (dl->currLine()->length() > columns())
        leftshift_current_line(dl);
    else
        move_cursor(dl->savedYPos(), dl->savedXPos());
}
static void remove_listing_line ( DirList * dl , int y ) { if ( dl -> lastLine ( ) != dl -> tail ( ) ) { dl -> setLast ( dl -> lastLine ( ) -> next ( ) ) ; dl -> deleteLine ( ) ; if ( CS || DL ) { if ( CS ) delete_listing_line ( y ) ; else { clear_modeline ( ) ; delete_screen_line ( y ) ; update_modeline ( ) ; } move_cursor ( rows ( ) - 3 , 0 ) ; display_string ( dl -> lastLine ( ) -> line ( ) , dl -> lastLine ( ) -> length ( ) ) ; } else { move_cursor ( y , 0 ) ; DirLine * ln = dl -> currLine ( ) ; for ( int i = y ; i < rows ( ) - 2 ; i ++ , ln = ln -> next ( ) ) { clear_to_end_of_line ( ) ; display_string ( ln -> line ( ) , ln -> length ( ) ) ; } update_modeline ( ) ; } dl -> saveYXPos ( y , goal_column ( dl ) ) ; } else { if ( dl -> atWindowTop ( ) && dl -> atWindowBot ( ) ) { scroll_down_half_window ( dl , y , 0 ) ; dl -> deleteLine ( ) ; DirLine * ln = dl -> firstLine ( ) ; for ( int pos = 0 ; ln != dl -> tail ( ) ; pos ++ , ln = ln -> next ( ) ) ; dl -> saveYXPos ( pos , goal_column ( dl ) ) ; move_cursor ( pos + 1 , 0 ) ; clear_to_end_of_line ( ) ; move_cursor ( pos , dl -> savedXPos ( ) ) ; } else if ( dl -> atWindowBot ( ) ) { dl -> deleteLine ( ) ; move_cursor ( y , 0 ) ; clear_to_end_of_line ( ) ; dl -> saveYXPos ( y - 1 , goal_column ( dl ) ) ; move_cursor ( y - 1 , dl -> savedXPos ( ) ) ; } else { dl -> deleteLine ( ) ; if ( CS || DL ) { if ( CS ) delete_listing_line ( y ) ; else { clear_modeline ( ) ; delete_screen_line ( y ) ; update_modeline ( ) ; } } else { clear_to_end_of_screen ( y ) ; move_cursor ( y , 0 ) ; for ( DirLine * ln = dl -> currLine ( ) ; ln ; ln = ln -> next ( ) ) display_string ( ln -> line ( ) , ln -> length ( ) ) ; update_modeline ( ) ; } dl -> saveYXPos ( y , goal_column ( dl ) ) ; } } if ( dl -> currLine ( ) -> length ( ) > columns ( ) ) leftshift_current_line ( dl ) ; else move_cursor ( dl -> savedYPos ( ) , dl -> savedXPos ( ) ) ; }
remove_listing_line - delete the current line in the DirList
and update both the screen and data
structures appropriately.
remove_listing_line - delete the current line in the DirList and update both the screen and data structures appropriately .
// // Last line in listing isn\'t in window, so we\'ll have to set // a new one.  We can just scroll up one line. // // // Last line of listing is visible in window, // so firstLIne\(\) and lastLine\(\) won\'t change. // // // The last line in the window is also the first line. // Since we don\'t allow deletion of `.\' or `..\', there // must be more viewable lines.  Scroll down half // a window to put more into view. // // // We want to delete the last line in the window. // // // We are in the middle of the listing. //