This PR introduces a new method for managing tabstops. With the updated architecture, we can reduce the chances of bugs described in issues #303 and #254 occurring.
Changes
Currently, we need to dispatch the dedicated state effects multiple times to update tabstopsStateField, which is a bit complicated. However, with the new implementation, we'll only need to dispatch a single transaction that provides the new editor selection. As a result, since the tabstopsStateField is updated based solely on editor selection changes, we no longer need to listen to view updates to keep tabstop groups in the correct state.
Details
consumeAndGotoNextTabstop has been replaced with setSelectionToNextTabstop. This new function determines the next tabstop position and dispatches the transaction that changes the editor selection.
tidyTabstops has been removed; its role is now fulfilled by the update logic of the tabstopsStateField.
The process of updating tabstop groups in the handleUpdate function has been removed.
This PR introduces a new method for managing tabstops. With the updated architecture, we can reduce the chances of bugs described in issues #303 and #254 occurring.
Changes
Currently, we need to dispatch the dedicated state effects multiple times to update
tabstopsStateField
, which is a bit complicated. However, with the new implementation, we'll only need to dispatch a single transaction that provides the new editor selection. As a result, since thetabstopsStateField
is updated based solely on editor selection changes, we no longer need to listen to view updates to keep tabstop groups in the correct state.Details
consumeAndGotoNextTabstop
has been replaced withsetSelectionToNextTabstop
. This new function determines the next tabstop position and dispatches the transaction that changes the editor selection.tidyTabstops
has been removed; its role is now fulfilled by the update logic of thetabstopsStateField
.handleUpdate
function has been removed.Demo
Before
https://github.com/artisticat1/obsidian-latex-suite/assets/54701853/cb6081e1-fb0e-413d-8853-e8a99adf63db
After
https://github.com/artisticat1/obsidian-latex-suite/assets/54701853/f9a5a7fc-8779-4174-bb74-efa131a493bf