summaryrefslogtreecommitdiff
path: root/buffer.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2021-02-25 18:27:07 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2021-02-25 18:27:07 -0500
commit2baf965c7db4a3640cd120e050c61aa7de67448b (patch)
tree4ea6d87d6157b3d25eba24aa8805a10219c44a2f /buffer.c
parent3ff107c7ca438749a8425feef9eefb67c7a8abfc (diff)
node resizing working
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/buffer.c b/buffer.c
index c7e5ce3..cb44eb4 100644
--- a/buffer.c
+++ b/buffer.c
@@ -844,6 +844,9 @@ void buffer_scroll_to_pos(TextBuffer *buffer, BufferPos pos) {
double display_cols = buffer_display_cols(buffer);
double scroll_x = buffer->scroll_x, scroll_y = buffer->scroll_y;
double scrolloff = settings->scrolloff;
+
+ // for very small buffers, the scrolloff might need to be reduced.
+ scrolloff = mind(scrolloff, display_lines * 0.5);
// scroll left if pos is off screen in that direction
double max_scroll_x = col - scrolloff;
@@ -2073,6 +2076,7 @@ void buffer_render(TextBuffer *buffer, Rect r) {
// set x1,y1,x2,y2 to an size 0 rectangle
buffer->x1 = buffer->x2 = r.pos.x;
buffer->y1 = buffer->y2 = r.pos.y;
+ return;
}
float x1, y1, x2, y2;