diff options
Diffstat (limited to 'src/glibext/bufferline.c')
| -rw-r--r-- | src/glibext/bufferline.c | 51 | 
1 files changed, 23 insertions, 28 deletions
| diff --git a/src/glibext/bufferline.c b/src/glibext/bufferline.c index 5eec1db..ec1176b 100644 --- a/src/glibext/bufferline.c +++ b/src/glibext/bufferline.c @@ -33,6 +33,7 @@  #include "linecolumn.h"  #include "../common/extstr.h"  #include "../core/paths.h" +#include "../gtkext/gtkblockdisplay.h" @@ -55,8 +56,7 @@ struct _GBufferLine      line_column *columns;                   /* Répartition du texte        */      size_t col_count;                       /* Nombre de colonnes présentes*/ -    BufferLineColumn merge_start;           /* Début de la zone globale    */ -    BufferLineColumn last_used;             /* Dernière colonne utilisée   */ +    size_t merge_start;                     /* Début de la zone globale    */      BufferLineFlags flags;                  /* Drapeaux particuliers       */ @@ -178,7 +178,6 @@ static void g_buffer_line_init(GBufferLine *line)      line->columns = NULL;      line->col_count = 0;      line->merge_start = -1; -    line->last_used = -1;  } @@ -503,19 +502,9 @@ void g_buffer_line_append_text(GBufferLine *line, size_t column, const char *tex      size_t index;                           /* Indice d'insertion          */      content_origin *origin;                 /* Définition d'une origine    */ +    assert(column < line->col_count);      assert(length > 0); -    if (column == -1) -        column = BLC_LAST_USED; - -    if (column == BLC_MAIN) -        column = BLC_ASSEMBLY;//line->main_column; - -    if (column == BLC_LAST_USED) -        column = line->last_used; -    else -        line->last_used = column; -      index = append_text_to_line_column(&line->columns[column], text, length, type);      if (creator != NULL) @@ -720,10 +709,7 @@ BufferLineColumn g_buffer_line_get_merge_start(const GBufferLine *line)  void g_buffer_line_start_merge_at(GBufferLine *line, BufferLineColumn start)  { -    if (start == BLC_LAST_USED) -        line->merge_start = line->last_used; -    else -        line->merge_start = start; +    line->merge_start = start;  } @@ -801,10 +787,11 @@ void g_buffer_line_remove_flag(GBufferLine *line, BufferLineFlags flag)  /******************************************************************************  *                                                                             * -*  Paramètres  : line    = ligne de texte à manipuler.                        * -*                ctx     = éléments à disposition pour l'exportation.         * -*                type    = type d'exportation attendue.                       * -*                display = règles d'affichage des colonnes modulables.        * +*  Paramètres  : line      = ligne de texte à manipuler.                      * +*                ctx       = éléments à disposition pour l'exportation.       * +*                type      = type d'exportation attendue.                     * +*                col_count = quantité de colonnes existantes au total.        * +*                options   = règles d'affichage des colonnes modulables.      *  *                                                                             *  *  Description : Exporte la ligne de texte représentée.                       *  *                                                                             * @@ -814,9 +801,10 @@ void g_buffer_line_remove_flag(GBufferLine *line, BufferLineFlags flag)  *                                                                             *  ******************************************************************************/ -void g_buffer_line_export(GBufferLine *line, buffer_export_context *ctx, BufferExportType type, const bool *display) +void g_buffer_line_export(GBufferLine *line, buffer_export_context *ctx, BufferExportType type, const GDisplayOptions *options)  { -    BufferLineColumn i;                     /* Boucle de parcours          */ +    size_t opt_count;                       /* Qté de colonnes en option   */ +    size_t i;                               /* Boucle de parcours          */      int col_span;                           /* Fusion de colonnes ?        */      switch (type) @@ -828,9 +816,16 @@ void g_buffer_line_export(GBufferLine *line, buffer_export_context *ctx, BufferE              break;      } -    for (i = 0; i < BLC_COUNT; i++) +    opt_count = g_display_options_count(options); +    assert(opt_count < line->col_count); + +    for (i = 0; i < line->col_count; i++)      { -        if (i < BLC_DISPLAY && !display[i]) continue; +        if (i < opt_count) +        { +            if (!g_display_options_get(options, i)) +                continue; +        }          switch (type)          { @@ -859,10 +854,10 @@ void g_buffer_line_export(GBufferLine *line, buffer_export_context *ctx, BufferE              col_span = 1;          else if (i == line->merge_start) -            col_span = BLC_COUNT - i; +            col_span = line->col_count - i;          else -            col_span = ((i + 1) == BLC_COUNT ? -1 : 0); +            col_span = ((i + 1) == line->col_count ? -1 : 0);          export_line_column_segments(&line->columns[i], ctx, type, col_span); | 
