fix: bad hack to move around the single user login in the workspace

Former-commit-id: 2e9f8938636593a5b7c7fedd173fc9ae81aa795e
This commit is contained in:
cschen 2024-08-05 22:46:01 +02:00
parent 744887b336
commit 78fe8010ce
3 changed files with 7 additions and 6 deletions

View file

@ -9,8 +9,8 @@ name = "codemp"
crate-type = ["cdylib"]
[dependencies]
codemp = { git = "ssh://git@github.com/codewithotherpeopleandchangenamelater/codemp.git", tag="v0.6.1"}
codemp-proto = { git = "ssh://git@github.com/codewithotherpeopleandchangenamelater/codemp-proto.git", tag = "v0.6.1" }
codemp = { git = "ssh://git@github.com/hexedtech/codemp.git", branch="glue"}
codemp-proto = { git = "ssh://git@github.com/hexedtech/codemp-proto.git", tag = "v0.6.1" }
pyo3 = { version = "0.20", features = ["extension-module"] }
pyo3-asyncio = { version = "0.20", features = ["tokio-runtime"] }
serde = { version = "1.0.196", features = ["derive"] }

View file

@ -198,7 +198,7 @@ class CodempJoinCommand(sublime_plugin.WindowCommand):
#############################################################################
class CodempJoinWorkspaceCommand(sublime_plugin.WindowCommand):
def run(self, workspace_id):
tm.dispatch(client.join_workspace(workspace_id, "sublime3"))
tm.dispatch(client.join_workspace(workspace_id))
def input_description(self):
return "Join specific workspace"

View file

@ -2,6 +2,7 @@ from __future__ import annotations
from typing import Optional
import sublime
import random
import asyncio
import tempfile
import os
@ -125,7 +126,7 @@ class VirtualBuffer:
region.begin(), region.end(), change.str
)
)
self.buffctl.send(region.begin(), region.end(), change.str)
self.buffctl.send(region.begin(), region.end()+len(change.str)-1, change.str)
def send_cursor(self, vws: VirtualWorkspace):
# TODO: only the last placed cursor/selection.
@ -340,10 +341,10 @@ class VirtualClient:
status_log(f"Connected to '{server_host}' with user id: {id}")
async def join_workspace(
self, workspace_id: str, user="sublime2", password="***REMOVED***"
self, workspace_id: str, user=f"user-{random.random()}", password="***REMOVED***"
) -> Optional[VirtualWorkspace]:
try:
status_log(f"Logging into workspace: '{workspace_id}'")
status_log(f"Logging into workspace: '{workspace_id}' with user: {user}")
await self.handle.login(user, password, workspace_id)
except Exception as e:
status_log(