Wiki: Multiuser Syntax Highlight Tracking


This topic's parent is TunnelDataInCommands.

An integral part of how edits are shown to a user is how to keep track of which parts of the changed text are the work of which human editor participating in the group editing session.

Some kind of syntax-like commands (perhaps a custom methodology) and highlight commands (easy to define with vimscript) will be used to show which human editor has last changed a particular text.

Existing mechanisms in the vimscript command syntax use "match" type and/or "region" type syntax definitions. These feel inadequate in the case of overlapping edits and edits over time, yet it does depend on the way the updating is done. If edits are transferred on a per character basis, a string of characters should extend a region or match, not a whole bunch of regions/matches with one character each. Also the timing of when the edits come in to a user's Vim client will either require the highlights to overlap based on time.

Another implementation strategy might be a sparse array for the buffer's characters, updated to show who edited which character last. This overlay would contain tokens for each editor of each character position. Highlighting would simply be making the characters the right color. While this may not track all the richness of editing history, it may simplify storage and implementation, keeping only the history information that will actually be used for display.

Once the method for tracking edits is understood, configuration to give a color to each of several connected clients/human editors/users should be configurable. Highlight commands can be used. Any data entered remotely will highlight until the end of the editing session. Perhaps an additional user interface and some kind of legend (perhaps using another buffer) could be provided to associate colors with actual users.


Copyright © 2007 RobertMelton.com