:to_end method on edit_line for OSX #128

Open
passenger94 opened this Issue Jun 3, 2015 · 4 comments

Comments

Projects
None yet
2 participants
@passenger94
Contributor

passenger94 commented Jun 3, 2015

when programmatically pasting text in an edit_line, cursor stays at the beginning of the text, this methods sends it at the end (implemented in gtk.c as "shoes_native_edit_line_cursor_to_end" ) #126
needs the same in cocoa

@passenger94 passenger94 added the OSX label Jun 3, 2015

ccoupe added a commit that referenced this issue Jun 11, 2015

stub method for #128 so OSX compiles and runs. Still TOTO.
* Restore byebug use of native (launch) terminal
* for OSX /long/path/Shoes.app/Contents/MacOS/shoes-launch keeps the controlling
  terminal and byebug runs fine when Shoes is launched that way. #124
* This should be moved from shoes.rb to a command line option. The splash menu
  should use the Shoes console (assuming that ever works).

@ccoupe ccoupe added this to the 3.2.24 milestone Jun 13, 2015

@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Jul 27, 2015

Contributor

I started working on this with a test script

Shoes.app do
  @el = edit_line
  button "insert this" do
    @el.text = 'insert this'
  end
  para "Watch the cursor"
end

but the doesn't show a problem (gtk or cocoa). @passenger94 I need more complete description of how to use this new method so I can write a bug test.

Contributor

ccoupe commented Jul 27, 2015

I started working on this with a test script

Shoes.app do
  @el = edit_line
  button "insert this" do
    @el.text = 'insert this'
  end
  para "Watch the cursor"
end

but the doesn't show a problem (gtk or cocoa). @passenger94 I need more complete description of how to use this new method so I can write a bug test.

@passenger94

This comment has been minimized.

Show comment
Hide comment
@passenger94

passenger94 Jul 27, 2015

Contributor
Shoes.app title: "to_end test", height: 150 do
  @history, @pointer = [], 0

  keypress do |k|
      case k
      when :up
          @entry.text = @history[@pointer]
          #@entry.to_end
          @pointer -= 1 unless @pointer == 0
      when :down
          @pointer += 1 unless @pointer == @history.size-1
          @entry.text = @history[@pointer]
          @entry.to_end
      end
  end

  para "Enter words in Edit_Line below to fill the history stack\nTry KeyUp/KeyDown and Watch cursor ..."

  @entry = edit_line "", width: 0.9, margin: [10,10,0,10]
  @entry.finish = proc { |e| @history << e.text
                             @pointer = @history.size-1
                             e.text = ""
                        }

  timer(0) { @entry.focus }
end

That's a simplified version of where i found the need for the method, probably an edge case ...

Contributor

passenger94 commented Jul 27, 2015

Shoes.app title: "to_end test", height: 150 do
  @history, @pointer = [], 0

  keypress do |k|
      case k
      when :up
          @entry.text = @history[@pointer]
          #@entry.to_end
          @pointer -= 1 unless @pointer == 0
      when :down
          @pointer += 1 unless @pointer == @history.size-1
          @entry.text = @history[@pointer]
          @entry.to_end
      end
  end

  para "Enter words in Edit_Line below to fill the history stack\nTry KeyUp/KeyDown and Watch cursor ..."

  @entry = edit_line "", width: 0.9, margin: [10,10,0,10]
  @entry.finish = proc { |e| @history << e.text
                             @pointer = @history.size-1
                             e.text = ""
                        }

  timer(0) { @entry.focus }
end

That's a simplified version of where i found the need for the method, probably an edge case ...

@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Jul 28, 2015

Contributor

Thank you. Now I can see what needs to be done. On OSX (w/o a fix) the words from the history show up in the edit_line as selected/hightlighted if the edit_line does not have focus which it won't because Shoes OSX don't do focus well. If the edit_line does have focus then the edit_line swallows the up/down and doesn't pass them to Shoes (known behavior) Since I've spent the last week getting educated about osx text handling I think it might be fixable. It is an edge case but it does exist.

Contributor

ccoupe commented Jul 28, 2015

Thank you. Now I can see what needs to be done. On OSX (w/o a fix) the words from the history show up in the edit_line as selected/hightlighted if the edit_line does not have focus which it won't because Shoes OSX don't do focus well. If the edit_line does have focus then the edit_line swallows the up/down and doesn't pass them to Shoes (known behavior) Since I've spent the last week getting educated about osx text handling I think it might be fixable. It is an edge case but it does exist.

@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Jul 30, 2015

Contributor

It looks like this is going to be a LARGE amount of work to implement on OSX since it involves the control focus handling (really) and that's iffy in gtk and it's worse on OSX. The app @passenger94 got the test snippet from is never going to be a happy Shoes/OSX app (for reasons mentioned above and #36).

I'm going to put this in the low priority queue until someone really wants to dig into all the focus issues with OSX. The to_end method exists in Gtk and harmless in OSX and is undocumented. I think it should stay undocumented.

Contributor

ccoupe commented Jul 30, 2015

It looks like this is going to be a LARGE amount of work to implement on OSX since it involves the control focus handling (really) and that's iffy in gtk and it's worse on OSX. The app @passenger94 got the test snippet from is never going to be a happy Shoes/OSX app (for reasons mentioned above and #36).

I'm going to put this in the low priority queue until someone really wants to dig into all the focus issues with OSX. The to_end method exists in Gtk and harmless in OSX and is undocumented. I think it should stay undocumented.

@ccoupe ccoupe added the Low label Jul 30, 2015

@ccoupe ccoupe removed this from the 3.2.24 milestone Jul 30, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment