andreikop / enki

A text editor for programmers
http://enki-editor.org
GNU General Public License v2.0
161 stars 38 forks source link

Rectangular selection and edit #82

Closed vi closed 11 years ago

vi commented 11 years ago

When I make tall cursor using Alt+Shift+{Up,Down} or Ctrl+Shift+LeftClick, I can delete columns using Delete and Backspace keys.

I can't hovewer insert or replace text in that mode: it only gets typed in the bottom line, not in all lines.

P.S. Also it whould be useful to have "multi-cursor" not tied to columns, just multiple cursors set my by Ctrl+Click that repeats all actions (typeing, replacing, erasing) in all selected positions.

andreikop commented 11 years ago

I'll merge qutepart in master soon. It doesn't support rectangular selection now.

vi commented 11 years ago

Rectangular selection is rather important for a programmer's text editor.

If Enki not supported it (and also regex search/replace) the day it was announced on linux.org.ru, I would considered it "yet another hello world editor using just standard textarea" and went along.

Shall I continue filing issues about non-qutepart Enki?

andreikop commented 11 years ago

This issue is actual for qutepart enki, because rectangular selection not implemented yet.

Currently qutepart is missing some features, but should be usable. I'll be happy, if you moved to it and helped me to find bugs and decide, which features must be done before I can release it as official next Enki version.

vi commented 11 years ago

Note: have just closed enkiq, started old enki, used "rectangular select" feature a little bit, restarted into enkiq again. Fortunately sessions are compatible, so it's simple. Hoping that after a while such restarts won't be necessary.

andreikop commented 11 years ago

I pushed minimal rectangular selection support. You can select and delete text. Copy-pasting and multicursor edit is not supported. Could you please check if it is what you need to become happy with new Enki? Is there some other issues, which must be closed before first release?

vi commented 11 years ago

Tried. Rectangular select works, although with some issues:

enkirectbug

Issues with current rectangular selection:

I expect if this is resolved, then qutepart Enki can be considered to be on par with old enki as for rectangular selection (expecting it (qutepart Enki) to be not just on par, but better than old enki for selection modes someday).

andreikop commented 11 years ago

[minor] The blinking cursor line is visible only on one line of multi-row-select, unlike in old Enki. (A little annloying in "Alt+Shift+Down several times, than Backspace several times" use case); Rectangular select does not stay after deletion, unlike in old Enki (for the use case mentioned on former point);

Backspace several times and long cursor will be supported, when multicursor edit is done. Now just select block and delete it.

[minor] non-rectangular rectangular selection, pictured above - because of tabs vs spaces;

Fixed

Can't cut,copy&paste;

Done

[minor] No menu entries, etc. How users unfamiliar with old Enki expeted to learn about the feature?

Those, who read the manual, will know. Others will not. I don't want to have too big main menu.

[minor] Reactangular selection is much more CPU-hungry with qutepart than with old Enki. While selecting some large rectangle and holding Alt+Shift+Right (so the selection continuously changes) old enki is about 40% CPU, and new qutepart Enki: 100% CPU and "low FPS": it shows only about 1.5 selections states per second while old enki shows each rectangle.

Sometimes my patience will be over and I'd by you a modern laptop!

I've fixed one performance issue. Now it might be better, but, I'm not sure, because it works fine for me.

vi commented 11 years ago

Performance of rectangular selection is still significantly bad. When I trying to select n lines, I feel that it takes O(n^2). Try to open 5000+ lines file and select very tall rectangle.

BTW after selecting tall rectangle I tried Ctrl+C, Ctrl+V and got

Traceback (most recent call last):
  File "/home/vi/src/git/qutepart/qutepart/__init__.py", line 1497, in insertFromMimeData
    self._rectangularSelection.paste(source)
  File "/home/vi/src/git/qutepart/qutepart/__init__.py", line 417, in paste
    currentLine = self._qpart.lines[cursorLine + index]
  File "/home/vi/src/git/qutepart/qutepart/lines.py", line 63, in __getitem__
    index = self._checkAndConvertIndex(index)
  File "/home/vi/src/git/qutepart/qutepart/lines.py", line 53, in _checkAndConvertIndex
    raise IndexError('Invalid block index', index)
IndexError: ('Invalid block index', 1489)

And on little rectangle it works weird (not as I expect and as old Enki works at least).

Sometimes my patience will be over and I'd by you a modern laptop!

... for me to temporarily turn on CPU throttling to test if Enki still working fast enough...

Somebody have to watch and prevent programs happily creeping into the abyss of resource wastefulness. I expect Enki (and other simplicity-favouring text editors and programs in general) to

  1. Work fine on slow comptuers;
  2. "Eat" little battery;
  3. Work fine on fast computers with heavy CPU + memory + IO background load;

If it works only "good enough" on modern computer, it will work bad on old computer or with significant background load; also it is expected to drain more battery. And if it works "good enough" on slow computers, it is expected to work good on modern computers.

P.S. Recently I saw some yet another "help me to choose editor" thread on linux.org.ru and rectangular select feature was explicitly in the list of requirements.

andreikop commented 11 years ago

BTW after selecting tall rectangle I tried Ctrl+C, Ctrl+V and got traceback

Thanks, fixed

And on little rectangle it works weird (not as I expect and as old Enki works at least).

Could you please explain it?

Somebody have to watch and prevent programs happily creeping into the abyss of resource wastefulness.

Previous comment was a joke. It is really cool, that you are testing the performance and showing me problems

andreikop commented 11 years ago

Performance of rectangular selection is still significantly bad. When I trying to select n lines, I feel that it takes O(n^2). Try to open 5000+ lines file and select very tall rectangle.

Currently, if rectangular selection area is bigger, than 256 lines or columns, I show warning to the user and drop the selection. Still bad, but at least avoids freeze. Might return to this problem later, but now there are more important tasks, than huge rectangular selections