line wrap problem with wide character

46 views
Skip to first unread message

ghostincircuit

unread,
Dec 8, 2012, 9:28:00 PM12/8/12
to wikidpa...@googlegroups.com
Hi, all

I have been using Wikidpad for almost a year, and it's the best cross-platform PIM software I have ever found.

But as a Chinese, the problem of line wrap has been bothering me all the time, and there's no doubt that Japanese and Koreans will also have this problem. It happened when you have typed a long string of characters and the editor do not know that there's no blanks between words in character-oriented language, so it treated a long string to be a single word, and the display will be very ugly. And even if you wrap the lines manually by adding newlines, it won't work if you zoom the view, and it would also make it quite inconvenient if you want to copy the text to elsewhere.

This can be solved by using char wrap rather than word wrap, I think we can add a global option to select whether word wrap or char wrap should be used.
Here's my patch, it worked for me under Ubuntu 12.04.

thanks!


Index: lib/pwiki/WikiTxtCtrl.py
===================================================================
--- lib/pwiki/WikiTxtCtrl.py (revision 365)
+++ lib/pwiki/WikiTxtCtrl.py (working copy)
@@ -127,7 +127,7 @@

# configurable editor settings
config = self.presenter.getConfig()
- self.setWrapMode(config.getboolean("main", "wrap_mode"))
+ self.setWrapMode(config.getboolean("main", "wrap_mode"), config.getboolean("main", "wrap_word"))
self.SetIndentationGuides(config.getboolean("main", "indentation_guides"))
self.autoIndent = config.getboolean("main", "auto_indent")
self.autoBullets = config.getboolean("main", "auto_bullets")
@@ -526,9 +526,12 @@
# self.Enable(True)
self.Enable(vis)

- def setWrapMode(self, onOrOff):
+ def setWrapMode(self, onOrOff, wordOrChar):
if onOrOff:
- self.SetWrapMode(wx.stc.STC_WRAP_WORD)
+ if wordOrChar:
+ self.SetWrapMode(wx.stc.STC_WRAP_WORD)
+ else:
+ self.SetWrapMode(wx.stc.STC_WRAP_CHAR)
else:
self.SetWrapMode(wx.stc.STC_WRAP_NONE)

Index: lib/pwiki/Configuration.py
===================================================================
--- lib/pwiki/Configuration.py (revision 365)
+++ lib/pwiki/Configuration.py (working copy)
@@ -467,6 +467,7 @@
("main", "recentWikisList_length"): u"5", # Length of recent wikis list
("main", "font"): None,
("main", "wrap_mode"): "True",
+ ("main", "wrap_word"): "True",
("main", "indentation_guides"): "True",
("main", "auto_bullets"): "True", # Show bullet/number after newline if current line has bullet
("main", "auto_indent"): "True",

Michael Butscher

unread,
Dec 10, 2012, 8:02:48 AM12/10/12
to wikidpa...@googlegroups.com
On 09.12.2012 03:28, ghostincircuit wrote:
> Hi, all
>
> I have been using Wikidpad for almost a year, and it's the best
> cross-platform PIM software I have ever found.
>
> But as a Chinese, the problem of line wrap has been bothering me all the
> time, and there's no doubt that Japanese and Koreans will also have this
> problem. It happened when you have typed a long string of characters and
> the editor do not know that there's no blanks between words in
> character-oriented language, so it treated a long string to be a single
> word, and the display will be very ugly. And even if you wrap the lines
> manually by adding newlines, it won't work if you zoom the view, and it
> would also make it quite inconvenient if you want to copy the text to
> elsewhere.
>
> This can be solved by using char wrap rather than word wrap, I think we can
> add a global option to select whether word wrap or char wrap should be used.
> Here's my patch, it worked for me under Ubuntu 12.04.

Thank you for the patch. I intend to implement it slightly differently by using
an attribute "wrap_type" (with values "word" or "char") which can be placed on a
single wiki page or "global.wrap_type" to affect all pages of a wiki. This would
allow more fine-grained control than a global configuration setting.

Is this ok for you?


Michael

ghostincircuit

unread,
Dec 10, 2012, 10:27:59 PM12/10/12
to wikidpa...@googlegroups.com
Yes, it's better.
Besides, we could add a option in the option dialog.

Michael Butscher

unread,
Dec 25, 2012, 9:27:54 AM12/25/12
to wikidpa...@googlegroups.com
On 11.12.2012 04:27, ghostincircuit wrote:
> Yes, it's better.
> Besides, we could add a option in the option dialog.

Ok.


Michael

Kehong Liu

unread,
Mar 28, 2016, 2:24:30 AM3/28/16
to wikidpad-devel
I am with wikdPad 2.2 now,  could not find wrap_type support,  is wrap_type implemented? thanks.

在 2012年12月25日星期二 UTC+8下午10:27:54,Michael Butscher写道:

Michael Butscher

unread,
Apr 5, 2016, 8:22:16 PM4/5/16
to wikidpa...@googlegroups.com
On 28.03.2016 08:24, Kehong Liu wrote:
> I am with wikdPad 2.2 now, could not find wrap_type support, is wrap_type
> implemented? thanks.

It isn't in 2.2. It was introduced with 2.3beta09.


Michael
Reply all
Reply to author
Forward
0 new messages