I need the start & end's line number of the selection parameters in custom tool
Dear all:
i hack a version base on revno: 261 that custom tool can be supported new two parameters start & end's line number for selection area. i create a script that will do something for selection word. for example: i want a list order by numbering.
list_1 1. list_1
list_2 ---> 2. list_2
list_3 3. list_3
so, if i know the exact area, i can easy to do the feature.
sorry, i don't know another way to let Maintainer know my patch. so i paste in this question. i am a new if this is impolite behavior. please let me know i have not to do this again.
=== modified file 'zim/gui/
--- zim/gui/
+++ zim/gui/
@@ -609,6 +609,15 @@
if '%D' in cmd:
cmd[
+ cmd[cmd.
+
+ if '%S' in cmd:
+ text = str(pageview.
+ cmd[cmd.
+
+ if '%E' in cmd:
+ text = str(pageview.
+ cmd[cmd.
if '%t' in cmd:
text = pageview.
=== modified file 'zim/gui/
--- zim/gui/
+++ zim/gui/
@@ -177,6 +177,8 @@
<b>%n</b> the notebook location (file or folder)
<b>%D</b> the document root (if any)
<b>%t</b> the selected text or word under cursor
+<b>%S</b> the start line number of the selection
+<b>%E</b> the end line number of the selection
</tt>
''') ) # T: Short help text in "Edit Custom Tool" dialog. The "%" is literal - please include the html formatting
=== modified file 'zim/gui/
--- zim/gui/pageview.py 2010-05-30 18:33:18 +0000
+++ zim/gui/pageview.py 2010-06-06 11:16:01 +0000
@@ -3144,6 +3144,22 @@
else:
return None
+ def get_start_
+ buffer = self.view.
+ start_y, end_y = buffer.
+ if start_y:
+ return start_y.get_line()
+ else:
+ return None
+
+ def get_end_
+ buffer = self.view.
+ start_y, end_y = buffer.
+ if end_y:
+ return end_y.get_line()
+ else:
+ return None
+
def get_word(self):
buffer = self.view.
buffer.
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Zim Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Jaap Karssenberg
- Solved:
- Last query:
- Last reply: