rpms/scim-sinhala/devel scim-sinhala-preedit-217065.patch, 1.1, 1.2 scim-sinhala.spec, 1.7, 1.8
Pravin Satpute (pravins)
fedora-extras-commits at redhat.com
Tue Jan 8 10:10:16 UTC 2008
Author: pravins
Update of /cvs/pkgs/rpms/scim-sinhala/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv5271
Modified Files:
scim-sinhala-preedit-217065.patch scim-sinhala.spec
Log Message:
* Tue Jan 08 2008 Pravin Satpute <psatpute at redhat.com> - 0.2.0-5.fc9
- removed preedit for unneccessary characters(#217065)
- modified scim-sinhala-preedit-217065.patch for this
scim-sinhala-preedit-217065.patch:
Index: scim-sinhala-preedit-217065.patch
===================================================================
RCS file: /cvs/pkgs/rpms/scim-sinhala/devel/scim-sinhala-preedit-217065.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- scim-sinhala-preedit-217065.patch 14 Dec 2007 11:04:47 -0000 1.1
+++ scim-sinhala-preedit-217065.patch 8 Jan 2008 10:10:08 -0000 1.2
@@ -1,6 +1,6 @@
diff -rup scim-sinhala-trans-0.2.0-20060825/src/scim_sinhala_imengine.cpp scim-sinhala-trans-0.2.0-20060825-modified/src/scim_sinhala_imengine.cpp
---- scim-sinhala-trans-0.2.0-20060825/src/scim_sinhala_imengine.cpp 2007-11-30 10:17:57.000000000 +0530
-+++ scim-sinhala-trans-0.2.0-20060825-modified/src/scim_sinhala_imengine.cpp 2007-12-13 18:30:42.000000000 +0530
+--- scim-sinhala-trans-0.2.0-20060825/src/scim_sinhala_imengine.cpp 2006-02-07 11:55:34.000000000 +0530
++++ scim-sinhala-trans-0.2.0-20060825-modified/src/scim_sinhala_imengine.cpp 2008-01-07 16:12:56.000000000 +0530
@@ -28,6 +28,7 @@
#define Uses_SCIM_LOOKUP_TABLE
#define Uses_SCIM_CONFIG_BASE
@@ -19,7 +19,16 @@
/*
* A BIG NOTE: Instead of working with three byte UTF-8 encoded
* characters, we will be using the 8 least significant bits of each
-@@ -208,11 +212,13 @@ SinhalaInstance::reset ()
+@@ -135,6 +139,8 @@ struct {
+ {0x8f, 0x90, 0x8f, 0x90, SCIM_KEY_Z},
+ {0, 0, 0, 0, 0}
+ };
++
++unsigned char nopreedit[] = {0xa4, 0xa5, 0xc0 ,0xbb , 0xba, 0xc6, 0xbd, 0xc5, 0x82, 0x9e, 0xb8, 0xb9};
+
+ SinhalaInstance::SinhalaInstance(SinhalaFactory *factory,
+ const String &encoding, int id) :
+@@ -208,11 +214,13 @@ SinhalaInstance::reset ()
{
SCIM_DEBUG_IMENGINE(2) << "reset.\n";
@@ -35,7 +44,30 @@
}
void
-@@ -377,6 +383,31 @@ SinhalaInstance::sinhala_transliterated_
+@@ -320,6 +328,22 @@ SinhalaInstance::find_consonent(int c)
+ return -1;
+ }
+
++/*
++ * search the nopreedit array, useful in deciding wheather to preedit character or
++ * commit it directly
++ */
++
++int
++SinhalaInstance::find_nopreedit(int c)
++{
++ int i = -1;
++ while (nopreedit[++i])
++ if (nopreedit[i]== c)
++ return i;
++ return -1;
++}
++
++
+
+ /*
+ * Search the vowel list to see if a key has a corresponding
+@@ -377,6 +401,31 @@ SinhalaInstance::sinhala_transliterated_
if (event.code == 0) return false;
@@ -67,19 +99,29 @@
if (event.is_key_release()) {
if (event.code == SCIM_KEY_Shift_L) shift_l = 0;
if (event.code == SCIM_KEY_Shift_R) shift_r = 0;
-@@ -440,82 +471,112 @@ bool
- SinhalaInstance::handle_consonant_pressed(const KeyEvent &event, int c)
+@@ -441,118 +490,215 @@ SinhalaInstance::handle_consonant_presse
{
int c1, l1;
-- unsigned char *u = NULL;
+ unsigned char *u = NULL;
-
+
+ if (m_preedit_string.length () == 0) {
++ c1 = find_nopreedit(consonents[c].character);
++ if (c1 >= 0) /* dont preedit. */
++ {
++ u = create_unicode_character_from_lsb(consonents[c].character);
++ commit_string(utf8_mbstowcs((const char*)u));
++ free(u);
++ last_key = lsb_to_unicode(consonents[c].character);
++ return true;
++ }
++ else {
+ show_preedit_string ();
+ m_preedit_string.push_back (lsb_to_unicode(consonents[c].character));
+ update_preedit_string (m_preedit_string);
+ update_preedit_caret (m_preedit_string.length ());
+ return true;
++ }
+ }
+
/* do modifiers first. */
@@ -208,40 +250,50 @@
- free(u);
+ commit_string(m_preedit_string);
+ m_preedit_string.erase (m_preedit_string.length () - 1, 1);
++ c1 = find_nopreedit(consonents[c].character);
++ if (c1 >= 0) /* dont preedit. */
++ {
++ u = create_unicode_character_from_lsb(consonents[c].character);
++ commit_string(utf8_mbstowcs((const char*)u));
++ free(u);
++ last_key = lsb_to_unicode(consonents[c].character);
++ update_preedit_string (m_preedit_string);
++ update_preedit_caret (m_preedit_string.length ());
++ return true;
++ }
++ else
+ m_preedit_string.push_back (lsb_to_unicode(consonents[c].character));
+ update_preedit_string (m_preedit_string);
+ update_preedit_caret (m_preedit_string.length ());
+
-+
- last_key = lsb_to_unicode(consonents[c].character);
+- last_key = lsb_to_unicode(consonents[c].character);
++
++ last_key = lsb_to_unicode(consonents[c].character);
return true;
-@@ -525,34 +586,62 @@ bool
+ }
+
+ bool
SinhalaInstance::handle_vowel_pressed(const KeyEvent &event, int c)
{
- int c1;
+- int c1;
- unsigned char *u = NULL;
-
-- /* look for a previous character first. */
-- u = NULL;
-- c1 = get_known_lsb_character(last_key);
-- if (is_consonent(c1)) {
-- u = create_unicode_character_from_lsb(vowels[c].single1);
-- last_key = lsb_to_unicode(vowels[c].single1);
-- }
-- else if (c1 == vowels[c].single0) {
-- backspace();
-- u = create_unicode_character_from_lsb(vowels[c].double0);
-- last_key = lsb_to_unicode(vowels[c].double0);
-- }
-- else if (c1 == vowels[c].single1) {
-- backspace();
-- u = create_unicode_character_from_lsb(vowels[c].double1);
-- last_key = lsb_to_unicode(vowels[c].double1);
-- }
-- else {
-- u = create_unicode_character_from_lsb(vowels[c].single0);
++ int c1,l1, c2,l2;
++
++ c2 = get_known_lsb_character(last_key);
++ l2 = find_nopreedit(c2);
++
++
+ if (m_preedit_string.length () == 0) {
++
++ if(l2 >= 0){
++ m_preedit_string.push_back(lsb_to_unicode(vowels[c].single1));
++ update_preedit_string (m_preedit_string);
++ update_preedit_caret (m_preedit_string.length ());
++ last_key = lsb_to_unicode(vowels[c].single1);
++ return true;
++ }
++
+ show_preedit_string ();
+ m_preedit_string.push_back (lsb_to_unicode(vowels[c].single0));
+ update_preedit_string (m_preedit_string);
@@ -249,12 +301,14 @@
+ return true;
+ }
+
++
+ else {
+
+ /* look for a previous character first. */
+ c1 = get_known_lsb_character((int)m_preedit_string[0]);
+
+
++
+ if (is_consonent(c1)) {
+ commit_string(m_preedit_string);
+ m_preedit_string.erase (m_preedit_string.length () - 1, 1);
@@ -289,7 +343,26 @@
+ m_preedit_string.push_back(lsb_to_unicode(vowels[c].single0));
+ update_preedit_string (m_preedit_string);
+ update_preedit_caret (m_preedit_string.length ());
-+
+
+- /* look for a previous character first. */
+- u = NULL;
+- c1 = get_known_lsb_character(last_key);
+- if (is_consonent(c1)) {
+- u = create_unicode_character_from_lsb(vowels[c].single1);
+- last_key = lsb_to_unicode(vowels[c].single1);
+- }
+- else if (c1 == vowels[c].single0) {
+- backspace();
+- u = create_unicode_character_from_lsb(vowels[c].double0);
+- last_key = lsb_to_unicode(vowels[c].double0);
+- }
+- else if (c1 == vowels[c].single1) {
+- backspace();
+- u = create_unicode_character_from_lsb(vowels[c].double1);
+- last_key = lsb_to_unicode(vowels[c].double1);
+- }
+- else {
+- u = create_unicode_character_from_lsb(vowels[c].single0);
last_key = lsb_to_unicode(vowels[c].single0);
}
@@ -301,8 +374,9 @@
}
/*
+diff -rup scim-sinhala-trans-0.2.0-20060825/src/scim_sinhala_imengine.h scim-sinhala-trans-0.2.0-20060825-modified/src/scim_sinhala_imengine.h
--- scim-sinhala-trans-0.2.0-20060825/src/scim_sinhala_imengine.h 2006-01-31 11:06:54.000000000 +0530
-+++ scim-sinhala-trans-0.2.0-20060825-modified/src/scim_sinhala_imengine.h 2007-12-07 12:32:57.000000000 +0530
++++ scim-sinhala-trans-0.2.0-20060825-modified/src/scim_sinhala_imengine.h 2008-01-03 12:49:44.000000000 +0530
@@ -28,6 +28,7 @@
#include <scim.h>
@@ -311,7 +385,7 @@
using namespace scim;
class SinhalaInstance : public IMEngineInstanceBase
-@@ -41,6 +42,8 @@
+@@ -41,6 +42,8 @@ private:
/* for candidates window */
CommonLookupTable m_lookup_table;
@@ -320,3 +394,11 @@
/* for toolbar */
PropertyList m_properties;
+@@ -83,6 +86,7 @@ private:
+ int is_consonent (int c);
+ int find_consonent_by_key (int k);
+ int find_consonent (int c);
++ int find_nopreedit (int c);
+ int find_vowel_by_key (int k);
+ unsigned char* create_unicode_character_from_lsb (unsigned int lsb);
+ bool sinhala_transliterated_filter_keypress (const KeyEvent &key);
Index: scim-sinhala.spec
===================================================================
RCS file: /cvs/pkgs/rpms/scim-sinhala/devel/scim-sinhala.spec,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- scim-sinhala.spec 14 Dec 2007 11:04:47 -0000 1.7
+++ scim-sinhala.spec 8 Jan 2008 10:10:08 -0000 1.8
@@ -3,7 +3,7 @@
Name: scim-sinhala
Version: 0.2.0
-Release: 4%{?dist}
+Release: 5%{?dist}
Summary: Sri Lankan input method for SCIM
Group: System Environment/Libraries
@@ -20,7 +20,6 @@
Patch2: scim-sinhala-remove-timeout-206253.patch
Patch3: scim-sinhala-help-text-206114.patch
Patch4: scim-sinhala-preedit-217065.patch
-
%description
This package provides a Sinhala Trans input method for SCIM.
@@ -60,6 +59,10 @@
%changelog
+* Tue Jan 08 2008 Pravin Satpute <psatpute at redhat.com> - 0.2.0-5.fc9
+- removed preedit for unneccessary characters(#217065)
+- modified scim-sinhala-preedit-217065.patch
+
* Fri Dec 14 2007 Pravin Satpute <psatpute at redhat.com> - 0.2.0-4.fc9
- implemented preedit in scim sinhala(#217065)
More information about the fedora-extras-commits
mailing list