API: Implement window_{get,set}_option

This commit is contained in:
Thiago de Arruda 2014-05-11 10:31:31 -03:00
parent 17053bbc39
commit 6226ac34fd
2 changed files with 21 additions and 7 deletions

View File

@ -134,14 +134,27 @@ Object window_set_var(Window window, String name, Object value, Error *err)
return dict_set_value(win->w_vars, name, value, err);
}
String window_get_option(Window window, String name, Error *err)
Object window_get_option(Window window, String name, Error *err)
{
abort();
Object rv;
win_T *win = find_window(window, err);
if (!win) {
return rv;
}
return get_option_from(win, SREQ_WIN, name, err);
}
void window_set_option(Window window, String name, String value, Error *err)
void window_set_option(Window window, String name, Object value, Error *err)
{
abort();
win_T *win = find_window(window, err);
if (!win) {
return;
}
set_option_to(win, SREQ_WIN, name, value, err);
}
Position window_get_pos(Window window, Error *err)

View File

@ -80,15 +80,16 @@ Object window_set_var(Window window, String name, Object value, Error *err);
/// @param name The option name
/// @param[out] err Details of an error that may have occurred
/// @return The option value
String window_get_option(Window window, String name, Error *err);
Object window_get_option(Window window, String name, Error *err);
/// Sets a window option value
/// Sets a window option value. Passing 'nil' as value deletes the option(only
/// works if there's a global fallback)
///
/// @param window The window handle
/// @param name The option name
/// @param value The option value
/// @param[out] err Details of an error that may have occurred
void window_set_option(Window window, String name, String value, Error *err);
void window_set_option(Window window, String name, Object value, Error *err);
/// Gets the window position in display cells. First position is zero.
///