Implement keyboard paste

PR:		25499
Submitted by:	Gaspar Chilingarov <nm@web.am>
This commit is contained in:
Andrey A. Chernov 2001-03-11 22:51:05 +00:00
parent 9a67c2cd11
commit 4629b5e0fb
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=74118
7 changed files with 28 additions and 5 deletions

View File

@ -87,7 +87,6 @@ static void mouse_cut_end(scr_stat *scp);
static void mouse_cut_word(scr_stat *scp);
static void mouse_cut_line(scr_stat *scp);
static void mouse_cut_extend(scr_stat *scp);
static void mouse_paste(scr_stat *scp);
#endif /* SC_NO_CUTPASTE */
#ifndef SC_NO_CUTPASTE
@ -589,8 +588,8 @@ mouse_cut_extend(scr_stat *scp)
}
/* paste cut buffer contents into the current vty */
static void
mouse_paste(scr_stat *scp)
void
sc_mouse_paste(scr_stat *scp)
{
if (scp->status & MOUSE_VISIBLE)
sc_paste(scp, cut_buffer, strlen(cut_buffer));
@ -784,7 +783,7 @@ sc_mouse_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag,
mouse_cut_end(cur_scp);
if (cur_scp->mouse_buttons & MOUSE_BUTTON2DOWN ||
cur_scp->mouse_buttons & MOUSE_BUTTON3DOWN)
mouse_paste(cur_scp);
sc_mouse_paste(cur_scp);
}
#endif /* SC_NO_CUTPASTE */
break;
@ -855,7 +854,7 @@ sc_mouse_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag,
case 0: /* up */
break;
default:
mouse_paste(cur_scp);
sc_mouse_paste(cur_scp);
break;
}
break;

View File

@ -3066,6 +3066,17 @@ scgetc(sc_softc_t *sc, u_int flags)
}
break;
case PASTE:
#ifndef SC_NO_CUTPASTE
/* XXX need to set MOUSE_VISIBLE flag 'cause sc_mouse_paste() */
/* and sc_paste() will not operate without it. */
i = scp->status;
scp->status |= MOUSE_VISIBLE;
sc_mouse_paste(scp);
scp->status = i;
#endif
break;
/* NON-LOCKING KEYS */
case NOP:
case LSH: case RSH: case LCTR: case RCTR:

View File

@ -548,6 +548,7 @@ int sc_inside_cutmark(scr_stat *scp, int pos);
void sc_remove_cutmarking(scr_stat *scp);
void sc_remove_all_cutmarkings(sc_softc_t *scp);
void sc_remove_all_mouse(sc_softc_t *scp);
void sc_mouse_paste(scr_stat *scp);
#else
#define sc_draw_mouse_image(scp)
#define sc_remove_mouse_image(scp)
@ -555,6 +556,7 @@ void sc_remove_all_mouse(sc_softc_t *scp);
#define sc_remove_cutmarking(scp)
#define sc_remove_all_cutmarkings(scp)
#define sc_remove_all_mouse(scp)
#define sc_mouse_paste(scp)
#endif /* SC_NO_CUTPASTE */
#ifndef SC_NO_SYSMOUSE
void sc_mouse_move(scr_stat *scp, int x, int y);

View File

@ -173,6 +173,7 @@ typedef struct keymap keymap_t;
#define RALTA 0xa0 /* right alt key / alt lock */
#define HALT 0xa1 /* halt machine */
#define PDWN 0xa2 /* halt machine and power down */
#define PASTE 0xa3 /* paste from cut-paste buffer */
#define F(x) ((x)+F_FN-1)
#define S(x) ((x)+F_SCR-1)

View File

@ -202,6 +202,8 @@ get_entry()
return HALT | 0x100;
case TPDWN:
return PDWN | 0x100;
case TPASTE:
return PASTE | 0x100;
case TACC:
if (ACC(number) > L_ACC)
return -1;
@ -439,6 +441,9 @@ print_entry(FILE *fp, int value)
case PDWN | 0x100:
fprintf(fp, " pdwn ");
break;
case PASTE | 0x100:
fprintf(fp, " paste ");
break;
default:
if (value & 0x100) {
if (val >= F_FN && val <= L_FN)
@ -638,6 +643,9 @@ dump_entry(int value)
case PDWN:
printf(" PDWN, ");
break;
case PASTE:
printf("PASTE, ");
break;
default:
if (value >= F_FN && value <= L_FN)
printf(" F(%2d),", value - F_FN + 1);

View File

@ -63,6 +63,7 @@
#define TRALTA 288
#define THALT 289
#define TPDWN 290
#define TPASTE 291
extern int number;
extern char letter;

View File

@ -70,6 +70,7 @@ lalta|alta { return TLALTA; }
ralta { return TRALTA; }
halt { return THALT; }
pdwn { return TPDWN; }
paste { return TPASTE; }
NUL|nul { number = 0; return TNUM; }
SOH|soh { number = 1; return TNUM; }