vim-pad

minimal etherpad alternative - vim plugin
git clone https://git.ce9e.org/vim-pad.git

commit
63cdbc9d23c7e779b5382e45499b4027ab6eb9bb
parent
5b5f4ce01ee47211dc8f571ed747bbb6ffbd80b9
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2023-05-29 15:08
cleanup

Diffstat

M python/pad/__init__.py 14 +++-----------

1 files changed, 3 insertions, 11 deletions


diff --git a/python/pad/__init__.py b/python/pad/__init__.py

@@ -15,11 +15,11 @@ pads = {}
   15    15 
   16    16 class Pad:
   17    17 	def __init__(self, buffer):
   -1    18 		self.id = ''.join(random.sample(string.hexdigits, 6))
   18    19 		self.buffer = buffer
   19    20 		self.local_changes = []
   20    21 		self.staged_changes = []
   21    22 		self.old = self.get_text()
   22    -1 		self.id = ''.join(random.sample(string.hexdigits, 6))
   23    23 
   24    24 		self.name = os.path.basename(buffer.name).removesuffix('.pad')
   25    25 		self.url = BASE_URL + self.name
@@ -45,9 +45,9 @@ class Pad:
   45    45 		self.old = text
   46    46 
   47    47 	def send_changes(self):
   48    -1 		if False:  # self.staged_changes:
   -1    48 		if self.staged_changes:
   -1    49 			# TODO: retry again later
   49    50 			print('abort because of staged changes')
   50    -1 			return  # TODO: retry later
   51    51 		else:
   52    52 			self.staged_changes = self.local_changes
   53    53 			self.local_changes = []
@@ -79,7 +79,6 @@ class Pad:
   79    79 		if text != prior:
   80    80 			# var scrollTop = el.scrollTop;
   81    81 			self.buffer[:] = text.split('\n')
   82    -1 			# el.value = text;
   83    82 			# el.selectionStart = selection[0];
   84    83 			# el.selectionEnd = selection[1];
   85    84 			# el.selectionDirection = selection[2];
@@ -88,13 +87,6 @@ class Pad:
   88    87 			# });
   89    88 			self.old = text
   90    89 
   91    -1 	def handle_message(self, msg):
   92    -1 		if msg[1] == 'changes':
   93    -1 			if msg[0] == self.id:
   94    -1 				self.stagedChanges = []
   95    -1 			else:
   96    -1 				self.apply_changes(msg[2])
   97    -1 
   98    90 	def reset_modified(self):
   99    91 		if self.local_changes or self.staged_changes:
  100    92 			vim.command('setl modified')