WordWrap algorithm for kate

Hamish Rodda rodda at kde.org
Mon Jun 6 13:19:55 BST 2005


On Sun, 5 Jun 2005 12:42 am, younker_dl wrote:
> Hi, All,
>
> I think the word wrap algorithm for kate isn't good, it wraps the word
> according to the space position, so if you write english articles, maybe
> this is the one you want, but if you write source codes, the wrapper
> function are not suitable for it. Also it works incorrect for Chinese
> word wrap.
>
> For example, the following codes are copied from kdelibs 3.4.1
>
>   KateAttribute* attr = m_doc->highlight()->attributes(m_schema)->data();
>
> if the window hasn't enough width to hold the line it maybe wrapped like
> this.
>
>   KateAttribute* attr =
> m_doc->highlight()->attributes(m_schema)->data();
>
> It wrapped at the last space position in the line.
>
> I don't think this is a good algorithm to wrap line.
>
> Could anyone tell me where is the code handled the wrapper function?

In kdelibs/kate/part/katerenderer.cpp:

uint KateRenderer::textWidth(const KateTextLine::Ptr &textLine, uint startcol, 
uint maxwidth, bool *needWrap, int *endX)

This function calculates the length of the line which fits within maxwidth - 
feel free to adjust it, and post a patch.

Please continue this thread on kwrite-devel at mail.kde.org - this is the list 
where discussions primarily concerning kate should go.

Cheers,
Hamish.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20050606/fee59701/attachment.sig>
-------------- next part --------------
_______________________________________________
KWrite-Devel mailing list
KWrite-Devel at kde.org
https://mail.kde.org/mailman/listinfo/kwrite-devel


More information about the kde-core-devel mailing list