1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-03-22 06:38:37 -05:00

Default handling of VT100 line drawing characters in cut and paste is

now to translate them into poor man's characters (+--+ and |). We also
have an option to disable this (and map line drawing characters to the
corresponding ASCII code as before). Thanks to Robert de Bath.

[originally from svn r1029]
This commit is contained in:
Simon Tatham 2001-04-09 11:59:35 +00:00
parent ab3443b9e6
commit 2c39b69a52
4 changed files with 42 additions and 28 deletions

View File

@ -52,6 +52,7 @@
#define ERASE_CHAR (ATTR_DEFAULT | ' ') #define ERASE_CHAR (ATTR_DEFAULT | ' ')
#define ATTR_MASK 0xFFFFFF00UL #define ATTR_MASK 0xFFFFFF00UL
#define CHAR_MASK 0x000000FFUL #define CHAR_MASK 0x000000FFUL
#define CSET_MASK 0x00F00000UL /* mask for character set */
typedef HDC Context; typedef HDC Context;
#define SEL_NL { 13, 10 } #define SEL_NL { 13, 10 }
@ -232,6 +233,7 @@ typedef struct {
unsigned char colours[22][3]; unsigned char colours[22][3];
/* Selection options */ /* Selection options */
int mouse_is_xterm; int mouse_is_xterm;
int rawcnp;
short wordness[256]; short wordness[256];
/* translations */ /* translations */
VT_Mode vtmode; VT_Mode vtmode;

View File

@ -124,6 +124,7 @@ void save_settings (char *section, int do_host, Config *cfg) {
cfg->colours[i][1], cfg->colours[i][2]); cfg->colours[i][1], cfg->colours[i][2]);
write_setting_s (sesskey, buf, buf2); write_setting_s (sesskey, buf, buf2);
} }
write_setting_i (sesskey, "RawCNP", cfg->rawcnp);
write_setting_i (sesskey, "MouseIsXterm", cfg->mouse_is_xterm); write_setting_i (sesskey, "MouseIsXterm", cfg->mouse_is_xterm);
for (i=0; i<256; i+=32) { for (i=0; i<256; i+=32) {
char buf[20], buf2[256]; char buf[20], buf2[256];
@ -296,6 +297,7 @@ void load_settings (char *section, int do_host, Config *cfg) {
cfg->colours[i][2] = c2; cfg->colours[i][2] = c2;
} }
} }
gppi (sesskey, "RawCNP", 0, &cfg->rawcnp);
gppi (sesskey, "MouseIsXterm", 0, &cfg->mouse_is_xterm); gppi (sesskey, "MouseIsXterm", 0, &cfg->mouse_is_xterm);
for (i=0; i<256; i+=32) { for (i=0; i<256; i+=32) {
static char *defaults[] = { static char *defaults[] = {

View File

@ -1948,34 +1948,34 @@ static void clipme(unsigned long *top, unsigned long *bottom, char *workbuf) {
} }
while (top < nlpos && top < bottom) while (top < nlpos && top < bottom)
{ {
#if 0
/* VT Specials -> ISO8859-1 */
static const char poorman2[] =
"* # HTFFCRLF\xB0 \xB1 NLVT+ + + + + - - - - - + + + + | <=>=PI!=\xA3 \xB7 ";
#endif
int ch = (*top & CHAR_MASK); int ch = (*top & CHAR_MASK);
int set = (*top & CSET_MASK);
#if 0 /* VT Specials -> ISO8859-1 for Cut&Paste */
if ((*top & ATTR_LINEDRW) && ch >= 0x60 && ch < 0x7F) { static const unsigned char poorman2[] =
int x; "* # HTFFCRLF\xB0 \xB1 NLVT+ + + + + - - - - - + + + + | <=>=PI!=\xA3 \xB7 ";
*wbptr++ = poorman2[2*(ch-0x60)];
if ( (x = poorman2[2*(ch-0x60)+1]) != ' ') if (set && !cfg.rawcnp) {
*wbptr++ = x; if (set == ATTR_LINEDRW && ch >= 0x60 && ch < 0x7F) {
} else int x;
#endif if ((x = poorman2[2*(ch-0x60)+1]) == ' ')
#if 0 x = 0;
if ((*top & ATTR_GBCHR) && ch == '#') ch = (x<<8) + poorman2[2*(ch-0x60)];
*wbptr++ = (unsigned char) 0xA3; }
else }
#endif
if ( wblen == buflen ) while(ch != 0) {
{ if (cfg.rawcnp || !!(ch&0xE0)) {
workbuf = srealloc(workbuf, buflen += 100); if ( wblen == buflen )
wbptr = workbuf + wblen; {
workbuf = srealloc(workbuf, buflen += 100);
wbptr = workbuf + wblen;
}
wblen++;
*wbptr++ = (unsigned char) ch;
}
ch>>=8;
} }
wblen++;
*wbptr++ = (unsigned char) ch;
top++; top++;
} }
if (nl) { if (nl) {

View File

@ -385,6 +385,7 @@ enum { IDCX_ABOUT = IDC_ABOUT, IDCX_TVSTATIC, IDCX_TREEVIEW, controlstartvalue,
IDC_TITLE_SELECTION, IDC_TITLE_SELECTION,
IDC_BOX_SELECTION1, IDC_BOX_SELECTION1,
IDC_BOX_SELECTION2, IDC_BOX_SELECTION2,
IDC_BOX_SELECTION3,
IDC_MBSTATIC, IDC_MBSTATIC,
IDC_MBWINDOWS, IDC_MBWINDOWS,
IDC_MBXTERM, IDC_MBXTERM,
@ -393,6 +394,7 @@ enum { IDCX_ABOUT = IDC_ABOUT, IDCX_TVSTATIC, IDCX_TREEVIEW, controlstartvalue,
IDC_CCSET, IDC_CCSET,
IDC_CCSTATIC2, IDC_CCSTATIC2,
IDC_CCEDIT, IDC_CCEDIT,
IDC_RAWCNP,
selectionpanelend, selectionpanelend,
colourspanelstart, colourspanelstart,
@ -591,6 +593,7 @@ static void init_dlg_ctrls(HWND hwnd) {
CheckRadioButton (hwnd, IDC_MBWINDOWS, IDC_MBXTERM, CheckRadioButton (hwnd, IDC_MBWINDOWS, IDC_MBXTERM,
cfg.mouse_is_xterm ? IDC_MBXTERM : IDC_MBWINDOWS); cfg.mouse_is_xterm ? IDC_MBXTERM : IDC_MBWINDOWS);
CheckDlgButton (hwnd, IDC_RAWCNP, cfg.rawcnp);
{ {
static int tabs[4] = {25, 61, 96, 128}; static int tabs[4] = {25, 61, 96, 128};
SendDlgItemMessage (hwnd, IDC_CCLIST, LB_SETTABSTOPS, 4, SendDlgItemMessage (hwnd, IDC_CCLIST, LB_SETTABSTOPS, 4,
@ -906,20 +909,25 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) {
} }
if (panel == selectionpanelstart) { if (panel == selectionpanelstart) {
/* The Selection panel. Accelerators used: [acgo] wx hst */ /* The Selection panel. Accelerators used: [acgo] d wx hst */
struct ctlpos cp; struct ctlpos cp;
ctlposinit(&cp, hwnd, 80, 3, 13); ctlposinit(&cp, hwnd, 80, 3, 13);
bartitle(&cp, "Options controlling copy and paste", bartitle(&cp, "Options controlling copy and paste",
IDC_TITLE_SELECTION); IDC_TITLE_SELECTION);
beginbox(&cp, "Control which mouse button does which thing", beginbox(&cp, "Translation of pasted characters",
IDC_BOX_SELECTION1); IDC_BOX_SELECTION1);
checkbox(&cp, "&Don't translate line drawing chars into +, - and |",
IDC_RAWCNP);
endbox(&cp);
beginbox(&cp, "Control which mouse button does which thing",
IDC_BOX_SELECTION2);
radiobig(&cp, "Action of mouse buttons:", IDC_MBSTATIC, radiobig(&cp, "Action of mouse buttons:", IDC_MBSTATIC,
"&Windows (Right pastes, Middle extends)", IDC_MBWINDOWS, "&Windows (Right pastes, Middle extends)", IDC_MBWINDOWS,
"&xterm (Right extends, Middle pastes)", IDC_MBXTERM, "&xterm (Right extends, Middle pastes)", IDC_MBXTERM,
NULL); NULL);
endbox(&cp); endbox(&cp);
beginbox(&cp, "Control the select-one-word-at-a-time mode", beginbox(&cp, "Control the select-one-word-at-a-time mode",
IDC_BOX_SELECTION2); IDC_BOX_SELECTION3);
charclass(&cp, "C&haracter classes:", IDC_CCSTATIC, IDC_CCLIST, charclass(&cp, "C&haracter classes:", IDC_CCSTATIC, IDC_CCLIST,
"&Set", IDC_CCSET, IDC_CCEDIT, "&Set", IDC_CCSET, IDC_CCEDIT,
"&to class", IDC_CCSTATIC2); "&to class", IDC_CCSTATIC2);
@ -1842,6 +1850,8 @@ static int GenericMainDlgProc (HWND hwnd, UINT msg,
SetDlgItemText (hwnd, IDC_PKEDIT, cfg.keyfile); SetDlgItemText (hwnd, IDC_PKEDIT, cfg.keyfile);
} }
break; break;
case IDC_RAWCNP:
cfg.rawcnp = IsDlgButtonChecked (hwnd, IDC_RAWCNP);
case IDC_MBWINDOWS: case IDC_MBWINDOWS:
case IDC_MBXTERM: case IDC_MBXTERM:
cfg.mouse_is_xterm = IsDlgButtonChecked (hwnd, IDC_MBXTERM); cfg.mouse_is_xterm = IsDlgButtonChecked (hwnd, IDC_MBXTERM);