2004-02-09 11:02:56 +00:00
|
|
|
# This file adds support for bookmarks in GPS
|
|
|
|
|
# Missing in this very partial implementation:
|
|
|
|
|
# - Add known bookmarks to a menu dynamically, for easy jumps
|
|
|
|
|
|
2006-08-07 11:14:55 +00:00
|
|
|
# This is mostly reimplemented in GPS itself at this point
|
|
|
|
|
|
2004-02-09 11:02:56 +00:00
|
|
|
import GPS
|
|
|
|
|
|
2017-06-27 15:35:51 +02:00
|
|
|
GPS.Editor.register_highlighting("bookmarks", "orange", True)
|
2004-02-09 11:02:56 +00:00
|
|
|
|
|
|
|
|
|
2017-06-27 15:35:51 +02:00
|
|
|
def add_bookmark():
|
|
|
|
|
context = GPS.current_context()
|
|
|
|
|
if isinstance(context, GPS.FileContext):
|
|
|
|
|
name = GPS.MDI.input_dialog("Name of bookmark", "Name")
|
|
|
|
|
if name != ():
|
2024-06-05 14:41:24 +04:00
|
|
|
GPS.Locations.add(
|
|
|
|
|
"Bookmarks",
|
|
|
|
|
context.file(),
|
|
|
|
|
GPS.Editor.cursor_get_line(context.file().name()),
|
|
|
|
|
GPS.Editor.cursor_get_column(context.file().name()),
|
|
|
|
|
name[0],
|
|
|
|
|
"bookmarks",
|
|
|
|
|
)
|
2017-06-27 15:35:51 +02:00
|
|
|
|
|
|
|
|
|
2024-06-05 14:41:24 +04:00
|
|
|
GPS.parse_xml(
|
|
|
|
|
"""
|
2006-06-14 13:28:03 +00:00
|
|
|
<action name="add bookmark" category="General">
|
2004-02-09 11:02:56 +00:00
|
|
|
<filter id="Source editor" />
|
|
|
|
|
<description>Add a bookmark for the current line</description>
|
2005-02-10 20:54:40 +00:00
|
|
|
<shell lang="python" output="none">bookmarks.add_bookmark()</shell>
|
2004-02-09 11:02:56 +00:00
|
|
|
</action>
|
|
|
|
|
<Submenu>
|
|
|
|
|
<Title>Navigate/Bookmarks</Title>
|
|
|
|
|
<menu action="add bookmark">
|
|
|
|
|
<Title>Add bookmark</Title>
|
|
|
|
|
</menu>
|
2024-06-05 14:41:24 +04:00
|
|
|
</Submenu>"""
|
|
|
|
|
)
|