diff --git a/Makefile b/Makefile index e380180a..6ef9901d 100644 --- a/Makefile +++ b/Makefile @@ -84,6 +84,8 @@ ALL_CPPFLAGS := $(PKG_CPPFLAGS) $(CPPFLAGS) # to compile procps, they might best be moved to CFLAGS. # On the other hand, they aren't normal -O -g things either. # +# TODO: determine why -fomit-frame-pointer is missing +# PKG_CFLAGS := -fno-common -ffast-math \ -W -Wall -Wshadow -Wcast-align -Wredundant-decls \ -Wbad-function-cast -Wcast-qual -Wwrite-strings -Waggregate-return \ diff --git a/proc/module.mk b/proc/module.mk index 7c9d3478..4155ced5 100644 --- a/proc/module.mk +++ b/proc/module.mk @@ -43,6 +43,7 @@ DIRS += proc/ proc/lib$(NAME).a: $(LIBOBJ) $(AR) rcs $@ $^ +.PHONY: proc/$(SONAME) #proc/$(SONAME): proc/library.map proc/$(SONAME): $(LIBOBJ) $(CC) -shared -Wl,-soname,$(SONAME) -Wl,--version-script=proc/library.map -o $@ $^ -lc diff --git a/top.c b/top.c index 5c2be5ad..e6baa848 100644 --- a/top.c +++ b/top.c @@ -105,6 +105,10 @@ static volatile struct timeval tv; /* Current terminal screen size. */ static int Screen_cols, Screen_rows, Max_lines; +// set to 1 if writing to the last column would be troublesome +// (we don't distinguish the lowermost row from the other rows) +static int avoid_last_column; + /* This is really the number of lines needed to display the summary information (0 - nn), but is used as the relative row where we stick the cursor between frames. */ @@ -484,8 +488,19 @@ static void capsmk (WIN_t *q) CAPCOPY(Cap_clr_eol, clr_eol); CAPCOPY(Cap_clr_eos, clr_eos); CAPCOPY(Cap_clr_scr, clear_screen); - CAPCOPY(Cap_rmam, exit_am_mode); - CAPCOPY(Cap_smam, enter_am_mode); + + if (!eat_newline_glitch) { // we like the eat_newline_glitch + CAPCOPY(Cap_rmam, exit_am_mode); + CAPCOPY(Cap_smam, enter_am_mode); + if (!*Cap_rmam || !*Cap_smam) { // need both + *Cap_rmam = '\0'; + *Cap_smam = '\0'; + if (auto_right_margin) { + avoid_last_column = 1; + } + } + } + CAPCOPY(Cap_curs_huge, cursor_visible); CAPCOPY(Cap_curs_norm, cursor_normal); CAPCOPY(Cap_home, cursor_home); @@ -2348,6 +2363,9 @@ static void wins_resize (int dont_care_sig) if(!*endptr && (t>0) && (t<=0x7fffffffL)) Screen_rows = (int)t; } + // be crudely tolerant of crude tty emulators + if (avoid_last_column) Screen_cols--; + // we might disappoint some folks (but they'll deserve it) if (SCREENMAX < Screen_cols) Screen_cols = SCREENMAX;