/* * IMInsert - handle INS key pressed in insert mode */ vi_rc IMInsert( void ) { if( overStrike ) { overStrike = FALSE; } else { overStrike = TRUE; } UpdateEditStatus(); return( ERR_NO_ERR ); } /* IMInsert */
/* * continueInsertText - continue in insert mode after mouse events */ static void continueInsertText( int col, bool overstrike ) { overStrike = overstrike; abbrevCnt = 0; if( !EditFlags.Modeless ) { UpdateEditStatus(); } EditFlags.Dotable = TRUE; EditFlags.NoReplaceSearchString = TRUE; EditFlags.InsertModeActive = TRUE; if( col > 1 && CurrentLine->len == 0 ) { col = 1; } GoToColumnOK( col ); GetCurrentLine(); } /* continueInsertText */
/* * EditMain - main driver for editor (command mode) */ void EditMain( void ) { vi_rc rc; char *msg = NULL; bool doclear; /* * loop forever, or at least until all done */ for( ;; ) { #if 0 #ifdef __WIN__ PushMode(); UpdateFiles(); PopMode(); #endif #endif if( !EditFlags.InsertModeActive || EditFlags.Modeless ) { if( EditFlags.Modeless ) { UpdateEditStatus(); EditFlags.NoCapsLock = false; } else { UpdateCurrentStatus( CSTATUS_COMMAND ); EditFlags.NoCapsLock = true; } if( !EditFlags.Modeless && EditFlags.ReturnToInsertMode && !NonKeyboardEventsPending() ) { EditFlags.ReturnToInsertMode = false; if( EditFlags.WasOverstrike ) { LastEvent = 'R'; } else { LastEvent = 'i'; } } else { DCUpdateAll(); #ifdef __WIN__ SetWindowCursorForReal(); #endif LastEvent = GetNextEvent( true ); } EditFlags.NoCapsLock = false; doclear = true; if( LastEvent == VI_KEY( MOUSEEVENT ) ) { if( LastMouseEvent == MOUSE_MOVE ) { doclear = false; } } if( doclear ) { if( EditFlags.AutoMessageClear ) { ClearWindow( MessageWindow ); } #ifndef __WIN__ ResetDisplayLine(); #endif } } else { // Cannot do a RestoreInfo while we are in insert mode // because it will call ValidateCurrentColumn which will // do something stupid on us... PushMode/PopMode solution // not working yet... this needs a little work DCUpdate(); #ifdef __WIN__ SetWindowCursorForReal(); #endif LastEvent = GetNextEvent( true ); } rc = DoLastEvent(); if( EditFlags.ReadOnlyError && rc <= ERR_NO_ERR ) { EditFlags.ReadOnlyError = false; rc = ERR_READ_ONLY_FILE_MODIFIED; } if( rc > ERR_NO_ERR ) { msg = GetErrorMsg( rc ); } DoneLastEvent( rc, false ); if( rc > ERR_NO_ERR ) { Error( msg ); } } } /* EditMain */