Ticket #83: dirty_readonly.diff

File dirty_readonly.diff, 2.1 KB (added by angel_il, 16 years ago)

first iteration

  • edit/edit-widget.h

    diff --git a/edit/edit-widget.h b/edit/edit-widget.h
    index ab55764..48288a3 100644
    a b struct WEdit { 
    6565    unsigned int screen_modified:1; /* File has been changed since the last screen draw */ 
    6666    unsigned int delete_file:1; /* New file, needs to be deleted unless modified */ 
    6767    unsigned int highlight:1;   /* There is a selected block */ 
     68    unsigned int readonly:1;    /* File is readonly */ 
    6869    long prev_col;              /* recent column position of the cursor - used when moving 
    6970                                   up or down past lines that are shorter than the current line */ 
    7071    long curs_line;             /* line number of the cursor. */ 
  • edit/editcmd.c

    diff --git a/edit/editcmd.c b/edit/editcmd.c
    index 257ab6e..25d4c3a 100644
    a b edit_insert_column_of_text (WEdit * edit, unsigned char *data, int size, int wid 
    968968void 
    969969edit_block_copy_cmd (WEdit *edit) 
    970970{ 
     971    if ( !edit->readonly ) { 
     972        return; 
     973    } 
    971974    long start_mark, end_mark, current = edit->curs1; 
    972975    int size; 
    973976    unsigned char *copy_buf; 
    edit_block_copy_cmd (WEdit *edit) 
    10081011void 
    10091012edit_block_move_cmd (WEdit *edit) 
    10101013{ 
     1014    if ( !edit->readonly ) { 
     1015        return; 
     1016    } 
    10111017    long count; 
    10121018    long current; 
    10131019    unsigned char *copy_buf; 
  • edit/edit.c

    diff --git a/edit/edit.c b/edit/edit.c
    index 51810f7..8e72b0d 100644
    a b static inline void edit_modification (WEdit * edit) 
    832832void 
    833833edit_insert (WEdit *edit, int c) 
    834834{ 
     835    if ( !edit->readonly ) { 
     836        return; 
     837    } 
     838    mc_log("insert: %i\n", c); 
    835839    /* check if file has grown to large */ 
    836840    if (edit->last_byte >= SIZE_LIMIT) 
    837841        return; 
    void edit_insert_ahead (WEdit * edit, int c) 
    917921 
    918922int edit_delete (WEdit * edit) 
    919923{ 
     924    if ( !edit->readonly ) { 
     925        return; 
     926    } 
    920927    int p; 
    921928    if (!edit->curs2) 
    922929        return 0; 
    int edit_delete (WEdit * edit) 
    955962static int 
    956963edit_backspace (WEdit * edit) 
    957964{ 
     965    if ( !edit->readonly ) { 
     966        return; 
     967    } 
    958968    int p; 
    959969    if (!edit->curs1) 
    960970        return 0;