Use the xenl terminfo flag to detect early-wrap terminals like the FreeBSD

console. Many thanks for a very informative email from Christian Weisgerber.
This commit is contained in:
Nicholas Marriott 2009-04-23 21:09:17 +00:00
parent a91ecf44fa
commit 5fbdca890a
4 changed files with 24 additions and 26 deletions

View File

@ -1,3 +1,8 @@
23 April 2009
* Use the xenl terminfo flag to detect early-wrap terminals like the FreeBSD
console. Many thanks for a very informative email from Christian Weisgerber.
21 April 2009
* tmux 0.8 released.
@ -1208,7 +1213,7 @@
(including mutt, emacs). No status bar yet and no key remapping or other
customisation.
$Id: CHANGES,v 1.273 2009-04-23 17:51:57 nicm Exp $
$Id: CHANGES,v 1.274 2009-04-23 21:09:17 nicm Exp $
LocalWords: showw utf UTF fulvio ciriaco joshe OSC APC gettime abc DEF OA clr
LocalWords: rivo nurges lscm Erdely eol smysession mysession ek dstname RB ms

2
TODO
View File

@ -62,8 +62,6 @@
- a confirm-before command which asks "Are you sure? (y/n)" before executing
command, eg bind-key "&" confirm-before "kill-window"
- clear window title on exit
- better support for stupid margin terminals. strcmp for cons25 sucks, how can
these be autodetected?
- refer to windows by name etc (duplicates? fnmatch?)
- the output code (tty.c) could do with optimisation depending on term
capibilities

5
tmux.h
View File

@ -1,4 +1,4 @@
/* $Id: tmux.h,v 1.299 2009-04-03 17:21:46 nicm Exp $ */
/* $Id: tmux.h,v 1.300 2009-04-23 21:09:17 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -317,8 +317,9 @@ enum tty_code_code {
TTYC_SMKX, /* keypad_xmit, ks */
TTYC_SMSO, /* enter_standout_mode, so */
TTYC_SMUL, /* enter_underline_mode, us */
TTYC_XENL, /* eat_newline_glitch, xn */
};
#define NTTYCODE (TTYC_SMUL + 1)
#define NTTYCODE (TTYC_XENL + 1)
/* Termcap types. */
enum tty_code_type {

View File

@ -1,4 +1,4 @@
/* $Id: tty-term.c,v 1.17 2009-03-07 10:29:06 nicm Exp $ */
/* $Id: tty-term.c,v 1.18 2009-04-23 21:09:17 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@ -107,6 +107,7 @@ struct tty_term_code_entry tty_term_codes[NTTYCODE] = {
{ TTYC_SMKX, TTYCODE_STRING, "smkx" },
{ TTYC_SMSO, TTYCODE_STRING, "smso" },
{ TTYC_SMUL, TTYCODE_STRING, "smul" },
{ TTYC_XENL, TTYCODE_FLAG, "xenl" },
};
char *
@ -156,26 +157,6 @@ tty_term_quirks(struct tty_term *term)
term->codes[TTYC_ICH1].value.string = xstrdup("\033[@");
}
}
#ifdef __FreeBSD__
if (strncmp(term->name, "cons", 4) == 0) {
/*
* FreeBSD's console wraps lines at $COLUMNS - 1 rather than
* $COLUMNS (the cursor can never be beyond $COLUMNS - 1) and
* does not appear to support changing this behaviour, or any
* of the obvious possibilities (turning off right margin
* wrapping, insert mode).
*
* This is irritating, most notably because it is impossible to
* write to the very bottom-right of the screen without
* scrolling.
*
* Flag the terminal here and apply some workarounds in other
* places to do the best possible.
*/
term->flags |= TERM_EARLYWRAP;
}
#endif
}
struct tty_term *
@ -323,6 +304,19 @@ tty_term_find(char *name, int fd, char **cause)
if (strstr(name, "88col") != NULL) /* XXX HACK */
term->flags |= TERM_88COLOURS;
/*
* Terminals without xenl (eat newline glitch) wrap at at $COLUMNS - 1
* rather than $COLUMNS (the cursor can never be beyond $COLUMNS - 1).
*
* This is irritating, most notably because it is impossible to write
* to the very bottom-right of the screen without scrolling.
*
* Flag the terminal here and apply some workarounds in other places to
* do the best possible.
*/
if (!tty_term_flag(term, TTYC_XENL))
term->flags |= TERM_EARLYWRAP;
return (term);
error: