summaryrefslogtreecommitdiffstats
path: root/osdep
diff options
context:
space:
mode:
Diffstat (limited to 'osdep')
-rw-r--r--osdep/terminal-unix.c15
-rw-r--r--osdep/terminal-win.c5
-rw-r--r--osdep/terminal.h4
3 files changed, 16 insertions, 8 deletions
diff --git a/osdep/terminal-unix.c b/osdep/terminal-unix.c
index 193cd8557f..de7087b9b8 100644
--- a/osdep/terminal-unix.c
+++ b/osdep/terminal-unix.c
@@ -56,7 +56,8 @@ static volatile int tio_orig_set;
int screen_width = 80;
int screen_height = 24;
-char * erase_to_end_of_line = NULL;
+char *terminal_erase_to_end_of_line = "\033[A";
+char *terminal_cursor_up = "\033[K";
typedef struct {
char *cap;
@@ -267,10 +268,16 @@ static int load_termcap(char *termtype){
#endif
ensure_cap(&termcap_buf, 2048);
- static char term_buf[64];
+ static char term_buf[128];
char *buf_ptr = &term_buf[0];
-
- erase_to_end_of_line = tgetstr("ce", &buf_ptr);
+ char *tmp;
+
+ tmp = tgetstr("ce", &buf_ptr);
+ if (tmp)
+ terminal_erase_to_end_of_line = tmp;
+ tmp = tgetstr("ku", &buf_ptr);
+ if (tmp)
+ terminal_cursor_up = tmp;
screen_width = tgetnum("co");
screen_height = tgetnum("li");
diff --git a/osdep/terminal-win.c b/osdep/terminal-win.c
index 5186c301f2..1ecb520f94 100644
--- a/osdep/terminal-win.c
+++ b/osdep/terminal-win.c
@@ -33,9 +33,10 @@
#include "input/input.h"
#include "terminal.h"
-int screen_width = 80;
+int screen_width = 79;
int screen_height = 24;
-char *erase_to_end_of_line = NULL;
+char *terminal_erase_to_end_of_line = "";
+char *terminal_cursor_up = "";
#define hSTDOUT GetStdHandle(STD_OUTPUT_HANDLE)
#define hSTDERR GetStdHandle(STD_ERROR_HANDLE)
diff --git a/osdep/terminal.h b/osdep/terminal.h
index c524adbc2b..651e31ed71 100644
--- a/osdep/terminal.h
+++ b/osdep/terminal.h
@@ -33,8 +33,8 @@ struct input_ctx;
extern int screen_width;
extern int screen_height;
-/* Termcap code to erase to end of line */
-extern char * erase_to_end_of_line;
+extern char *terminal_erase_to_end_of_line;
+extern char *terminal_cursor_up;
/* Global initialization for terminal output. */
int terminal_init(void);