diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2021-03-05 16:49:17 -0500 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2021-03-05 16:49:17 -0500 |
commit | edbad154a65f47dc77dbb901801651e28c4f5e55 (patch) | |
tree | 544d1e29f7507622a0a58c906fea0ddf500393af /session.c | |
parent | e37ef801a6304f602fdff195b2c46098cf7f5994 (diff) |
fix :shell with no files open, write cwd to session
Diffstat (limited to 'session.c')
-rw-r--r-- | session.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -1,5 +1,5 @@ #define SESSION_FILENAME "session.txt" -#define SESSION_VERSION "\x7fTED0001" +#define SESSION_VERSION "\x7fTED0002" static void session_write_node(Ted *ted, FILE *fp, u16 node_idx) { Node *node = &ted->nodes[node_idx]; @@ -95,6 +95,8 @@ static void session_read_buffer(Ted *ted, FILE *fp) { static void session_write_file(Ted *ted, FILE *fp) { fwrite(SESSION_VERSION, 1, sizeof SESSION_VERSION, fp); + write_cstr(fp, ted->cwd); + write_u16(fp, ted->active_node ? (u16)(ted->active_node - ted->nodes) : U16_MAX); // active node idx write_u16(fp, ted->active_buffer ? (u16)(ted->active_buffer - ted->buffers) : U16_MAX); // active buffer idx @@ -123,6 +125,8 @@ static void session_read_file(Ted *ted, FILE *fp) { return; // wrong version } + read_cstr(fp, ted->cwd, sizeof ted->cwd); + u16 active_node_idx = read_u16(fp); u16 active_buffer_idx = read_u16(fp); |