SHELL 0.7.8 changelog

- fixed bug with ctrl+v
- added navigation in current string by Home, End
- directory highlighting in ls command output

git-svn-id: svn://kolibrios.org@7787 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Rustem Gimadutdinov (rgimad) 2020-04-14 14:46:35 +00:00
parent 4ad25a75b3
commit 6bc343bd07
3 changed files with 51 additions and 26 deletions

View File

@ -93,10 +93,13 @@ else
t = (unsigned*) (k70.p16+32+(304)*i); t = (unsigned*) (k70.p16+32+(304)*i);
type_of_file = *t; type_of_file = *t;
int is_folder = 0;
if ( (0x10 == (type_of_file&0x10)) || (8 == (type_of_file&8)) ) { is_folder = 1; strcat(cur_file, "/"); }
if ( (0x10 == (type_of_file&0x10)) || (8 == (type_of_file&8)) ) strcat(cur_file, "/"); if (is_folder) { printf("\033[0;36m"); } // set cyan for folder
printf ("%*s", -longest_name_len, cur_file); printf ("%*s", -longest_name_len, cur_file);
if (is_folder) { printf("\033[0m"); } // is had been set, reset
if ((i>0) && ((i+1)%columns_max == 0)) printf ("\n\r"); if ((i>0) && ((i+1)%columns_max == 0)) printf ("\n\r");
} }

View File

@ -1,5 +1,5 @@
#define SHELL_VERSION "0.7.7" #define SHELL_VERSION "0.7.8"
extern char PATH[256]; extern char PATH[256];
extern char PARAM[256]; extern char PARAM[256];

View File

@ -23,8 +23,30 @@ if (CMD_HISTORY_NUM_REAL < CMD_HISTORY_NUM-1)
CMD_HISTORY_NUM_REAL++; CMD_HISTORY_NUM_REAL++;
} }
// ============================================================
char * insert_string( char s1[], unsigned int pos, const char s2[] )
{
unsigned int n1 = strlen( s1 );
unsigned int n2 = strlen( s2 );
if ( n1 < pos ) pos = n1;
unsigned int i;
for ( i = 0; i < n1 - pos; i++ )
{
s1[n1 + n2 - i - 1] = s1[n1 - i - 1];
}
for ( i = 0; i < n2; i++)
{
s1[pos+i] = s2[i];
}
s1[n1 + n2] = '\0';
return s1;
}
/// =========================================================== /// ===========================================================
@ -102,30 +124,19 @@ for (;;)
{ {
if ((int)*(clipBuf+8)==1) // 866 encoding? if ((int)*(clipBuf+8)==1) // 866 encoding?
{ {
for (i = cmdPos; i < cmdLen; i++) // clear previous text
printf(" "); for (i = cmdPos; i < cmdLen; i++)
for (i = cmdLen; i > 0; i--) printf(" ");
printf("%c %c", 8, 8); for (i = cmdLen; i > 0; i--)
cmdLen = 0; printf("%c %c", 8, 8);
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);
char *pasteText = clipBuf + 12;
int pasteLen = strlen(pasteText);
insert_string(CMD, cmdPos, pasteText);
cmdLen = strlen(CMD);
cmdPos += pasteLen;
printf("%s", CMD);
for (i = 0; i < cmdLen-cmdPos; i++) printf("%c", 8); // rewind the internal console cursor
} }
} }
} }
@ -206,6 +217,17 @@ for (;;)
} }
break; break;
case 0x47: // Home
// move internal cursor and cmdPos to the beginning of the line
for (;cmdPos > 0; cmdPos--) {printf("%c", 8);}
break;
case 0x4F: // End
// move internal cursor and cmdPos to the end of the line
for (;cmdPos < cmdLen; cmdPos++) {printf("%c", CMD[cmdPos]);}
break;
case 75: // Left case 75: // Left
if (cmdPos > 0) if (cmdPos > 0)
{ {