TrySound / TrySound/rifm

Cursor index when adding multiple characters in format

Open
#80 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.4k
Forks
37
Avg merge
2h 19m
Merged PRs (30d)
11

Description

This library is awesome and all, done pretty much most of the heavy lifting I wasted work hours on. But it has a small problem

Problem statement

When reformatting the value, if I add characters to the new value as in:

...
format={v => v + 'abcd'};
...

The cursor would stand where I would normally be without the newly added characters, not at the end of the new string.

Problem reproduced

https://codesandbox.io/s/istarkovrifm-cursor-index-bug-p9mjr

Versions

node: v11.14.0
npm: 6.9.2
rifm: ^0.9.1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the cursor-position problem in the linked CodeSandbox with a format function that appends multiple characters. Trace how the formatted value and cursor index are updated, then verify that the cursor accounts for the appended characters and stays at the end of the new string.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.