Bug 329106 - Cantor does not use a monospace font in the Help column
Summary: Cantor does not use a monospace font in the Help column
Status: RESOLVED FIXED
Alias: None
Product: cantor
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR wishlist
Target Milestone: ---
Assignee: Alexander Rieder
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-22 04:20 UTC by Yichao Zhou
Modified: 2014-02-04 20:16 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
make help panel monospace (580 bytes, patch)
2014-01-28 17:46 UTC, Yichao Zhou
Details
updated patch r2 (3.61 KB, patch)
2014-01-29 06:13 UTC, Yichao Zhou
Details
updated patch r3 (3.55 KB, patch)
2014-01-29 07:02 UTC, Yichao Zhou
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yichao Zhou 2013-12-22 04:20:07 UTC
Some helps from backend like sage prints the help of python, which is indented to be displayed with monospace font.  I suggest that we could change its font to monospace in order to increase the readability.

Reproducible: Always
Comment 1 Yichao Zhou 2014-01-28 15:42:57 UTC
Any comments on this?
Comment 2 Alexander Rieder 2014-01-28 15:49:23 UTC
Hi,
sorry for the long silence. You are right, this should be changed. 
If you want to do it, it shouldn't be too hard, just look at src/panelplugins/helppanel/helppanel.cpp. Otherwise I will fix it myself, probably this weekend.
Comment 3 Yichao Zhou 2014-01-28 17:46:03 UTC
Created attachment 84870 [details]
make help panel monospace

Yes.  It is just a one line patch but it costs me some time to figure it out.
Comment 4 Yichao Zhou 2014-01-29 04:52:56 UTC
After using monospace, another problem I find is that the leading space of help is gone (at least for sage backend).
Comment 5 Yichao Zhou 2014-01-29 06:13:12 UTC
Created attachment 84875 [details]
updated patch r2

I have updated my patch:  the original patch will make other stuff such as right-click menu in the help panel to use monospace too.  I think it is fixed now.

I also fixed the monospace problem:  I just escape the whitespace in some popular backends: sage, octave and R.

Unfortunately, I found that the help system in maxima is buggy: when I type "example(integrate);", the result is not shown in the help panel.  So I cannot fix that.
Comment 6 Yichao Zhou 2014-01-29 07:02:33 UTC
Created attachment 84876 [details]
updated patch r3
Comment 7 Yichao Zhou 2014-01-29 07:04:26 UTC
I also found such code in last git:

  if(s&&s->sageVersion()>SageSession::VersionInfo(5, 7))
    extractCompletionsLegacy();
  else
    extractCompletionsNew();

Are you sure we are using extractCompletionsLegacy when I'm using sage 6.0?  At least that doesn't enable completion on my linux.  I think you should reverse the inequality.
Comment 8 Alexander Rieder 2014-02-01 18:46:00 UTC
Hi,
sorry it took me a while to look at your patch.
It seems to work but is there a reason you didn't just use "m_edit->setFontFamily("monospace");" instead of manaully setting the font each time? 
The escaping of the whitespaces is a good idea.
example not working is strange. from a quick glance at the code i have no idea what could be wrong. it might take me a little bit to figure it out.
The version statement is obviously wrong. good catch, thanks! i'll fix it immediately. (in fact i just got a bug report about this today (Bug 330632)
Comment 9 Yichao Zhou 2014-02-02 03:42:00 UTC
If you try m_edit->setFontFamily("monospace");, you will find it simply will not work.  This is because m_edit has a HTML backend engine. "m_edit->setFontFamily" will only change the font selected.  So we need to select all the text first, then change the font.  Finally we deselect all the text (and move the cursor to the begining).
Comment 10 Alexander Rieder 2014-02-03 21:48:19 UTC
hi,
you're right, it woudln't work, sorry. I somehow didn't expect that behaviour. 
Your patch looks fine and can go into master, but personally I'd remove the #include<KDebug> and "kdebug()<<help;" call, as I think it creates a lot of noise and is not very useful on a day to day basis. what do you think?
Do you have commit rights or should I commit this for you?
Comment 11 Yichao Zhou 2014-02-04 03:35:24 UTC
YES.  That's right.  Please remove that.

I do not have the commit rights and please commit for me.
Comment 12 Alexander Rieder 2014-02-04 20:16:14 UTC
Git commit a2f20c1659a46b4ea7493b04500068947a62fd48 by Alexander Rieder.
Committed on 04/02/2014 at 20:12.
Pushed by arieder into branch 'master'.

- change the font of the help panel to monospace
- escape spaces in the help messages, as they might be important for formatting

Patch by Yichao Zhou, thanks!

M  +2    -0    src/backends/R/rexpression.cpp
M  +3    -0    src/backends/octave/octaveexpression.cpp
M  +3    -0    src/backends/sage/sageexpression.cpp
M  +13   -2    src/panelplugins/helppanel/helppanelplugin.cpp
M  +1    -0    src/panelplugins/helppanel/helppanelplugin.h

http://commits.kde.org/cantor/a2f20c1659a46b4ea7493b04500068947a62fd48