commit da3c75c0153f75494c241d6f4ffcf3aa0cf654ab
Author: rani <clagv.randomgames@gmail.com>
Date: Thu May 25 17:18:14 2023 +0000
diff --git a/src/dir.c b/src/dir.c
index 8e72963..a7f3052 100644
--- a/src/dir.c
+++ b/src/dir.c
@@ -2697 +2697 @@ void enter_dir(char * name) {
sprintf(tmp, "%s%s", cwd, name);
if (chdir(tmp) == -1) {
- display_info(INFO_ERR, strerror(errno));
+ display_info(INFO_ERR, "%s", strerror(errno));
free(tmp);
} else {
free(cwd);
diff --git a/src/info.c b/src/info.c
index 84cc32b..34f36bc 100644
--- a/src/info.c
+++ b/src/info.c
@@ -877 +8713 @@ void refresh_info(void) {
werase(info_buffer.w);
waddstr(info_buffer.w, "(:i) ");
wattron(info_buffer.w, cp);
- waddstr(info_buffer.w, info_buffer.i[n]->msg);
+ // 5 for (:i) text, 3 for ..., 1 for exra space
+ waddnstr(info_buffer.w, info_buffer.i[n]->msg, COLS - 9);
+ if (strlen(info_buffer.i[n]->msg) + 8 >= (unsigned)COLS) {
+ wattron(info_buffer.w, A_DIM);
+ waddstr(info_buffer.w, "...");
+ wattroff(info_buffer.w, A_DIM);
+ }
wattroff(info_buffer.w, cp);
wrefresh(info_buffer.w);
}
@@ -1107 +11612 @@ void page_info(void) {
for (size_t i = first_info; i <= last_info; i++) {
int cp = get_info_color(info_buffer.i[i]);
attron(cp);
- addstr(info_buffer.i[i]->msg);
+ addnstr(info_buffer.i[i]->msg, COLS - 4);
+ if (strlen(info_buffer.i[i]->msg) >= (unsigned)COLS) {
+ attron(A_DIM);
+ addstr("...");
+ attroff(A_DIM);
+ }
attroff(cp);
addch('\n');
}