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 705c5e014e
commit 707c89cf31
3 changed files with 7 additions and 6 deletions

View file

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

View file

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

View file

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