summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/board.c7
-rw-r--r--mbbsd/edit.c8
-rw-r--r--mbbsd/more.c10
-rw-r--r--mbbsd/screen.c17
-rw-r--r--mbbsd/term.c8
5 files changed, 33 insertions, 17 deletions
diff --git a/mbbsd/board.c b/mbbsd/board.c
index bd8e562e..368241fb 100644
--- a/mbbsd/board.c
+++ b/mbbsd/board.c
@@ -1,4 +1,4 @@
-/* $Id: board.c,v 1.57 2002/08/20 17:19:11 in2 Exp $ */
+/* $Id: board.c,v 1.58 2002/09/11 07:16:49 kcwu Exp $ */
#include "bbs.h"
#define BRC_STRLEN 15 /* Length of board name */
#define BRC_MAXSIZE 24576
@@ -648,10 +648,11 @@ show_brdlist(int head, int clsflag, int newflag)
prints("%2d ", ptr->bh->nuser);
else
prints(" %c ", ptr->bh->bvote ? 'V' : ' ');
- prints("%.13s", ptr->bh->BM);
+ prints("%.*s", t_columns - 67, ptr->bh->BM);
refresh();
} else {
- prints("%-40.40s %.13s", ptr->bh->title + 7, ptr->bh->BM);
+ prints("%-40.40s %.*s", ptr->bh->title + 7,
+ t_columns - 67, ptr->bh->BM);
}
}
clrtoeol();
diff --git a/mbbsd/edit.c b/mbbsd/edit.c
index c74dd2b2..5073d10a 100644
--- a/mbbsd/edit.c
+++ b/mbbsd/edit.c
@@ -1,4 +1,4 @@
-/* $Id: edit.c,v 1.18 2002/08/25 07:37:47 in2 Exp $ */
+/* $Id: edit.c,v 1.19 2002/09/11 07:16:49 kcwu Exp $ */
#include "bbs.h"
typedef struct textline_t {
struct textline_t *prev;
@@ -9,7 +9,6 @@ typedef struct textline_t {
#define KEEP_EDITING -2
#define BACKUP_LIMIT 100
-#define SCR_WIDTH 80
enum {
NOBODY, MANAGER, SYSOP
@@ -2263,7 +2262,10 @@ vedit(char *fpath, int saveheader, int *islocal)
}
}
}
- edit_margin = currpnt < SCR_WIDTH - 1 ? 0 : currpnt / 72 * 72;
+ if (currpnt < t_columns - 1)
+ edit_margin = 0;
+ else
+ edit_margin = currpnt / (t_columns - 8) * (t_columns - 8);
if (!redraw_everything) {
if (edit_margin != last_margin) {
diff --git a/mbbsd/more.c b/mbbsd/more.c
index fc3434ba..3afc6ca9 100644
--- a/mbbsd/more.c
+++ b/mbbsd/more.c
@@ -1,4 +1,4 @@
-/* $Id: more.c,v 1.20 2002/08/20 02:42:36 in2 Exp $ */
+/* $Id: more.c,v 1.21 2002/09/11 07:16:49 kcwu Exp $ */
#include "bbs.h"
#define MORE_BUFSIZE 4096
#define MORE_WINSIZE 4096
@@ -83,7 +83,7 @@ more_readln(int fd, unsigned char *buf)
do {
*buf++ = ' ';
}
- while ((++len & 7) && len < 80);
+ while ((++len & 7) && len < t_columns);
} else if (ch == '\033') {
if (atoi((char *)(data + 1)) > 47) {
if ((cc = (unsigned char *)strchr((char *)(data + 1), 'm')) != NULL) {
@@ -107,8 +107,12 @@ more_readln(int fd, unsigned char *buf)
len++;
*buf++ = ch;
}
+ } while (len < t_columns && buf < tail);
+ if(len==t_columns && head<size && *data=='\n') {
+ /* XXX: not handle head==size, should read data */
+ /* no extra newline dirty hack for exact 80byte line */
+ data++; bytes++; head++;
}
- while (len < 80 && buf < tail);
*buf = '\0';
more_head = head;
return bytes;
diff --git a/mbbsd/screen.c b/mbbsd/screen.c
index 0dc36811..fb367618 100644
--- a/mbbsd/screen.c
+++ b/mbbsd/screen.c
@@ -1,11 +1,10 @@
-/* $Id: screen.c,v 1.9 2002/09/11 03:22:50 kcwu Exp $ */
+/* $Id: screen.c,v 1.10 2002/09/11 07:16:49 kcwu Exp $ */
#include "bbs.h"
#ifdef SUPPORT_GB
static int current_font_type = TYPE_BIG5;
static int gbinited = 0;
#endif
-#define SCR_WIDTH 80
#define o_clear() output(clearbuf,clearbuflen)
#define o_cleol() output(cleolbuf,cleolbuflen)
#define o_scrollrev() output(scrollrev,scrollrevlen)
@@ -119,6 +118,7 @@ redoscr()
output((char *)bp->data, len);
tc_col += len;
if (tc_col >= t_columns) {
+ /* XXX Is this code right? */
if (automargins)
tc_col = t_columns - 1;
else {
@@ -182,12 +182,15 @@ refresh()
output((char *)&bp->data[bp->smod], bp->emod - bp->smod + 1);
tc_col = bp->emod + 1;
if (tc_col >= t_columns) {
- if (automargins) {
+ /* XXX Is this code right? */
+ if (automargins)
+ tc_col = t_columns - 1;
+ else {
tc_col -= t_columns;
- if (++tc_line >= t_lines)
+ tc_line++;
+ if (tc_line >= t_lines)
tc_line = b_lines;
- } else
- tc_col = t_columns - 1;
+ }
}
}
if (bp->oldlen > len) {
@@ -423,7 +426,7 @@ edit_outs(char *text)
if (current_font_type == TYPE_GB)
text = hc_convert_str(text, HC_BIGtoGB, HC_DO_SINGLE);
#endif
- while ((ch = *text++) && (++column < SCR_WIDTH))
+ while ((ch = *text++) && (++column < t_columns))
outch(ch == 27 ? '*' : ch);
return 0;
diff --git a/mbbsd/term.c b/mbbsd/term.c
index f5b2544b..ed112346 100644
--- a/mbbsd/term.c
+++ b/mbbsd/term.c
@@ -1,4 +1,4 @@
-/* $Id: term.c,v 1.9 2002/08/25 11:40:16 kcwu Exp $ */
+/* $Id: term.c,v 1.10 2002/09/11 07:16:49 kcwu Exp $ */
#include "bbs.h"
int tgetent(const char *bp, char *name);
@@ -60,6 +60,11 @@ term_resize(int sig)
signal(SIGWINCH, SIG_IGN); /* Don't bother me! */
ioctl(0, TIOCGWINSZ, &newsize);
+
+ /* make sure reasonable size */
+ newsize.ws_row = MAX(24, MIN(100, newsize.ws_row));
+ newsize.ws_col = MAX(80, MIN(200, newsize.ws_col));
+
if (newsize.ws_row > t_lines) {
new_picture = (screenline_t *) calloc(newsize.ws_row,
sizeof(screenline_t));
@@ -72,6 +77,7 @@ term_resize(int sig)
big_picture = new_picture;
}
t_lines = newsize.ws_row;
+ t_columns = newsize.ws_col;
scr_lns = t_lines; /* XXX: scr_lns 跟 t_lines 有什麼不同, 為何分成兩個 */
b_lines = t_lines - 1;
p_lines = t_lines - 4;