1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-25 01:02:24 +00: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 ATTR_MASK 0xFFFFFF00UL
#define CHAR_MASK 0x000000FFUL
#define CSET_MASK 0x00F00000UL /* mask for character set */
typedef HDC Context;
#define SEL_NL { 13, 10 }
@ -232,6 +233,7 @@ typedef struct {
unsigned char colours[22][3];
/* Selection options */
int mouse_is_xterm;
int rawcnp;
short wordness[256];
/* translations */
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]);
write_setting_s (sesskey, buf, buf2);
}
write_setting_i (sesskey, "RawCNP", cfg->rawcnp);
write_setting_i (sesskey, "MouseIsXterm", cfg->mouse_is_xterm);
for (i=0; i<256; i+=32) {
char buf[20], buf2[256];
@ -296,6 +297,7 @@ void load_settings (char *section, int do_host, Config *cfg) {
cfg->colours[i][2] = c2;
}
}
gppi (sesskey, "RawCNP", 0, &cfg->rawcnp);
gppi (sesskey, "MouseIsXterm", 0, &cfg->mouse_is_xterm);
for (i=0; i<256; i+=32) {
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)
{
#if 0
/* VT Specials -> ISO8859-1 */
static const char poorman2[] =
"* # HTFFCRLF\xB0 \xB1 NLVT+ + + + + - - - - - + + + + | <=>=PI!=\xA3 \xB7 ";
#endif
int ch = (*top & CHAR_MASK);
int set = (*top & CSET_MASK);
#if 0
if ((*top & ATTR_LINEDRW) && ch >= 0x60 && ch < 0x7F) {
int x;
*wbptr++ = poorman2[2*(ch-0x60)];
if ( (x = poorman2[2*(ch-0x60)+1]) != ' ')
*wbptr++ = x;
} else
#endif
#if 0
if ((*top & ATTR_GBCHR) && ch == '#')
*wbptr++ = (unsigned char) 0xA3;
else
#endif
if ( wblen == buflen )
{
workbuf = srealloc(workbuf, buflen += 100);
wbptr = workbuf + wblen;
/* VT Specials -> ISO8859-1 for Cut&Paste */
static const unsigned char poorman2[] =
"* # HTFFCRLF\xB0 \xB1 NLVT+ + + + + - - - - - + + + + | <=>=PI!=\xA3 \xB7 ";
if (set && !cfg.rawcnp) {
if (set == ATTR_LINEDRW && ch >= 0x60 && ch < 0x7F) {
int x;
if ((x = poorman2[2*(ch-0x60)+1]) == ' ')
x = 0;
ch = (x<<8) + poorman2[2*(ch-0x60)];
}
}
while(ch != 0) {
if (cfg.rawcnp || !!(ch&0xE0)) {
if ( wblen == buflen )
{
workbuf = srealloc(workbuf, buflen += 100);
wbptr = workbuf + wblen;
}
wblen++;
*wbptr++ = (unsigned char) ch;
}
ch>>=8;
}
wblen++;
*wbptr++ = (unsigned char) ch;
top++;
}
if (nl) {

View File

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