summaryrefslogtreecommitdiff
path: root/session.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-07-18 17:20:11 -0400
committerpommicket <pommicket@gmail.com>2023-07-18 17:20:11 -0400
commiteb1c75720eaa8686c160e3ffa2559a03b5187e5a (patch)
tree47d1b9236ae45ba2392a64994c8fa8181c414630 /session.c
parent9bee6a4bbd74a6ef9c317cfb54ffa7136644de4c (diff)
font fallbacksvariable-width
Diffstat (limited to 'session.c')
-rw-r--r--session.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/session.c b/session.c
index 8860cd1..af55eba 100644
--- a/session.c
+++ b/session.c
@@ -116,7 +116,7 @@ static char read_char(FILE *fp) {
}
static bool read_bool(FILE *fp) {
- return (bool)getc(fp);
+ return getc(fp) != 0;
}
static void write_cstr(FILE *fp, const char *cstr) {
@@ -244,6 +244,12 @@ static void session_read_buffer(Ted *ted, FILE *fp) {
buffer->selection = read_bool(fp);
if (buffer->selection)
buffer->selection_pos = buffer_pos_read(buffer, fp);
+ buffer_pos_validate(buffer, &buffer->cursor_pos);
+ buffer_pos_validate(buffer, &buffer->selection_pos);
+ if (buffer->selection && buffer_pos_eq(buffer->cursor_pos, buffer->selection_pos)) {
+ // this could happen if the file was changed on disk
+ buffer->selection = false;
+ }
}
}