texstudio-org / texstudio

TeXstudio is a fully featured LaTeX editor. Our goal is to make writing LaTeX documents as easy and comfortable as possible.
http://www.texstudio.org/
GNU General Public License v3.0
2.78k stars 344 forks source link

Option selection for multicursor behavior #2296

Open fernandozucatelli opened 2 years ago

fernandozucatelli commented 2 years ago

Describe the feature and the current behavior/state

I would like to have an option to select between two behaviors of multicursors: 1 - The old one until version 3.1.2 2 - The new one of version 4.2.3

Who will benefit with this feature?

Every user that learned how to use the old behavior and lost that skill.

Any Other info

Details of old and new behavior were presented at #2292.

sunderme commented 2 years ago

There will be no selection of incomplete behaviours. The only option is to implement more multicursor movement with well defined behaviour over corner cases.

fernandozucatelli commented 2 years ago

There will be no selection of incomplete behaviours. The only option is to implement more multicursor movement with well defined behaviour over corner cases.

I don't very well how to well define the behavior in terms of the code. However, I can suggest the following.

octaeder commented 2 years ago

One caveat I have seen is code expansion. One could insert something at multiple posititions and then try code expansion. But code expansion may depend on text surrounding the different cursors and may result in different expansions. It would not be possible to present different drop down lists for further selection. I concluded myself that multicursors should only be used in simple cases, with care and with not to much expectations.

Another example: You could setup two multicursors at the beginning of one word each (words should be the same). Then select the words by pressing Ctrl+D, which is currently not working (why?). So we use cursor movement to select the words. Now press Ctrl+B for example, then only the first of the two words will be surrounded with \textbf{...} (again why?). I assume it could be quite difficult to come to a (reasonable) general concept of simultanious work at multiple cursors.

fernandozucatelli commented 2 years ago

One caveat I have seen is code expansion. One could insert something at multiple posititions and then try code expansion. But code expansion may depend on text surrounding the different cursors and may result in different expansions. It would not be possible to present different drop down lists for further selection. I concluded myself that multicursors should only be used in simple cases, with care and with not to much expectations.

Yes, I remember some troubles like this.

Video 3.1.2 A:

  1. Selecting multirow, Ctrl + B, adds bold only for first element.
  2. Typing \textbf{, autocompletes }, delete }, End, type }. Writes every single one. Perfect.
  3. Copy-Pasta \textbf, type {, autocompletes (same as before).

https://user-images.githubusercontent.com/2475760/166114739-a1c83423-56db-4c81-a28b-99b357362d36.mp4

Video 4.2.3 A:

  1. Selecting multirow, Ctrl + D, -- strange behavior selection last line twice --, Ctrl + B, adds bold only for last element.
  2. Selecting multirow, Ctrl + B, adds only \textbf{}. Perfect.
  3. Selecting multirow, Ctrl + B, adds \textbf{} only for first element. No objections. Perfect.
  4. Typing \textbf{, autocompletes }, delete }, End, goes only for first line, type }. I have to navigate each end line (Arrow Down + End) inserting each }. Not ideal.
  5. Copy-Pasta \textbf, type {, autocompletes (same as before), but now only first line, I would have to repeat for each line.
  6. After Copy-Pasta \textbf, with multicursor in all lines, Shift + End, now type { and it autocompletes perfectly (It also happened in version 3.1.2, despite not presented in the video).

Another example: You could setup two multicursors at the beginning of one word each (words should be the same). Then select the words by pressing Ctrl+D, which is currently not working (why?). So we use cursor movement to select the words. Now press Ctrl+B for example, then only the first of the two words will be surrounded with \textbf{...} (again why?). I assume it could be quite difficult to come to a (reasonable) general concept of simultanious work at multiple cursors.

Video 3.1.2 B:

  1. Multiple selections with Alt Gr (Ctrl + Alt) + Click, Ctrl + D, Ctrl + V, first line removed. Bad behavior.*
  2. Multiple selections with Alt Gr + Click at the beginning of each line, Ctrl + D, a little bit time, Ctrl + B, first line bold. No objections. Perfect.

*1: Post video verification. I wrongly typed Ctrl + V without noticing it. I did the test again by pressing { after Ctrl + V and it adds {<contents>}. Perfect.

https://user-images.githubusercontent.com/2475760/166115265-16e99016-6971-4807-93c0-0dcc383a8491.mp4

Video 3.1.2 C:

  1. Multiple selections with Alt Gr + Click at the beginning of first line and anywhere else for other lines, Ctrl + D, a little bit time, Ctrl + B, first line bold. No objections. Perfect.

https://user-images.githubusercontent.com/2475760/166115273-edfcbb94-7190-4ed3-972b-0d154273ba4d.mp4

Video 4.2.3 B (entails "3.1.2 C"):

  1. Multiple selections with Alt Gr + Click at the beginning of first line and anywhere else for other lines, Ctrl + D, a little bit time, Ctrl + B, first line bold. No objections. Perfect.
  2. (Ignore selecting \textbf) Double Click first line, Multiple selections with Alt Gr + Click, , Ctrl + D (I did it twice, but the same happens when pressed once), Ctrl + B, adds \textbf{} to the last cursor position. Not ideal.
  3. Multiple selections with Alt Gr + Click, , Ctrl + B, adds \textbf{} to the first cursor position. No objections.
  4. Multiple cursos Alt Gr + Click, Ctrl + D, Ctrl + B, adds \textbf{} to the first line. No objections. Perfect.

https://user-images.githubusercontent.com/2475760/166115277-9a29a40c-bfb3-457d-a7c0-a2df41403d56.mp4

OBS: You may notice some "old ghost cursors" at the end of some line. They appeared while I was testing and training before capturing video. Probably a glitch, but I'm not concerned about them.

The next one I found out while testing. It was a nice surprise.

Video 4.2.3 D:

  1. Multiple cursos Alt Gr + Click, Shift + End, Arrow Left. Nice surprise, I can type at the last column of each line.
  2. Shift + Home, Arrow Right, ok, I can move all columns aligned.
  3. Shift + End, Arrow Left (again), I can move and select with Shift before.
  4. Move with left arrow until the most left one reaches first column, multicursors colapse, and there only one. No objections. Perfect.

https://user-images.githubusercontent.com/2475760/166115718-85055477-fa37-4ce9-b20c-61be9b3d57a8.mp4

Conclusion.

Despite Home/End behavior have been altered, I still can do some of the old tricks by adding Shift to the key combinations. I agree some old behaviors (3.1.2) were not ideals, but in my humble opinion, they seemed better than the new ones (4.2.3).

I understand and agree that drop down lists wouldn't make sense. Every time I had to insert commands with multicursors I was aware it would complete all lines, so I typed or copy-pasted them and navigate with keyboard arrows to complete not aligned ends, when it couldn't just be made with a jump to end. Sometimes even using Alt Gr + Click at the correct locations.

I really would like to have back the old Home/End behavior, but if it will bring more questions and issues than answers and solutions, I will re-adapt myself using an added Shift to my hand typing movements.

benibela commented 2 years ago

fixed in 7231acaa4023a22850f4e4a0dcfff2c8116e6b99

Selecting multirow, Ctrl + D, -- strange behavior selection last line twice --, Ctrl + B, adds bold only for last element.

Selecting multirow, Ctrl + B, adds only \textbf{}. Perfect. Selecting multirow, Ctrl + B, adds \textbf{} only for first element. No objections. Perfect. Typing \textbf{, autocompletes }, delete }, End, goes only for first line, type }. I have to navigate each end line (Arrow Down + End) inserting each }. Not ideal. Copy-Pasta \textbf, type {, autocompletes (same as before), but now only first line, I would have to repeat for each line. After Copy-Pasta \textbf, with multicursor in all lines, Shift + End, now type { and it autocompletes perfectly (It also happened in version 3.1.2, despite not presented in the video).

did not change that