Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow disabling of statusbar #1168

Merged
merged 1 commit into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions sam.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ enum {
OPTION_SHOW_TABS,
OPTION_SHOW_NEWLINES,
OPTION_SHOW_EOF,
OPTION_STATUSBAR,
OPTION_NUMBER,
OPTION_NUMBER_RELATIVE,
OPTION_CURSOR_LINE,
Expand Down Expand Up @@ -359,6 +360,11 @@ static const OptionDef options[] = {
NULL,
"show-eof"
},
[OPTION_STATUSBAR] = {
{ "statusbar", "sb" },
VIS_OPTION_TYPE_BOOL|VIS_OPTION_NEED_WINDOW,
VIS_HELP("Display status bar")
},
[OPTION_NUMBER] = {
{ "numbers", "nu" },
VIS_OPTION_TYPE_BOOL|VIS_OPTION_NEED_WINDOW,
Expand Down
2 changes: 2 additions & 0 deletions vis-cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,14 @@ static bool cmd_set(Vis *vis, Win *win, Command *cmd, const char *argv[], Select
case OPTION_SHOW_TABS:
case OPTION_SHOW_NEWLINES:
case OPTION_SHOW_EOF:
case OPTION_STATUSBAR:
{
const int values[] = {
[OPTION_SHOW_SPACES] = UI_OPTION_SYMBOL_SPACE,
[OPTION_SHOW_TABS] = UI_OPTION_SYMBOL_TAB|UI_OPTION_SYMBOL_TAB_FILL,
[OPTION_SHOW_NEWLINES] = UI_OPTION_SYMBOL_EOL,
[OPTION_SHOW_EOF] = UI_OPTION_SYMBOL_EOF,
[OPTION_STATUSBAR] = UI_OPTION_STATUSBAR,
};
int flags = view_options_get(win->view);
if (arg.b || (toggle && !(flags & values[opt_index])))
Expand Down
10 changes: 10 additions & 0 deletions vis-lua.c
Original file line number Diff line number Diff line change
Expand Up @@ -1960,6 +1960,12 @@ static int window_options_assign(Win *win, lua_State *L, const char *key, int ne
else
flags &= ~UI_OPTION_SYMBOL_TAB;
view_options_set(win->view, flags);
} else if (strcmp(key, "statusbar") == 0) {
if (lua_toboolean(L, next))
flags |= UI_OPTION_STATUSBAR;
else
flags &= ~UI_OPTION_STATUSBAR;
view_options_set(win->view, flags);
} else if (strcmp(key, "wrapcolumn") == 0 || strcmp(key, "wc") == 0) {
view_wrapcolumn_set(win->view, luaL_checkint(L, next));
} else if (strcmp(key, "tabwidth") == 0 || strcmp(key, "tw") == 0) {
Expand Down Expand Up @@ -2175,6 +2181,7 @@ static const struct luaL_Reg window_funcs[] = {
* @tfield[opt=false] boolean shownewlines
* @tfield[opt=false] boolean showspaces
* @tfield[opt=false] boolean showtabs
* @tfield[opt=true] boolean statusbar
* @tfield[opt=8] int tabwidth {tw}
* @tfield[opt=0] int wrapcolumn {wc}
* @see Vis.options
Expand Down Expand Up @@ -2216,6 +2223,9 @@ static int window_options_index(lua_State *L) {
} else if (strcmp(key, "showtabs") == 0) {
lua_pushboolean(L, view_options_get(win->view) & UI_OPTION_SYMBOL_TAB);
return 1;
} else if (strcmp(key, "statusbar") == 0) {
lua_pushboolean(L, view_options_get(win->view) & UI_OPTION_STATUSBAR);
return 1;
} else if (strcmp(key, "tabwidth") == 0 || strcmp(key, "tw") == 0) {
lua_pushinteger(L, view_tabwidth_get(win->view));
return 1;
Expand Down
Loading