aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_session.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/ex_session.c')
-rw-r--r--src/nvim/ex_session.c64
1 files changed, 30 insertions, 34 deletions
diff --git a/src/nvim/ex_session.c b/src/nvim/ex_session.c
index 3038ed3947..11e8353e3a 100644
--- a/src/nvim/ex_session.c
+++ b/src/nvim/ex_session.c
@@ -8,13 +8,11 @@
// :mksession
#include <assert.h>
-#include <string.h>
+#include <inttypes.h>
#include <stdbool.h>
#include <stdlib.h>
-#include <inttypes.h>
+#include <string.h>
-#include "nvim/vim.h"
-#include "nvim/globals.h"
#include "nvim/ascii.h"
#include "nvim/buffer.h"
#include "nvim/cursor.h"
@@ -28,6 +26,7 @@
#include "nvim/fileio.h"
#include "nvim/fold.h"
#include "nvim/getchar.h"
+#include "nvim/globals.h"
#include "nvim/keymap.h"
#include "nvim/misc1.h"
#include "nvim/move.h"
@@ -36,6 +35,7 @@
#include "nvim/os/os.h"
#include "nvim/os/time.h"
#include "nvim/path.h"
+#include "nvim/vim.h"
#include "nvim/window.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
@@ -63,7 +63,7 @@ static int put_view_curpos(FILE *fd, const win_T *wp, char *spaces)
static int ses_winsizes(FILE *fd, int restore_size, win_T *tab_firstwin)
{
int n = 0;
- win_T *wp;
+ win_T *wp;
if (restore_size && (ssop_flags & SSOP_WINSIZE)) {
for (wp = tab_firstwin; wp != NULL; wp = wp->w_next) {
@@ -105,7 +105,7 @@ static int ses_winsizes(FILE *fd, int restore_size, win_T *tab_firstwin)
// Returns FAIL when writing the commands to "fd" fails.
static int ses_win_rec(FILE *fd, frame_T *fr)
{
- frame_T *frc;
+ frame_T *frc;
int count = 0;
if (fr->fr_layout != FR_LEAF) {
@@ -149,7 +149,7 @@ static int ses_win_rec(FILE *fd, frame_T *fr)
// Returns NULL when there none.
static frame_T *ses_skipframe(frame_T *fr)
{
- frame_T *frc;
+ frame_T *frc;
FOR_ALL_FRAMES(frc, fr) {
if (ses_do_frame(frc)) {
@@ -200,11 +200,10 @@ static int ses_do_win(win_T *wp)
/// @param flagp
///
/// @returns FAIL if writing fails.
-static int ses_arglist(FILE *fd, char *cmd, garray_T *gap, int fullname,
- unsigned *flagp)
+static int ses_arglist(FILE *fd, char *cmd, garray_T *gap, int fullname, unsigned *flagp)
{
- char_u *buf = NULL;
- char_u *s;
+ char_u *buf = NULL;
+ char_u *s;
if (fprintf(fd, "%s\n%s\n", cmd, "%argdel") < 0) {
return FAIL;
@@ -297,17 +296,15 @@ static int ses_put_fname(FILE *fd, char_u *name, unsigned *flagp)
return retval;
}
-// Write commands to "fd" to restore the view of a window.
-// Caller must make sure 'scrolloff' is zero.
-static int put_view(
- FILE *fd,
- win_T *wp,
- int add_edit, // add ":edit" command to view
- unsigned *flagp, // vop_flags or ssop_flags
- int current_arg_idx // current argument index of the window, use
-) // -1 if unknown
+/// Write commands to "fd" to restore the view of a window.
+/// Caller must make sure 'scrolloff' is zero.
+///
+/// @param add_edit add ":edit" command to view
+/// @param flagp vop_flags or ssop_flags
+/// @param current_arg_idx current argument index of the window, use -1 if unknown
+static int put_view(FILE *fd, win_T *wp, int add_edit, unsigned *flagp, int current_arg_idx)
{
- win_T *save_curwin;
+ win_T *save_curwin;
int f;
int do_cursor;
int did_next = false;
@@ -348,8 +345,8 @@ static int put_view(
// Load the file.
//
if (wp->w_buffer->b_ffname != NULL
- && (!bt_nofile(wp->w_buffer) || wp->w_buffer->terminal)
- ) {
+ && (!bt_nofile(wp->w_buffer) ||
+ wp->w_buffer->terminal)) {
// Editing a file in this buffer: use ":edit file".
// This may have side effects! (e.g., compressed or network file).
//
@@ -434,8 +431,8 @@ static int put_view(
//
if ((*flagp & SSOP_FOLDS)
&& wp->w_buffer->b_ffname != NULL
- && (bt_normal(wp->w_buffer) || bt_help(wp->w_buffer))
- ) {
+ && (bt_normal(wp->w_buffer) ||
+ bt_help(wp->w_buffer))) {
if (put_folds(fd, wp) == FAIL) {
return FAIL;
}
@@ -525,12 +522,12 @@ static int makeopens(FILE *fd, char_u *dirnow)
int only_save_windows = true;
int nr;
int restore_size = true;
- win_T *wp;
- char_u *sname;
- win_T *edited_win = NULL;
+ win_T *wp;
+ char_u *sname;
+ win_T *edited_win = NULL;
int tabnr;
- win_T *tab_firstwin;
- frame_T *tab_topframe;
+ win_T *tab_firstwin;
+ frame_T *tab_topframe;
int cur_arg_idx = 0;
int next_arg_idx = 0;
@@ -658,8 +655,7 @@ static int makeopens(FILE *fd, char_u *dirnow)
if (ses_do_win(wp)
&& wp->w_buffer->b_ffname != NULL
&& !bt_help(wp->w_buffer)
- && !bt_nofile(wp->w_buffer)
- ) {
+ && !bt_nofile(wp->w_buffer)) {
if (need_tabnext && put_line(fd, "tabnext") == FAIL) {
return FAIL;
}
@@ -877,12 +873,12 @@ void ex_loadview(exarg_T *eap)
/// - SSOP_SLASH: filenames are written with "/" slash
void ex_mkrc(exarg_T *eap)
{
- FILE *fd;
+ FILE *fd;
int failed = false;
int view_session = false; // :mkview, :mksession
int using_vdir = false; // using 'viewdir'?
char *viewFile = NULL;
- unsigned *flagp;
+ unsigned *flagp;
if (eap->cmdidx == CMD_mksession || eap->cmdidx == CMD_mkview) {
view_session = true;