mirror of
https://github.com/MidnightCommander/mc
synced 2025-02-02 00:16:04 +03:00
* slcommon.c, sldisplay.c, slerr.c, slgetkey.c, slmisc.c, slsignal.c,
slsmg.c, slstring.c, sltermin.c, slutty.c, include/_slang.h, include/slang.h: Patch to slang-2.0.6 leaving local patches intact.
This commit is contained in:
parent
1c32268bf9
commit
56ba3ed4b3
@ -1,3 +1,18 @@
|
||||
2006-02-15 Leonard den Ottolander <leonard den ottolander nl>
|
||||
|
||||
* slcommon.c: Patch to slang-2.0.6 leaving local patches intact.
|
||||
* sldisply.c: Likewise.
|
||||
* slerr.c: Likewise.
|
||||
* slgetkey.c: Likewise.
|
||||
* slmisc.c: Likewise.
|
||||
* slsignal.c: Likewise.
|
||||
* slsmg.c: Likewise.
|
||||
* slstring.c: Likewise.
|
||||
* sltermin.c: Likewise.
|
||||
* slutty.c: Likewise.
|
||||
* include/_slang.h: Likewise.
|
||||
* include/slang.h: Likewise.
|
||||
|
||||
2006-02-01 Vladimir Nadvorknik <nadvornik@suse.cz>
|
||||
|
||||
* slcommon.c (utf8_enable_function): Use '==' instead of '=' for
|
||||
|
@ -3,7 +3,7 @@
|
||||
/* header file for S-Lang internal structures that users do not (should not)
|
||||
need. Use slang.h for that purpose. */
|
||||
/*
|
||||
Copyright (C) 2004, 2005 John E. Davis
|
||||
Copyright (C) 2004, 2005, 2006 John E. Davis
|
||||
|
||||
This file is part of the S-Lang Library.
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define DAVIS_SLANG_H_
|
||||
/* -*- mode: C; mode: fold; -*- */
|
||||
/*
|
||||
Copyright (C) 2004, 2005 John E. Davis
|
||||
Copyright (C) 2004, 2005, 2006 John E. Davis
|
||||
|
||||
This file is part of the S-Lang Library.
|
||||
|
||||
@ -22,8 +22,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA.
|
||||
*/
|
||||
|
||||
#define SLANG_VERSION 20005
|
||||
#define SLANG_VERSION_STRING "2.0.5"
|
||||
#define SLANG_VERSION 20006
|
||||
#define SLANG_VERSION_STRING "2.0.6"
|
||||
/* #ifdef __DATE__ */
|
||||
/* # define SLANG_VERSION_STRING SLANG_VERSION_STRING0 " " __DATE__ */
|
||||
/* #else */
|
||||
|
@ -2,7 +2,7 @@
|
||||
* links to the library.
|
||||
*/
|
||||
/*
|
||||
Copyright (C) 2004, 2005 John E. Davis
|
||||
Copyright (C) 2004, 2005, 2006 John E. Davis
|
||||
|
||||
This file is part of the S-Lang Library.
|
||||
|
||||
@ -87,7 +87,7 @@ static int utf8_enable (int mode)
|
||||
|
||||
(void) setlocale (LC_ALL, "");
|
||||
|
||||
#ifdef HAVE_NL_LANGINFO
|
||||
#ifdef HAVE_NL_LANGINFO_CODESET
|
||||
locale = nl_langinfo (CODESET);
|
||||
if ((locale != NULL) && (*locale))
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 2004, 2005 John E. Davis
|
||||
Copyright (C) 2004, 2005, 2006 John E. Davis
|
||||
|
||||
This file is part of the S-Lang Library.
|
||||
|
||||
@ -159,7 +159,7 @@ Brush_Info_Type;
|
||||
static Brush_Info_Type Brush_Table[JMAX_COLORS];
|
||||
|
||||
/* 0 if least significant bit is blue, not red */
|
||||
static int Is_Fg_BGR = 0;
|
||||
/* static int Is_Fg_BGR = 0; */
|
||||
static int Is_Bg_BGR = 0;
|
||||
#define COLOR_ARG(color, is_bgr) ((is_bgr) ? RGB_to_BGR[(color)&0x7] : (color))
|
||||
static SLCONST int RGB_to_BGR[] =
|
||||
@ -1508,16 +1508,35 @@ static void write_string_with_care (char *str)
|
||||
len = strlen (str);
|
||||
if (Automatic_Margins && (Cursor_r + 1 == SLtt_Screen_Rows))
|
||||
{
|
||||
if (len + (unsigned int) Cursor_c >= (unsigned int) SLtt_Screen_Cols)
|
||||
{
|
||||
/* For now, just do not write there. Later, something more
|
||||
* sophisticated will be implemented.
|
||||
*/
|
||||
if (SLtt_Screen_Cols > Cursor_c)
|
||||
len = SLtt_Screen_Cols - Cursor_c - 1;
|
||||
else
|
||||
len = 0;
|
||||
}
|
||||
if (_pSLtt_UTF8_Mode == 0)
|
||||
{
|
||||
if (len + (unsigned int) Cursor_c >= (unsigned int) SLtt_Screen_Cols)
|
||||
{
|
||||
/* For now, just do not write there. Later, something more
|
||||
* sophisticated will be implemented.
|
||||
*/
|
||||
if (SLtt_Screen_Cols > Cursor_c)
|
||||
len = SLtt_Screen_Cols - Cursor_c - 1;
|
||||
else
|
||||
len = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned int nchars = SLutf8_strlen((SLuchar_Type *)str, 1);
|
||||
if (nchars + (unsigned int) Cursor_c >= (unsigned int) SLtt_Screen_Cols)
|
||||
{
|
||||
if (SLtt_Screen_Cols > Cursor_c)
|
||||
{
|
||||
char *p;
|
||||
nchars = SLtt_Screen_Cols - Cursor_c - 1;
|
||||
p = (char *)SLutf8_skip_chars((SLuchar_Type *) str, (SLuchar_Type *)(str + len), nchars, NULL, 1);
|
||||
len = p - str;
|
||||
}
|
||||
else
|
||||
len = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
tt_write (str, len);
|
||||
}
|
||||
@ -2126,10 +2145,11 @@ static void get_color_info (void)
|
||||
|
||||
static int Termcap_Initalized = 0;
|
||||
|
||||
/* #define USE_TERMCAP 1 */
|
||||
#ifdef USE_TERMCAP
|
||||
/* Termcap based system */
|
||||
static char Termcap_Buf[4096];
|
||||
static char Termcap_String_Buf[4096];
|
||||
/* static char Termcap_String_Buf[4096]; */
|
||||
/* static char *Termcap_String_Ptr; */
|
||||
extern char *tgetstr(char *, char **);
|
||||
extern int tgetent(char *, char *);
|
||||
@ -2181,14 +2201,22 @@ char *SLtt_tgetstr (char *cap)
|
||||
{
|
||||
char *s;
|
||||
#ifdef USE_TERMCAP
|
||||
char *tmp_area;
|
||||
char area_buf[4096];
|
||||
char *area;
|
||||
#endif
|
||||
if (Termcap_Initalized == 0)
|
||||
return NULL;
|
||||
|
||||
#ifdef USE_TERMCAP
|
||||
tmp_area = (char*) &Termcap_String_Buf;
|
||||
s = tgetstr (cap, &tmp_area);
|
||||
/* tmp_area = &Termcap_String_Buf; */
|
||||
area = area_buf;
|
||||
s = tgetstr (cap, &area);
|
||||
if (area > area_buf + sizeof(area_buf))
|
||||
{
|
||||
SLang_exit_error ("\
|
||||
The termcap tgetstr appears to have overflowed a buffer.\n\
|
||||
The integrity of this program has been violated.\n");
|
||||
}
|
||||
#else
|
||||
s = _pSLtt_tigetstr (Terminfo, cap);
|
||||
#endif
|
||||
@ -2200,7 +2228,20 @@ char *SLtt_tgetstr (char *cap)
|
||||
if (0 == strcmp (cap, "ac"))
|
||||
return s;
|
||||
|
||||
return fixup_tgetstr (s);
|
||||
s = fixup_tgetstr (s);
|
||||
#ifdef USE_TERMCAP
|
||||
if ((s >= area_buf) && (s < area_buf + sizeof(area_buf)))
|
||||
{
|
||||
/* It looks like tgetstr placed the object in the buffer and
|
||||
* returned a pointer to that buffer. So, we have to make a
|
||||
* copy of it.
|
||||
*
|
||||
* Yes, this introduces a leak...
|
||||
*/
|
||||
s = SLmake_string (s);
|
||||
}
|
||||
#endif
|
||||
return s;
|
||||
}
|
||||
|
||||
int SLtt_tgetnum (char *s)
|
||||
@ -2530,13 +2571,13 @@ int SLtt_initialize (char *term)
|
||||
if (Color_Fg_Str == NULL)
|
||||
{
|
||||
Color_Fg_Str = SLtt_tgetstr ("Sf"); /* setf */
|
||||
Is_Fg_BGR = (Color_Fg_Str != NULL);
|
||||
/* Is_Fg_BGR = (Color_Fg_Str != NULL); */
|
||||
}
|
||||
Color_Bg_Str = SLtt_tgetstr ("AB"); /* ANSI setbf */
|
||||
if (Color_Bg_Str == NULL)
|
||||
{
|
||||
Color_Bg_Str = SLtt_tgetstr ("Sb"); /* setb */
|
||||
Is_Bg_BGR = (Color_Bg_Str != NULL);
|
||||
/* Is_Fg_BGR = (Color_Bg_Str != NULL); */
|
||||
}
|
||||
|
||||
if ((Max_Terminfo_Colors = SLtt_tgetnum ("Co")) < 0)
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* error handling common to all routines. */
|
||||
/*
|
||||
Copyright (C) 2004, 2005 John E. Davis
|
||||
Copyright (C) 2004, 2005, 2006 John E. Davis
|
||||
|
||||
This file is part of the S-Lang Library.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 2004, 2005 John E. Davis
|
||||
Copyright (C) 2004, 2005, 2006 John E. Davis
|
||||
|
||||
This file is part of the S-Lang Library.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 2004, 2005 John E. Davis
|
||||
Copyright (C) 2004, 2005, 2006 John E. Davis
|
||||
|
||||
This file is part of the S-Lang Library.
|
||||
|
||||
@ -39,9 +39,11 @@ char *_pSLexpand_escaped_char(char *p, SLwchar_Type *ch, int *isunicodep)
|
||||
SLwchar_Type num, base = 0;
|
||||
SLwchar_Type ch1;
|
||||
int isunicode;
|
||||
int needs_brace;
|
||||
|
||||
ch1 = *p++;
|
||||
isunicode = 0;
|
||||
needs_brace = 0;
|
||||
|
||||
switch (ch1)
|
||||
{
|
||||
@ -70,6 +72,9 @@ char *_pSLexpand_escaped_char(char *p, SLwchar_Type *ch, int *isunicodep)
|
||||
num = 0;
|
||||
break;
|
||||
|
||||
case 'u':
|
||||
isunicode = 1;
|
||||
/* drop */
|
||||
case 'x': /* hex */
|
||||
base = 16;
|
||||
max = '9';
|
||||
@ -84,10 +89,18 @@ char *_pSLexpand_escaped_char(char *p, SLwchar_Type *ch, int *isunicodep)
|
||||
i++;
|
||||
if (p[i] != '}')
|
||||
{
|
||||
SLang_verror (SL_UNICODE_ERROR, "Escaped unicode character missing closing }.");
|
||||
SLang_verror (SL_SYNTAX_ERROR, "Escaped character missing closing }.");
|
||||
return NULL;
|
||||
}
|
||||
isunicode = 1;
|
||||
/* The meaning of \x{...} is mode dependent. If in UTF-8 mode, then
|
||||
* \x{...} always generates a unicode character. Otherwise, the
|
||||
* meaning of \x{...} depends upon the number of characters enclosed
|
||||
* by the brace. If there are less than 3, then assume no unicode.
|
||||
* If greater than or equal to 3, then assume unicode.
|
||||
*/
|
||||
if (isunicode == 0) /* \x... */
|
||||
isunicode = _pSLinterp_UTF8_Mode || (i > 2);
|
||||
needs_brace = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -112,11 +125,11 @@ char *_pSLexpand_escaped_char(char *p, SLwchar_Type *ch, int *isunicodep)
|
||||
p++;
|
||||
}
|
||||
|
||||
if (isunicode)
|
||||
if (needs_brace)
|
||||
{
|
||||
if (*p != '}')
|
||||
{
|
||||
SLang_verror (SL_UNICODE_ERROR, "Malformed Escaped unicode character.");
|
||||
SLang_verror (SL_SYNTAX_ERROR, "Malformed escaped character.");
|
||||
return NULL;
|
||||
}
|
||||
p++;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 2004, 2005 John E. Davis
|
||||
Copyright (C) 2004, 2005, 2006 John E. Davis
|
||||
|
||||
This file is part of the S-Lang Library.
|
||||
|
||||
|
@ -21,7 +21,7 @@ Screen_Type;
|
||||
#define TRASHED 0x2
|
||||
static int Screen_Trashed;
|
||||
|
||||
Screen_Type SL_Screen[SLTT_MAX_SCREEN_ROWS];
|
||||
static Screen_Type SL_Screen[SLTT_MAX_SCREEN_ROWS];
|
||||
static int Start_Col, Start_Row;
|
||||
static unsigned int Screen_Cols, Screen_Rows;
|
||||
static int This_Row, This_Col;
|
||||
@ -1614,7 +1614,6 @@ void SLsmg_draw_object (int r, int c, SLwchar_Type object)
|
||||
void SLsmg_draw_hline (unsigned int n)
|
||||
{
|
||||
static unsigned char hbuf[16];
|
||||
int count;
|
||||
int cmin, cmax;
|
||||
int final_col = This_Col + (int) n;
|
||||
int save_color;
|
||||
@ -1630,7 +1629,6 @@ void SLsmg_draw_hline (unsigned int n)
|
||||
}
|
||||
|
||||
n = (unsigned int)(cmax - cmin);
|
||||
count = n / 16;
|
||||
|
||||
save_color = This_Color;
|
||||
This_Color |= SLSMG_ACS_MASK;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 2004, 2005 John E. Davis
|
||||
Copyright (C) 2004, 2005, 2006 John E. Davis
|
||||
|
||||
This file is part of the S-Lang Library.
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright (C) 2004, 2005 John E. Davis
|
||||
Copyright (C) 2004, 2005, 2006 John E. Davis
|
||||
|
||||
This file is part of the S-Lang Library.
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* slutty.c --- Unix Low level terminal (tty) functions for S-Lang */
|
||||
/*
|
||||
Copyright (C) 2004, 2005 John E. Davis
|
||||
Copyright (C) 2004, 2005, 2006 John E. Davis
|
||||
|
||||
This file is part of the S-Lang Library.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user