From 1d696c0047ec2d0b1a4fde6861f9c35e413df3e3 Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Sat, 9 Jul 2005 05:24:33 +0000 Subject: [PATCH] work around slang brokenness git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2841 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 11 +++++++---- src/nano.h | 6 ++++++ src/proto.h | 3 +++ src/winio.c | 23 +++++++++++++++-------- 4 files changed, 31 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 05594735..a2226505 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,10 +23,11 @@ CVS code - rename open_pipe() execute_command(), and remove execute_command(). (DLR) - Replace almost all mvwaddstr(hblank) calls with mvwhline(' ', - COLS) calls, which do the same thing. Changes to - do_browser(), blank_titlebar(), blank_topbar(), blank_edit(), - blank_statusbar(), blank_bottombars(), update_line(), and - edit_refresh(). (DLR) + COLS) calls, which do the same thing. New function + nmvwhline() (since slang doesn't define mvwhline()); changes + to do_browser(), blank_titlebar(), blank_topbar(), + blank_edit(), blank_statusbar(), blank_bottombars(), + update_line(), and edit_refresh(). (DLR) - files.c: open_file() - Assert that filename isn't NULL, and don't do anything special @@ -82,6 +83,8 @@ CVS code - display_string() - Display invalid multibyte sequences as Unicode 0xFFFD (Replacement Character). (DLR) + total_redraw() + - Rework to use functions that slang actually defines. (DLR) - configure.ac: - Since we only use vsnprintf() now, remove the tests for snprintf(). (DLR) diff --git a/src/nano.h b/src/nano.h index b9ac25f1..b418ac8e 100644 --- a/src/nano.h +++ b/src/nano.h @@ -127,6 +127,12 @@ #define getline ngetline #endif +/* Slang curses emulation brain damage, part 3: Slang doesn't define + * mvwhline(), so use the version we have. */ +#ifdef USE_SLANG +#define mvwhline nmvwhline +#endif + #define VERMSG "GNU nano " VERSION /* If we aren't using ncurses, turn the mouse support off, as it's diff --git a/src/proto.h b/src/proto.h index 2323ae07..196d9151 100644 --- a/src/proto.h +++ b/src/proto.h @@ -567,6 +567,9 @@ void get_totals(const filestruct *begin, const filestruct *end, size_t *lines, size_t *size); /* Public functions in winio.c. */ +#ifdef USE_SLANG +int nmvwhline(WINDOW *win, int y, int x, char ch, int n); +#endif #ifndef NANO_SMALL void reset_kbinput(void); #endif diff --git a/src/winio.c b/src/winio.c index ac64d4bc..3ddb0457 100644 --- a/src/winio.c +++ b/src/winio.c @@ -52,6 +52,19 @@ static bool resetstatuspos = FALSE; /* Should we reset the cursor position * at the statusbar prompt? */ +#ifdef USE_SLANG +/* Slang curses emulation brain damage, part 4: Slang doesn't define + * mvwhline(). */ +int nmvwhline(WINDOW *win, int y, int x, char ch, int n) +{ + wmove(win, y, x); + for (; n > 0; n--) + waddch(win, ch); + + return 0; +} +#endif + /* Control character compatibility: * * - NANO_BACKSPACE_KEY is Ctrl-H, which is Backspace under ASCII, ANSI, @@ -3776,14 +3789,8 @@ int do_yesno(bool all, const char *msg) void total_redraw(void) { -#ifdef USE_SLANG - /* Slang curses emulation brain damage, part 3: Slang doesn't define - * curscr. */ - SLsmg_touch_screen(); - SLsmg_refresh(); -#else - wrefresh(curscr); -#endif + touchwin(stdscr); + wrefresh(stdscr); } void total_refresh(void)