Actually insert blank lines in the soft buffer
So they can be preserved forever!weechat-hashes
parent
9679c7474e
commit
d00b3d3b70
5
buffer.c
5
buffer.c
|
@ -184,11 +184,6 @@ int bufferPush(
|
||||||
return flow(&buffer->hard, cols, soft);
|
return flow(&buffer->hard, cols, soft);
|
||||||
}
|
}
|
||||||
|
|
||||||
int bufferBlank(struct Buffer *buffer) {
|
|
||||||
struct Line blank = { .heat = Cold, .str = "" };
|
|
||||||
return flow(&buffer->hard, 1, &blank);
|
|
||||||
}
|
|
||||||
|
|
||||||
void bufferReflow(struct Buffer *buffer, int cols) {
|
void bufferReflow(struct Buffer *buffer, int cols) {
|
||||||
buffer->hard.len = 0;
|
buffer->hard.len = 0;
|
||||||
for (size_t i = 0; i < BufferCap; ++i) {
|
for (size_t i = 0; i < BufferCap; ++i) {
|
||||||
|
|
1
chat.h
1
chat.h
|
@ -291,7 +291,6 @@ int bufferPush(
|
||||||
struct Buffer *buffer, int cols,
|
struct Buffer *buffer, int cols,
|
||||||
enum Heat heat, time_t time, const char *str
|
enum Heat heat, time_t time, const char *str
|
||||||
);
|
);
|
||||||
int bufferBlank(struct Buffer *buffer);
|
|
||||||
void bufferReflow(struct Buffer *buffer, int cols);
|
void bufferReflow(struct Buffer *buffer, int cols);
|
||||||
|
|
||||||
enum Edit {
|
enum Edit {
|
||||||
|
|
14
ui.c
14
ui.c
|
@ -546,7 +546,7 @@ void uiWrite(uint id, enum Heat heat, const time_t *src, const char *str) {
|
||||||
if (!window->unreadSoft++) window->unreadHard = 0;
|
if (!window->unreadSoft++) window->unreadHard = 0;
|
||||||
if (window->mark && heat > Cold) {
|
if (window->mark && heat > Cold) {
|
||||||
if (!window->unreadWarm++) {
|
if (!window->unreadWarm++) {
|
||||||
lines += bufferBlank(window->buffer);
|
lines += bufferPush(window->buffer, COLS, Cold, 0, "");
|
||||||
}
|
}
|
||||||
if (heat > window->heat) window->heat = heat;
|
if (heat > window->heat) window->heat = heat;
|
||||||
statusUpdate();
|
statusUpdate();
|
||||||
|
@ -788,6 +788,16 @@ static void showAuto(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void insertBlank(struct Window *window) {
|
||||||
|
int lines = bufferPush(window->buffer, COLS, Cold, 0, "");
|
||||||
|
window->unreadHard += lines;
|
||||||
|
if (window->scroll) {
|
||||||
|
windowScroll(window, lines);
|
||||||
|
} else {
|
||||||
|
windowUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void keyCode(int code) {
|
static void keyCode(int code) {
|
||||||
struct Window *window = windows.ptrs[windows.show];
|
struct Window *window = windows.ptrs[windows.show];
|
||||||
uint id = window->id;
|
uint id = window->id;
|
||||||
|
@ -810,7 +820,7 @@ static void keyCode(int code) {
|
||||||
break; case KeyMetaD: edit(id, EditDeleteNextWord, 0);
|
break; case KeyMetaD: edit(id, EditDeleteNextWord, 0);
|
||||||
break; case KeyMetaF: edit(id, EditNextWord, 0);
|
break; case KeyMetaF: edit(id, EditNextWord, 0);
|
||||||
break; case KeyMetaL: bufferList(window->buffer);
|
break; case KeyMetaL: bufferList(window->buffer);
|
||||||
break; case KeyMetaM: bufferBlank(window->buffer); windowUpdate();
|
break; case KeyMetaM: insertBlank(window);
|
||||||
break; case KeyMetaQ: edit(id, EditCollapse, 0);
|
break; case KeyMetaQ: edit(id, EditCollapse, 0);
|
||||||
break; case KeyMetaU: windowScrollUnread(window);
|
break; case KeyMetaU: windowScrollUnread(window);
|
||||||
break; case KeyMetaV: windowScrollPage(window, +1);
|
break; case KeyMetaV: windowScrollPage(window, +1);
|
||||||
|
|
Loading…
Reference in New Issue