[838] in BarnOwl Developers

home help back first fref pref prev next nref lref last post

[D-O-H] r832 - branches/barnowl_unicode/owl

daemon@ATHENA.MIT.EDU (asedeno@MIT.EDU)
Thu Oct 29 18:10:16 2009

Resent-From: nelhage@mit.edu
Resent-To: barnowl-dev-mtg@charon.mit.edu
To: dirty-owl-hackers@mit.edu
From: asedeno@MIT.EDU
Reply-to: dirty-owl-hackers@MIT.EDU
Date: Fri, 11 Jan 2008 14:46:53 -0500 (EST)

Author: asedeno
Date: 2008-01-11 14:46:52 -0500 (Fri, 11 Jan 2008)
New Revision: 832

Modified:
   branches/barnowl_unicode/owl/editwin.c
   branches/barnowl_unicode/owl/keys.c
Log:
fixing post-processing in the editwin.

Modified: branches/barnowl_unicode/owl/editwin.c
===================================================================
--- branches/barnowl_unicode/owl/editwin.c	2008-01-11 19:28:36 UTC (rev 831)
+++ branches/barnowl_unicode/owl/editwin.c	2008-01-11 19:46:52 UTC (rev 832)
@@ -567,7 +567,7 @@
   p = string;
   c = g_utf8_get_char(p);
   while (c) {
-    owl_editwin_process_char(e, c);
+    _owl_editwin_process_char(e, c);
     p = g_utf8_next_char(p);
     c = g_utf8_get_char(p);
   }
@@ -1074,30 +1074,36 @@
   return(0);
 }
 
-void owl_editwin_post_process_char(owl_editwin *e, gunichar j)
+void owl_editwin_post_process_char(owl_editwin *e, owl_input j)
 {
   /* check if we need to scroll down */
   if (e->buffy-e->topline >= e->winlines) {
     e->topline+=e->winlines/2;
   }
-  if ((j==13 || j==10) && owl_editwin_check_dotsend(e)) {
+  if ((j.ch==13 || j.ch==10) && owl_editwin_check_dotsend(e)) {
     owl_command_editmulti_done(e);
     return;
   }
   owl_editwin_redisplay(e, 0);  
 }
 
-void owl_editwin_process_char(owl_editwin *e, gunichar j)
+void _owl_editwin_process_char(owl_editwin *e, gunichar j)
 {
-  if (j == ERR) return;
-  if (g_unichar_iscntrl(j) && (j != 10) && (j != 13)) {
-    return;
-  }
-  else {
+  if (!(g_unichar_iscntrl(j) && (j != 10) && (j != 13))) {
     owl_editwin_insert_char(e, j);
   }
 }
 
+
+void owl_editwin_process_char(owl_editwin *e, owl_input j)
+{
+  if (j.ch == ERR) return;
+  /* Ignore ncurses control characters. */
+  if (j.ch < 0x100) { 
+    _owl_editwin_process_char(e, j.uch);
+  }
+}
+
 char *owl_editwin_get_text(owl_editwin *e)
 {
   return(e->buff+e->lock);

Modified: branches/barnowl_unicode/owl/keys.c
===================================================================
--- branches/barnowl_unicode/owl/keys.c	2008-01-11 19:28:36 UTC (rev 831)
+++ branches/barnowl_unicode/owl/keys.c	2008-01-11 19:46:52 UTC (rev 832)
@@ -300,18 +300,16 @@
 
 void owl_keys_editwin_default(owl_input j) {
   owl_editwin *e;
-  if (NULL != (e=owl_global_get_typwin(&g))
-      && j.ch < 0x100) {
-       owl_editwin_process_char(e, j.uch);
+  if (NULL != (e=owl_global_get_typwin(&g))) {
+       owl_editwin_process_char(e, j);
   }
 }
 
 void owl_keys_editwin_postalways(owl_input j) {
   owl_editwin *e;
-  if (NULL != (e=owl_global_get_typwin(&g))
-      && j.ch < 0x100) {
-    owl_editwin_post_process_char(e, j.uch);
-  }  
+  if (NULL != (e=owl_global_get_typwin(&g))) {
+    owl_editwin_post_process_char(e, j);
+  }
   owl_global_set_needrefresh(&g);
 }
 


home help back first fref pref prev next nref lref last post