Subversion Repositories Kolibri OS

Rev

Rev 7419 | Rev 8121 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7419 Rev 8116
Line 12... Line 12...
12
*   GNU General Public License for more details.
12
*   GNU General Public License for more details.
13
*
13
*
14
*   You should have received a copy of the GNU General Public License
14
*   You should have received a copy of the GNU General Public License
15
*   along with this program.  If not, see .
15
*   along with this program.  If not, see .
16
*/
16
*/
17
/* Kolibri port by Siemargl 2018 
17
/* Kolibri port by Siemargl 2018 and update by maxcodehack 2020
18
 * my fixes mostly commented with triple comment ///
18
 * my fixes mostly commented with triple comment ///
19
 * */
19
 * */
Line 20... Line 20...
20
 
20
 
Line 1367... Line 1367...
1367
void editorDrawWelcomeMessage(struct a_buf* ab) {
1367
void editorDrawWelcomeMessage(struct a_buf* ab) {
1368
    char welcome[80];
1368
    char welcome[80];
1369
    // Using snprintf to truncate message in case the terminal
1369
    // Using snprintf to truncate message in case the terminal
1370
    // is too tiny to handle the entire string.
1370
    // is too tiny to handle the entire string.
1371
    int welcome_len = snprintf(welcome, sizeof(welcome),
1371
    int welcome_len = snprintf(welcome, sizeof(welcome),
1372
        "tte %s ", TTE_VERSION);
1372
        "TinyTextEditor %s", TTE_VERSION);
1373
    if (welcome_len > ec.screen_cols)
1373
    if (welcome_len > ec.screen_cols)
1374
        welcome_len = ec.screen_cols;
1374
        welcome_len = ec.screen_cols;
1375
    // Centering the message.
1375
    // Centering the message.
1376
    int padding = (ec.screen_cols - welcome_len) / 2;
1376
    int padding = (ec.screen_cols - welcome_len) / 2;
1377
    // Remember that everything != 0 is true.
1377
    // Remember that everything != 0 is true.
Line 1762... Line 1762...
1762
    return 1;
1762
    return 1;
1763
}
1763
}
Line 1764... Line 1764...
1764
 
1764
 
1765
int main(int argc, char* argv[]) {
1765
int main(int argc, char* argv[]) {
1766
	if (con_init_console_dll()) return 1; // init fail
-
 
-
 
1766
	if (con_init_console_dll()) return 1; // init fail
1767
 
1767
	con_set_title("TinyTextEditor");
1768
    initEditor();
1768
    initEditor();
1769
    int arg_response = handleArgs(argc, argv);
1769
    int arg_response = handleArgs(argc, argv);
1770
    if (arg_response == 1)
1770
    if (arg_response == 1) {
-
 
1771
		editorOpen(argv[1]);
-
 
1772
		char* title = argv[1];
-
 
1773
		strcat(title, " - TinyTextEditor");
-
 
1774
		con_set_title(title);
1771
        editorOpen(argv[1]);
1775
	}  
1772
    else if (arg_response == -1)
1776
    else if (arg_response == -1)
1773
        return 0;
1777
        return 0;
1774
    enableRawMode();
-
 
1775
 
1778
    enableRawMode();
Line 1776... Line 1779...
1776
    editorSetStatusMessage(" Ctrl-Q, ^Z to quit | Ctrl-S to save | (tte -h | --help for more info)");
1779
    editorSetStatusMessage(" Ctrl-Q, ^Z to quit | Ctrl-S to save | (tte -h | --help for more info)");
1777
 
1780
 
1778
    while (1) {
1781
    while (1) {