Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
* [sup-talk] Get text at current line in ThredViewMode
@ 2014-04-14 21:43 Micah Duke
  2014-04-15 18:38 ` Matthieu Rakotojaona
  0 siblings, 1 reply; 3+ messages in thread
From: Micah Duke @ 2014-04-14 21:43 UTC (permalink / raw)
  To: sup-talk

Hello Everybody,

I am attempting to do some hacking to get a custom Keymap working. I am
trying to figure our a way to get the text of the cursor line so I can
process it further.

I see the @message_lines but that just returns a message. From there I
cannot find how to get the actual text displayed. 

Is this even possible to do? What am I missing?

Thanks for your help.

_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [sup-talk] Get text at current line in ThredViewMode
  2014-04-14 21:43 [sup-talk] Get text at current line in ThredViewMode Micah Duke
@ 2014-04-15 18:38 ` Matthieu Rakotojaona
  2014-04-15 19:10   ` Micah Duke
  0 siblings, 1 reply; 3+ messages in thread
From: Matthieu Rakotojaona @ 2014-04-15 18:38 UTC (permalink / raw)
  To: sup-talk


[-- Attachment #1.1: Type: text/plain, Size: 519 bytes --]

Hello,

Take a look at this PR:

  https://github.com/sup-heliotrope/sup/pull/241

In this PR I take the text on the current line, try to extract an URI
out of it and open it with the system's xdg-open. The line you're
interested in is thread_view_mobe.rb:718. Basically a view is a list of
tuples: [color, data]. color denotes how to paint the data. The one
you're interested in is certainly :text_color.

This PR really old, and I should work on it, but I got distracted ...

-- 
Matthieu Rakotojaona

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 966 bytes --]

[-- Attachment #2: Type: text/plain, Size: 140 bytes --]

_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [sup-talk] Get text at current line in ThredViewMode
  2014-04-15 18:38 ` Matthieu Rakotojaona
@ 2014-04-15 19:10   ` Micah Duke
  0 siblings, 0 replies; 3+ messages in thread
From: Micah Duke @ 2014-04-15 19:10 UTC (permalink / raw)
  To: sup-talk

Thanks Matthieu!

Ultimately that is what I was trying to do-open URI under cursor line.

I arrived at a similar solution. I will repost mine here, in case anyone
else finds it helpful.


class Redwood::ThreadViewMode
  def open_link_at_cursor
    BufferManager.flash "Extracting URL...#{'(turn text wrap off for better results)' if @wrap}"
    line_text = get_textline_at_cursor
    url = line_text.slice(URI::regexp)
    spawn "chromium","--new-window", url,[:in, :out, :err] => "/dev/null" unless !url
    BufferManager.flash "No URL found at cursor line" if !url
  end
  def get_textline_at_cursor
    self[curpos].last.last.to_s
  end
end

-Micah


Excerpts from Matthieu Rakotojaona's message of 2014-04-15 13:38:15 -0500:
> Hello,
> 
> Take a look at this PR:
> 
>   https://github.com/sup-heliotrope/sup/pull/241
> 
> In this PR I take the text on the current line, try to extract an URI
> out of it and open it with the system's xdg-open. The line you're
> interested in is thread_view_mobe.rb:718. Basically a view is a list of
> tuples: [color, data]. color denotes how to paint the data. The one
> you're interested in is certainly :text_color.
> 
> This PR really old, and I should work on it, but I got distracted ...
> 
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-04-15 19:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-14 21:43 [sup-talk] Get text at current line in ThredViewMode Micah Duke
2014-04-15 18:38 ` Matthieu Rakotojaona
2014-04-15 19:10   ` Micah Duke

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox