forked from KolibriOS/kolibrios
Shell 0.7.4. Clipboard works. Ctrl+C copies the whole command line and Ctrl+V pastes it.
git-svn-id: svn://kolibrios.org@4516 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
10c974c8fc
commit
3e68853ae6
@ -1,3 +1,7 @@
|
||||
Shell 0.7.4 // 23.01.2014 // Albom
|
||||
* <20> ¡®â á ¡ãä¥à®¬ ®¡¬¥ (ª®¯¨à®¢ ¨¥ Ctrl+C ¨ ¢áâ ¢ª Ctrl+V áâப¨ 楫¨ª®¬)
|
||||
|
||||
|
||||
Shell 0.7.3 // 28.11.2013 // Albom
|
||||
* ˆá¯à ¢«¥ ®è¨¡ª á ᨬ¢®«®¬ % ¢ ¨áâ®à¨¨ ª®¬ ¤
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
#define SHELL_VERSION "0.7.3"
|
||||
#define SHELL_VERSION "0.7.4"
|
||||
|
||||
extern char PATH[256];
|
||||
extern char PARAM[256];
|
||||
|
@ -35,6 +35,10 @@ unsigned cmdLen = 0;
|
||||
unsigned cmdPos = 0;
|
||||
CMD[0] = '\0';
|
||||
|
||||
int clipNum; // number of clipboard slots
|
||||
char* clipBuf; // clipboard buffer
|
||||
char clipCopy[255+12];
|
||||
|
||||
for (;;)
|
||||
{
|
||||
key = getch();
|
||||
@ -87,6 +91,65 @@ for (;;)
|
||||
break;
|
||||
|
||||
|
||||
case 22: // Ctrl+V
|
||||
clipNum = kol_clip_num();
|
||||
if (clipNum > 0)
|
||||
{
|
||||
clipBuf = kol_clip_get(clipNum-1);
|
||||
// printf("Length: %d, Type: %d, Encoding: %d\n", (int) *clipBuf, (int)*(clipBuf+4), (int)*(clipBuf+8));
|
||||
if ( (int) *clipBuf > 0 ) // is clipboard empty?
|
||||
{
|
||||
if ((int)*(clipBuf+4)==0) // text?
|
||||
{
|
||||
if ((int)*(clipBuf+8)==1) // 866 encoding?
|
||||
|
||||
for (i = cmdPos; i < cmdLen; i++)
|
||||
printf(" ");
|
||||
for (i = cmdLen; i > 0; i--)
|
||||
printf("%c %c", 8, 8);
|
||||
cmdLen = 0;
|
||||
cmdPos = 0;
|
||||
CMD[0] = '\0';
|
||||
|
||||
// strcpy_n
|
||||
for (i = 0; i < 255; i++)
|
||||
{
|
||||
CMD[i]=*(clipBuf+12+i);
|
||||
if (CMD[i]=='\0')
|
||||
break;
|
||||
}
|
||||
|
||||
cmdPos = cmdLen = strlen(CMD);
|
||||
/*
|
||||
printf("Length: %d\n", cmdLen);
|
||||
for (i = 0; i < cmdLen; i++)
|
||||
printf("%d ", CMD[i]);
|
||||
*/
|
||||
printf("%s", CMD);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 3: // Ctrl+C
|
||||
if ( cmdLen > 0 )
|
||||
{
|
||||
|
||||
*clipCopy = 12 + cmdLen;
|
||||
*(clipCopy+4)=0;
|
||||
*(clipCopy+8)=1;
|
||||
|
||||
for (i = 0; i <= cmdLen; i++)
|
||||
*(clipCopy+12+i) = CMD[i];
|
||||
|
||||
kol_clip_set(12+cmdLen, clipCopy);
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
if (cmdLen < 255)
|
||||
{
|
||||
|
@ -421,3 +421,18 @@ void kol_buffer_close(char name[])
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(68), "b"(23), "c"(name));
|
||||
}
|
||||
|
||||
int kol_clip_num()
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(54), "b"(0));
|
||||
}
|
||||
|
||||
char* kol_clip_get(int n)
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(54), "b"(1), "c"(n));
|
||||
}
|
||||
|
||||
int kol_clip_set(int n, char buffer[])
|
||||
{
|
||||
asm volatile ("int $0x40"::"a"(54), "b"(2), "c"(n), "d"(buffer));
|
||||
}
|
||||
|
@ -111,3 +111,6 @@ void kol_get_kernel_ver(char buff16b[]);
|
||||
int kol_kill_process(unsigned process);
|
||||
int kol_buffer_open(char name[], int mode, int size, char **buf);
|
||||
void kol_buffer_close(char name[]);
|
||||
int kol_clip_num();
|
||||
char* kol_clip_get(int n);
|
||||
int kol_clip_set(int n, char buffer[]);
|
||||
|
Loading…
Reference in New Issue
Block a user