block text select

Asked by Patrick Byrne

Hi (again),

Is there any possibility of having the ability to block-select text, please? By this I mean copying or cutting a rectangular block of text from a document.

Is this a case of 'write-yer-own-plugin'? If so, could someone please offer pointers as to how I might apprroach this?

Ta,
Patrick Byrne

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu gedit Edit question
Assignee:
No assignee Edit question
Solved by:
Bhavani Shankar
Solved:
Last query:
Last reply:
Revision history for this message
Bhavani Shankar (bhavi) said :
#1

Hello

You can use a mouse simple right?

The mouse may be used to mark a block of text by clicking on the beginning of the block and dragging the mouse to the end of the block before releasing it.

Text can be edited by marking it first and then selecting Cut, or Copy from the buttons at the top. "Cutting" will result in the marked text being copied into a storage buffer and then deleted from the editing window, while "Copying" will result in just a copy of the text being copied into the storage buffer without the deletion of the original text. The text cut/copied in this way can then be pasted into another part of the document by moving the mouse to the desired location and selecting the Paste button at the top.

Another way of invoking these functions is to click on the Edit option on the top menu bar and selecting the desired function, e.g.
Edit --> Cut
Edit --> Copy
Edit --> Paste

Or another way is cntrl+C for cut and cntrl+V for paste.... :)

Regards

Bhavani Shankar.

Revision history for this message
Patrick Byrne (pjlbyrne) said :
#2

Thanks for your prompt response Bhavani. This get-help-online feature attached to the app is fantastic.

...nonono! I understand about text selection basics! What I mean is, suppose I have a block of text like:

00000000
00111100
00111100
00000000

Now, in some other editors, it is possible to (say) hold ALT and then click on the top left-hand '1', drag the mouse to the bottom right-hand 1 and release. This leaves the '1's and only the '1's selected. This block of text can then be cut or copied to the clipboard. For example, if I cut the selected '1's then I get:

00000000
0000
0000
00000000

block-text select is very useful for editing code (I reckon).

I understand that it might not be considered as a must-have feature for gedit, and I am willing to consider writing a plugin to do it myself. If gedit developers are not going to jump at the chance to add this feature, then could I please be pointed towards plugin-writing info?

Ta
Patrick Byrne

Revision history for this message
Curtis Hovey (sinzui) said :
#3

There are no plugin that provide block selection. The feature is a tricky because the underlying GtkSourceView and GtkTextView do not support a grid-based way of selecting. The feature has been requested from time to time, but without an obvious way to implement it, no progress has been made.

Revision history for this message
Best Bhavani Shankar (bhavi) said :
#4

yes +1 curtis...

Revision history for this message
Patrick Byrne (pjlbyrne) said :
#5

Thanks Bhavani Shankar, that solved my question.

Revision history for this message
drieteenmeeuw (drieteenmeeuw) said :
#6

kwrite does this and has done so for a long time.

Revision history for this message
Wvdschel (wim-fixnum) said :
#7

Geany seems to support it, it can't be that hard to port it from Geany...

Revision history for this message
Deo Favente (deofavente1) said :
#8

"There are no plugin that provide block selection. The feature is a tricky because the underlying GtkSourceView and GtkTextView do not support a grid-based way of selecting. The feature has been requested from time to time, but without an obvious way to implement it, no progress has been made."

gedit has a grid - sort of. More like a 2d array but thats close enough... I'll give you a hint look at the bottom right of a gedit window. It gives you the x and y cordinates of the cursor position. This means array and this means only a simple loop is required to produce the block select functionality, assuming of course gedit allows you to read the document somehow. I am a programmer and also find myself needed this function, or at least wanting - I suppose I could flip rows of switches instead.