コード例 #1
0
/*
 * ConditionalCurrentLineReplaceUndoEnd - do the above if there are changes
 */
void ConditionalCurrentLineReplaceUndoEnd( void )
{
    if( lineSave->len == CurrentLine->len ) {
        if( !memcmp( lineSave->data, CurrentLine->data, lineSave->len ) ) {
            CurrentLineReplaceUndoCancel();
            return;
        }
    }
    CurrentLineReplaceUndoEnd( TRUE );

} /* ConditionalCurrentLineReplaceUndoEnd */
コード例 #2
0
ファイル: editdc.c プロジェクト: Ukusbobra/open-watcom-v2
/*
 * DeleteRangeOnCurrentLine - perform the deletion
 */
vi_rc DeleteRangeOnCurrentLine( int scol, int ecol, int savebuf_flag )
{
    int     i;
    vi_rc   rc;

    /*
     * verify range
     */
    if( scol > ecol ) {
        i = scol;
        scol = ecol;
        ecol = i;
    }

    /*
     * go delete block and set up undo
     */
    CurrentLineReplaceUndoStart();
    rc = DeleteBlockFromCurrentLine( scol, ecol, savebuf_flag );
    if( rc != ERR_NO_ERR ) {
        CurrentLineReplaceUndoCancel();
        return( rc );
    }
    DisplayWorkLine( TRUE );
    ReplaceCurrentLine();
    CurrentLineReplaceUndoEnd( TRUE );
    EditFlags.Dotable = TRUE;
    if( savebuf_flag ) {
#ifdef __WIN__
        if( LastSavebuf == 0 ) {
            Message1( "%d characters deleted into the clipboard", ecol - scol + 1 );
        } else {
#endif
            Message1( "%d %s%s%c", ecol - scol + 1, MSG_CHARACTERS,
                      MSG_DELETEDINTOBUFFER, LastSavebuf );
#ifdef __WIN__
        }
#endif
    }
    return( ERR_NO_ERR );

} /* DeleteRangeOnCurrentLine */
コード例 #3
0
ファイル: editins.c プロジェクト: Ukusbobra/open-watcom-v2
/*
 * DeleteAndInsertText - delete text range, then insert at beginning
 */
vi_rc DeleteAndInsertText( int scol, int ecol )
{
    int     startcol;
    vi_rc   rc;

    StartUndoGroup( UndoStack );
    CurrentLineReplaceUndoStart();
    currLineRepUndo = TRUE;
    if( ecol >= 0 ) {
        if( CurrentLine->len > 0 ) {
            rc = DeleteBlockFromCurrentLine( scol, ecol, FALSE );
            if( rc == ERR_NO_ERR ) {
                startcol = CurrentPos.column;
                if( scol > ecol ) {
                    startcol = ecol + 1;
                }
                if( startcol > WorkLine->len ) {
                    startcol = WorkLine->len + 1;
                }
                DisplayWorkLine( TRUE );
                ReplaceCurrentLine();
                rc = GoToColumnOK( startcol );
            }
            if( rc != ERR_NO_ERR ) {
                CurrentLineReplaceUndoCancel();
                EndUndoGroup( UndoStack );
                return( rc );
            }
        } else {
            ReplaceCurrentLine();
        }
    }
    continueInsertText( CurrentPos.column, FALSE );
    return( ERR_NO_ERR );

} /* DeleteAndInsertText */