/* * RestoreCurrentFilePos */ void RestoreCurrentFilePos( void ) { vi_rc rc; CurrentFile = oldFile[stackDepth]; CurrentPos = oldCurrentPos[stackDepth]; LeftTopPos = oldLeftTopPos[stackDepth]; if( CurrentFile != NULL ) { rc = CGimmeLinePtr( CurrentPos.line, &CurrentFcb, &CurrentLine ); if( rc == ERR_NO_SUCH_LINE ) { if( CurrentFile->fcbs.tail != NULL ) { CurrentPos.line = CurrentFile->fcbs.tail->end_line; CGimmeLinePtr( CurrentPos.line, &CurrentFcb, &CurrentLine ); } } } else { CurrentFcb = NULL; CurrentLine = NULL; } ValidateCurrentColumn(); VarAddRandC(); stackDepth--; } /* RestoreCurrentFilePos */
void SetCurrentLineNumber( linenum l ) { long last; long height; CurrentPos.line = l; UpdateCursorDrag(); VarAddRandC(); if( CurrentFile != NULL ) { height = WindowAuxInfo( current_window_id, WIND_INFO_TEXT_LINES ); last = CurrentFile->fcbs.tail->end_line - height + 1; if ( LeftTopPos.line > last ){ last = LeftTopPos.line; } } else { last = 1; } PositionVerticalScrollThumb( current_window_id, LeftTopPos.line, last ); }
/* * NewFile - load up a new file */ vi_rc NewFile( char *name, bool same_file ) { vi_rc rc; bool dup; status_type oldstatus; dup = EditFlags.DuplicateFile; EditFlags.DuplicateFile = false; oldstatus = UpdateCurrentStatus( CSTATUS_READING ); ScreenPage( 1 ); #ifdef __WIN__ EditFlags.ResizeableWindow = true; #endif rc = createNewFile( name, same_file ); if( rc != ERR_NO_ERR && rc != NEW_FILE ) { ScreenPage( -1 ); if( !EditFlags.Starting ) { MoveWindowToFrontDammit( MessageWindow, true ); MoveWindowToFrontDammit( CurrentWindow, true ); } UpdateCurrentStatus( oldstatus ); return( rc ); } GoToLineNoRelCurs( 1 ); GoToColumnOnCurrentLine( 1 ); FileSPVAR(); SaveCurrentInfo(); if( !same_file ) { inReadHook++; rc = SourceHook( SRC_HOOK_READ, rc ); inReadHook--; } /* * back from hook, so all loadings are done * (who should have priority - hook or fts commands?) */ #if 0 rc = FTSRunCmds( CurrentFile->name ); FTSRunCmds( CurrentFile->name ); #endif /* * reset the screen to the display page, display everything */ ScreenPage( -1 ); MoveWindowToFrontDammit( CurrentWindow, true ); UpdateStatusWindow(); SetWindowCursor(); DCDisplayAllLines(); EditFlags.DuplicateFile = dup; DisplayFileStatus(); SaveCurrentInfo(); ActiveWindow( CurrentWindow ); VarAddRandC(); SetModifiedVar( false ); UpdateCurrentStatus( oldstatus ); if( !same_file && !inReadHook ) { UpdateLastFileList( CurrentFile->name ); } #ifdef __WIN__ DCUpdateAll(); ResetEditWindowCursor( CurrentWindow ); SetWindowCursorForReal(); GotoFile( CurrentWindow ); #endif return( rc ); } /* NewFile */