{"payload":{"feedbackUrl":"https://github.com/orgs/community/discussions/53140","repo":{"id":551542779,"defaultBranch":"main","name":"pairpad","ownerLogin":"burntcarrot","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2022-10-14T15:47:19.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/53528139?v=4","public":true,"private":false,"isOrgOwned":false},"refInfo":{"name":"","listCacheKey":"v0:1683908992.978667","currentOid":""},"activityList":{"items":[{"before":"d7a5677a564d6afb33af7be4196ff628d6dcab4f","after":"a9d7b4166161d022d0ad2b19ee8ba42dc7074b28","ref":"refs/heads/main","pushedAt":"2023-05-12T16:22:02.677Z","pushType":"pr_merge","commitsCount":1,"pusher":{"login":"burntcarrot","name":"Aadhav Vignesh","path":"/burntcarrot","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/53528139?s=80&v=4"},"commit":{"message":"Improve status bar (#31)\n\n* Remove unused AddRune method.\r\n\r\nThe AddRune method was used for local insertions to update the\r\neditor's slice of runes, bypassing the CRDT doc entirely. The\r\neditor's slice of runes was then being immediately overwritten by\r\na CRDT insert, so AddRune was doing nothing.\r\n\r\nThis removes the AddRune method and slightly adapts the local\r\ninsertion logic to keep behavior the same.\r\n\r\n* Add mutex around local clock increment.\r\n\r\nThe GenerateInsert method increments the local clock. Without a mutex,\r\na race condition was possible because both the local and message\r\nhandling threads were able to insert characters simultaneously.\r\n\r\n* Make status bar show active users.\r\n\r\nStatus bar now shows all active users connected to the server.\r\n\r\n* Add cell to status bar showing connection status.\r\n\r\n* Add mutex to avoid concurrent read/write panics.\r\n\r\nThe Gorilla WebSocket package does not support concurrent reads and\r\nwrites. The server would occasionally panic on a concurrent write, so\r\nI followed the recommendation at (https://github.com/gorilla/websocket/\r\nissues/119#issuecomment-198710015) to use a mutex.\r\n\r\nAlso changed the name of the `clientInfo` type to `client` to better\r\nreflect its purpose.\r\n\r\n* Refactor status bar logic.\r\n\r\nStatus messages are now sent on a buffered channel, to allow for\r\nmultiple threads to update the status without conflict. There's a\r\nseparate status message handler that asynchronously listens on the\r\nchannel and temporarily shows any received messages.\r\n\r\nUsernames in the status bar are now rendered in different colors.\r\n\r\n* Fix linter and DeepSource issues.\r\n\r\n* Fix miscellaneous issues.\r\n\r\nChanged string concatenation to use fmt.Sprintf() instead of '+'.\r\nFixed potential out-of-bounds error with the userColors slice.\r\n\r\n* Refactor to fix concurrency bugs and data races.\r\n\r\nPreviously, there were data races occurring due to multiple goroutines\r\nconcurrently reading from and writing to the `activeClients` map.\r\n\r\nThe main change is that there is now a monitor goroutine method called\r\n`handle` that ensures that all modifications to the list of active\r\nclients happen sequentially. Any other goroutine that wants to read\r\nor write the list of active clients now has to send a request through\r\na channel, and the monitor goroutine selects a channel with a pending\r\nrequest and fulfills the request.\r\n\r\nI also refactored some of the main logic by splitting out the denser\r\nsections of code into their own functions.\r\n\r\n* Fix race condition with accessing client names.\r\n\r\n* Fix client-side data races.\r\n\r\nThis is a first pass at addressing multiple data races on the client\r\nside. The biggest change was serializing calls to Draw by sending on\r\na single channel to eliminate concurrency. Most other changes utilized\r\nmutexes to protect concurrent read/write access of editor state.\r\n\r\nI no longer detect data races at runtime during normal local use. More\r\nrigorous detection could be done by increasing test coverage and running\r\nthe Go race detector with the test suite.\r\n\r\nNot much consideration was given to performance. Profiling the client\r\nand server code with the 'block' and 'mutex' memory profiles could point\r\nto many areas for improvement.\r\n\r\n* ci: add race detector step\r\n\r\n---------\r\n\r\nCo-authored-by: burntcarrot ","shortMessageHtmlLink":"Improve status bar (#31)"}},{"before":"df558818277129ad64284dc7c7b4c2370f8d5722","after":"d7a5677a564d6afb33af7be4196ff628d6dcab4f","ref":"refs/heads/main","pushedAt":"2023-04-22T16:00:54.000Z","pushType":"pr_merge","commitsCount":1,"pusher":{"login":"burntcarrot","name":"Aadhav Vignesh","path":"/burntcarrot","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/53528139?s=80&v=4"},"commit":{"message":"Remove unused method and add mutex. (#30)\n\n* Remove unused AddRune method.\r\n\r\nThe AddRune method was used for local insertions to update the\r\neditor's slice of runes, bypassing the CRDT doc entirely. The\r\neditor's slice of runes was then being immediately overwritten by\r\na CRDT insert, so AddRune was doing nothing.\r\n\r\nThis removes the AddRune method and slightly adapts the local\r\ninsertion logic to keep behavior the same.\r\n\r\n* Add mutex around local clock increment.\r\n\r\nThe GenerateInsert method increments the local clock. Without a mutex,\r\na race condition was possible because both the local and message\r\nhandling threads were able to insert characters simultaneously.","shortMessageHtmlLink":"Remove unused method and add mutex. (#30)"}},{"before":"e7ce4dec9e5e637dfedc582c7fe6742aeba25854","after":"df558818277129ad64284dc7c7b4c2370f8d5722","ref":"refs/heads/main","pushedAt":"2023-04-16T06:16:21.000Z","pushType":"pr_merge","commitsCount":1,"pusher":{"login":"burntcarrot","name":"Aadhav Vignesh","path":"/burntcarrot","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/53528139?s=80&v=4"},"commit":{"message":"Cursor updating and scrolling (#28)\n\n* Add updating local cursor on remote insert/delete\r\n\r\nCursor now \"stays in place\" when another user adds or deletes\r\ncharacters.\r\n\r\nThis needs to be tested when two people are editing simultaneously to\r\nmake sure behavior is as desired.\r\n\r\nAlso, I wasn't sure what should happen if two users have their cursor on\r\nthe same character and one user does an insert. Should the other user's\r\ncursor stay in place or move along with the inserts? Currently, it moves\r\nalong with the inserts.\r\n\r\n* (WIP) Implement scrolling.\r\n\r\nThis commit is to store the progress of an attempt to add scrolling as a\r\nfull feature, including scrolling independently of the cursor.\r\n\r\nI've decided to scale back the scope and only try to implement scrolling\r\nwith the cursor for now, which is how the kilo editor does it.\r\n\r\n* Add basic scrolling.\r\n\r\nAdded basic scrolling with the cursor. When the cursor reaches the\r\nborder of the editor window, the editor window will shift to follow the\r\ncursor. This level of basic scrolling seems to be on par with the kilo\r\ntext editor, as a point of comparison.\r\n\r\nAlso added some basic test cases. More tests would be welcome.\r\n\r\nMore robust scrolling in the future could include the ability to scroll\r\nindependently of the cursor, or scroll multiple lines at once.\r\n\r\n* Remove logging, clean up extra functions/comments.\r\n\r\n* Fix formatting issue.\r\n\r\n* Add 'jumping' scroll.\r\n\r\nWindow now follows cursor even if it has to 'jump' more than one\r\nrow/column at a time.\r\n\r\n* Make scrolling toggleable with a flag.\r\n\r\n* refactor: use a config struct\r\n\r\n* fix: set ScrollEnabled to true in test\r\n\r\n---------\r\n\r\nCo-authored-by: burntcarrot ","shortMessageHtmlLink":"Cursor updating and scrolling (#28)"}},{"before":"c5470895a6dca21d3fff915e5bed7ed209b5d550","after":"e7ce4dec9e5e637dfedc582c7fe6742aeba25854","ref":"refs/heads/main","pushedAt":"2023-04-10T16:37:03.000Z","pushType":"pr_merge","commitsCount":1,"pusher":{"login":"burntcarrot","name":"Aadhav Vignesh","path":"/burntcarrot","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/53528139?s=80&v=4"},"commit":{"message":"Fix cleanup of server state on client disconnect (#27)\n\n* Improve error handling for server.\r\n\r\nFixes a problem where the server would be left in a bad state after some\r\nserver-side closures of client WebSocket connections. The bad state was\r\ncaused by clients not being removed from the activeClients map and\r\ncausing nil pointer errors when attempting to broadcast a message, for\r\nexample.\r\n\r\nThis commit tries to avoid that by defining a function that cleanly\r\ndisconnects from a client connection. It also refactors some error\r\nhandling and logging.\r\n\r\n* Fix potential concurrency bug with mutex.\r\n\r\nI think there was a potential concurrency bug that the mutex previously\r\nwouldn't have addressed: If two clients joined at the same time, the\r\nmutex would avoid a data race on the value of the site ID, but it was\r\nstill possible for the client to be assigned the wrong site ID value\r\nafter each mutex had released its lock. I moved the mutex unlock until\r\nafter the site ID is recorded in the activeClients map to try and avoid\r\nthis issue.\r\n\r\nI also moved and edited a log message to make the server logs make a bit\r\nmore sense.\r\n\r\n* Add missing return after write-to-server error.","shortMessageHtmlLink":"Fix cleanup of server state on client disconnect (#27)"}},{"before":"0626ad8c4b2e03a9a212d68b8b8ebfc7c6129ed7","after":null,"ref":"refs/tags/v1.2.0","pushedAt":"2023-04-09T09:51:57.000Z","pushType":"branch_deletion","commitsCount":0,"pusher":{"login":"burntcarrot","name":"Aadhav Vignesh","path":"/burntcarrot","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/53528139?s=80&v=4"}},{"before":"0626ad8c4b2e03a9a212d68b8b8ebfc7c6129ed7","after":"c5470895a6dca21d3fff915e5bed7ed209b5d550","ref":"refs/heads/main","pushedAt":"2023-04-09T09:51:31.000Z","pushType":"pr_merge","commitsCount":1,"pusher":{"login":"burntcarrot","name":"Aadhav Vignesh","path":"/burntcarrot","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/53528139?s=80&v=4"},"commit":{"message":"refactor: cleanup client and server (#26)\n\n* refactor: cleanup client and server\r\n\r\n* refactor: use commons and add comments\r\n\r\n* chore: update goreleaser\r\n\r\n* docs: update README\r\n\r\n* fix: remove os.Exit calls\r\n\r\n* docs: fix formatting for keybindings","shortMessageHtmlLink":"refactor: cleanup client and server (#26)"}},{"before":"1794cea4b96d6b832fdb1535480a24ead99b0f4c","after":"085af3400ceaf0aa72e099ebce6745148bdf0348","ref":"refs/heads/refactor-pairpad","pushedAt":"2023-04-09T09:49:59.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"burntcarrot","name":"Aadhav Vignesh","path":"/burntcarrot","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/53528139?s=80&v=4"},"commit":{"message":"docs: fix formatting for keybindings","shortMessageHtmlLink":"docs: fix formatting for keybindings"}},{"before":"6fc929446ce6b39298723f0c0fd655eb05706e9e","after":"1794cea4b96d6b832fdb1535480a24ead99b0f4c","ref":"refs/heads/refactor-pairpad","pushedAt":"2023-04-09T09:47:18.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"burntcarrot","name":"Aadhav Vignesh","path":"/burntcarrot","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/53528139?s=80&v=4"},"commit":{"message":"fix: remove os.Exit calls","shortMessageHtmlLink":"fix: remove os.Exit calls"}},{"before":"150ffbb78f8d15c3deb4eb5db383c13929178b30","after":"6fc929446ce6b39298723f0c0fd655eb05706e9e","ref":"refs/heads/refactor-pairpad","pushedAt":"2023-04-09T09:41:55.000Z","pushType":"push","commitsCount":3,"pusher":{"login":"burntcarrot","name":"Aadhav Vignesh","path":"/burntcarrot","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/53528139?s=80&v=4"},"commit":{"message":"docs: update README","shortMessageHtmlLink":"docs: update README"}},{"before":null,"after":"150ffbb78f8d15c3deb4eb5db383c13929178b30","ref":"refs/heads/refactor-pairpad","pushedAt":"2023-04-08T16:32:40.000Z","pushType":"branch_creation","commitsCount":0,"pusher":{"login":"burntcarrot","name":"Aadhav Vignesh","path":"/burntcarrot","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/53528139?s=80&v=4"},"commit":{"message":"refactor: cleanup client and server","shortMessageHtmlLink":"refactor: cleanup client and server"}},{"before":"aea18bb00055051f6f274efa8bac10afc63e6179","after":"0626ad8c4b2e03a9a212d68b8b8ebfc7c6129ed7","ref":"refs/heads/main","pushedAt":"2023-04-08T06:38:00.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"burntcarrot","name":"Aadhav Vignesh","path":"/burntcarrot","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/53528139?s=80&v=4"},"commit":{"message":"rename project to pairpad","shortMessageHtmlLink":"rename project to pairpad"}}],"hasNextPage":false,"hasPreviousPage":false,"activityType":"all","actor":null,"timePeriod":"all","sort":"DESC","perPage":30,"cursor":"djE6ks8AAAADK6h7DAA","startCursor":null,"endCursor":null}},"title":"Activity ยท burntcarrot/pairpad"}