diff mcabber/src/screen.c @ 232:9a6ba4b38e63

[/trunk] Changeset 245 by mikael * Fix backspace handling (KEY_BACKSPACE isn't reliable) * UTF-8 locale detection * Display a warning when the locale is UTF-8 * Display log notice when sending a notification request message * Update TODO * Update INSTALL and mcabberrc.example files for better explanations
author mikael
date Wed, 08 Jun 2005 18:33:28 +0000
parents 8dfdc6f1778e
children 72fd1273f2b7
line wrap: on
line diff
--- a/mcabber/src/screen.c	Tue Jun 07 19:46:42 2005 +0000
+++ b/mcabber/src/screen.c	Wed Jun 08 18:33:28 2005 +0000
@@ -6,6 +6,7 @@
 #include <time.h>
 #include <ctype.h>
 #include <locale.h>
+#include <langinfo.h>
 
 #include "screen.h"
 #include "hbuf.h"
@@ -43,6 +44,7 @@
 
 static int chatmode;
 int update_roster;
+int utf8_mode = 0;
 
 static char       inputLine[INPUTLINE_LENGTH+1];
 static char      *ptr_inputline;
@@ -445,6 +447,7 @@
   ptr_inputline = inputLine;
 
   setlocale(LC_CTYPE, "");
+  utf8_mode = (strcmp(nl_langinfo(CODESET), "UTF-8") == 0);
 
   return;
 }
@@ -512,6 +515,9 @@
     logPanel_border = new_panel(logWnd_border);
     logPanel    = new_panel(logWnd);
     inputPanel  = new_panel(inputWnd);
+
+    if (utf8_mode)
+      scr_LogPrint("WARNING: UTF-8 not yet supported!");
   } else {
     // Update panels
     replace_panel(rosterPanel, rosterWnd);
@@ -1309,6 +1315,8 @@
     check_offset(1);
   } else {
     switch(key) {
+      case 8:     // Ctrl-h
+      case 127:   // Backspace too
       case KEY_BACKSPACE:
           if (ptr_inputline != (char*)&inputLine) {
             char *c = --ptr_inputline;
@@ -1425,6 +1433,8 @@
           break;
       default:
           scr_LogPrint("Unkown key=%d", key);
+          if (utf8_mode)
+            scr_LogPrint("WARNING: UTF-8 not yet supported!");
     }
   }
   if (completion_started && key != 9 && key != KEY_RESIZE)