Skip to content
This repository
Browse code

disable double-click by default, add setting for it

commit 10540b05c59ae9987b7387f909137c327cc25842 1 parent 3cfda0f
Ryan Hileman authored

Showing 2 changed files with 29 additions and 2 deletions. Show diff stats Hide diff stats

  1. +14 0 Default.sublime-commands
  2. +15 2 xiki.py
14 Default.sublime-commands
@@ -6,5 +6,19 @@
6 6 {
7 7 "caption": "Create Xiki Buffer",
8 8 "command": "new_xiki"
  9 + },
  10 + {
  11 + "caption": "Preferences: SublimeXiki Settings – Default",
  12 + "command": "open_file", "args":
  13 + {
  14 + "file": "${packages}/SublimeXiki/SublimeXiki.sublime-settings"
  15 + }
  16 + },
  17 + {
  18 + "caption": "Preferences: SublimeXiki Settings – User",
  19 + "command": "open_file", "args":
  20 + {
  21 + "file": "${packages}/User/SublimeXiki.sublime-settings"
  22 + }
9 23 }
10 24 ]
17 xiki.py
@@ -8,6 +8,7 @@
8 8 from lib.util import communicate, popen, create_environment
9 9
10 10 from collections import defaultdict
  11 +import json
11 12 import os
12 13 import platform
13 14 import Queue
@@ -21,6 +22,8 @@
21 22 INDENTATION = ' '
22 23 backspace_re = re.compile('.\b')
23 24
  25 +xiki_settings = sublime.load_settings('SublimeXiki.sublime-settings')
  26 +
24 27 class BoundaryError(Exception): pass
25 28
26 29 if not 'already' in globals():
@@ -458,7 +461,17 @@ def on_query_context(self, view, key, operator, operand, match_all):
458 461 return True
459 462
460 463 def on_load(self, view):
461   - if is_xiki_buffer(view):
  464 + # handle new user preferences file
  465 + if view.file_name() and os.path.split(view.file_name())[1] == 'SublimeXiki.sublime-settings':
  466 + if view.size() == 0:
  467 + edit = view.begin_edit()
  468 +
  469 + template = {
  470 + "double_click": False
  471 + }
  472 + view.insert(edit, 0, json.dumps(template, indent=4))
  473 + view.end_edit(edit)
  474 + elif is_xiki_buffer(view):
462 475 apply_xiki_settings(view)
463 476
464 477 def on_close(self, view):
@@ -492,7 +505,7 @@ def run(self):
492 505 class XikiClick(sublime_plugin.WindowCommand):
493 506 def run(self):
494 507 view = self.window.active_view()
495   - if is_xiki_buffer(view):
  508 + if is_xiki_buffer(view) and xiki_settings.get('double_click'):
496 509 sel = view.sel()
497 510 s = sel[0]
498 511

0 comments on commit 10540b0

Please sign in to comment.
Something went wrong with that request. Please try again.