Some updates for TinyTextEditor

git-svn-id: svn://kolibrios.org@8116 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
maxcodehack 2020-10-24 13:14:35 +00:00
parent 5f677e4407
commit 70798cbfe0

View File

@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* Kolibri port by Siemargl 2018 /* Kolibri port by Siemargl 2018 and update by maxcodehack 2020
* my fixes mostly commented with triple comment /// * my fixes mostly commented with triple comment ///
* */ * */
@ -1369,7 +1369,7 @@ void editorDrawWelcomeMessage(struct a_buf* ab) {
// Using snprintf to truncate message in case the terminal // Using snprintf to truncate message in case the terminal
// is too tiny to handle the entire string. // is too tiny to handle the entire string.
int welcome_len = snprintf(welcome, sizeof(welcome), int welcome_len = snprintf(welcome, sizeof(welcome),
"tte %s <http://dmoral.es/>", TTE_VERSION); "TinyTextEditor %s", TTE_VERSION);
if (welcome_len > ec.screen_cols) if (welcome_len > ec.screen_cols)
welcome_len = ec.screen_cols; welcome_len = ec.screen_cols;
// Centering the message. // Centering the message.
@ -1764,15 +1764,18 @@ int handleArgs(int argc, char* argv[]) {
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
if (con_init_console_dll()) return 1; // init fail if (con_init_console_dll()) return 1; // init fail
con_set_title("TinyTextEditor");
initEditor(); initEditor();
int arg_response = handleArgs(argc, argv); int arg_response = handleArgs(argc, argv);
if (arg_response == 1) if (arg_response == 1) {
editorOpen(argv[1]); editorOpen(argv[1]);
char* title = argv[1];
strcat(title, " - TinyTextEditor");
con_set_title(title);
}
else if (arg_response == -1) else if (arg_response == -1)
return 0; return 0;
enableRawMode(); enableRawMode();
editorSetStatusMessage(" Ctrl-Q, ^Z to quit | Ctrl-S to save | (tte -h | --help for more info)"); editorSetStatusMessage(" Ctrl-Q, ^Z to quit | Ctrl-S to save | (tte -h | --help for more info)");
while (1) { while (1) {