Author Topic: select_line not cutting it  (Read 4464 times)

pdrexel

  • Junior Community Member
  • Posts: 2
  • Hero Points: 1
select_line not cutting it
« on: August 19, 2006, 12:02:48 am »
select_line behaves differently depending on the keyboard emulation mode as documented.

Comment: this is goofy.

Here's what I'm trying to do:

Call find to search for some text
If found, start a line selection (i.e., select_line)
Call find to search for more text
If found, the selection extends (at least in Brief emulation it does)
Delete the selection with delete_selection

The above works in Brief emulation mode but not in CodeWright mode.

I have tried using brief_select_line and I have also tried _select_line but when I'm in
CodeWright mode the second find call does not extend the selection. What gives?

Is there a way to do this? If not this is a bug.

Graeme

  • Senior Community Member
  • Posts: 2323
  • Hero Points: 305
Re: select_line not cutting it
« Reply #1 on: August 28, 2006, 09:05:22 am »

Maybe you could do it like this.

1. Call find.
2. int sline = p_line; save line number
3. call find again.
4. call deselect()
5. int eline = p_line; int ecol = p_col;
6. call goto_line(sline); goto_col(1);
7. call _select_char()
8. call goto_line(eline); goto_col(ecol);
9. call _select_char()
10. call delete_selection()

Graeme

hs2

  • Senior Community Member
  • Posts: 2737
  • Hero Points: 288
Re: select_line not cutting it
« Reply #2 on: August 28, 2006, 11:00:14 am »
Try this:
Code: [Select]
   deselect();  // ensure re-starting selection
   select_line();
   search_again();
   select_line();  // extend selection
   delete_selection();

HS2

pdrexel

  • Junior Community Member
  • Posts: 2
  • Hero Points: 1
Re: select_line not cutting it
« Reply #3 on: August 28, 2006, 04:39:33 pm »
Thanks for the ideas! I've got something working now. It turns out in CodeWright mode that it is very important to call deselect after find before doinf another find.