summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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
6 files changed, 58 insertions, 2 deletions
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);