Skip to content

Commit

Permalink
Vertical split patch
Browse files Browse the repository at this point in the history
Ported David Whetstone's vertical split patch, originally written
against v0.6.6, to v0.6.7.
  • Loading branch information
dcohenp committed Jul 23, 2013
1 parent f84b748 commit 0391e9c
Show file tree
Hide file tree
Showing 5 changed files with 188 additions and 41 deletions.
26 changes: 26 additions & 0 deletions cgdb/cgdbrc.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ enum ConfigType {
static int command_set_arrowstyle(const char *value);
static int command_set_cgdb_mode_key(const char *value);
static int command_set_winsplit(const char *value);
static int command_set_splitorientation(const char *value);
static int command_set_timeout(int value);
static int command_set_timeoutlen(int value);
static int command_set_ttimeout(int value);
Expand Down Expand Up @@ -74,6 +75,7 @@ static struct cgdbrc_config_option cgdbrc_config_options[CGDBRC_WRAPSCAN + 1] =
{CGDBRC_TTIMEOUT_LEN, {100}},
{CGDBRC_WINMINHEIGHT, {0}},
{CGDBRC_WINSPLIT, {WIN_SPLIT_EVEN}},
{CGDBRC_SPLITORIENTATION, {SPLIT_HORIZONTAL}},
{CGDBRC_WRAPSCAN, {1}}
};

Expand Down Expand Up @@ -136,6 +138,10 @@ static struct ConfigVariable {
/* winsplit */
{
"winsplit", "winsplit", CONFIG_TYPE_FUNC_STRING, command_set_winsplit},
/* splitorientation */
{
"splitorientation", "so", CONFIG_TYPE_FUNC_STRING,
command_set_splitorientation},
/* wrapscan */
{
"wrapscan", "ws", CONFIG_TYPE_BOOL,
Expand Down Expand Up @@ -334,6 +340,26 @@ int command_set_winsplit(const char *value)
return 0;
}

int command_set_splitorientation(const char *value)
{
struct cgdbrc_config_option option;
SPLIT_ORIENTATION_TYPE orientation = SPLIT_HORIZONTAL;

option.option_kind = CGDBRC_SPLITORIENTATION;

if (strcasecmp(value, "horizontal") == 0)
orientation = SPLIT_HORIZONTAL;
else if (strcasecmp(value, "vertical") == 0)
orientation = SPLIT_VERTICAL;

option.variant.win_orientation_val = orientation;
if (cgdbrc_set_val(option))
return 1;
if_set_splitorientation(orientation);

return 0;
}

static int command_set_winminheight(int value)
{
struct cgdbrc_config_option option;
Expand Down
13 changes: 13 additions & 0 deletions cgdb/cgdbrc.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,16 @@ typedef enum { WIN_SPLIT_FREE = -3, /* split point not on quarter mark */
WIN_SPLIT_TOP_FULL = 2 /* src window is 100% of screen */
} WIN_SPLIT_TYPE;

/** window split orientation type enumeration
*
* SPLIT_VERTICAL and SPLIT_HORIZONTAL refer to the orientation
* of the split between the source and GDB windows.
*/
typedef enum {
SPLIT_HORIZONTAL = 0, /* source above and GDB below (default) */
SPLIT_VERTICAL = 1 /* source left and GDB right */
} SPLIT_ORIENTATION_TYPE;

/** All of the different configuration options */
enum cgdbrc_option_kind {
CGDBRC_ARROWSTYLE,
Expand All @@ -114,6 +124,7 @@ enum cgdbrc_option_kind {
CGDBRC_TTIMEOUT_LEN,
CGDBRC_WINMINHEIGHT,
CGDBRC_WINSPLIT,
CGDBRC_SPLITORIENTATION,
CGDBRC_WRAPSCAN
};

Expand All @@ -139,6 +150,8 @@ struct cgdbrc_config_option {
enum tokenizer_language_support language_support_val;
/* option_kind == CGDBRC_WINSPLIT */
WIN_SPLIT_TYPE win_split_val;
/* option_kind == CGDBRC_WINORIENTATION */
SPLIT_ORIENTATION_TYPE win_orientation_val;
} variant;
};

Expand Down
Loading

0 comments on commit 0391e9c

Please sign in to comment.