helix icon indicating copy to clipboard operation
helix copied to clipboard

Feature request: selected character count

Open xJonathanLEI opened this issue 3 years ago • 1 comments

When dealing with hashes (in hex) and big decimal numbers, I frequently find myself selecting the whole thing in vim just to check if the length is correct, thanks to the vim feature that shows how many chars you've selected.

Currently Helix is only able to show the number of selections. It would be nice to also have the option to display the number of characters.

xJonathanLEI avatar Nov 07 '22 04:11 xJonathanLEI

My current workaround is to put my cursor right before the text I'm interested in, then press the desired length followed by l to see if the cursor lands on the last character. It kind of works for my case but not when you want to measure the length of some text.

xJonathanLEI avatar Nov 07 '22 06:11 xJonathanLEI

Hi all! I'd like to tackle this issue if that's fine with everyone 😄

Siiiimon avatar Nov 09 '22 09:11 Siiiimon

@Siiiimon - sorry. this is my first ever attempt at contributing. i didn't realize that we should claim work before starting.

anyways, i have a starting attempt here: https://github.com/helix-editor/helix/pull/4682

looking forward to any feedback

wes-adams avatar Nov 09 '22 18:11 wes-adams

the linter pointed out my poor coding style

pushed 2nd attempt

wes-adams avatar Nov 09 '22 18:11 wes-adams

no worries!

Siiiimon avatar Nov 10 '22 09:11 Siiiimon

@Siiiimon - thanks for the feedback - i'll definitely be implementing your suggestions

EDIT: wow, i was really overthinking the question below. i got it all figured out. the solution was simply re-building the project. heh, amazing.

i am stuck on one thing though: how do i link my new config.toml setting to the actual logic in source?

config.toml
. . . 
[editor.statusline]
left = ["mode", "spinner"]
center = ["file-name", "primary-selection-length"]
right = ["diagnostics", "selections", "position", "file-encoding", "file-line-ending", "file-type"]
. . . 
> hx
Bad config: unknown variant `primary-selection-length`, expected one of `mode`, `spinner`, `file-name`, `file-encoding`, `file-line-ending`, `file-type`, `diagnostics`, `selections`, `position`, `separator`, `position-percentage`, `total-line-numbers`, `spacer` for key `editor.statusline.center` at line 16 column 1
Press <ENTER> to continue with default config

Screenshot from 2022-11-10 09-41-57

wes-adams avatar Nov 10 '22 14:11 wes-adams