Bug 156561 - [PATCH] Thai language issues in Kate
Summary: [PATCH] Thai language issues in Kate
Status: RESOLVED WORKSFORME
Alias: None
Product: kate
Classification: Applications
Component: part (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: VHI normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2008-01-24 17:21 UTC by Pattara Kiatisevi
Modified: 2018-10-27 04:18 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Fix several Thai related issues in Kate/Kwrite (9.86 KB, patch)
2008-01-24 17:22 UTC, Pattara Kiatisevi
Details
Fix several Thai related issues in Kate/Kwrite (10.94 KB, patch)
2008-01-29 17:10 UTC, Pattara Kiatisevi
Details
Fix Thai word break crash in Kate/Kwrite (10.99 KB, patch)
2008-02-08 11:22 UTC, Jakkapun Kwanroengjai
Details
kdelibs/kate Thai wordbreak patch (6.42 KB, patch)
2008-08-28 10:00 UTC, Pattara Kiatisevi
Details
kdelibs/kate im cursor query patch (580 bytes, patch)
2008-08-28 10:07 UTC, Pattara Kiatisevi
Details
Fixed Thai-related problems in Kate (Word break and cursor movement) (6.46 KB, patch)
2010-05-13 18:20 UTC, Pattara Kiatisevi
Details
Fixed Thai-related problems in Kate (Word break and cursor movement) (7.51 KB, patch)
2012-01-07 03:28 UTC, Pattara Kiatisevi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pattara Kiatisevi 2008-01-24 17:21:49 UTC
Version:            (using KDE 4.0.0)
Installed from:    Ubuntu Packages

This patch by Jakkapun Kwanroengjai fixes Thai-related issues in Kate.

-Word breaking: it uses libthai (either compile-time linking or dynamic loading in the similar fashion to in KHTML) to determine words boundaries positions and stores in the m_breakLine attributes. Pressing the Ctrl + Left/Right arrow keys should now be able to jump between Thai words.

-Cursor movement and delete/backspace keys' behavior: now works correctly in case of Thai text

-Input method: fixed in the Qt::ImCursorPosition case to return the correct position

-Wrap text: wrap Thai sentences properly when selecting Tool / Word Wrap Document. (Question: where to fix if we want this wrapping to happen automatically?)
Comment 1 Pattara Kiatisevi 2008-01-24 17:22:48 UTC
Created attachment 23243 [details]
Fix several Thai related issues in Kate/Kwrite

By Jakkapun Kwanroengjai 
URL:
http://linux.thai.net/viewvc/viewvc.cgi/software/kde/kdelibs-4.0.0/kate_thai_patch.diff?view=log
Comment 2 Hamish Rodda 2008-01-29 06:26:41 UTC
Patch looks ok to me, if one of the other kate devs can try it out to check for regressions and it looks ok, it can be committed (sorry, no time to do so here at the moment)
Comment 3 Pattara Kiatisevi 2008-01-29 17:10:38 UTC
Created attachment 23350 [details]
Fix several Thai related issues in Kate/Kwrite

Updated patch from Mr.Jakkapun Kwanroengjai

+ fix Thai word break problem in the case of dynamic word wrapping
Comment 4 Jakkapun Kwanroengjai 2008-02-08 11:22:36 UTC
Created attachment 23476 [details]
Fix Thai word break crash in Kate/Kwrite

Fix Thai word break crash in Kate/Kwrite
Comment 5 Christoph Cullmann 2008-08-19 00:05:54 UTC
No idea about it? Commit it?
Comment 6 Hamish Rodda 2008-08-19 05:07:18 UTC
I've had another look at this...

1) "Question: where to fix if we want this wrapping to happen
automatically?"

As far as I understand, you'd need to patch Qt or at least report it to Trolltech.  We use QTextOption::WrapAtWordBoundaryOrAnywhere now in katepart SVN head, and if Qt isn't breaking at the correct places, that's a Qt issue.

2) I'm not sure about having that break line vector in text line, that seems like a bit of an unnecessary use of memory, can't it be calculated only when needed, or stored somewhere else (eg. in KateTextLine / KateTextLayout) temporarily?
Comment 7 Christoph Cullmann 2008-08-19 07:51:27 UTC
For 2), I don't want a line break vector in textline, that is overhead not justified just for thai linebreaks.
Comment 8 Pattara Kiatisevi 2008-08-28 10:00:03 UTC
Created attachment 27096 [details]
kdelibs/kate Thai wordbreak patch

Updated patch for KDE 4.1 /Qt 4.4 -- use Qt/HarfBuzz to break words instead of doing it by ourselves

(patch by Thanomsub Noppaburana)
Comment 9 Pattara Kiatisevi 2008-08-28 10:07:36 UTC
Created attachment 27097 [details]
kdelibs/kate im cursor query patch
Comment 10 Pattara Kiatisevi 2008-08-28 10:10:27 UTC
We have patched Qt 4.4 to include Thai support and will send to Trolltech. The new patch above won't do the breaking by itself anymore but instead will consult Qt. Please help review.

Cheers,
Pattara
Comment 11 Hamish Rodda 2008-08-28 17:14:06 UTC
Thanks for the new patch, it seems to be more in line with what I wanted (support to mainly come from Qt).  I'll take a look in detail soon.

The im cursor query patch is already implemented in trunk, although a little differently to what you have done (it returns the start of the preedit string when one exists).  Could you please test that?
Comment 12 Jakkapun Kwanroengjai 2008-08-29 12:44:50 UTC
I tested the code in trunk and found m_cursor.start().column() is always zero  so XIM doesn't really work.

Here I dump the values of m_cursor.start().column() compared to those of m_cursor.column() when typing a Thai word "ที่"

m_cursor.start().column() = 0    m_cursor.column() = 1
m_cursor.start().column() = 0    m_cursor.column() = 2  
m_cursor.start().column() = 0    m_cursor.column() = 3  
m_cursor.start().column() = 0    m_cursor.column() = 3  
Comment 13 Pattara Kiatisevi 2008-11-12 13:34:49 UTC
This is to inform that the above two Thai language related patches for kwrite ( Thai wordbreak and IM cursor query) works OK on KDE 4.1.3/Qt 4.4.3 (just tested).
Comment 14 Pattara Kiatisevi 2009-09-20 06:39:25 UTC
So any progress on this? Any comment with the patch?

Commit it?
Comment 15 Dominik Haumann 2010-05-09 09:10:46 UTC
Can you please build current kate and check whether this is still an issue?
As far as I know the patch was never committed. A tutorial on how to compile kate can be found here: http://gitorious.org/kate/pages/Building%20Kate
Comment 16 Pattara Kiatisevi 2010-05-13 18:20:10 UTC
Created attachment 43547 [details]
Fixed Thai-related problems in Kate (Word break and cursor movement)

-word wrapping
-cursor movement
-delete and backspace
Comment 17 Pattara Kiatisevi 2010-05-13 18:22:37 UTC
Yes the problem still exists and we have revised the patch against KDE 4.4.2 (source from Ubuntu Lucid).

Correct the patch was never committed and we're wondering why...
Comment 18 Christoph Cullmann 2010-05-22 20:41:02 UTC
Could you redo the patch without the ugly defines? I guess requiring Qt 4.4 is no problem, KDE anyways needs 4.5/6.
Comment 19 Dominik Haumann 2010-10-26 15:48:13 UTC
@Pattara: Can you build Kate again (http://kate-editor.org/get-it/), and if the bug still exists, redo your patch without the redefines? Maybe we'll finally get this in for KDE 4.6 then!
Comment 20 Pattara Kiatisevi 2010-10-26 17:39:37 UTC
OK Dominik we'll try, thank you.

Pattara
Comment 21 Dominik Haumann 2011-08-08 12:52:18 UTC
Any updates? It's been almost a year, and in the meantime KDE 4.7 is out.
Comment 22 Pattara Kiatisevi 2012-01-07 03:28:45 UTC
Created attachment 67527 [details]
Fixed Thai-related problems in Kate (Word break and cursor movement)

Sorry for the long delay. We just tested against 4.7.3. The bug still exists. The revised patch is as attached. Please review.
Comment 23 Christoph Cullmann 2012-07-04 14:40:04 UTC
Git commit 1d3b6bca55b8d73c88dd122861f5927cc3c3098e by Christoph Cullmann.
Committed on 04/07/2012 at 16:39.
Pushed by cullmann into branch 'master'.

apply patch for thai
we missed to have this for KDE 4.9, but without wider testing, I won't like to backport this
now at least in master
thanks for the patch, please review, if current behavior is now ok

M  +4    -7    part/document/katedocument.cpp
M  +16   -9    part/view/kateview.cpp
M  +73   -52   part/view/kateviewinternal.cpp

http://commits.kde.org/kate/1d3b6bca55b8d73c88dd122861f5927cc3c3098e
Comment 24 Christoph Cullmann 2012-07-05 14:28:42 UTC
Git commit f6a351d4e5fbd4a32c09ab312b463fcd65a33d2e by Christoph Cullmann.
Committed on 05/07/2012 at 16:27.
Pushed by cullmann into branch 'master'.

try to fix selectWord
did crash with thai patch sometimes, because out of range
use hl functions again
please review thai guys ;)

M  +21   -17   part/view/kateview.cpp

http://commits.kde.org/kate/f6a351d4e5fbd4a32c09ab312b463fcd65a33d2e
Comment 25 Christoph Cullmann 2012-10-21 11:38:00 UTC
Reopen, reverted commits because of regressions, see:

On Wednesday 17 Oct 2012 21:50:55 Michel Ludwig wrote:
> Hi,
> 
> On Wed 17 Oct 2012 08:56:22 Simon St James wrote:
> > The commit:
> > 
> > https://projects.kde.org/projects/kde/kde-
> > baseapps/kate/repository/revisions/1d3b6bca55b8d73c88dd122861f5927cc3c3098
> > e
> > 
> > which fixes bug:
> > 
> > https://bugs.kde.org/show_bug.cgi?id=156561
> > 
> > breaks word-wrapping pretty severely, making e.g. Kile almost unusable.  A
> > small test-case can be found by running vimode_test (it's currently the
> > only failing test). I'd look into it myself, but I don't know enough about
> > https://bugs.kde.org/show_bug.cgi?id=156561 to not break anything :/
> 
> Is this maybe related to bug 304258 as well?
> 
> https://bugs.kde.org/show_bug.cgi?id=304258
Comment 26 Christoph Cullmann 2012-10-27 09:47:33 UTC
In would need an updated patch, this own breaks word wrap and co :(
Comment 27 Andrew Crouthamel 2018-09-23 02:32:12 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information as soon as possible and set the bug status as REPORTED. Due to regular bug tracker maintenance, if the bug is still in NEEDSINFO status with no change in 30 days, the bug will be closed as RESOLVED > WORKSFORME due to lack of needed information.

For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please set the bug status as REPORTED so that the KDE team knows that the bug is ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 28 Andrew Crouthamel 2018-10-27 04:18:47 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least 30 days. The bug is now closed as RESOLVED > WORKSFORME due to lack of needed information.

For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!