Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Nov 2015
    Location
    Belo Horizonte
    Posts
    6

    Replacing text in block column selection (kate, kwrite, gedit, etc.)


    This is a very bizarre issue I found recently which seems to happen in all distros and graphic text editing programs I currently have access to.

    I remember that, long ago, I used to easily make substitions in selected columns (using block selection) in my favorite file editing programs (usually kwrite). For example, starting with:

    ABCAAAB
    ABCAAAD

    If I selected the second column and then did a search/replace to look for Bs and change for Cs (while, of course, checking the "replace in selection" option), the result would be:

    ACCAAAB
    ACCAAAD

    Which, unless I'm missing something, should be the natural thing to do. Now, if I try to do that, I get this:

    ACCAAAC
    ACCAAAD

    I.e., the last B in the first line also gets replaced by a C even though it was not in my selection. I know I'm not dreaming about this being once possible, because I've seen people complain about it in many different forums but, in what is even weirder, they usually are just left unsolved, some of them being years old. I first wondered if it might be a bug in a specific distribution, but in my department I can choose from Centos/KDE, Ubuntu, and kwrite/kate/gedit as editing software and all of them seem to have exactly the same problem. Any suggestions?

  2. #2
    Linux Guru
    Join Date
    Dec 2013
    Posts
    2,747
    it is not a bug.

    vertical selection:
    some text editors don't have this feature, some might have it by default, and many have it as an option to be enabled or as a plugin.

    what is your current text editor, have you checked the options and the available plugins?

  3. #3
    Just Joined!
    Join Date
    Nov 2015
    Location
    Belo Horizonte
    Posts
    6
    Quote Originally Posted by nihili View Post
    it is not a bug.

    vertical selection:
    some text editors don't have this feature, some might have it by default, and many have it as an option to be enabled or as a plugin.

    what is your current text editor, have you checked the options and the available plugins?
    That is a surprise to me, I don't remember actually needing to install anything in order to use vertical selection, as it is usually available in all distros and text editors I use...

    Currently my main machine is running CentOS 6.5 with KDE, and it has both Kwrite and Kate installed. Both present the aforementioned problem. It is also the case for other machines I have access to: Ubuntu with gedit, Kubuntu with kwrite/kate, all of which have vertical selection by default. In Kwrite, for example, I just need to press CTRL-SHIFT-B and it changes to vertical selection mode. kwrite isn't much customizable, but I checked the options and plugins in kate and there doesn't seem to be anything related to that.

    Perhaps what actually happened is that this was once a built-in future in a previous version I used in the past (I've used most Kubuntu distributions since Dapper Drake, and Fedora before that), but at some point it ceased to be default? Anyway, if that is the case, what would I need to install to have that feature back?

    As I said, it is very surprising to me that this is not the default. Maybe I'm missing something, but, in my understanding, if an option called "replace within selection" is chosen and the program actually replaces things outside of the selection, it is a bug to me.

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Guru
    Join Date
    Dec 2013
    Posts
    2,747
    ok, so we're talking kate/kwrite/gedit.


    Quote Originally Posted by lbleicher View Post
    if an option called "replace within selection" is chosen and the program actually replaces things outside of the selection, it is a bug to me.
    so are you saying you can make vertical selections (not sure i'm using the right term)?
    maybe i misinterpreted your first post.

  6. #5
    Just Joined!
    Join Date
    Nov 2015
    Location
    Belo Horizonte
    Posts
    6
    Quote Originally Posted by nihili View Post
    ok, so we're talking kate/kwrite/gedit.

    so are you saying you can make vertical selections (not sure i'm using the right term)?
    maybe i misinterpreted your first post.
    Yes. That's what some editors call "block selection" (usually acessible with ctrl-shift-b). Those editors all allow it, but, strangely, search/replace does not work with such selections even when "replace within selection" is chosen.

  7. #6
    Quote Originally Posted by lbleicher View Post
    Yes. That's what some editors call "block selection" (usually acessible with ctrl-shift-b). Those editors all allow it, but, strangely, search/replace does not work with such selections even when "replace within selection" is chosen.
    Have you looked into using sed along with an appropriate regular expression? I'm not real sure but I believe that even vi should be able to handle what you want.

  8. #7
    Just Joined!
    Join Date
    Nov 2015
    Location
    Belo Horizonte
    Posts
    6
    Quote Originally Posted by BowCatShot View Post
    Have you looked into using sed along with an appropriate regular expression? I'm not real sure but I believe that even vi should be able to handle what you want.
    I can do it with some python coding, it's just that I think it's annoying that a simple search/replace command does not work. I'm surprised about nihili's comment about it not being a bug - if a command "replace in selection" is not replacing in what is currently selected, then it is clearly a bug to me.

  9. #8
    Quote Originally Posted by lbleicher View Post
    I can do it with some python coding, it's just that I think it's annoying that a simple search/replace command does not work. I'm surprised about nihili's comment about it not being a bug - if a command "replace in selection" is not replacing in what is currently selected, then it is clearly a bug to me.
    Well, I agree with you that it clearly is a bug. But agreeing to that doesn't get us anywhere. Agreement on a work around is more constructive.

  10. #9
    Just Joined!
    Join Date
    Nov 2015
    Location
    Belo Horizonte
    Posts
    6
    Quote Originally Posted by BowCatShot View Post
    Well, I agree with you that it clearly is a bug. But agreeing to that doesn't get us anywhere. Agreement on a work around is more constructive.
    Indeed. Is there a specific place for suggesting bug corrections?

  11. #10
    Linux Guru
    Join Date
    Dec 2013
    Posts
    2,747
    -->
    Quote Originally Posted by lbleicher View Post
    I'm surprised about nihili's comment about it not being a bug - if a command "replace in selection" is not replacing in what is currently selected, then it is clearly a bug to me.
    i somewhat misunderstood your original post; yes, i guess one could call it a bug.


    Quote Originally Posted by lbleicher View Post
    Indeed. Is there a specific place for suggesting bug corrections?
    for geany?
    i suggest going here: http://geany.org/ and having a look-search for yourself.
    shouldn't be hard to find a phrase like "bug report" with a link.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •