1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
From f0b064b47bfa046da941f5029cdc1b4c851553ce Mon Sep 17 00:00:00 2001
From: "Thomas E. Dickey" <dickey@invisible-island.net>
Date: Sat, 18 Mar 2017 21:44:28 +0000
Subject: [PATCH] snapshot of project "lynx", label v2-8-9dev_11m
---
CHANGES | 5 +++--
src/LYCurses.c | 18 ++++++++++++------
src/LYStrings.c | 7 ++++---
3 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/src/LYCurses.c b/src/LYCurses.c
index 6b839c28..63b73ece 100644
--- a/src/LYCurses.c
+++ b/src/LYCurses.c
@@ -1696,7 +1696,7 @@ void lynx_enable_mouse(int state)
void lynx_nl2crlf(int normal GCC_UNUSED)
{
#if defined(NCURSES_VERSION_PATCH) && defined(SET_TTY) && defined(TERMIOS) && defined(ONLCR)
- static TTY saved_tty;
+ static struct termios saved_tty;
static int did_save = FALSE;
static int waiting = FALSE;
static int can_fix = TRUE;
@@ -1705,8 +1705,10 @@ void lynx_nl2crlf(int normal GCC_UNUSED)
if (cur_term == 0) {
can_fix = FALSE;
} else {
- saved_tty = cur_term->Nttyb;
+ tcgetattr(fileno(stdout), &saved_tty);
did_save = TRUE;
+ if ((saved_tty.c_oflag & ONLCR))
+ can_fix = FALSE;
#if NCURSES_VERSION_PATCH < 20010529
/* workaround for optimizer bug with nonl() */
if ((tigetstr("cud1") != 0 && *tigetstr("cud1") == '\n')
@@ -1718,14 +1720,18 @@ void lynx_nl2crlf(int normal GCC_UNUSED)
if (can_fix) {
if (normal) {
if (!waiting) {
- cur_term->Nttyb.c_oflag |= ONLCR;
+ struct termios alter_tty = saved_tty;
+
+ alter_tty.c_oflag |= ONLCR;
+ tcsetattr(fileno(stdout), TCSAFLUSH, &alter_tty);
+ def_prog_mode();
waiting = TRUE;
nonl();
}
} else {
if (waiting) {
- cur_term->Nttyb = saved_tty;
- SET_TTY(fileno(stdout), &saved_tty);
+ tcsetattr(fileno(stdout), TCSAFLUSH, &saved_tty);
+ def_prog_mode();
waiting = FALSE;
nl();
LYrefresh();
diff --git a/src/LYStrings.c b/src/LYStrings.c
index e97481c2..02b1286d 100644
--- a/src/LYStrings.c
+++ b/src/LYStrings.c
@@ -1004,12 +1004,13 @@ static const char *expand_tiname(const char *first, size_t len, char **result, c
{
char name[BUFSIZ];
int code;
+ TERMTYPE *tp = (TERMTYPE *) (cur_term);
LYStrNCpy(name, first, len);
if ((code = lookup_tiname(name, strnames)) >= 0
|| (code = lookup_tiname(name, strfnames)) >= 0) {
- if (cur_term->type.Strings[code] != 0) {
- LYStrNCpy(*result, cur_term->type.Strings[code], (final - *result));
+ if (tp->Strings[code] != 0) {
+ LYStrNCpy(*result, tp->Strings[code], (final - *result));
(*result) += strlen(*result);
}
}
|