diff --git a/src/ui/buffer.c b/src/ui/buffer.c index 88d7eb42..16919c08 100644 --- a/src/ui/buffer.c +++ b/src/ui/buffer.c @@ -95,52 +95,4 @@ buffer_yield_entry(ProfBuff* buffer, int entry) } else { return buffer->entry[entry % (buffer->current)]; } -} - -int -buffer_yield(ProfBuff* buffer, int line, ProfBuffEntry** list) -{ - //Returns the size of the (line+1)-th last line, and list contains the line - //e.g. if line == 0, returns the last line - //bug if the wrap happens in the middle of a line - int current = buffer->current; - int imax = current; - - if (buffer->wrap == 1) { - imax = BUFF_SIZE; - } - - int i = 1; - int j = 0; - while (i <= imax) { - ProfBuffEntry e = buffer->entry[(current - i) % BUFF_SIZE]; - - if (j == line && (e.flags & NO_EOL) == 0) { - //We found our line and we are at its last entry - int nb_entries = 1; - - while (i + nb_entries <= imax) { - e = buffer->entry[(current - i - nb_entries) % BUFF_SIZE]; - if ((e.flags & NO_EOL) == 0) { - break; - } - nb_entries += 1; - } - - if ((buffer->wrap == 1) && (i + nb_entries > imax)) { - //The line is at the top of the buffer, we don't know if it's complete - return 0; - } else { - *list = &(buffer->entry[(current - i - nb_entries + 1) % BUFF_SIZE]); - return nb_entries; - } - } - - if ((e.flags & NO_EOL) == 0) { - j++; - } - i++; - } - - return 0; } \ No newline at end of file diff --git a/src/ui/buffer.h b/src/ui/buffer.h index 4a0030d0..b8828c14 100644 --- a/src/ui/buffer.h +++ b/src/ui/buffer.h @@ -24,6 +24,5 @@ ProfBuff* buffer_create(); void buffer_free(ProfBuff* buffer); void buffer_push(ProfBuff* buffer, const char show_char, const char * const date_fmt, int flags, int attrs, const char * const from, const char * const message); int buffer_size(ProfBuff* buffer); -int buffer_yield(ProfBuff* buffer, int line, ProfBuffEntry** list); ProfBuffEntry buffer_yield_entry(ProfBuff* buffer, int entry); #endif \ No newline at end of file