Alexey-T / CudaText

Cross-platform text editor, written in Free Pascal
Mozilla Public License 2.0
2.39k stars 166 forks source link

CLI: call cudatext with a filename:line-number-0 argument #5491

Closed Gregory-K closed 2 months ago

Gregory-K commented 2 months ago

Replicate

Supposedly an existing conf.json file with content.
cudatext ./conf.json:0 will open the dialogue to create a new file
cudatext ./conf.json: will open the dialogue to create a new file

Understood that : and :0 are not hard for a human user to avoid as arguments, but in automated scenarios where another software provides the ability to open the listed file with an external editor, both : and :0 may be added as a suffix to filepath. (e.g. broot at the absence of a line number produces cudatext filepath:0)

Resolution

cudatext ./conf.json:0 & cudatext ./conf.json:
should both open the file in CudaText at position 1 (line no 1).

CudaText already 'understands' higher than existent line numbers.
For example, cudatext ./conf.json:20000 will open the file at position EOF (assuming of-course that this json file has less than 20000 lines).

Alexey-T commented 2 months ago

Small good idea. Agree, todo.