Update TTE:

- Help via @notify

git-svn-id: svn://kolibrios.org@8127 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
maxcodehack 2020-11-02 12:07:36 +00:00
parent 0e597e6d0a
commit 47f30eaa44
2 changed files with 64 additions and 4 deletions

29
programs/other/tte/notify.h Executable file
View File

@ -0,0 +1,29 @@
typedef unsigned int uint32_t;
static inline
int start_app(char *app_name, char *args){
#pragma pack(push, 1)
struct file_op_t
{
uint32_t fn;
uint32_t flags;
char* args;
uint32_t res1, res2;
char zero;
char* app_name __attribute__((packed));
} file_op;
#pragma pack(pop)
memset(&file_op, 0, sizeof(file_op));
file_op.fn = 7;
file_op.args = args;
file_op.app_name = app_name;
register int val;
asm volatile ("int $0x40":"=a"(val):"a"(70), "b"(&file_op));
return val;
}
void notify(char *text) {
start_app("/sys/@notify", text);
}

View File

@ -14,9 +14,10 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* Kolibri port by Siemargl 2018 and update by maxcodehack 2020
* my fixes mostly commented with triple comment ///
* */
*/
/*** Include section ***/
@ -45,6 +46,8 @@
///#include <unistd.h>
#include <conio.h>
/// Notify
#include "notify.h"
/*** Define section ***/
@ -1723,6 +1726,7 @@ void initEditor() {
}
void printHelp() {
/*
printf("Usage: tte [OPTIONS] [FILE]\n\n");
printf("\nKEYBINDINGS\n-----------\n\n");
printf("Keybinding\t\tAction\n\n");
@ -1742,6 +1746,29 @@ void printHelp() {
printf("-v | --version\t\tPrints the version of tte\n");
printf("\n\nFor now, usage of ISO 8859-1 is recommended.\n");
*/
/// NOTIFY HOTKEYS
char* __help__ =
"'Hotkeys: \n\
^Q, ^Z Exit \n\
Ctrl-S Save \n\
Ctrl-F Search. Esc, \n\
enter and arrows to interact once searching \n\
Ctrl-E Flip line upwards \n\
Ctrl-D Flip line downwards \n\
Ctrl-C Copy line \n\
Ctrl-X Cut line \n\
Ctrl-V Paste line' -t -I";
notify(__help__);
/// NOTIFY OPTIONS
__help__ =
"'Options:\n\
-h, --help Prints the help \n\
-v, --version Prints the version of tte \n\
For now, usage of ISO 8859-1 is recommended.\n' -t -I";
notify(__help__);
}
// 1 if editor should open, 0 otherwise, -1 if the program should exit
@ -1754,7 +1781,11 @@ int handleArgs(int argc, char* argv[]) {
printHelp();
return -1;
} else if(strncmp("-v", argv[1], 2) == 0 || strncmp("--version", argv[1], 9) == 0) {
printf("tte - version %s\n", TTE_VERSION);
char* _notify_version = "'Version:\n";
strcat(_notify_version, TTE_VERSION);
strcat(_notify_version, "' -t -I");
/// printf("tte - version %s\n", TTE_VERSION);
notify(_notify_version);
return -1;
}
}