Skip to content

Commit

Permalink
disable double-click by default, add setting for it
Browse files Browse the repository at this point in the history
  • Loading branch information
lunixbochs committed Oct 31, 2012
1 parent 3cfda0f commit 10540b0
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
14 changes: 14 additions & 0 deletions Default.sublime-commands
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,19 @@
{
"caption": "Create Xiki Buffer",
"command": "new_xiki"
},
{
"caption": "Preferences: SublimeXiki Settings – Default",
"command": "open_file", "args":
{
"file": "${packages}/SublimeXiki/SublimeXiki.sublime-settings"
}
},
{
"caption": "Preferences: SublimeXiki Settings – User",
"command": "open_file", "args":
{
"file": "${packages}/User/SublimeXiki.sublime-settings"
}
}
]
17 changes: 15 additions & 2 deletions xiki.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from lib.util import communicate, popen, create_environment

from collections import defaultdict
import json
import os
import platform
import Queue
Expand All @@ -21,6 +22,8 @@
INDENTATION = ' '
backspace_re = re.compile('.\b')

xiki_settings = sublime.load_settings('SublimeXiki.sublime-settings')

class BoundaryError(Exception): pass

if not 'already' in globals():
Expand Down Expand Up @@ -458,7 +461,17 @@ def on_query_context(self, view, key, operator, operand, match_all):
return True

def on_load(self, view):
if is_xiki_buffer(view):
# handle new user preferences file
if view.file_name() and os.path.split(view.file_name())[1] == 'SublimeXiki.sublime-settings':
if view.size() == 0:
edit = view.begin_edit()

template = {
"double_click": False
}
view.insert(edit, 0, json.dumps(template, indent=4))
view.end_edit(edit)
elif is_xiki_buffer(view):
apply_xiki_settings(view)

def on_close(self, view):
Expand Down Expand Up @@ -492,7 +505,7 @@ def run(self):
class XikiClick(sublime_plugin.WindowCommand):
def run(self):
view = self.window.active_view()
if is_xiki_buffer(view):
if is_xiki_buffer(view) and xiki_settings.get('double_click'):
sel = view.sel()
s = sel[0]

Expand Down

0 comments on commit 10540b0

Please sign in to comment.