summaryrefslogtreecommitdiff
path: root/source3/utils/regedit.c
diff options
context:
space:
mode:
authorC. Davis <cd.rattan@gmail.com>2012-08-11 23:22:06 -0700
committerMichael Adam <obnox@samba.org>2013-04-29 13:06:25 +0200
commitdc119eb9b2881c0f3cf92a0c77fe71411a6a1a13 (patch)
treeaabaf93701bd209520448268fea877ee4619d730 /source3/utils/regedit.c
parent485af4a785e16b9a219363be50e996e50bca8f77 (diff)
downloadsamba-dc119eb9b2881c0f3cf92a0c77fe71411a6a1a13.tar.gz
samba-dc119eb9b2881c0f3cf92a0c77fe71411a6a1a13.tar.bz2
samba-dc119eb9b2881c0f3cf92a0c77fe71411a6a1a13.zip
regedit: Cut off the front of the path when screen width is too small.
Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'source3/utils/regedit.c')
-rw-r--r--source3/utils/regedit.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/source3/utils/regedit.c b/source3/utils/regedit.c
index 51528a8d11..efea07b89c 100644
--- a/source3/utils/regedit.c
+++ b/source3/utils/regedit.c
@@ -42,12 +42,14 @@
#define INFO_WIDTH (LINES)
#define PATH_START_Y 0
#define PATH_START_X 6
-#define PATH_MAX_Y (COLS-1)
+#define PATH_MAX_Y (COLS - 1)
+#define PATH_WIDTH (COLS - 6)
#define PATH_WIDTH_MAX 1024
struct regedit {
WINDOW *main_window;
WINDOW *path_label;
+ size_t path_len;
struct value_list *vl;
struct tree_view *keys;
bool tree_input;
@@ -57,13 +59,21 @@ static struct regedit *regedit_main = NULL;
static void show_path(struct regedit *regedit)
{
- prefresh(regedit->path_label, 0, 0, PATH_START_Y, PATH_START_X,
+ int start_pad = 0;
+ int start_win = PATH_START_X;
+
+ if (PATH_START_X + regedit->path_len > COLS) {
+ start_pad = 3 + PATH_START_X + regedit->path_len - COLS;
+ mvprintw(PATH_START_Y, start_win, "...");
+ start_win += 3;
+ }
+ prefresh(regedit->path_label, 0, start_pad, PATH_START_Y, start_win,
PATH_START_Y, PATH_MAX_Y);
}
static void print_path(struct regedit *regedit, struct tree_node *node)
{
- tree_node_print_path(regedit->path_label, node);
+ regedit->path_len = tree_node_print_path(regedit->path_label, node);
}
/* load all available hives */