/* * updateRegion - update marked region */ static void updateRegion( void ) { #ifdef __WIN__ if( !SelRgn.selected ) { int min_line, max_line; min_line = last_start_line; if( min_line > last_start_line ) min_line = last_start_line; max_line = last_start_line; if( max_line < last_end_line ) max_line = last_end_line; DCDisplaySomeLines( min_line - LeftTopPos.line, max_line - LeftTopPos.line ); last_start_line = last_end_line = 1; return; } else { int min_start, max_start; int min_end, max_end; min_start = SelRgn.start.line; if( min_start > last_start_line ) min_start = last_start_line; max_start = SelRgn.start.line; if( max_start < last_start_line ) max_start = last_start_line; min_end = SelRgn.end.line; if( min_end > last_end_line ) min_end = last_end_line; max_end = SelRgn.end.line; if( max_end < last_end_line ) max_end = last_end_line; DCDisplaySomeLines( min_start - LeftTopPos.line, max_start - LeftTopPos.line ); DCDisplaySomeLines( min_end - LeftTopPos.line, max_end - LeftTopPos.line ); } last_start_line = SelRgn.start.line; last_end_line = SelRgn.end.line; #else markRegion( true ); DCDisplayAllLines(); #endif } /* updateRegion */
/* * updateRegion - update marked region */ static void updateRegion( void ) { #ifdef __WIN__ if( SelRgn.selected == FALSE ) { DCDisplaySomeLines( __min( last_start_line, last_end_line ) - LeftTopPos.line, __max( last_start_line, last_end_line ) - LeftTopPos.line ); last_start_line = last_end_line = 1; return; } else { DCDisplaySomeLines( __min( SelRgn.start.line, last_start_line ) - LeftTopPos.line, __max( SelRgn.start.line, last_start_line ) - LeftTopPos.line ); DCDisplaySomeLines( __min( SelRgn.end.line, last_end_line ) - LeftTopPos.line, __max( SelRgn.end.line, last_end_line ) - LeftTopPos.line ); } last_start_line = SelRgn.start.line; last_end_line = SelRgn.end.line; #else markRegion( TRUE ); DCDisplayAllLines(); #endif } /* updateRegion */
/* * DisplayWorkLine - display the working copy of the current line */ void DisplayWorkLine( bool killsFlags ) { int i; if( killsFlags ) { DCDisplayAllLines(); } else { // could speed up a little by calling directly i = (int)( CurrentPos.line - LeftTopPos.line ); DCDisplaySomeLines( i, i ); } } /* DisplayWorkLine */
/* * goToLine - go to a specified line number */ static vi_rc goToLine( linenum lineno, bool relcurs ) { int text_lines, tl; linenum diff, cwl, nwl; // linenum s, e, hiddcnt; bool dispall, pageshift; fcb *cfcb; line *cline; int pad; vi_rc rc; if( lineno < 1 ) { return( ERR_NO_SUCH_LINE ); } /* * get pointer to requested line */ rc = CGimmeLinePtr( lineno, &cfcb, &cline ); if( rc != ERR_NO_ERR ) { return( rc ); } #if 0 if( cline->u.ld.hidden ) { GetHiddenRange( lineno, &s, &e ); if( lineno > CurrentPos.line ) { lineno = e + 1; } else { lineno = s - 1; } rc = CGimmeLinePtr( lineno, &cfcb, &cline ); if( rc != ERR_NO_ERR ) { return( rc ); } } #endif /* * compute new location */ CurrentFcb = cfcb; CurrentLine = cline; diff = lineno - CurrentPos.line; if( diff == 0 && !EditFlags.GlobalInProgress ) { return( ERR_NO_ERR ); } cwl = CurrentPos.line - LeftTopPos.line + 1; nwl = cwl + diff; /* * if we go off the window, relocate */ pageshift = false; dispall = false; text_lines = WindowAuxInfo( current_window_id, WIND_INFO_TEXT_LINES ); if( nwl < 1 || nwl > text_lines ) { tl = text_lines / 2; if( !relcurs ) { LeftTopPos.line = lineno - tl; } else { LeftTopPos.line = lineno + 1 - cwl; pad = ( EditFlags.JumpyScroll ) ? 1 : 0; if( diff > 0 ) { LeftTopPos.line += pad; diff += pad; } else { LeftTopPos.line -= pad; diff -= pad; } if( diff > -tl && diff < tl && !dispall ) { pageshift = true; } } if( LeftTopPos.line < 1 ) { assert( diff <= 0 ); // < -> <= W.Briscoe 20031003 to avoid debug build failure of // C:\watcom\source\docs\nt) wmake -h -f ..\mif\master.mif hbook=wccerrs dotarget=nt diff += ( 1 - LeftTopPos.line ); LeftTopPos.line = 1; } if( LeftTopPos.line > lineno ) { assert( diff > 0 ); diff = LeftTopPos.line - lineno; LeftTopPos.line = lineno; } dispall = true; } #if 0 hiddcnt = GetHiddenLineCount( LeftTopPos.line, lineno ); if( hiddcnt > 0 ) { pageshift = false; dispall = true; } #endif if( CheckCurrentColumn() || EditFlags.Dragging ) { // pageshift wont help if we also have to column shift // and not really useful if dragging dispall = true; pageshift = false; } /* call SetCurrentLineNumber AFTER LeftTopPos.line set & CurrentColumn checked */ SetCurrentLineNumber( lineno ); if( pageshift ) { dispall = false; ShiftWindowUpDown( current_window_id, diff ); if( EditFlags.LineNumbers ) { ShiftWindowUpDown( curr_num_window_id, diff ); } if( diff > 0 ) { DCDisplaySomeLines( text_lines - diff, text_lines - 1 ); } else { DCDisplaySomeLines( 0, -diff - 1 ); } } UpdateStatusWindow(); SetWindowCursor(); if( dispall ) { DCInvalidateAllLines(); // lines definitely invalid DCDisplayAllLines(); } return( ERR_NO_ERR ); } /* goToLine */
void DCDisplayAllLines( void ) { if( CurrentInfo == NULL ) return; DCDisplaySomeLines( 0, CurrentInfo->dc_size - 1 ); }