Rev 8127 | Rev 8385 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8127 | Rev 8225 | ||
---|---|---|---|
Line 457... | Line 457... | ||
457 | 457 | ||
458 | /// if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &raw) == -1) |
458 | /// if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &raw) == -1) |
459 | /// die("Failed to set raw mode"); |
459 | /// die("Failed to set raw mode"); |
Line 460... | Line -... | ||
460 | } |
- | |
461 | - | ||
462 | 460 | } |
|
463 | 461 | ||
464 | /// by Siemargl rewritten, still Ctrl+ combination works only in english locale, so need analyze scancode |
462 | /// by Siemargl rewritten, still Ctrl+ combination works only in english locale, so need analyze scancode |
465 | int editorReadKey() { |
463 | int editorReadKey() { |
466 | int key = con_getch2(); |
464 | int key = con_getch2(); |
Line 1796... | Line 1794... | ||
1796 | int main(int argc, char* argv[]) { |
1794 | int main(int argc, char* argv[]) { |
1797 | con_init_console_dll_param(con_def_wnd_width, con_def_wnd_height, con_def_wnd_width, con_def_wnd_height, "TinyTextEditor"); |
1795 | con_init_console_dll_param(con_def_wnd_width, con_def_wnd_height, con_def_wnd_width, con_def_wnd_height, "TinyTextEditor"); |
1798 | initEditor(); |
1796 | initEditor(); |
1799 | int arg_response = handleArgs(argc, argv); |
1797 | int arg_response = handleArgs(argc, argv); |
1800 | if (arg_response == 1) { |
1798 | if (arg_response == 1) { |
- | 1799 | char* filename = argv[1]; |
|
- | 1800 | // tolower |
|
- | 1801 | for (int i = 0; i < strlen(filename); i++) filename[i] = tolower(filename[i]); |
|
- | 1802 | ||
1801 | editorOpen(argv[1]); |
1803 | editorOpen(filename); |
1802 | char* title = argv[1]; |
1804 | char* title = argv[1]; |
1803 | strcat(title, " - TinyTextEditor"); |
1805 | strcat(title, " - TinyTextEditor"); |
1804 | con_set_title(title); |
1806 | con_set_title(title); |
1805 | } |
1807 | } |
1806 | else if (arg_response == -1) |
1808 | else if (arg_response == -1) |
Line 1810... | Line 1812... | ||
1810 | 1812 | ||
1811 | while (1) { |
1813 | while (1) { |
1812 | editorRefreshScreen(); |
1814 | editorRefreshScreen(); |
1813 | editorProcessKeypress(); |
1815 | editorProcessKeypress(); |
1814 | } |
- | |
1815 | 1816 | } |
|
1816 | con_exit(1); |
1817 | con_exit(1); |
1817 | return 0; |
1818 | return 0; |