aboutsummaryrefslogtreecommitdiff
path: root/screen.c
diff options
context:
space:
mode:
Diffstat (limited to 'screen.c')
-rw-r--r--screen.c63
1 files changed, 39 insertions, 24 deletions
diff --git a/screen.c b/screen.c
index 3837c8f5..12ca4d17 100644
--- a/screen.c
+++ b/screen.c
@@ -81,11 +81,15 @@ screen_init(struct screen *s, u_int sx, u_int sy, u_int hlimit)
s->path = NULL;
s->cstyle = SCREEN_CURSOR_DEFAULT;
- s->ccolour = xstrdup("");
+ s->default_cstyle = SCREEN_CURSOR_DEFAULT;
+ s->default_mode = 0;
+ s->ccolour = -1;
+ s->default_ccolour = -1;
s->tabs = NULL;
s->sel = NULL;
s->write_list = NULL;
+ s->hyperlinks = NULL;
screen_reinit(s);
}
@@ -100,7 +104,7 @@ screen_reinit(struct screen *s)
s->rupper = 0;
s->rlower = screen_size_y(s) - 1;
- s->mode = MODE_CURSOR|MODE_WRAP;
+ s->mode = MODE_CURSOR|MODE_WRAP|(s->mode & MODE_CRLF);
if (options_get_number(global_options, "extended-keys") == 2)
s->mode |= MODE_KEXTENDED;
@@ -115,6 +119,17 @@ screen_reinit(struct screen *s)
screen_clear_selection(s);
screen_free_titles(s);
+ screen_reset_hyperlinks(s);
+}
+
+/* Reset hyperlinks of a screen. */
+void
+screen_reset_hyperlinks(struct screen *s)
+{
+ if (s->hyperlinks == NULL)
+ s->hyperlinks = hyperlinks_init();
+ else
+ hyperlinks_reset(s->hyperlinks);
}
/* Destroy a screen. */
@@ -125,7 +140,6 @@ screen_free(struct screen *s)
free(s->tabs);
free(s->path);
free(s->title);
- free(s->ccolour);
if (s->write_list != NULL)
screen_write_free_list(s);
@@ -134,6 +148,8 @@ screen_free(struct screen *s)
grid_destroy(s->saved_grid);
grid_destroy(s->grid);
+ if (s->hyperlinks != NULL)
+ hyperlinks_free(s->hyperlinks);
screen_free_titles(s);
}
@@ -151,48 +167,47 @@ screen_reset_tabs(struct screen *s)
bit_set(s->tabs, i);
}
-/* Set screen cursor style. */
+/* Set screen cursor style and mode. */
void
-screen_set_cursor_style(struct screen *s, u_int style)
+screen_set_cursor_style(u_int style, enum screen_cursor_style *cstyle,
+ int *mode)
{
- log_debug("%s: new %u, was %u", __func__, style, s->cstyle);
switch (style) {
case 0:
- s->cstyle = SCREEN_CURSOR_DEFAULT;
+ *cstyle = SCREEN_CURSOR_DEFAULT;
break;
case 1:
- s->cstyle = SCREEN_CURSOR_BLOCK;
- s->mode |= MODE_CURSOR_BLINKING;
+ *cstyle = SCREEN_CURSOR_BLOCK;
+ *mode |= MODE_CURSOR_BLINKING;
break;
case 2:
- s->cstyle = SCREEN_CURSOR_BLOCK;
- s->mode &= ~MODE_CURSOR_BLINKING;
+ *cstyle = SCREEN_CURSOR_BLOCK;
+ *mode &= ~MODE_CURSOR_BLINKING;
break;
case 3:
- s->cstyle = SCREEN_CURSOR_UNDERLINE;
- s->mode |= MODE_CURSOR_BLINKING;
+ *cstyle = SCREEN_CURSOR_UNDERLINE;
+ *mode |= MODE_CURSOR_BLINKING;
break;
case 4:
- s->cstyle = SCREEN_CURSOR_UNDERLINE;
- s->mode &= ~MODE_CURSOR_BLINKING;
+ *cstyle = SCREEN_CURSOR_UNDERLINE;
+ *mode &= ~MODE_CURSOR_BLINKING;
break;
case 5:
- s->cstyle = SCREEN_CURSOR_BAR;
- s->mode |= MODE_CURSOR_BLINKING;
+ *cstyle = SCREEN_CURSOR_BAR;
+ *mode |= MODE_CURSOR_BLINKING;
break;
case 6:
- s->cstyle = SCREEN_CURSOR_BAR;
- s->mode &= ~MODE_CURSOR_BLINKING;
+ *cstyle = SCREEN_CURSOR_BAR;
+ *mode &= ~MODE_CURSOR_BLINKING;
break;
}
}
/* Set screen cursor colour. */
void
-screen_set_cursor_colour(struct screen *s, const char *colour)
+screen_set_cursor_colour(struct screen *s, int colour)
{
- free(s->ccolour);
- s->ccolour = xstrdup(colour);
+ s->ccolour = colour;
}
/* Set screen title. */
@@ -660,9 +675,9 @@ screen_mode_to_string(int mode)
static char tmp[1024];
if (mode == 0)
- return "NONE";
+ return ("NONE");
if (mode == ALL_MODES)
- return "ALL";
+ return ("ALL");
*tmp = '\0';
if (mode & MODE_CURSOR)