xaizek / vifm (License: GPLv2+) (since 2018-12-07)
Vifm is a file manager with curses interface, which provides Vi[m]-like environment for managing objects within file systems, extended with some useful ideas from mutt.
Commit c96ef29d2326973c5ed91f6d1a837511e2061a42

Fix resetting of 'lines' and 'columns' options
To their default values.

The previous implementation didn't take into account that corresponding
fields of the cfg structure have incorrect default values. So new
implementation adds additional fields to the status structure, which
hold initial geometry of the terminal remembered after first redraw
operation.

Thanks to filterfalse.
Author: xaizek
Author date (UTC): 2013-05-10 08:29
Committer name: xaizek
Committer date (UTC): 2013-05-10 08:29
Parent(s): 903c6b39e03e40b9a13c8e59cfdbb86e22dc7102
Signing key:
Tree: d41b5063a55e3b431e5eabd85d055be84f14c3b6
File Lines added Lines deleted
ChangeLog 3 0
src/opt_handlers.c 10 2
src/status.c 4 1
src/status.h 3 0
src/ui.c 7 0
File ChangeLog changed (mode: 100644) (index ee0f1c897..0d16d3b62)
45 45 path with spaces in vifm's configuration directory. Thanks to path with spaces in vifm's configuration directory. Thanks to
46 46 filterfalse. filterfalse.
47 47
48 Fixed resetting of 'lines' and 'columns' options to their default values.
49 Thanks to filterfalse.
50
48 51 0.7.4b to 0.7.5-beta 0.7.4b to 0.7.5-beta
49 52
50 53 Added Gentoo ebuild. Thanks to Oleg Gordienko (a.k.a. gordio). Added Gentoo ebuild. Thanks to Oleg Gordienko (a.k.a. gordio).
File src/opt_handlers.c changed (mode: 100644) (index 2ab098a75..e6c0272b3)
... ... columns_handler(OPT_OP op, optval_t val)
616 616 /* Handle case when 'columns' value wasn't yet initialized. */ /* Handle case when 'columns' value wasn't yet initialized. */
617 617 if(val.int_val == INT_MIN) if(val.int_val == INT_MIN)
618 618 { {
619 val.int_val = getmaxx(stdscr);
619 val.int_val = curr_stats.initial_columns;
620 if(val.int_val == INT_MIN)
621 {
622 val.int_val = getmaxx(stdscr);
623 }
620 624 } }
621 625
622 626 if(val.int_val < MIN_TERM_WIDTH) if(val.int_val < MIN_TERM_WIDTH)
 
... ... lines_handler(OPT_OP op, optval_t val)
781 785 /* Handle case when 'lines' value wasn't yet initialized. */ /* Handle case when 'lines' value wasn't yet initialized. */
782 786 if(val.int_val == INT_MIN) if(val.int_val == INT_MIN)
783 787 { {
784 val.int_val = getmaxy(stdscr);
788 val.int_val = curr_stats.initial_lines;
789 if(val.int_val == INT_MIN)
790 {
791 val.int_val = getmaxy(stdscr);
792 }
785 793 } }
786 794
787 795 if(val.int_val < MIN_TERM_HEIGHT) if(val.int_val < MIN_TERM_HEIGHT)
File src/status.c changed (mode: 100644) (index 473d6be53..b098f1796)
25 25 #endif #endif
26 26
27 27 #include <assert.h> /* assert() */ #include <assert.h> /* assert() */
28 #include <limits.h>
28 #include <limits.h> /* INT_MIN */
29 29 #include <string.h> #include <string.h>
30 30
31 31 #include "cfg/config.h" #include "cfg/config.h"
 
... ... load_def_values(status_t *stats)
113 113 stats->env_type = ENVTYPE_EMULATOR; stats->env_type = ENVTYPE_EMULATOR;
114 114
115 115 stats->using_screen = 0; stats->using_screen = 0;
116
117 stats->initial_lines = INT_MIN;
118 stats->initial_columns = INT_MIN;
116 119 } }
117 120
118 121 static void static void
File src/status.h changed (mode: 100644) (index 28937ed76..1a8ebd913)
... ... typedef struct
119 119 /* Stores last command-line mode command that was executed or an empty line /* Stores last command-line mode command that was executed or an empty line
120 120 * (e.g. right after startup or :restart command). */ * (e.g. right after startup or :restart command). */
121 121 char *last_cmdline_command; char *last_cmdline_command;
122
123 int initial_lines; /* Initial terminal height in lines. */
124 int initial_columns; /* Initial terminal width in characters. */
122 125 } }
123 126 status_t; status_t;
124 127
File src/ui.c changed (mode: 100644) (index 2f1ea715b..7611a87e7)
... ... resize_all(void)
1097 1097 getmaxyx(stdscr, screen_y, screen_x); getmaxyx(stdscr, screen_y, screen_x);
1098 1098 cfg.lines = screen_y; cfg.lines = screen_y;
1099 1099 cfg.columns = screen_x; cfg.columns = screen_x;
1100
1101 if(curr_stats.initial_lines == INT_MIN)
1102 {
1103 curr_stats.initial_lines = screen_y;
1104 curr_stats.initial_columns = screen_x;
1105 }
1106
1100 1107 load_geometry(); load_geometry();
1101 1108
1102 1109 LOG_INFO_MSG("screen_y = %d; screen_x = %d", screen_y, screen_x); LOG_INFO_MSG("screen_y = %d; screen_x = %d", screen_y, screen_x);
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/vifm

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/vifm

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master