It is a continuation of http://qiita.com/items/940cab68f7e112af249f.
If you search on Google Chrome or PyCharm, the marker will tell you which side has the hit keyword.
Like this. This is Iron, not Chrome.
I want this feature in TortoiseHg as well.
For the time being, it seems that the BlockList class, which I modified the other day, can be used almost as it is. Let's place it on the right side of the file view, like Chrome. So it looks like this.
The source is here. https://bitbucket.org/iwata0303/thg/commits/d8452bd98690ab2f939164358976ff68 SIGNAL / SLOT is carefully defined in the TortoiseHg code, so this kind of extension is easy :)
Now, like the other day, let's implement this function with a plugin. It's a hassle to build TortoiseHg yourself. Last time, I realized it by adding a method to the BlockList class at runtime, but this time it is a bit troublesome because the corrections are divided into several parts and the existing methods also have corrections. .. At this time, it seems faster to replace each class. It's easier to deal with version upgrades.
The procedure is like this.
thg-ext
(whatever the name is) in a suitable location.blockmatcher.py
, qscilib.py
, fileview.py
) into that folder.__init__.py
in the same folder with the following contents.__init__.py
# -*- coding: utf-8 -*-
import sys
import os
def extsetup():
#Make it work only when launched from TortoiseHg
if not os.path.basename(sys.argv[0]).startswith('thg'):
return
# qscilib.Replace scintilla
from tortoisehg.hgqt import qscilib
from .qscilib import Scintilla
qscilib.Scintilla = Scintilla
# blockmatcher.Replace BlockList
from tortoisehg.hgqt import blockmatcher
from .blockmatcher import BlockList
blockmatcher.BlockList = BlockList
# fileview.Replace HgFileView
from tortoisehg.hgqt import fileview
from .fileview import HgFileView
fileview.HgFileView = HgFileView
By the way, the replacement order of Scintilla
→ HgFileView
is important. HgFileView inherits Scintilla, so if you load HgFileView first, you will use Scintilla before replacement.
mercurial.ini
or hgrc
, register the path of the thg-ext
folder as an extension.mercurial.ini
[extensions]
thgext = C:\Work\thg-ext
So, congratulations, the search marker function worked :) Freedom is good for dynamic languages. It is a source of trouble from the side that prepares the plug-in mechanism, but w