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 this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "module.h"
+#include "signals.h"
#include "settings.h"
#include "term.h"
if (!term_use_colors)
attr = (color & 0x70) ? A_REVERSE : 0;
- else if (((color & 0x0f) == 8) && (color & ATTR_BOLD) == 0)
- attr = (A_DIM | COLOR_PAIR(63));
+ else if ((color & 0xff) == 8 || (color & (0xff | ATTR_RESETFG)) == 0)
+ attr = COLOR_PAIR(63);
else if ((color & 0x77) == 0)
attr = A_NORMAL;
else {
color &= ~0x0f;
color |= settings_get_int("default_color");
}
- attr = (COLOR_PAIR((color&7) + (color&0x70)/2));
+ attr = COLOR_PAIR((color&7) | ((color&0x70)>>1));
}
if ((color & 0x08) || (color & ATTR_BOLD)) attr |= A_BOLD;
wmove(window->win, y, x);
}
-void term_addch(TERM_WINDOW *window, int chr)
+void term_addch(TERM_WINDOW *window, char chr)
{
waddch(window->win, chr);
}
void term_add_unichar(TERM_WINDOW *window, unichar chr)
{
+#ifdef WIDEC_CURSES
+ cchar_t wch;
+ wchar_t temp[2];
+ temp[0] = chr;
+ temp[1] = 0;
+ if (setcchar(&wch, temp, A_NORMAL, 0, NULL) == OK)
+ wadd_wch(window->win, &wch);
+ else
+#endif
waddch(window->win, chr);
}
void term_stop(void)
{
term_deinit_int();
- kill(getpid(), SIGSTOP);
+ kill(getpid(), SIGTSTP);
term_init_int();
irssi_redraw();
}
-void term_auto_detach(int set)
-{
-}
-
void term_set_input_type(int type)
{
}
-int term_gets(unichar *buffer, int size)
+void term_gets(GArray *buffer, int *line_count)
{
- int key, count;
+#ifdef WIDEC_CURSES
+ wint_t key;
+#else
+ int key;
+#endif
- for (count = 0; count < size; ) {
- key = getch();
+ for (;;) {
+#ifdef WIDEC_CURSES
+ if (get_wch(&key) == ERR)
+#else
+ if ((key = getch()) == ERR)
+#endif
+ break;
#ifdef KEY_RESIZE
if (key == KEY_RESIZE)
continue;
#endif
- if (key == ERR)
- break;
-
- buffer[count] = key;
- count++;
+ g_array_append_val(buffer, key);
+ if (key == '\r' || key == '\n')
+ (*line_count)++;
}
-
- return count;
}