Saturday, October 30, 2021

[SOLVED] Get selected character in shell with mouse

Issue

I'm curious about how different codes are written. And when i started to use Termux, i am with a dude:

How text editors like Vim can get what character you have selected to write after that?

Is it possible without using external libraries in low level languages like C or C++?

I am reading the code of Nano but it use external libraries to do that.


Solution

you can achieve such low level tasks using termios.h in C. you should simply disable some of default shell features using functions in termios.h header file then use escape sequence to move the cursor and set/get characters. then you can make buffers and store or edit them how you like.

take a look at this guide. you will learn to do such things.



Answered By - Amir H