chewing / chewing-editor

Cross platform chewing user phrase editor
https://chewing.im/
GNU General Public License v2.0
31 stars 52 forks source link

Typing a long word #74

Open cltseng0420 opened 8 years ago

cltseng0420 commented 8 years ago

Sometimes if you type a word, for example, "王王王王王王王王王王王王王(13 characters)", it cannot add to the chewing editor.

david50407 commented 8 years ago

Debug console will output like this:

Warning: [userphrase-sql.c:213 UserUpdatePhrase] wordSeq length > 20 MAX_PHRASE_LEN (11) ((null) :0)

Maybe we can show a error dialog telling the word user typed-in is too long, or showing the limitation while adding phrases?

ShengYenPeng commented 8 years ago

we can add phrase->setMaxLength(11); in void setupUi(QDialog *UserphraseDialog), which is inside "ui_UserphraseDialog.h"

so that the phrase will be truncated into limited size, you can't input more than 11 characters.

*use MAX_PHRASE_LEN is better than 11, but I don't know where is MAX_PHRASE_LEN.

ref: maxLength : int

ShengYenPeng commented 8 years ago

oh... I found "ui_UserphraseDialog.h" is generated by "UserphraseDialog.ui"....

david50407 commented 8 years ago

MAX_PHRASE_LEN is inside libchewing, it depends on the package on your system

ShengYenPeng commented 8 years ago

I found that

MAX_PHRASE_LEN in 'libchewing/include/internal/chewing-private.h' is

#define MAX_PHRASE_LEN 11