mirror of
https://github.com/profanity-im/profanity.git
synced 2025-01-03 14:57:42 -05:00
Removed unused function
This commit is contained in:
parent
0619303abe
commit
860591872f
@ -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;
|
||||
}
|
@ -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
|
Loading…
Reference in New Issue
Block a user