* [sup-talk] ncurses hack @ 2009-08-17 19:54 Edward Z. Yang 2009-08-18 2:43 ` William Morgan 0 siblings, 1 reply; 9+ messages in thread From: Edward Z. Yang @ 2009-08-17 19:54 UTC (permalink / raw) Today, I decided to throw in the towel and patch my copy of ncurses to have the appropriate fix for international characters + tabs. Does anyone know of a list of instructions for carrying this out? Cheers, Edward ^ permalink raw reply [flat|nested] 9+ messages in thread
* [sup-talk] ncurses hack 2009-08-17 19:54 [sup-talk] ncurses hack Edward Z. Yang @ 2009-08-18 2:43 ` William Morgan 2009-08-18 7:42 ` Dusan 0 siblings, 1 reply; 9+ messages in thread From: William Morgan @ 2009-08-18 2:43 UTC (permalink / raw) Reformatted excerpts from Edward Z. Yang's message of 2009-08-17: > Today, I decided to throw in the towel and patch my copy of ncurses to > have the appropriate fix for international characters + tabs. Does > anyone know of a list of instructions for carrying this out? Try http://sup.rubyforge.org/wiki/wiki.pl?UTF8. If you're running Sup git, I've made a nice branch for this: $ git branch --track ncursesw origin/ncursesw $ git checkout ncursesw $ cd ncurses-0.9.1/ $ ./run-this-for-sup.sh Which will generate an ncurses.so file in lib/. You can then switch back to master or next and it should pick it up. This should fix many wide-character issues but it won't fix all of them, because there's still no way of determining the display width of a unicode character (e.g. Chinese characters take two columns to display). So the display still ends up funny. Ruby 1.9 has better encoding support but I don't know if it fixes this. -- William <wmorgan-sup at masanjin.net> ^ permalink raw reply [flat|nested] 9+ messages in thread
* [sup-talk] ncurses hack 2009-08-18 2:43 ` William Morgan @ 2009-08-18 7:42 ` Dusan 2009-08-18 18:24 ` Benoît PIERRE 0 siblings, 1 reply; 9+ messages in thread From: Dusan @ 2009-08-18 7:42 UTC (permalink / raw) Excerpts from William Morgan's message of Tue Aug 18 04:43:18 +0200 2009: > Reformatted excerpts from Edward Z. Yang's message of 2009-08-17: > > Today, I decided to throw in the towel and patch my copy of ncurses to > > have the appropriate fix for international characters + tabs. Does > > anyone know of a list of instructions for carrying this out? > > Try http://sup.rubyforge.org/wiki/wiki.pl?UTF8. If you're running Sup > git, I've made a nice branch for this: > > $ git branch --track ncursesw origin/ncursesw > $ git checkout ncursesw > $ cd ncurses-0.9.1/ > $ ./run-this-for-sup.sh > > Which will generate an ncurses.so file in lib/. You can then switch back > to master or next and it should pick it up. > > This should fix many wide-character issues but it won't fix all of them, > because there's still no way of determining the display width of a > unicode character (e.g. Chinese characters take two columns to display). > So the display still ends up funny. > > Ruby 1.9 has better encoding support but I don't know if it fixes this. I am new sup user and love it very much. Not being able to fix search/save and other edits is huge show-stopper. I do what I read somewhere: -start search, get garbage results -kill that buffer with 'x' -start another search but instead of typing search term again first repeat: press up, delete search garbage, press up, delete search garbage, repeat until there is nothing to delete -type another search term and search now works 100% This works for searches but edits like save still fail (or save X((%^1X file so if you can find it you can rename it). Looks like fixable bug to simulate what I did for searches? Repeat in code ten times 'up arrow', '50 x delete char'? Sorry if I am wrong. Using sup and not being able to properly search or save is too wrong. If there is any config/version I should report to get this fixed just let me know. Without waiting for new ruby of course -- I do have proper results when I repeat deleting ritual. Thanks ^ permalink raw reply [flat|nested] 9+ messages in thread
* [sup-talk] ncurses hack 2009-08-18 7:42 ` Dusan @ 2009-08-18 18:24 ` Benoît PIERRE 2009-08-18 18:46 ` Dusan 2009-08-18 19:31 ` Jörg-Hendrik Bach 0 siblings, 2 replies; 9+ messages in thread From: Benoît PIERRE @ 2009-08-18 18:24 UTC (permalink / raw) Excerpts from Dusan's message of Tue Aug 18 09:42:48 +0200 2009: > > [...] > > Not being able to fix search/save and other edits is huge show-stopper. > I do what I read somewhere: > > -start search, get garbage results > -kill that buffer with 'x' > -start another search but instead of typing search term again first > repeat: press up, delete search garbage, press up, delete search > garbage, repeat until there is nothing to delete > -type another search term and search now works 100% > > This works for searches but edits like save still fail (or save X((%^1X file > so if you can find it you can rename it). > > Looks like fixable bug to simulate what I did for searches? Repeat in > code ten times 'up arrow', '50 x delete char'? Sorry if I am wrong. > > Using sup and not being able to properly search or save is too wrong. > > If there is any config/version I should report to get this fixed just > let me know. Without waiting for new ruby of course -- I do have proper > results when I repeat deleting ritual. Hi, can you try the following patch and tell me if it fix the problem? diff --git a/lib/sup/textfield.rb b/lib/sup/textfield.rb index b8dec59..ccc8533 100644 --- a/lib/sup/textfield.rb +++ b/lib/sup/textfield.rb @@ -36,8 +36,9 @@ class TextField @field = Ncurses::Form.new_field 1, @width - question.length, @y, @x + question.length, 256, 0 @form = Ncurses::Form.new_form [@field] @value = default + @value ||= '' Ncurses::Form.post_form @form - set_cursed_value default if default + set_cursed_value @value end def position_cursor -- A: Because it destroys the flow of conversation. Q: Why is top posting dumb? ^ permalink raw reply [flat|nested] 9+ messages in thread
* [sup-talk] ncurses hack 2009-08-18 18:24 ` Benoît PIERRE @ 2009-08-18 18:46 ` Dusan 2009-08-18 18:59 ` Benoît PIERRE 2009-08-18 19:31 ` Jörg-Hendrik Bach 1 sibling, 1 reply; 9+ messages in thread From: Dusan @ 2009-08-18 18:46 UTC (permalink / raw) Excerpts from Beno?t PIERRE's message of Tue Aug 18 20:24:45 +0200 2009: > Excerpts from Dusan's message of Tue Aug 18 09:42:48 +0200 2009: > > > > [...] > > > > Not being able to fix search/save and other edits is huge show-stopper. > > I do what I read somewhere: > > > > -start search, get garbage results > > -kill that buffer with 'x' > > -start another search but instead of typing search term again first > > repeat: press up, delete search garbage, press up, delete search > > garbage, repeat until there is nothing to delete > > -type another search term and search now works 100% > > > > This works for searches but edits like save still fail (or save X((%^1X file > > so if you can find it you can rename it). > > > > Looks like fixable bug to simulate what I did for searches? Repeat in > > code ten times 'up arrow', '50 x delete char'? Sorry if I am wrong. > > > > Using sup and not being able to properly search or save is too wrong. > > > > If there is any config/version I should report to get this fixed just > > let me know. Without waiting for new ruby of course -- I do have proper > > results when I repeat deleting ritual. > > Hi, can you try the following patch and tell me if it fix the problem? > > diff --git a/lib/sup/textfield.rb b/lib/sup/textfield.rb > index b8dec59..ccc8533 100644 > --- a/lib/sup/textfield.rb > +++ b/lib/sup/textfield.rb > @@ -36,8 +36,9 @@ class TextField > @field = Ncurses::Form.new_field 1, @width - question.length, @y, > @x + question.length, 256, 0 > @form = Ncurses::Form.new_form [@field] > @value = default > + @value ||= '' > Ncurses::Form.post_form @form > - set_cursed_value default if default > + set_cursed_value @value > end > > def position_cursor I will, just give me day or two. I am using gem version, not svn or git. I did some stuff with them but never with ruby. Can you give me two lines help what to install and where? Latest svn? Sorry I am not _that_ helpful but ruby is new thing to me. I should be able to test this soon enough with some help. Thanks, Dusan ^ permalink raw reply [flat|nested] 9+ messages in thread
* [sup-talk] ncurses hack 2009-08-18 18:46 ` Dusan @ 2009-08-18 18:59 ` Benoît PIERRE 2009-08-18 19:04 ` Dusan 2009-08-18 19:24 ` Dusan 0 siblings, 2 replies; 9+ messages in thread From: Benoît PIERRE @ 2009-08-18 18:59 UTC (permalink / raw) Excerpts from Dusan's message of Tue Aug 18 20:46:52 +0200 2009: > Excerpts from Beno?t PIERRE's message of Tue Aug 18 20:24:45 +0200 2009: > > Excerpts from Dusan's message of Tue Aug 18 09:42:48 +0200 2009: > > [...] > > I will, just give me day or two. I am using gem version, not svn or git. > I did some stuff with them but never with ruby. Can you give me two > lines help what to install and where? Latest svn? You can probably directly patch the sources in the gem. For example on Ubuntu, the sources should be somewhere in /var/lib/gems/1.8/gems/sup-xxx. Use 'gem environment' to get the installation directory. Another option is to follow the wiki to get the latest git version: http://sup.rubyforge.org/wiki/wiki.pl?Contributing -- A: Because it destroys the flow of conversation. Q: Why is top posting dumb? -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: not available URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090818/302eaeb0/attachment.bin> ^ permalink raw reply [flat|nested] 9+ messages in thread
* [sup-talk] ncurses hack 2009-08-18 18:59 ` Benoît PIERRE @ 2009-08-18 19:04 ` Dusan 2009-08-18 19:24 ` Dusan 1 sibling, 0 replies; 9+ messages in thread From: Dusan @ 2009-08-18 19:04 UTC (permalink / raw) Excerpts from Beno?t PIERRE's message of Tue Aug 18 20:59:20 +0200 2009: > Excerpts from Dusan's message of Tue Aug 18 20:46:52 +0200 2009: > > Excerpts from Beno?t PIERRE's message of Tue Aug 18 20:24:45 +0200 2009: > > > Excerpts from Dusan's message of Tue Aug 18 09:42:48 +0200 2009: > > > > [...] > > > > I will, just give me day or two. I am using gem version, not svn or git. > > I did some stuff with them but never with ruby. Can you give me two > > lines help what to install and where? Latest svn? > > You can probably directly patch the sources in the gem. For example on > Ubuntu, the sources should be somewhere in /var/lib/gems/1.8/gems/sup-xxx. > > Use 'gem environment' to get the installation directory. > > Another option is to follow the wiki to get the latest git version: > http://sup.rubyforge.org/wiki/wiki.pl?Contributing Everything but git, thanks :) Of course, ruby is interpreter, I keep forgetting that. I am using ArchLinux and should be fairly skilled to do some changing. Reporting back tomorrow. ^ permalink raw reply [flat|nested] 9+ messages in thread
* [sup-talk] ncurses hack 2009-08-18 18:59 ` Benoît PIERRE 2009-08-18 19:04 ` Dusan @ 2009-08-18 19:24 ` Dusan 1 sibling, 0 replies; 9+ messages in thread From: Dusan @ 2009-08-18 19:24 UTC (permalink / raw) Excerpts from Beno?t PIERRE's message of Tue Aug 18 20:59:20 +0200 2009: > Excerpts from Dusan's message of Tue Aug 18 20:46:52 +0200 2009: > > Excerpts from Beno?t PIERRE's message of Tue Aug 18 20:24:45 +0200 2009: > > > Excerpts from Dusan's message of Tue Aug 18 09:42:48 +0200 2009: > > > > [...] > > > > I will, just give me day or two. I am using gem version, not svn or git. > > I did some stuff with them but never with ruby. Can you give me two > > lines help what to install and where? Latest svn? > > You can probably directly patch the sources in the gem. For example on > Ubuntu, the sources should be somewhere in /var/lib/gems/1.8/gems/sup-xxx. > > Use 'gem environment' to get the installation directory. > > Another option is to follow the wiki to get the latest git version: > http://sup.rubyforge.org/wiki/wiki.pl?Contributing Bah, I could not wait till tomorrow and it's not _that_ late... This fix WORKS :) Every time so far. Please include this into release asap, this is what prevents a lot of people from using sup. I patched source with vim, diff is too automatic :) Here is func that works: activate window, y, x, width, question, default=nil, &block @w, @y, @x, @width = window, y, x, width @question = question @completion_block = block @field = Ncurses::Form.new_field 1, @width - question.length, @y, @x + question.length, 256, 0 @form = Ncurses::Form.new_form [@field] @value = default @value ||= '' Ncurses::Form.post_form @form # set_cursed_value default if default set_cursed_value @value end Probably @value=default can go too, not sure since I don't know ruby? Thanks a lot! ^ permalink raw reply [flat|nested] 9+ messages in thread
* [sup-talk] ncurses hack 2009-08-18 18:24 ` Benoît PIERRE 2009-08-18 18:46 ` Dusan @ 2009-08-18 19:31 ` Jörg-Hendrik Bach 1 sibling, 0 replies; 9+ messages in thread From: Jörg-Hendrik Bach @ 2009-08-18 19:31 UTC (permalink / raw) 2009/8/18 Beno?t PIERRE <benoit.pierre at gmail.com>: > Hi, can you try the following patch and tell me if it fix the problem? > > diff --git a/lib/sup/textfield.rb b/lib/sup/textfield.rb > index b8dec59..ccc8533 100644 > --- a/lib/sup/textfield.rb > +++ b/lib/sup/textfield.rb > @@ -36,8 +36,9 @@ class TextField > ? ? @field = Ncurses::Form.new_field 1, @width - question.length, @y, > @x + question.length, 256, 0 > ? ? @form = Ncurses::Form.new_form [@field] > ? ? @value = default > + ? ?@value ||= '' > ? ? Ncurses::Form.post_form @form > - ? ?set_cursed_value default if default > + ? ?set_cursed_value @value > ? end > > ? def position_cursor Thanks a lot. I don't know what this does exactly, but the first added line of that patch was sufficient to get searches with utf-8 running well from startup, without the need to go for a dummy search each time i restarted sup. The full patch (including the replacement at line 41) broke searching altogether, on hitting '\' it throws: --- TypeError from thread: main can't convert nil into String /usr/lib/ruby/gems/1.8/gems/sup-0.8.1/lib/sup/textfield.rb:159:in `set_field_buffer' /usr/lib/ruby/gems/1.8/gems/sup-0.8.1/lib/sup/textfield.rb:159:in `set_cursed_value' /usr/lib/ruby/gems/1.8/gems/sup-0.8.1/lib/sup/textfield.rb:42:in `activate' /usr/lib/ruby/gems/1.8/gems/sup-0.8.1/lib/sup/buffer.rb:537:in `ask' /usr/lib/ruby/gems/1.8/gems/sup-0.8.1/lib/sup/buffer.rb:26:in `synchronize' /usr/lib/ruby/gems/1.8/gems/sup-0.8.1/lib/sup/buffer.rb:26:in `sync' /usr/lib/ruby/gems/1.8/gems/sup-0.8.1/lib/sup/buffer.rb:536:in `ask' /usr/lib/ruby/gems/1.8/gems/sup-0.8.1/lib/sup/util.rb:513:in `send' /usr/lib/ruby/gems/1.8/gems/sup-0.8.1/lib/sup/util.rb:513:in `method_missing' /usr/lib/ruby/gems/1.8/gems/sup-0.8.1/bin/sup:268 /usr/bin/sup:19:in `load' /usr/bin/sup:19 - J?rg-Hendrik ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2009-08-18 19:31 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2009-08-17 19:54 [sup-talk] ncurses hack Edward Z. Yang 2009-08-18 2:43 ` William Morgan 2009-08-18 7:42 ` Dusan 2009-08-18 18:24 ` Benoît PIERRE 2009-08-18 18:46 ` Dusan 2009-08-18 18:59 ` Benoît PIERRE 2009-08-18 19:04 ` Dusan 2009-08-18 19:24 ` Dusan 2009-08-18 19:31 ` Jörg-Hendrik Bach
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox