Skip to main content
edited body
Source Link

I am writing a text editor.

With 1049 (alternate screen) mode + 10071000 (mouse tracking) mode enabled, the terminal is able to catch both mouse scroll events and click events. I do not need the click events.

This has the added disadvantage of not allowing other useful motions with your mouse (example: an external copy paste by highlighting text on the terminal screen).

I say vim, because it has ideal mouse behavior, where with a scroll event the cursor position changes to reflect it, and click events seem not to affect it. In addition, it does so in a manner that does not lead to flickering.

The thing that tells me that it does not use 1049 + 1007 is that something like the external copy-paste (by highlighting text) is possible in vim.

My question: How is vim doing this?

I've scoured the source code and am unable to find it. I've also attempted to trace the escape sequences it writes to the screen. This holds true on 2 terminal emulators I've tried.

I am writing a text editor.

With 1049 (alternate screen) mode + 1007 (mouse tracking) mode enabled, the terminal is able to catch both mouse scroll events and click events. I do not need the click events.

This has the added disadvantage of not allowing other useful motions with your mouse (example: an external copy paste by highlighting text on the terminal screen).

I say vim, because it has ideal mouse behavior, where with a scroll event the cursor position changes to reflect it, and click events seem not to affect it. In addition, it does so in a manner that does not lead to flickering.

The thing that tells me that it does not use 1049 + 1007 is that something like the external copy-paste (by highlighting text) is possible in vim.

My question: How is vim doing this?

I've scoured the source code and am unable to find it. I've also attempted to trace the escape sequences it writes to the screen. This holds true on 2 terminal emulators I've tried.

I am writing a text editor.

With 1049 (alternate screen) mode + 1000 (mouse tracking) mode enabled, the terminal is able to catch both mouse scroll events and click events. I do not need the click events.

This has the added disadvantage of not allowing other useful motions with your mouse (example: an external copy paste by highlighting text on the terminal screen).

I say vim, because it has ideal mouse behavior, where with a scroll event the cursor position changes to reflect it, and click events seem not to affect it. In addition, it does so in a manner that does not lead to flickering.

The thing that tells me that it does not use 1049 + 1007 is that something like the external copy-paste (by highlighting text) is possible in vim.

My question: How is vim doing this?

I've scoured the source code and am unable to find it. I've also attempted to trace the escape sequences it writes to the screen. This holds true on 2 terminal emulators I've tried.

Source Link

How does vim catch mouse scroll events?

I am writing a text editor.

With 1049 (alternate screen) mode + 1007 (mouse tracking) mode enabled, the terminal is able to catch both mouse scroll events and click events. I do not need the click events.

This has the added disadvantage of not allowing other useful motions with your mouse (example: an external copy paste by highlighting text on the terminal screen).

I say vim, because it has ideal mouse behavior, where with a scroll event the cursor position changes to reflect it, and click events seem not to affect it. In addition, it does so in a manner that does not lead to flickering.

The thing that tells me that it does not use 1049 + 1007 is that something like the external copy-paste (by highlighting text) is possible in vim.

My question: How is vim doing this?

I've scoured the source code and am unable to find it. I've also attempted to trace the escape sequences it writes to the screen. This holds true on 2 terminal emulators I've tried.