From d00b3d3b70f326a18b58e6652428e928236e7c65 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Wed, 2 Sep 2020 16:29:38 -0400 Subject: Actually insert blank lines in the soft buffer So they can be preserved forever! --- buffer.c | 5 ----- chat.h | 1 - ui.c | 14 ++++++++++++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/buffer.c b/buffer.c index bc4a2b8..fd69cd3 100644 --- a/buffer.c +++ b/buffer.c @@ -184,11 +184,6 @@ int bufferPush( 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) { buffer->hard.len = 0; for (size_t i = 0; i < BufferCap; ++i) { diff --git a/chat.h b/chat.h index 72b0246..d05121f 100644 --- a/chat.h +++ b/chat.h @@ -291,7 +291,6 @@ int bufferPush( struct Buffer *buffer, int cols, enum Heat heat, time_t time, const char *str ); -int bufferBlank(struct Buffer *buffer); void bufferReflow(struct Buffer *buffer, int cols); enum Edit { diff --git a/ui.c b/ui.c index df51a3d..93c98bb 100644 --- a/ui.c +++ b/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->mark && heat > Cold) { if (!window->unreadWarm++) { - lines += bufferBlank(window->buffer); + lines += bufferPush(window->buffer, COLS, Cold, 0, ""); } if (heat > window->heat) window->heat = heat; 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) { struct Window *window = windows.ptrs[windows.show]; uint id = window->id; @@ -810,7 +820,7 @@ static void keyCode(int code) { break; case KeyMetaD: edit(id, EditDeleteNextWord, 0); break; case KeyMetaF: edit(id, EditNextWord, 0); 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 KeyMetaU: windowScrollUnread(window); break; case KeyMetaV: windowScrollPage(window, +1); -- cgit 1.4.1 ist nowrap'>Commit message (Collapse)Author 2025-04-08Those were supposed to be en-dashes...June McEnroe 2025-04-08Generate pages per rollJune McEnroe 2025-04-08Add metadata from many rolls of filmJune McEnroe 2025-03-25Add emoji for lens, replace all f/'sJune McEnroe 2024-12-29Add photos from December 28June McEnroe 2024-12-29Fancify the manual lens textJune McEnroe 2024-12-28Update film preset list with what I expect to keep shootingJune McEnroe 2024-12-28Add the past few months of rolls of filmJune McEnroe 2024-11-13Add Tea with the Black DragonJune McEnroe I found this in a box on the side of the road being thrown own. It's decent pulp but nothing special. Not even as racist as I expected it to be. Also as one might guess, the author using their initials is a woman, so I only broke one of my rules when it comes to book selection. 2024-11-05Add a bunch of photosJune McEnroe 2024-10-12Publish "film review"June McEnroe 2024-10-12Add photos from October 6June McEnroe 2024-10-12Add photos from October 5June McEnroe 2024-10-09Add photos from October 1June McEnroe Ok the first 3 are from September 29 but I didn't want to spoil the black and white roll. 2024-10-07Add photos from September 29June McEnroe 2024-10-07Add photos from September 28June McEnroe 2024-10-07Add photos from September 22June McEnroe 2024-09-25Add photos from September 15June McEnroe 2024-09-24Add photos from September 14June McEnroe 2024-09-24Add photos from September 12June McEnroe 2024-09-24Add photos from September 7June McEnroe 2024-09-24Allow not having descriptionsJune McEnroe I'm sorry, I can't keep writing descriptions. It makes posting photos take too long, I often don't know the words for what I'm looking at, and a good description is an entirely different work of art than the photo I took, and I'm just a photographer. It's visual art. 2024-09-23Automatically select the last used lens for a bodyJune McEnroe 2024-09-19Add photos from September 5June McEnroe Had to prefix the folder number onto these file names manually because they must have come out of a different scanner or something. 2024-09-15Add some more film stocks to the listJune McEnroe 2024-09-13Add photos from September 2June McEnroe 2024-09-13Add Fomapan 200 to films listJune McEnroe 2024-09-10Add August 29 picnic photosJune McEnroe 2024-09-08Apply some bold to trips renderingJune McEnroe This seems easier to visually scan. The only other thing I'd like is a nicer date rendering but JavaScript is useless for that. 2024-09-08Render trips hopefully more efficientlyJune McEnroe 2024-09-08Allow removing bodies and lensesJune McEnroe 2024-09-08Limit body width so it looks less silly on desktopJune McEnroe 2024-09-07Handle no film being loadedJune McEnroe 2024-09-07Fancy up the text a littleJune McEnroe