summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2011-06-01 12:10:03 +0200
committerSebastien Helleu <flashcode@flashtux.org>2011-06-01 12:10:03 +0200
commit41261875743002bbaad8fe90fb2bb9c657a0fb41 (patch)
treee2bad6d9929428cdd2282ae9b45fcafde7672981
parent35120b633c5a7dd01ea73d8073d3a1d7da63bd84 (diff)
downloadweechat-41261875743002bbaad8fe90fb2bb9c657a0fb41.zip
core: fix bug with new line inserted at end of each line displayed (set eat_newline_glitch to 0 if available)
-rw-r--r--ChangeLog2
-rw-r--r--config.h.cmake1
-rw-r--r--configure.in111
-rw-r--r--src/CMakeLists.txt5
-rw-r--r--src/gui/curses/CMakeLists.txt1
-rw-r--r--src/gui/curses/Makefile.am1
-rw-r--r--src/gui/curses/gui-curses-main.c2
-rw-r--r--src/gui/curses/gui-curses-term.c48
-rw-r--r--src/gui/curses/gui-curses.h3
9 files changed, 127 insertions, 47 deletions
diff --git a/ChangeLog b/ChangeLog
index 3a97541bc..18edf4e78 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,8 @@ v0.3.6-dev, 2011-06-01
Version 0.3.6 (under dev!)
--------------------------
+* core: fix bug with new line inserted at end of each line displayed (set
+ eat_newline_glitch to 0 if available)
* core: add option "infolists" for command /debug
* core: add horizontal scrolling for buffers with free content (command
/window scroll_horiz) (task #11112)
diff --git a/config.h.cmake b/config.h.cmake
index 50bb9261e..1c1714e59 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -22,6 +22,7 @@
#cmakedefine ICONV_2ARG_IS_CONST 1
#cmakedefine HAVE_TCL_CREATE_NS
#cmakedefine HAVE_MALLINFO
+#cmakedefine HAVE_EAT_NEWLINE_GLITCH
#define PACKAGE_VERSION "@VERSION@"
#define PACKAGE "@PROJECT_NAME@"
#define PACKAGE_NAME "@PROJECT_NAME@"
diff --git a/configure.in b/configure.in
index 592fae7c4..c1e883df0 100644
--- a/configure.in
+++ b/configure.in
@@ -100,28 +100,29 @@ AC_CHECK_FUNCS([gethostbyname gethostname getsockname gettimeofday inet_ntoa mem
# Variables in config.h
-AH_VERBATIM([PREFIX], [#undef PREFIX])
-AH_VERBATIM([WEECHAT_LIBDIR], [#undef WEECHAT_LIBDIR])
-AH_VERBATIM([WEECHAT_SHAREDIR], [#undef WEECHAT_SHAREDIR])
-AH_VERBATIM([HAVE_GCRYPT], [#undef HAVE_GCRYPT])
-AH_VERBATIM([HAVE_GNUTLS], [#undef HAVE_GNUTLS])
-AH_VERBATIM([HAVE_FLOCK], [#undef HAVE_FLOCK])
-AH_VERBATIM([PLUGIN_ALIAS], [#undef PLUGIN_ALIAS])
-AH_VERBATIM([PLUGIN_ASPELL], [#undef PLUGIN_ASPELL])
-AH_VERBATIM([PLUGIN_CHARSET], [#undef PLUGIN_CHARSET])
-AH_VERBATIM([PLUGIN_DEMO], [#undef PLUGIN_DEMO])
-AH_VERBATIM([PLUGIN_FIFO], [#undef PLUGIN_FIFO])
-AH_VERBATIM([PLUGIN_IRC], [#undef PLUGIN_IRC])
-AH_VERBATIM([PLUGIN_LOGGER], [#undef PLUGIN_LOGGER])
-AH_VERBATIM([PLUGIN_RELAY], [#undef PLUGIN_RELAY])
-AH_VERBATIM([PLUGIN_RMODIFIER], [#undef PLUGIN_RMODIFIER])
-AH_VERBATIM([PLUGIN_PERL], [#undef PLUGIN_PERL])
-AH_VERBATIM([PLUGIN_PYTHON], [#undef PLUGIN_PYTHON])
-AH_VERBATIM([PLUGIN_RUBY], [#undef PLUGIN_RUBY])
-AH_VERBATIM([PLUGIN_LUA], [#undef PLUGIN_LUA])
-AH_VERBATIM([PLUGIN_TCL], [#undef PLUGIN_TCL])
-AH_VERBATIM([PLUGIN_XFER], [#undef PLUGIN_XFER])
-AH_VERBATIM([DOC], [#undef DOC])
+AH_VERBATIM([PREFIX], [#undef PREFIX])
+AH_VERBATIM([WEECHAT_LIBDIR], [#undef WEECHAT_LIBDIR])
+AH_VERBATIM([WEECHAT_SHAREDIR], [#undef WEECHAT_SHAREDIR])
+AH_VERBATIM([HAVE_GCRYPT], [#undef HAVE_GCRYPT])
+AH_VERBATIM([HAVE_GNUTLS], [#undef HAVE_GNUTLS])
+AH_VERBATIM([HAVE_FLOCK], [#undef HAVE_FLOCK])
+AH_VERBATIM([HAVE_EAT_NEWLINE_GLITCH], [#undef HAVE_EAT_NEWLINE_GLITCH])
+AH_VERBATIM([PLUGIN_ALIAS], [#undef PLUGIN_ALIAS])
+AH_VERBATIM([PLUGIN_ASPELL], [#undef PLUGIN_ASPELL])
+AH_VERBATIM([PLUGIN_CHARSET], [#undef PLUGIN_CHARSET])
+AH_VERBATIM([PLUGIN_DEMO], [#undef PLUGIN_DEMO])
+AH_VERBATIM([PLUGIN_FIFO], [#undef PLUGIN_FIFO])
+AH_VERBATIM([PLUGIN_IRC], [#undef PLUGIN_IRC])
+AH_VERBATIM([PLUGIN_LOGGER], [#undef PLUGIN_LOGGER])
+AH_VERBATIM([PLUGIN_RELAY], [#undef PLUGIN_RELAY])
+AH_VERBATIM([PLUGIN_RMODIFIER], [#undef PLUGIN_RMODIFIER])
+AH_VERBATIM([PLUGIN_PERL], [#undef PLUGIN_PERL])
+AH_VERBATIM([PLUGIN_PYTHON], [#undef PLUGIN_PYTHON])
+AH_VERBATIM([PLUGIN_RUBY], [#undef PLUGIN_RUBY])
+AH_VERBATIM([PLUGIN_LUA], [#undef PLUGIN_LUA])
+AH_VERBATIM([PLUGIN_TCL], [#undef PLUGIN_TCL])
+AH_VERBATIM([PLUGIN_XFER], [#undef PLUGIN_XFER])
+AH_VERBATIM([DOC], [#undef DOC])
# Arguments for ./configure
@@ -865,6 +866,25 @@ if test "x$debug" != "x0" ; then
fi
# ------------------------------------------------------------------------------
+# eat_newline_glitch
+# ------------------------------------------------------------------------------
+
+enable_eatnewlineglitch="no"
+AC_CACHE_CHECK([for eat_newline_glitch support], ac_have_eatnewlineglitch, [
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+[[ #include <term.h> ]],
+[[ eat_newline_glitch = 0; ]])],
+[ ac_have_eatnewlineglitch="yes" ],
+[ ac_have_eatnewlineglitch="no" ])])
+
+if test "x$ac_have_eatnewlineglitch" = "xyes"; then
+ enable_eatnewlineglitch="yes"
+ AC_DEFINE(HAVE_EAT_NEWLINE_GLITCH)
+else
+ not_found="$not_found eat_newline_glitch"
+fi
+
+# ------------------------------------------------------------------------------
# documentation
# ------------------------------------------------------------------------------
@@ -981,29 +1001,30 @@ CFLAGS="$CFLAGS -DWEECHAT_VERSION=\\\"$VERSION\\\" -DWEECHAT_LICENSE=\\\"$LICENS
# output Makefiles
# ------------------------------------------------------------------------------
-AM_CONDITIONAL(HAVE_GCRYPT, test "$enable_gcrypt" = "yes")
-AM_CONDITIONAL(HAVE_GNUTLS, test "$enable_gnutls" = "yes")
-AM_CONDITIONAL(HAVE_FLOCK, test "$enable_flock" = "yes")
-AM_CONDITIONAL(GUI_NCURSES, test "$enable_ncurses" = "yes")
-AM_CONDITIONAL(GUI_WXWIDGETS, test "$enable_wxwidgets" = "yes")
-AM_CONDITIONAL(GUI_GTK, test "$enable_gtk" = "yes")
-AM_CONDITIONAL(GUI_QT, test "$enable_qt" = "yes")
-AM_CONDITIONAL(PLUGIN_ALIAS, test "$enable_alias" = "yes")
-AM_CONDITIONAL(PLUGIN_ASPELL, test "$enable_aspell" = "yes")
-AM_CONDITIONAL(PLUGIN_CHARSET, test "$enable_charset" = "yes")
-AM_CONDITIONAL(PLUGIN_DEMO, test "$enable_demo" = "yes")
-AM_CONDITIONAL(PLUGIN_FIFO, test "$enable_fifo" = "yes")
-AM_CONDITIONAL(PLUGIN_IRC, test "$enable_irc" = "yes")
-AM_CONDITIONAL(PLUGIN_LOGGER, test "$enable_logger" = "yes")
-AM_CONDITIONAL(PLUGIN_RELAY, test "$enable_relay" = "yes")
-AM_CONDITIONAL(PLUGIN_RMODIFIER, test "$enable_rmodifier" = "yes")
-AM_CONDITIONAL(PLUGIN_PERL, test "$enable_perl" = "yes")
-AM_CONDITIONAL(PLUGIN_PYTHON, test "$enable_python" = "yes")
-AM_CONDITIONAL(PLUGIN_RUBY, test "$enable_ruby" = "yes")
-AM_CONDITIONAL(PLUGIN_LUA, test "$enable_lua" = "yes")
-AM_CONDITIONAL(PLUGIN_TCL, test "$enable_tcl" = "yes")
-AM_CONDITIONAL(PLUGIN_XFER, test "$enable_xfer" = "yes")
-AM_CONDITIONAL(DOC, test "$enable_doc" = "yes")
+AM_CONDITIONAL(HAVE_GCRYPT, test "$enable_gcrypt" = "yes")
+AM_CONDITIONAL(HAVE_GNUTLS, test "$enable_gnutls" = "yes")
+AM_CONDITIONAL(HAVE_FLOCK, test "$enable_flock" = "yes")
+AM_CONDITIONAL(HAVE_EAT_NEWLINE_GLITCH, test "$enable_eatnewlineglitch" = "yes")
+AM_CONDITIONAL(GUI_NCURSES, test "$enable_ncurses" = "yes")
+AM_CONDITIONAL(GUI_WXWIDGETS, test "$enable_wxwidgets" = "yes")
+AM_CONDITIONAL(GUI_GTK, test "$enable_gtk" = "yes")
+AM_CONDITIONAL(GUI_QT, test "$enable_qt" = "yes")
+AM_CONDITIONAL(PLUGIN_ALIAS, test "$enable_alias" = "yes")
+AM_CONDITIONAL(PLUGIN_ASPELL, test "$enable_aspell" = "yes")
+AM_CONDITIONAL(PLUGIN_CHARSET, test "$enable_charset" = "yes")
+AM_CONDITIONAL(PLUGIN_DEMO, test "$enable_demo" = "yes")
+AM_CONDITIONAL(PLUGIN_FIFO, test "$enable_fifo" = "yes")
+AM_CONDITIONAL(PLUGIN_IRC, test "$enable_irc" = "yes")
+AM_CONDITIONAL(PLUGIN_LOGGER, test "$enable_logger" = "yes")
+AM_CONDITIONAL(PLUGIN_RELAY, test "$enable_relay" = "yes")
+AM_CONDITIONAL(PLUGIN_RMODIFIER, test "$enable_rmodifier" = "yes")
+AM_CONDITIONAL(PLUGIN_PERL, test "$enable_perl" = "yes")
+AM_CONDITIONAL(PLUGIN_PYTHON, test "$enable_python" = "yes")
+AM_CONDITIONAL(PLUGIN_RUBY, test "$enable_ruby" = "yes")
+AM_CONDITIONAL(PLUGIN_LUA, test "$enable_lua" = "yes")
+AM_CONDITIONAL(PLUGIN_TCL, test "$enable_tcl" = "yes")
+AM_CONDITIONAL(PLUGIN_XFER, test "$enable_xfer" = "yes")
+AM_CONDITIONAL(DOC, test "$enable_doc" = "yes")
AC_OUTPUT([Makefile
doc/Makefile
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index db86c860c..7b806b408 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -23,6 +23,7 @@ ADD_DEFINITIONS(-DHAVE_CONFIG_H)
INCLUDE(CheckIncludeFiles)
INCLUDE(CheckFunctionExists)
+INCLUDE(CheckSymbolExists)
CHECK_INCLUDE_FILES("arpa/inet.h" HAVE_ARPA_INET_H)
CHECK_INCLUDE_FILES("limits.h" HAVE_LIMITS_H)
@@ -66,9 +67,9 @@ CHECK_FUNCTION_EXISTS(mallinfo HAVE_MALLINFO)
CHECK_INCLUDE_FILES("regex.h" HAVE_REGEX_H)
CHECK_FUNCTION_EXISTS(regexec HAVE_REGEXEC)
+CHECK_SYMBOL_EXISTS("eat_newline_glitch" "term.h" HAVE_EAT_NEWLINE_GLITCH)
-#needs to be splitted in subdirectories
-# FIXME: weechat_gui_common MUST be the first lib in the list
+# weechat_gui_common MUST be the first lib in the list
SET(STATIC_LIBS weechat_gui_common)
# Check for Large File Support
diff --git a/src/gui/curses/CMakeLists.txt b/src/gui/curses/CMakeLists.txt
index 15f4b7645..3f4cd0a5e 100644
--- a/src/gui/curses/CMakeLists.txt
+++ b/src/gui/curses/CMakeLists.txt
@@ -30,6 +30,7 @@ gui-curses-chat.c
gui-curses-color.c
gui-curses-keyboard.c
gui-curses-main.c
+gui-curses-term.c
gui-curses-window.c)
SET(EXECUTABLE weechat-curses)
diff --git a/src/gui/curses/Makefile.am b/src/gui/curses/Makefile.am
index a7d92b7dc..284f21fc7 100644
--- a/src/gui/curses/Makefile.am
+++ b/src/gui/curses/Makefile.am
@@ -37,6 +37,7 @@ weechat_curses_SOURCES = gui-curses-bar-window.c \
gui-curses-color.c \
gui-curses-keyboard.c \
gui-curses-main.c \
+ gui-curses-term.c \
gui-curses-window.c \
gui-curses.h
diff --git a/src/gui/curses/gui-curses-main.c b/src/gui/curses/gui-curses-main.c
index bc91c32e1..33e1143bf 100644
--- a/src/gui/curses/gui-curses-main.c
+++ b/src/gui/curses/gui-curses-main.c
@@ -92,6 +92,8 @@ gui_main_init ()
initscr ();
+ gui_term_set_eat_newline_glitch (0);
+
curs_set (1);
noecho ();
nodelay (stdscr, TRUE);
diff --git a/src/gui/curses/gui-curses-term.c b/src/gui/curses/gui-curses-term.c
new file mode 100644
index 000000000..65f7d25c4
--- /dev/null
+++ b/src/gui/curses/gui-curses-term.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2011 Sebastien Helleu <flashcode@flashtux.org>
+ *
+ * This file is part of WeeChat, the extensible chat client.
+ *
+ * WeeChat is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * WeeChat is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * gui-curses-term.c: terminal functions for Curses GUI
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <term.h>
+
+
+/*
+ * gui_term_set_eat_newline_glitch: set "eat_newline_glitch" variable
+ * With value 0, this is used to not auto
+ * insert newline char at end of lines
+ * displayed, so that long words like URLs are
+ * not cut when they are selected with mouse
+ */
+
+void
+gui_term_set_eat_newline_glitch (int value)
+{
+#ifdef HAVE_EAT_NEWLINE_GLITCH
+ eat_newline_glitch = value;
+#else
+ /* make C compiler happy */
+ (void) value;
+#endif
+}
diff --git a/src/gui/curses/gui-curses.h b/src/gui/curses/gui-curses.h
index 7c5033912..97b663f3b 100644
--- a/src/gui/curses/gui-curses.h
+++ b/src/gui/curses/gui-curses.h
@@ -82,6 +82,9 @@ extern void gui_chat_calculate_line_diff (struct t_gui_window *window,
extern void gui_keyboard_default_bindings ();
extern int gui_keyboard_read_cb (void *data, int fd);
+/* terminal functions */
+extern void gui_term_set_eat_newline_glitch (int value);
+
/* window functions */
extern void gui_window_read_terminal_size ();
extern void gui_window_redraw_buffer (struct t_gui_buffer *buffer);