[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nano-devel] definition of filestruct with ENABLE_MULTIBUFFER

From: David Benbennick
Subject: Re: [Nano-devel] definition of filestruct with ENABLE_MULTIBUFFER
Date: Tue, 26 Mar 2002 07:17:37 -0500 (EST)

On Fri, 22 Mar 2002, David Lawrence Ramsey wrote:
> --- David Benbennick <address@hidden> wrote:
> > I think fileage should be removed (that is, open_files would be
> > defined in all cases, and would just have ->prev == NULL == ->next if
> > !ENABLE_MULTIBUFFER).  That would generally make the code cleaner.  
> > Perhaps I will do that soon.
> Hvae you been able to yet?

No, I haven't done anything with it yet.  I intend to work on that
soon; if I really do I will start with your nanopieces.patch.  Thanks for
including my other small patches there.

I agree that going in steps is wise.  What do you think of the following
as the final goal for the definition of openfilestruct in nano.h?  
Differences with your current definition:

* make only next and prev be conditional on ENABLE_MULTIBUFFER,

* use file_flags instead of file_modified, to eventually support
buffer-local MARK_ISSET,

* keep edittop and filebot instead of file_lineno.  When switching between
very large files, it can be arbitrarily slow to recalculate them from
file_lineno.  There is not much need to keep openfilestruct as small as
possible, since the number of open files is usually small.

* and have mark_beginbuf and mark_beginx, for eventual MARK_ISSET.

typedef struct openfilestruct {
    char *filename;
    struct openfilestruct *next;        /* Next node */
    struct openfilestruct *prev;        /* Previous node */
    struct filestruct *fileage; /* Current file */
    int file_current_x;         /* Current file's x-coordinate position */
    int file_current_y;         /* Current file's y-coordinate position */
    int file_flags;             /* Current file's flags */
    int file_placewewant;       /* Current file's place we want */
    int file_totlines;          /* Current file's total number of lines */
    long file_totsize;          /* Current file's total size */
    filestruct *edittop;        /* line at top of edit window */
    filestruct *filebot;        /* last line of this file */
    filestruct *mark_beginbuf;  /* line with start of cut mark */
    int mark_beginx;            /* position of mark in line */
} openfilestruct;

>From global.c I eventually want to remove the following variables.

char *filename = NULL;          /* Name of the file */
int current_x = 0, current_y = 0;       /* Current position of X and Y in
                                           the editor - relative to edit
                                           window (0,0) */
filestruct *fileage = NULL;     /* Our file buffer */
filestruct *edittop = NULL;     /* Pointer to the top of the edit
                                   buffer with respect to the
                                   file struct */
filestruct *filebot = NULL;     /* Last node in the file struct */
int totlines = 0;               /* Total number of lines in the file */
long totsize = 0;               /* Total number of bytes in the file */
int placewewant = 0;            /* The column we'd like the cursor
                                   to jump to when we go to the
                                   next or previous line */
filestruct *mark_beginbuf;      /* the begin marker buffer */
int mark_beginx;                /* X value in the string to start */


reply via email to

[Prev in Thread] Current Thread [Next in Thread]