Changeset 112

Show
Ignore:
Timestamp:
Mon Apr 16 07:54:29 2007
Author:
mbutscher
Message:

branches/mbutscher/work:

* Clicking on footnotes moves to the last footnote on page

(footnote anchor). In HTML preview/export all but the
last footnote become links to the last one (this does of
course not work if footnotes are set in options to be
used as wikiwords).
* Internal: New subpackage rtlibRepl (runtime library
replacement) to replace things from Python runtime which
might need change, currently used for re module.
* Rebuild is now slower, but more reliable. Two pass
rebuild: First pass collects attribute(=property)
changes, second pass does the rest.
* Better update of a page if some important properties were
changed
* Support for auto_link function: find (groups of) words
that match a wiki word and make them links.
* Store list of all open wiki words in wiki configuration
between sessions
* Some speedup and convenience changes in customtreectrl.py
* Clicking on fold margin in editor shows fold menu
* Bug fixed: editor context menu showed "Cut" and "Delete"
if pasting is not possible
* Bug fixed: Links were sometimes not recognized when
having the same page in two tabs
* Bug fixed: Some clipboard and drag&drop problems on Linux
(other problems exist yet).
* Support for "win" modifier (=Windows key) for hotkeys.

Files:

Legend:

Unmodified
Added
Removed
Modified
  • branches/mbutscher/TodoList.txt

    r107 r112  
      1 Wiki hotkey support doesn't recognize WinKey. Is it possible to add it? (To  
      2 support scenarios like WinKey+P or even WinKey + `). Thanks.  
      3  
      4  
      5 > right clicking inside the folding marker area/margin could popup the Folding menu  
      6  
      7  
    1 8 +++ More graceful handling if options dialog started without wiki loaded  
    2 9  
    3 10  
      11 WikidPad seems to work well with tabs. This would be an interesting  
      12 alternate delimiter for tables since anything pasted from and to Excel  
      13 is tab delimited. I believe this is also true for Open Office  
      14 spreadsheet.  
      15  
      16 Maybe it could be <<|tab| or something like that. The table start and  
      17 end tag could even be copied since they would just be in the first  
      18 column in Excel anyway.  
      19  
      20 Basically what I do now is paste to WikidPad and then change tabs to a  
      21 tab plus a "|".  
      22 *Details*:  
      23 First, allow to insert tabs in editor.  
      24  
      25  
      26 > This should now at least work for "http:" and "ftp:" links.  
      27  
      28 > "file:" links may not always work as desired, but currently I don't know  
      29 > how to start the right application for e.g. an Open Office or audio file  
      30 > on Linux.  
      31  
      32 On the command line i use 'open <filename>' to start the apropriate application for the file. the 'open' comand is provided by Gnome, which I use on my desktop. However, I think it is the same command for KDE, so you might try to launch 'open' for the file in question.  
      33  
      34  
      35 * there is, however, a bug with deleting headings. Write on a new page:  
      36 <<  
      37 text  
      38 another text  
      39 >>  
      40  
      41 fold both headings, highlight and delete them one by one. you will see only 'text' on the page and 'another text' can be only recovered if you write a new heading under (or maybe above, too?) 'text' and you fold and unfold it. (it shows in preview, though)(probably re-opening the wiki also helps)  
      42  
      43  
    4 44 +++ Wiki info dialog (initially done)  
    5 45 Containing database backend and some stats  
    6 46  
    7 47  
    8   +++ Find/Replace History (at least of previous settings if not previous searches)  
    9 48  
    10 49  
    11   +++ Report number of replacements made from Replace All/Replace in Selection  
      50 > * drop-down history of typed-in searches in Search Wiki? Same for Open  
      51 > Wiki? (I know there is Save Search)  
      52  
      53  
      54 Handle "page" insertions like links to other pages (show as children in the tree).  
      55  
      56  
      57 <<  
      58 That's awesome! Although I searched throught he Wikidpad Help and  
      59 didn't see any reference to ctrl-alt-d.  
      60  
      61 I find the journaly aspect of wikedpad extremely useful. I love to see  
      62 more funtionallity built around this.  
      63  
      64 It would be nice if there were other key combinations I could  
      65 customize. For example if I want a journal for fixing up my hotrod I  
      66 prefix with string with [hotrod.*] and for my Brain surgery research  
      67 I'd used [brains.*]. I see that with the Global Script library I can  
      68 basically do this using python functions, but would like to see this  
      69 more into the basic functionallity.  
      70 >>  
      71  
      72  
      73  
      74  
      75  
      76  
      77  
      78 I think it would be a great addition to have ability to sort based on  
      79 last modified date of the topics.  
    12 80  
    13 81  
     
    28 111  
    29 112  
      113 i would also recommend adding a 'Show All (Levels)' kind of  
      114 option that would... well, show all levels, like a toc tree  
      115 (or maybe a 'Show 1/Show 2 etc. level' like in Word's outliner  
      116 function). Do you know what I mean?  
      117  
      118  
      119  
    30 120 +++ More shortcut customizations  
    31 121 > (Having mentioned shortcut keys: is there any ways to change ctrl-space  
     
    57 148  
    58 149  
      150 Show all or selected level of headings in the same fold-level  
      151  
      152  
      153 maybe when you highlight a folded heading, the text (although not visible) under it should be highlighted/selected as well. so, when dragged (deleted), the text should be moved (deleted) too. (this is how old-school outlining works, anyway, and it has its ups and downs, so needs some more thinking. maybe deleting should work differently? or whole thing should be optional? brr, i don't like these questions...  
      154  
      155  
    59 156 +++ Option to ignore repeated properties on a page.  
    60 157 Normally, properties are intended to tag a whole page, therefore WikidPad thinks it is an error if the same property appears twice. I can at least create an option to switch off this behavior.  
     
    84 183  
    85 184  
    86   +++ Ctrl-Tab to toggle Edit and Preview mode when in another window  
    87   > 1) Ctrl-Tab toggles between Edit and Preview mode.  
    88   > But only if the focus is in one of the above two windows.  
    89   > It would be nice if that would work too if the focus is in the tree  
    90   > view.  
    91    
    92    
    93 185 +++ Limited number of characters per line in preview  
    94 186 >>> Thank you for your effort in this wonderful software.  
     
    133 225  
    134 226  
      227 I use the ISO-8601 format. http://www.saqqara.demon.co.uk/datefmt.htm  
      228  
      229 But for weekdays it uses 1 to 7 for Monday to Sunday.  
      230  
      231 Can it be a other literal, for example %q, similar to %w but for ISO-8601?  
      232  
      233 %w : Weekday as a decimal number [0(Sunday),6]  
      234 %q : Weekday as a decimal number [1(Monday),7]  
      235  
      236 So I can write  2006-03-25  or  2006-W12-6  for today.  
      237  
      238  
    135 239 +++ mark search words in different color on found pages  
    136 240 > mark search words in different color on found pages  
     
    154 259  
    155 260  
      261 > Sorry, but I don't agree. Quite the contrary. Most of the time, I feel  
      262 > in wikidPad, that I have to remember what wikis I've already made (not  
      263 > the precise names, that's true (thanks to AutoComplete), but the wikis  
      264 > themselves). I WILL GIVE YOU AN EXAMPLE WHAT I MEAN BELOW. PLS JUST SKIP  
      265 > THE NEXT FEW PARAGRAPHS IF NOT INTERESTED.  
      266 >  
      267 > You assume that I only want to create links on purpose, but what if I  
      268 > don't?  
      269 >  
      270 > Let me give you an example: I'm making lots of research for a project  
      271 > and collect notes in wikidPad, but I have something like 100 different  
      272 > keywords of the project as wikiwords, like e.g. "Atapuerca", "Homo  
      273 > erectus", "Gran Dolina". It's impossible to remember which of these I  
      274 > have made notes on already. So with the ZuluPad approach, when I write  
      275 > down anywhere "Homo erectus" (of which I would never normally write down  
      276 > "HomoErectus"), I could see that I already have a wiki like that. This  
      277 > way, I can create a wikipedia-like cross linked database effortlessly,  
      278 > without having to remember what entries I have already covered. (It  
      279 > keeps the flow of writing completely fluent, and it was what I wanted to  
      280 > achieve in point 5 above with "GranDolina".)  
      281 >  
      282 > It has other handy uses, like learning languages: e.g. you paste a  
      283 > target-language text into a TextWiki. You start reading and come across  
      284 > a word that you don't know. You look it up, wikize it and write the  
      285 > definition into its wiki. This way, you slowly build your own dictionary  
      286 > sort of thing and later, as you paste a new text into the TextWiki, you  
      287 > would see all the words that you have covered and click on them if  
      288 > you're not sure what they mean, etc.  
      289 >  
      290 >> and on the other hand you may create undesired links because a typed  
      291 >> text incidentially matches a wiki word.  
      292 >  
      293 > That's true, but if I'm so stupid to wikize a word like "the", than I  
      294 > deserve to have undesired links... It needs some common sense to wikize  
      295 > a bit more unique words/word combinations.  
      296 >  
      297 > Anyway, suppose I wikize something more unique and still create an  
      298 > undesired link; you could surely escape it... Also, I could still choose  
      299 > to use only ThisWay or [this]...  
      300 *Details*:  
      301     * Should be case-insensitive  
      302     * Try brute force searching (as Soks does)  
      303  
      304  
      305 E.g.  
      306 \[:imageicon:notepad]  
    156 307  
    157 308  
     
    201 354  
    202 355  
      356 > I'm new to wikidpad, and I'm slowly getting love it. I really like the  
      357 > "modified-within" autogrouping. Is there any way I can extend the  
      358 > current 1,3,7 & 30 date ranges? Ideally I'd like make them none  
      359 > overlapping ranges too. Everything else seems to be configurable - is  
      360 > this?  
      361  
    203 362  
    204 363  
     
    213 373  
    214 374  
    215   +++ HTML export: Allow exporting entities as they are  
    216    
    217    
    218 375 +++ HTML import  
    219 376 This is one of the most important features for me. Perhaps it could be  
     
    282 439  
    283 440  
    284   +++ tabs as table cell delimiter  
    285   WikidPad seems to work well with tabs. This would be an interesting  
    286   alternate delimiter for tables since anything pasted from and to Excel  
    287   is tab delimited. I believe this is also true for Open Office  
    288   spreadsheet.  
    289    
    290   Maybe it could be <<|tab| or something like that. The table start and  
    291   end tag could even be copied since they would just be in the first  
    292   column in Excel anyway.  
    293    
    294   Basically what I do now is paste to WikidPad and then change tabs to a  
    295   tab plus a "|".  
    296   *Details*:  
    297   First, allow to insert tabs in editor.  
    298    
    299    
    300 441 +++ Select multiple tree nodes  
    301 442 > I see, thanks. I was trying under Views - parentless-nodes. I could use  
     
    331 472  
    332 473  
    333   +++ Autocompletion for todo items  
    334   Sometimes it is very hard to keep tack of all special attributes and  
    335   their subgroups. It would be great to have auto completion for atts  
    336   too. That would keep things more ordered.  
    337    
    338    
    339   +++ Autocompletion for anchors  
    340   Scenario: cntl-space after the first few wikiword letters brings up  
    341   the autocomplete - select the correct wikiword (currently  
    342   implemented), then type the exclamation point - then an additional  
    343   cntl-space would scan the wikiword for anchors to populate the  
    344   autocomplete with.  
    345    
    346    
    347   +++ Autocompletion for all words  
    348   > 2. Editor: SciTE offers auto completion. Right now Wikid Pad limits  
    349   > this feature to attribute names and wiki words. An option to turn this  
    350   > on for all words would be great.  
    351    
    352    
    353    
    354    
    355 474 +++ hide nodes in tree by attribute  
    356 475 <<  
     
    374 493  
    375 494  
      495 > Under the Print menu dialog, add "preview page" in addition to plain  
      496 > text. This is how I would want to print my todo list and my contacts  
      497 > etc.  
      498 *Details*:  
      499 The wxPython library, beneath other things used for printing, has some problems to print out really large documents. Printing a single wiki page in HTML (if it doesn't span over 20 or 30 paper pages) should work.  
      500  
      501  
    376 502 +++ Allow selection of page sets by view, by property  
    377 503 The way that I'm using it is to organize things by project, but to use  
     
    394 521  
    395 522  
    396   +++ Allow to store selections in Export or Print dialog as presets  
    397    
    398    
    399   +++ System-wide hotkey  
    400   It would also be cool it WikiPad would support a hotkey to expand it.  
    401    
    402    
    403 523 +++ Better check for validity of special properties (partially done)  
    404 524  
     
    419 539  
    420 540  
    421   +++ On tree context menu click, don't switch to clicked tree item  
    422   > Having talked about nodes, when I right-click a node I wouldn't want to  
    423   > open that page, just to see its popup menu. (But if I did want to open  
    424   > it, there could be an "Go to/Open Wiki" menu item, couldn't there?)  
    425    
    426   > 7. Tree and mouse: When right clicking on an item in the tree to open  
    427   > the context menu, in the edit / preview pane the according page is  
    428   > displayed. I guess it would be more intuitive, if the according page  
    429   > is only displayed when left clicking an item in the tree. In other  
    430   > words: When just right clicking on a tree item, the editor / preview  
    431   > pane shouldn't change its focus.  
    432    
    433    
    434    
    435 541 +++ icon bar button for bullets  
    436 542 > How about an icon bar button for bullets, like the ones for italics and bold?  
     
    513 619  
    514 620  
    515   +++ Make automatic wiki links from normal text words (configurable!)  
    516   > Sorry, but I don't agree. Quite the contrary. Most of the time, I feel  
    517   > in wikidPad, that I have to remember what wikis I've already made (not  
    518   > the precise names, that's true (thanks to AutoComplete), but the wikis  
    519   > themselves). I WILL GIVE YOU AN EXAMPLE WHAT I MEAN BELOW. PLS JUST SKIP  
    520   > THE NEXT FEW PARAGRAPHS IF NOT INTERESTED.  
    521   >  
    522   > You assume that I only want to create links on purpose, but what if I  
    523   > don't?  
    524   >  
    525   > Let me give you an example: I'm making lots of research for a project  
    526   > and collect notes in wikidPad, but I have something like 100 different  
    527   > keywords of the project as wikiwords, like e.g. "Atapuerca", "Homo  
    528   > erectus", "Gran Dolina". It's impossible to remember which of these I  
    529   > have made notes on already. So with the ZuluPad approach, when I write  
    530   > down anywhere "Homo erectus" (of which I would never normally write down  
    531   > "HomoErectus"), I could see that I already have a wiki like that. This  
    532   > way, I can create a wikipedia-like cross linked database effortlessly,  
    533   > without having to remember what entries I have already covered. (It  
    534   > keeps the flow of writing completely fluent, and it was what I wanted to  
    535   > achieve in point 5 above with "GranDolina".)  
    536   >  
    537   > It has other handy uses, like learning languages: e.g. you paste a  
    538   > target-language text into a TextWiki. You start reading and come across  
    539   > a word that you don't know. You look it up, wikize it and write the  
    540   > definition into its wiki. This way, you slowly build your own dictionary  
    541   > sort of thing and later, as you paste a new text into the TextWiki, you  
    542   > would see all the words that you have covered and click on them if  
    543   > you're not sure what they mean, etc.  
    544   >  
    545   >> and on the other hand you may create undesired links because a typed  
    546   >> text incidentially matches a wiki word.  
    547   >  
    548   > That's true, but if I'm so stupid to wikize a word like "the", than I  
    549   > deserve to have undesired links... It needs some common sense to wikize  
    550   > a bit more unique words/word combinations.  
    551   >  
    552   > Anyway, suppose I wikize something more unique and still create an  
    553   > undesired link; you could surely escape it... Also, I could still choose  
    554   > to use only ThisWay or [this]...  
    555   *Details*:  
    556   Should be case-insensitive  
    557    
    558    
    559   +++ History of searches, opened wiki words, autocompleted terms and opened wikis  
    560   > * drop-down history of typed-in searches in Search Wiki? Same for Open  
    561   > Wiki? (I know there is Save Search)  
    562    
    563    
    564   +++ Multiple wikis in one window  
    565   > I like using 3 separate wikis for my different projects, but sometimes I  
    566   > wish I could use them all together as one. What I see is a kind of  
    567   > 'merge wikis' thing, where I could open/access/modify/search all three  
    568   > of them as one, but I could open them separately as well, if I want.  
    569   > (What I see after 'merging', is a new wiki with the 3 separate wikis'  
    570   > names on the root page as tree nodes.) Do you know what I mean?  
    571    
    572    
    573 621 +++ Highlight search terms in preview  
    574 622 > When searching the search terms (when found) are highlighted in the  
     
    628 676  
    629 677  
    630   +++ date format with weekday between 1 and 7  
    631   I use the ISO-8601 format. http://www.saqqara.demon.co.uk/datefmt.htm  
    632    
    633   But for weekdays it uses 1 to 7 for Monday to Sunday.  
    634    
    635   Can it be a other literal, for example %q, similar to %w but for ISO-8601?  
    636    
    637   %w : Weekday as a decimal number [0(Sunday),6]  
    638   %q : Weekday as a decimal number [1(Monday),7]  
    639    
    640   So I can write  2006-03-25  or  2006-W12-6  for today.  
    641    
    642    
    643 678 +++ No more delayed respect of camelCaseWordsEnabled attribute  
    644 679 > (2) If I insert \[camelCaseWordsEnabled=false] in a page, in which  
     
    651 686  
    652 687  
    653    
    654    
    655   +++ HTML print  
    656   > Under the Print menu dialog, add "preview page" in addition to plain  
    657   > text. This is how I would want to print my todo list and my contacts  
    658   > etc.  
    659   *Details*:  
    660   The wxPython library, beneath other things used for printing, has some problems to print out really large documents. Printing a single wiki page in HTML (if it doesn't span over 20 or 30 paper pages) should work.  
    661    
    662    
    663    
    664 688 +++ Delete todo and properties from View tree  
    665 689 <<  
  • branches/mbutscher/work/WikidPadStarter.py

    r108 r112  
    4 4 os.stat_float_times(True)  
    5 5  
    6   VERSION_STRING = "wikidPad 1.9beta3"  
      6 VERSION_STRING = "wikidPad 1.9beta4"  
    6 6  
    7 7 if not hasattr(sys, 'frozen'):  
  • branches/mbutscher/work/extensions/WikiSyntax.py

    r111 r112  
    23 23 PlainEscapedCharacterRE = re.compile(ur"\\(.)",  
    24 24         re.DOTALL | re.UNICODE | re.MULTILINE)  
    25            
      25  
      26  
      27 # How to start a non-camelcase wiki word or an attribute (normally opening bracket)  
    26 28 BracketStart = u"["  
      29 # Same, escaped for RE pattern  
    27 30 BracketStartPAT = ur"\["  
      31 # Same, escaped for reverse RE pattern (for autocompletion)  
    28 32 BracketStartRevPAT = ur"\["  
      33  
      34 # How to end a non-camelcase wiki word or an attribute (normally closing bracket)  
    29 35 BracketEnd = u"]"  
      36 # Same, escaped for RE pattern  
    30 37 BracketEndPAT = ur"\]"  
      38 # Same, escaped for reverse RE pattern (for autocompletion)  
    31 39 BracketEndRevPAT = ur"\]"  
    32 40  
     
    138 146  
    139 147 # Only to exclude them from WikiWordRE2  
    140   FootnoteRE     = re.compile(BracketStartPAT + ur"[0-9]+?" + BracketEndPAT,  
    141           re.DOTALL | re.UNICODE | re.MULTILINE)  
      148 FootnoteRE     = re.compile(BracketStartPAT + ur"(?P<footnoteId>[0-9]+?)" +  
      149         BracketEndPAT, re.DOTALL | re.UNICODE | re.MULTILINE)  
    142 150  
    143 151  
  • branches/mbutscher/work/lib/pwiki/WikiTxtCtrl.py

    r111 r112  
    183 183  
    184 184  
      185 etEVT_STYLE_DONE_COMMAND = wx.NewEventType()  
      186 EVT_STYLE_DONE_COMMAND = wx.PyEventBinder(etEVT_STYLE_DONE_COMMAND, 0)  
      187  
      188 class StyleDoneEvent(wx.PyCommandEvent):  
      189     """  
      190     This wx Event is fired when style and folding calculations are finished.  
      191     It is needed to savely transfer data from the style thread to the main thread.  
      192     """  
      193     def __init__(self, stylebytes, pageAst, foldingseq):  
      194         wx.PyCommandEvent.__init__(self, etEVT_STYLE_DONE_COMMAND, -1)  
      195         self.stylebytes = stylebytes  
      196         self.pageAst = pageAst  
      197         self.foldingseq = foldingseq  
      198  
      199  
      200  
    185 201 class WikiTxtCtrl(wx.stc.StyledTextCtrl):  
    186 202     NUMBER_MARGIN = 0  
     
    193 209         self.evalScope = None  
    194 210         self.stylebytes = None  
    195           self.folding = None  
    196           self.stylingThreadHolder = ThreadHolder()  
      211         self.foldingseq = None  
    197 212         self.pageAst = None  
      213         self.pageType = "normal"   # The pagetype controls some special editor behaviour  
      214 #         self.idleCounter = 0       # Used to reduce idle load  
      215         self.stylingThreadHolder = ThreadHolder()  
    198 216         self.loadedDocPage = None  
    199 217         self.lastFont = None  
    200 218         self.ignoreOnChange = False  
    201           self.pageType = "normal"   # The pagetype controls some special editor behaviour  
    202   #         self.idleCounter = 0       # Used to reduce idle load  
    203 219         self.searchStr = u""  
    204 220          
     
    283 299         # make the text control a drop target for files and text  
    284 300         self.SetDropTarget(WikiTxtCtrlDropTarget(self))  
    285    
      301          
    285 301         # register some keyboard commands  
    286 302         self.CmdKeyAssign(ord('+'), wx.stc.STC_SCMOD_CTRL, wx.stc.STC_CMD_ZOOMIN)  
     
    346 362         wx.EVT_IDLE(self, self.OnIdle)  
    347 363         wx.EVT_CONTEXT_MENU(self, self.OnContextMenu)  
      364          
      365         EVT_STYLE_DONE_COMMAND(self, self.OnStyleDone)  
    348 366  
    349 367         # search related vars  
     
    359 377         self.eolMode = self.GetEOLMode()  
    360 378  
    361           # Stock cursors. Created here because the App object must be created first  
    362           WikiTxtCtrl.CURSOR_IBEAM = wx.StockCursor(wx.CURSOR_IBEAM)  
    363           WikiTxtCtrl.CURSOR_HAND = wx.StockCursor(wx.CURSOR_HAND)  
      379 #         # Stock cursors. Created here because the App object must be created first  
      380 #         WikiTxtCtrl.CURSOR_IBEAM = wx.StockCursor(wx.CURSOR_IBEAM)  
      381 #         WikiTxtCtrl.CURSOR_HAND = wx.StockCursor(wx.CURSOR_HAND)  
    364 382  
    365 383         self.contextMenuTokens = None  
     
    385 403  
    386 404         wx.EVT_MENU(self, GUI_ID.CMD_TEXT_SELECT_ALL, lambda evt: self.SelectAll())  
    387            
    388   #         self.interceptor = WindowsHacks.WikidPadWin32WPInterceptor(self.pWiki)  
    389   #         self.interceptor.intercept(self.GetHandle())  
      405  
      406 #         wx.EVT_MENU(self, GUI_ID.CMD_UNFOLD_ALL_IN_CURRENT,  
      407 #                 lambda evt: self.unfoldAll())  
      408 #         wx.EVT_MENU(self, GUI_ID.CMD_FOLD_ALL_IN_CURRENT,  
      409 #                 lambda evt: self.foldAll())  
    390 410  
    391 411  
     
    426 446         Informs the widget if it is really visible on the screen or not  
    427 447         """  
      448 #         if vis:  
      449 #             self.Enable(True)  
    428 450         self.Enable(vis)  
    429   #         if not vis:  
    430   #             self.endIncrementalSearch()  
    431    
    432    
    433   #         if not self.visible and vis:  
    434   #             self.refresh()  
    435   #  
    436   #         self.visible = vis  
    437 451  
    438 452     def setWrapMode(self, onOrOff):  
     
    511 525         self.incSearchCharStartPos = 0  
    512 526         self.stylebytes = None  
    513           self.folding = None  
      527         self.foldingseq = None  
    513 527         self.pageAst = None  
    514 528         self.pageType = "normal"  
     
    592 606         return (cs, ce)  
    593 607  
      608  
      609     def gotoCharPos(self, pos):  
      610         # Go to the end and back again, so the anchor is  
      611         # near the top  
      612         self.SetSelection(-1, -1)  
      613         self.GotoPos(self.GetLength())  
      614         self.GotoPos(self.bytelenSct(self.GetText()[:pos]))  
      615  
      616         # self.SetSelectionByCharPos(pos, pos)  
      617  
      618  
    594 619     def applyBasicSciSettings(self):  
    595 620         """  
     
    643 668                 self.saveLoadedDocPage()  
    644 669  
    645    
    646 670             miscevt = self.loadedDocPage.getMiscEvent()  
    647 671             miscevt.removeListener(self.wikiPageListener)  
     
    652 676             self.loadedDocPage.removeTxtEditor(self)  
    653 677             self.loadedDocPage = None  
      678  
      679             self.stylebytes = None  
      680             self.foldingseq = None  
      681             self.pageAst = None  
    654 682             self.pageType = "normal"  
    655 683  
     
    774 802                     for t in anchorTokens:  
    775 803                         if t.grpdict["anchorValue"] == anchor:  
    776                               # Go to the end and back again, so the anchor is  
    777                               # near the top  
    778                               self.GotoPos(self.GetLength())  
    779                               self.SetSelectionByCharPos(  
    780                                       t.start + t.getRealLength(),  
    781                                       t.start + t.getRealLength())  
      804                             self.gotoCharPos(t.start + t.getRealLength())  
      805 #                             # Go to the end and back again, so the anchor is  
      806 #                             # near the top  
      807 #                             self.GotoPos(self.GetLength())  
      808 #                             self.SetSelectionByCharPos(  
      809 #                                     t.start + t.getRealLength(),  
      810 #                                     t.start + t.getRealLength())  
    782 811                             break  
    783 812                     else:  
     
    928 957         self.SetCaretForeground(color)  
    929 958          
      959         # Set default color (especially for folding lines)  
      960         coltuple = htmlColorToRgbTuple(self.presenter.getConfig().get(  
      961                 "main", "editor_plaintext_color"))  
      962          
      963         if coltuple is None:  
      964             coltuple = (0, 0, 0)  
      965  
      966         color = wx.Colour(*coltuple)  
      967         self.StyleSetForeground(wx.stc.STC_STYLE_DEFAULT, color)  
      968  
    930 969  
    931 970  
     
    987 1026             self.stylingThreadHolder.setThread(None)  
    988 1027             self.stylebytes = None  
    989               self.folding = None  
      1028             self.foldingseq = None  
    989 1028             self.pageAst = None  
    990 1029  
     
    997 1036             self.applyStyling(self.stylebytes)  
    998 1037             if self.getFoldingActive():  
    999                   self.applyFolding(self.folding)  
      1038                 self.applyFolding(self.foldingseq)  
    999 1038         else:  
    1000 1039             # Asynchronous styling  
     
    1013 1052  
    1014 1053  
      1054     # TODO Wrong reaction on press of context menu button on keyboard  
    1015 1055     def OnContextMenu(self, evt):  
    1016           menu = wx.Menu()  
    1017           appendToMenuByMenuDesc(menu, _CONTEXT_MENU_BASE)  
      1056         mousePos = self.ScreenToClient(wx.GetMousePosition())  
    1018 1057          
    1019           tokens = self.getTokensForMousePos(self.ScreenToClient(wx.GetMousePosition()))  
      1058         leftFold = 0  
      1059         for i in range(self.FOLD_MARGIN):  
      1060             left